Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: YATTT sd_map_test cPong SnowDemo ... more
PokittoLib
Library for programming Pokitto hardware
How to Use
- Import this library to online compiler (see button "import" on the right hand side
- DO NOT import mbed-src anymore, a better version is now included inside PokittoLib
- Change My_settings.h according to your project
- Start coding!
Diff: POKITTO_CORE/PokittoSound.cpp
- Revision:
- 2:968589ca3484
- Parent:
- 1:4b1511a0a2c2
- Child:
- 4:ecf2fe370c1c
--- a/POKITTO_CORE/PokittoSound.cpp Mon Sep 18 12:34:05 2017 +0000
+++ b/POKITTO_CORE/PokittoSound.cpp Tue Sep 19 08:47:36 2017 +0000
@@ -147,6 +147,7 @@
uint8_t _chanOutput[NUM_CHANNELS]; //current value of the outputted waveform
bool _chanNoise[NUM_CHANNELS]; //if a random value should be added to the waveform to generate noise
+#if POK_GBSOUND > 0
const uint16_t squareWaveInstrument[] = {0x0101, 0x03F7};
const uint16_t noiseInstrument[] = {0x0101, 0x03FF};
const uint16_t* const defaultInstruments[] = {squareWaveInstrument,noiseInstrument};
@@ -154,7 +155,7 @@
const uint16_t playOKPattern[] = {0x0005,0x138,0x168,0x0000};
const uint16_t playCancelPattern[] = {0x0005,0x168,0x138,0x0000};
const uint16_t playTickP[] = {0x0045,0x168,0x0000};
-
+#endif
#if(EXTENDED_NOTE_RANGE > 0)
//extended note range
#define NUM_PITCH 59
@@ -441,7 +442,7 @@
return;
switch(cmd){
case CMD_VOLUME: //volume
- X = constrain(X, 0, 10);
+ X = constrain((int8_t)X, 0, 10);
noteVolume[i] = X;
break;
case CMD_INSTRUMENT: //instrument
@@ -845,6 +846,7 @@
return Pokitto::ampIsOn();
#endif
#endif // POK_SIM
+ return 0;
}
void Sound::ampEnable(uint8_t v) {
@@ -860,7 +862,7 @@
int Sound::playMusicStream(char* filename)
{
- playMusicStream(filename,0);
+ return playMusicStream(filename,0);
}
int Sound::playMusicStream()