Part of MicroGen4 Music Synthesizer Program. (But not test it yet.) I2S ,DMA ,Stereo ,16Bit Dac(PCM1781) See detail: http://www.geocities.jp/micro_diys/index2
Now added generate Saw Wave to DAC function in generate(); You will hear Stereo saw wave sound now.
more info: http://www.geocities.jp/micro_diys/i2s_test_sample/i2s_test_sample.html
Revision 1:48f506a7b488, committed 2017-09-21
- Comitter:
- p_igmon
- Date:
- Thu Sep 21 10:20:50 2017 +0000
- Parent:
- 0:dc88722ab141
- Commit message:
- Added Sample Saw Wave in Function Generate.
; DAC PCM1781 Can Output Saw Wave now.
Changed in this revision
Synthesizer.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r dc88722ab141 -r 48f506a7b488 Synthesizer.cpp --- a/Synthesizer.cpp Thu Jul 03 11:59:07 2014 +0000 +++ b/Synthesizer.cpp Thu Sep 21 10:20:50 2017 +0000 @@ -9,23 +9,23 @@ extern __IO BUFFER_StateTypeDef BufferOffset; void wave_generate(void){ - U16 count; - S16 rch,lch;// 16bit stereo - volatile S16 *ptr0; + u16 count; + s16 rch,lch;// 16bit stereo + volatile s16 *ptr0; - if (BufferOffset == DMA_FullComplete){ - ptr0 = (S16 *)&DMA_Buffer[DMA_BUFFERSIZE>>1];// From Half + if (bufferoffset == dma_fullcomplete){ + ptr0 = (s16 *)&dma_buffer[dma_buffersize>>1];// from half }else{ - ptr0 = (S16 *)&DMA_Buffer[0];// From Top + ptr0 = (s16 *)&dma_buffer[0];// from top } - BufferOffset = DMA_Idle; + bufferoffset = dma_idle; - count = DMA_BUFFERSIZE/4; + count = dma_buffersize>>2;// 512samples while(count-- > 0){ /* generate wave here */ -// lch = ..... -// rch = ..... + lch = ((s16)(count - 256))<<6;// Saw Wave Lch + rch = ((s16)(256 -count))<<6;// Saw Wave Rch *ptr0++ = lch; *ptr0++ = rch; }