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_LIBS/Synth/Synth_oscfuncs.cpp
- Revision:
- 66:6281a40d73e6
- Parent:
- 31:f4b9b85c7b62
--- a/POKITTO_LIBS/Synth/Synth_oscfuncs.cpp Sat Mar 23 19:22:35 2019 +0000
+++ b/POKITTO_LIBS/Synth/Synth_oscfuncs.cpp Sat Mar 23 20:03:34 2019 +0000
@@ -39,11 +39,12 @@
/** OSCILLATOR FUNCTIONS **/
void setOSC(OSC* o,byte on=1, byte wave=1, byte loop=0, byte echo=0, byte adsr=0,
- uint8_t notenumber=25, uint8_t volume=127,
+ uint8_t notenumber=25, uint16_t volume=127,
uint16_t attack=0, uint16_t decay=0, uint16_t sustain=0, uint16_t release=0,
int16_t maxbend=0, int16_t bendrate=0, uint8_t arpmode = 0, uint8_t overdrive=0, uint8_t kick=0){
//Serial.println("SetOsc "); osc1
o->on = on;
+ o->duration = -1; //max this out for the time being
o->overdrive = overdrive;
o->kick = kick;
o->wave = wave;
@@ -66,12 +67,13 @@
o->tonic = notenumber; // save tonic for arpeggio use
if (wave == 2) o->cinc >>= 1; // correct pitch for saw wave
if (wave == 4) o->cinc <<= 1; // enable higher pitch for pure noise
+ if (wave == 6) o->samplestep = (o->cinc/(cincs[37]>>8));
o->vol = volume << 8;//volume;
if (adsr) {
o->attack = attack;
o->decay = decay;
- o->sustain = sustain;
+ o->sustain = sustain<<8; //sustain needs to be multiplied by 256 also
o->release = release;
o->adsrphase = 1;
if (!o->attack) o->adsrvol = o->vol; // start directly, no attack ramp
@@ -85,10 +87,15 @@
o->adsrvol = o->vol; // will stay same all the time
}
+ o->pitchbend = 0; //this has to be zeroed always!
if (bendrate != 0) {
- o->bendrate = bendrate; // test value
- o->pitchbend = 0;
- o->maxbend = maxbend;
+ o->bendrate = (int32_t)bendrate*(o->cinc/10000); // test value
+ o->maxbend = (int32_t)maxbend*(o->cinc/100);
+ //o->samplebendcount = o->maxbend>>24;
+ //o->samplebendtick = 0;
+ } else {
+ o->bendrate = 0;
+ o->maxbend = 0;
}
}