diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/example1.c | 14 | ||||
-rw-r--r-- | examples/example2.cpp | 10 |
2 files changed, 10 insertions, 14 deletions
diff --git a/examples/example1.c b/examples/example1.c index f827ca7..8a9ee5a 100644 --- a/examples/example1.c +++ b/examples/example1.c @@ -49,7 +49,7 @@ FILE* wavfile_open() header.num_channels = 1; header.sample_rate = samples_per_second; header.byte_rate = samples_per_second * (bits_per_sample / 8); - header.block_align = bits_per_sample/8; + header.block_align = bits_per_sample / 8; header.bits_per_sample = bits_per_sample; header.data_length = 0; @@ -127,12 +127,12 @@ void create() target = wavfile_open(); int seconds = 20; int total_samples = samples_per_second * seconds; - int sample = 0; - int buffer_pos = 0; - int buffer_size = 4410; - double *buffer = (double*) malloc(sizeof(double) * buffer_size); + int sample = 0; + int buffer_pos = 0; + int buffer_size = 4410; + double *buffer = (double*) malloc(sizeof(double) * buffer_size); - gutter_state *gs = gutter_init(4, 24, samples_per_second); + gutter_state *gs = gutter_init(4, 24, samples_per_second); //gutter_randomisefilters(gs); double* filterAutomation = malloc(sizeof(double) * gs->bankCount * gs->filterCount * 3 * 2); @@ -209,7 +209,7 @@ void create() free(buffer); free(filterAutomation); - gutter_cleanup(gs); + gutter_cleanup(gs); wavfile_close(); } diff --git a/examples/example2.cpp b/examples/example2.cpp index 415c1ff..13e8228 100644 --- a/examples/example2.cpp +++ b/examples/example2.cpp @@ -50,7 +50,6 @@ public: } void write(double value) { - //https://www.cplusplus.com/forum/beginner/166954/ write_word((short) (value * SHRT_MAX * 0.5), 2); } @@ -82,17 +81,14 @@ public: void run() { int total_samples = 30 * samplerate; int sample = 0; - short data; - gs->randomiseFilters(); + FLT data; gs->filtersOn(true); gs->smoothing(true); gs->distortionMethod(2); - + gs->randomiseFilters(); + for (int sample = 0; sample < total_samples; sample ++) { data = gs->process(); - if (data > 0) { - std::cout << data; - } wav->write(data); if (sample % samplerate == 0) { // randomise every second |