
a
Dependencies: TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG
Revision 5:7db99d28bc36, committed 2019-05-05
- Comitter:
- Tantep
- Date:
- Sun May 05 02:48:03 2019 +0000
- Parent:
- 4:ec0ff5b355e8
- Commit message:
- a
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat May 04 17:41:04 2019 +0000 +++ b/main.cpp Sun May 05 02:48:03 2019 +0000 @@ -35,7 +35,7 @@ { lcd.Clear(LCD_COLOR_BLUE); ee.attach(&screen, 0.03); - re.attach(&play, 0.5);//เล่นตามtempo + re.attach(&play,0.5);//เล่นตามtempo er.attach(&test, 0.25);//กดช้ากดเร็วแล้วแต่ rr.attach(&knob,0.5);//readknob ทุก0.5 @@ -102,9 +102,9 @@ ///////////////////////////////////////////////////////////////////////////// PLAY PART ////////////////////////////////////////////// void playsnare() { - speaker = sn44_data[h]/16777215.0;//scale to 0.0 to 1.0 for PWM + speaker = volume*(sn44_data[h]/16777215.0);//scale to 0.0 to 1.0 for PWM h++; - speaker.period((1.0/330750.0)*volume); //PWM freq >10X audio sample rate + speaker.period(1.0/330750.0); //PWM freq >10X audio sample rate if (h>= num_sn44) { h = 0; @@ -115,9 +115,9 @@ void playkick() { - speaker = kick44_data[l]/16777215.0;//scale to 0.0 to 1.0 for PWM + speaker = volume*(kick44_data[l]/16777215.0);//scale to 0.0 to 1.0 for PWM l++; - speaker.period((1.0/441000.0)*volume); //PWM freq >10X audio sample rate + speaker.period(1.0/441000.0); //PWM freq >10X audio sample rate if (l>= num_kick44) { l = 0; @@ -127,9 +127,9 @@ } void playclap() { - speaker = cl44_data[i]/16777215.0;//scale to 0.0 to 1.0 for PWM + speaker = volume*(cl44_data[i]/16777215.0);//scale to 0.0 to 1.0 for PWM i++; - speaker.period((1.0/220500.0)*volume); //PWM freq >10X audio sample rate + speaker.period(1.0/220500.0); //PWM freq >10X audio sample rate if (i>= num_cl44) { i = 0; @@ -140,9 +140,9 @@ void playclhh() { - speaker = clhh44_data[j]/16777215.0;//scale to 0.0 to 1.0 for PWM + speaker = volume*(clhh44_data[j]/16777215.0);//scale to 0.0 to 1.0 for PWM j++; - speaker.period((1.0/330750.0)*volume); //PWM freq >10X audio sample rate + speaker.period(1.0/330750.0); //PWM freq >10X audio sample rate if (j>= num_clhh44) { j = 0; @@ -153,9 +153,9 @@ void playophh() { - speaker = ophh44_data[k]/16777215.0;//scale to 0.0 to 1.0 for PWM + speaker = volume*(ophh44_data[k]/16777215.0);//scale to 0.0 to 1.0 for PWM k++; - speaker.period((1.0/330750.0)*volume); //PWM freq >10X audio sample rate + speaker.period(1.0/330750.0); //PWM freq >10X audio sample rate if (k>= num_ophh44) { k = 0; @@ -786,5 +786,6 @@ } } +