paex_ocean_shore.c File Reference
Generate Pink Noise using Gardner method, and make "waves". Provides an example of how to post stuff to/from the audio callback using lock-free FIFOs implemented by the PA ringbuffer.
More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "portaudio.h"
#include "pa_ringbuffer.h"
#include "pa_util.h"
Go to the source code of this file.
|
Data Structures |
struct | PinkNoise |
struct | BiQuad |
struct | OceanWave |
struct | paTestData |
Defines |
#define | PINK_MAX_RANDOM_ROWS (30) |
#define | PINK_RANDOM_BITS (24) |
#define | PINK_RANDOM_SHIFT ((sizeof(long)*8)-PINK_RANDOM_BITS) |
#define | NEW_ROW_SIZE (12 + (8*rand())/RAND_MAX) |
Enumerations |
enum | EnvState { State_kAttack,
State_kPreDecay,
State_kDecay,
State_kCnt
} |
Functions |
void | InitializePinkNoise (PinkNoise *pink, int numRows) |
float | GeneratePinkNoise (PinkNoise *pink) |
unsigned | GenerateWave (OceanWave *wave, float *output, unsigned noOfFrames) |
float | ProcessBiquad (const BiQuad *coeffs, float *memory, float input) |
OceanWave * | InitializeWave (double SR, float attackInSeconds, float maxLevel, float positionLeftRight) |
int | main (void) |
Detailed Description
Generate Pink Noise using Gardner method, and make "waves". Provides an example of how to post stuff to/from the audio callback using lock-free FIFOs implemented by the PA ringbuffer.
Optimization suggested by James McCartney uses a tree to select which random value to replace.
x x x x x x x x x x x x x x x x
x x x x x x x x
x x x x
x x
x
Tree is generated by counting trailing zeros in an increasing index. When the index is zero, no random number is selected.
- Author:
- Phil Burk http://www.softsynth.com Robert Bielik
Definition in file paex_ocean_shore.c.