Example #1
0
BaseSynthEvent::~BaseSynthEvent()
{
    removeFromSequencer();

    if ( _adsr != 0 )
    {
        delete _adsr;
        _adsr = 0;
    }
}
void BaseAudioEvent::setInstrument( BaseInstrument* aInstrument )
{
    // swap instrument if new one is different to existing reference
    // additionally, if event was added to the sequencer, add it to the new
    // instruments sequenced events list

    if ( aInstrument != 0 &&
        _instrument  != aInstrument )
    {
        bool wasAddedToSequencer = _addedToSequencer;

        if ( wasAddedToSequencer )
            removeFromSequencer();

        _instrument = aInstrument;

        if ( wasAddedToSequencer )
            addToSequencer();
    }
}
Example #3
0
/**
 * @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
 *                    can be NULL to keep the current SynthInstrument, if not null the current
 *                    SynthInstrument is replaced
 */
void BaseSynthEvent::invalidateProperties( int aPosition, float aLength, SynthInstrument *aInstrument )
{
    // swap instrument if new one is different to existing reference
    if ( aInstrument != 0 && _instrument != aInstrument )
    {
        removeFromSequencer();
        _instrument = aInstrument;
        addToSequencer();
    }
    position = aPosition;
    length   = aLength;

    // is this event caching ?

    if ( AudioEngineProps::EVENT_CACHING && !_cachingCompleted ) _cancel = true;

    if ( _rendering )
        _update = true;     // we're rendering, request update from within render loop
    else
        updateProperties(); // instant update as we're not rendering
}
BaseAudioEvent::~BaseAudioEvent()
{
    removeFromSequencer();
    destroyBuffer();
}