SynthEvent::~SynthEvent() { if ( _ringBuffer != 0 ) { delete _ringBuffer; _ringBuffer = 0; } if ( _arpeggiator != 0 ) { delete _arpeggiator; _arpeggiator = 0; } if ( _adsr != 0 ) { delete _adsr; _adsr = 0; } // secondary oscillator destroyOSC2(); // remove AudioEvent from sequencer if ( !isSequenced ) { for ( int i; i < _instrument->liveEvents->size(); i++ ) { if ( _instrument->liveEvents->at( i ) == this ) { _instrument->liveEvents->erase( _instrument->liveEvents->begin() + i ); break; } } } else { for ( int i; i < _instrument->audioEvents->size(); i++ ) { if ( _instrument->audioEvents->at( i ) == this ) { _instrument->audioEvents->erase( _instrument->audioEvents->begin() + i ); break; } } } }
SynthEvent::~SynthEvent() { if ( _ringBuffer != 0 ) { delete _ringBuffer; _ringBuffer = 0; } if ( _arpeggiator != 0 ) { delete _arpeggiator; _arpeggiator = 0; } destroyOSC2(); }
/** * @param aPosition position in the sequencer where this event starts playing * @param aLength length (in sequencer steps) of this event * @param aInstrument the SynthInstrument whose properties will be used for synthesizing this event * @param aState which oscillator(s) to update 0 = all, 1 = oscillator 1, 2 = oscillator 2 * this is currently rudimentary as both oscillators are rendered and merged into one * this is here for either legacy purposes or when performance improvements can be gained */ void SynthEvent::updateProperties( int aPosition, float aLength, SynthInstrument *aInstrument, int aState ) { bool updateLFO1 = true;//( aState == 0 || aState == 1 ); bool updateOSC2 = true;//( aState == 0 || aState == 2 ); _type = aInstrument->waveform; position = aPosition; length = aLength; _adsr->cloneEnvelopes( aInstrument->adsr ); // secondary oscillator if ( updateOSC2 && aInstrument->osc2active ) createOSC2( aPosition, aLength, aInstrument ); else destroyOSC2(); // modules applyModules( aInstrument ); if ( updateLFO1 ) { if ( _caching /*&& !_cachingCompleted */) { if ( _osc2 != 0 && _osc2->_caching ) _osc2->_cancel = true; _cancel = true; } else { calculateBuffers(); } } }