Test the Synth sound functions of Pokitto
Dependencies: PokittoLib
SynthTest - Pokitto synth demo
To test this program, simply press "Import into Compiler" button on the right!
Revision 6:cd9679164a70, committed 2018-05-01
- Comitter:
- Pokitto
- Date:
- Tue May 01 18:44:03 2018 +0000
- Parent:
- 5:09131ded851b
- Commit message:
- New PokittoLib version;
Changed in this revision
PokittoLib.lib | Show annotated file Show diff for this revision Revisions of this file |
SynthTest.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 09131ded851b -r cd9679164a70 PokittoLib.lib --- a/PokittoLib.lib Sat Apr 14 07:39:10 2018 +0000 +++ b/PokittoLib.lib Tue May 01 18:44:03 2018 +0000 @@ -1,1 +1,1 @@ -http://os.mbed.com/users/Pokitto/code/PokittoLib/#771321e70814 +http://mbed.org/users/Pokitto/code/PokittoLib/#6183b12dd99c
diff -r 09131ded851b -r cd9679164a70 SynthTest.cpp --- a/SynthTest.cpp Sat Apr 14 07:39:10 2018 +0000 +++ b/SynthTest.cpp Tue May 01 18:44:03 2018 +0000 @@ -1,11 +1,13 @@ #include "Pokitto.h" #include "Synth.h" -#include "dma_11u6x.h" Pokitto::Core game; Pokitto::Display disp; Pokitto::Sound snd; Pokitto::Buttons btn; +#ifndef POK_SIM +DigitalOut enable(EXT4); +#endif // POK_SIM int tonefreq=46; uint8_t amplitude = 255;//127; @@ -14,11 +16,14 @@ char notestr[6]; uint8_t sbindx=0,sbx=0,prevy=0; + int main() { + #ifndef POK_SIM + enable=0; + #endif // POK_SIM game.begin(); - - snd.setVolume(snd.getMaxVol()); // volume to max level depending on headset/speaker safety level + //snd.setVolume(snd.getMaxVol()); // volume to max level depending on headset/speaker safety level disp.persistence = true; disp.color=wavetype+1; disp.bgcolor=0; @@ -55,7 +60,11 @@ case 5: disp.println(" SqNois");break; } - disp.print("HWvol:"); + disp.print("Vol:"); + #ifndef POK_SIM + disp.print((int)Pokitto::getHWvolume()); + disp.print(", "); + #endif // POK_SIM disp.println((int)snd.getVolume()); disp.lcdRefresh(disp.screenbuffer); @@ -69,6 +78,7 @@ #define DEBOU 256 #endif + if (changed == 0) { if(btn.upBtn()) { amplitude++; changed = DEBOU; } if(btn.downBtn()) { amplitude--; changed = DEBOU; } @@ -105,7 +115,11 @@ case 5: disp.println(" SqNois");break; } - disp.print("HWvol:"); + disp.print("Vol:"); + #ifndef POK_SIM + disp.print((int)Pokitto::getHWvolume()); + disp.print(", "); + #endif // POK_SIM disp.println((int)snd.getVolume()); snd.playTone(1,tonefreq,amplitude,wavetype,arpmode); oldvol = (int) snd.getVolume(); @@ -127,4 +141,3 @@ } return 0; // good manners! } -