From b1da36e4ff5c11d603051a1791862740c7089e6c Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sat, 31 Oct 2015 09:02:59 +0000 Subject: [PATCH] - improved wave export git-svn-id: http://moon:8086/svn/software/trunk/projects/JaySynth@274 b431acfa-c32f-4a4a-93f1-934dc6c82436 --- Source/synth/wavetable.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Source/synth/wavetable.c b/Source/synth/wavetable.c index 47cbfb9..b11a97a 100644 --- a/Source/synth/wavetable.c +++ b/Source/synth/wavetable.c @@ -9,6 +9,8 @@ #include "vector_utils.h" #include "wavetable.h" +//#define WAVE_EXPORT_FILE + const wt_descr_t _g_wt_descr[WT_NUM_WAVETABLES] = { {8, 0, 101, 8, 69, 16, 70, 24, 71, 32, 72, 40, 73, 48, 74, 60, 75}, @@ -62,6 +64,12 @@ void WT_ModInit(wt_common_t *pCom) synth_float_t kmix; synth_float_t x, dx, wave_tri[WT_WAVE_SIZE], wave_sqr[WT_WAVE_SIZE], wave_saw[WT_WAVE_SIZE]; + FILE *pFileAll = NULL; + +#ifdef WAVE_EXPORT_FILE + pFileAll = fopen("C:\\Users\\jens\\JaySynth\\wave_sweep.pcm", "wb"); +#endif + // Create waves from 16-bit raw data offset = 0; for (i=0; i < 300; i++) @@ -93,8 +101,7 @@ void WT_ModInit(wt_common_t *pCom) pCom->waves[offset+i][j] = (synth_float_t)wave[j]/8192; } -#if 0 -//#ifdef SYNTH_DEBUG +#ifdef WAVE_EXPORT_FILE { FILE *pFile = NULL; char filename[128] = {0}; @@ -108,8 +115,21 @@ void WT_ModInit(wt_common_t *pCom) } } #endif + + if (pFileAll) + { + int i; + + for (i=0; i < 20; i++) + { + fwrite(wave, 2, WT_WAVE_SIZE, pFileAll); + } + } } + if (pFileAll) + fclose(pFileAll); + // Create classic waveforms // Saw x = 1;