void Playlist::clear(uint8_t clearFlags) { if(clearFlags & CLEAR_SCRIPT_URL) { WRITE_STRING_TO_PLAYLIST(script, (char *) ""); } if(clearFlags & CLEAR_SETTINGS) { setPlayOrder(FORWARDS_ORDER); setPortamento(true); setVolume(DEFAULT_VOLUME); setUpdateFlags(0); setInterval(DEFAULT_INTERVAL); setAutoplayTimes(0, 0, 0); setAutoplayChirpLimit(PLAYLIST_CAPACITY); } if(clearFlags & CLEAR_LIST) { WRITE_TO_PLAYLIST(addIndex, 0); // codes starting with 0 byte are considered empty uint8_t *addr = PLAYLIST_FIELD_ADDR(codes); for(uint8_t i = 0; i < PLAYLIST_CAPACITY; i++) { Store::writeValue(addr, 0, 1); addr += CODE_LENGTH; } nChirps = 0; playIndex = 0; isFirst = true; } }
Oscillator::Oscillator() : AudioNode() { FrequencyIn = new AudioNodeInput(); FMSourceIn = new AudioNodeInput(); FMAmountIn = new AudioNodeInput(); _period = 0; _phase = 0; _osc = 0; _accumulator = 0; _sample = 0; setFrequency(110.0f); setDetune(0.0f); setBend(0.0f); setPortamento(1); setSemitone(0); setGain(1.0f); // this extends the standard midi frequencies from 128 to 256 discrete values, // extending the frequency range with -117 positions below to 0.00949 Hz // and +11 above to 23679 Hz. for (int i=0; i<=128; i++) { _expFrequency[i] = (int64_t(pow(2,((float(i) - 69.0) / 12.0)) * 440.0) << 32) / SAMPLE_RATE; // divide by sample rate? // Serial.print("_expFrequency["); // Serial.print(i); // Serial.print("] = "); // Serial.println(int(_expFrequency[i] >> 32)); } for (int i=0; i<=128; i++) { _lfoFrequency[i] = (int64_t(pow(2,((double(i) - 117.0 - 69.0) / 12.0)) * 440.0) << 32) / SAMPLE_RATE; // divide by sample rate? } _dir = 1; _indx = 0; _ifrac = 0; _freq0 = 0; _freq1 = 0; _dfreq = 0; _ffrac = 0; _dPhase = 0; _lfo = false; }