Exemplo n.º 1
0
    void collectLiveEvents( BaseInstrument* instrument )
    {
        AudioChannel* channel                    = instrument->audioChannel;
        std::vector<BaseAudioEvent*>* liveEvents = instrument->getLiveEvents();

        // removal queue
        std::vector<BaseAudioEvent*> removes;

        int i = 0;
        for ( i; i < liveEvents->size(); i++ )
        {
            BaseAudioEvent* audioEvent = liveEvents->at( i );

            if ( !audioEvent->isDeletable())
                channel->addLiveEvent( audioEvent );
            else
                removes.push_back( audioEvent );
        }
        // removal queue filled ? process it so we can safely
        // remove "deleted" AudioEvents without errors occurring
        if ( removes.size() > 0 )
        {
            int i = 0;
            for ( i; i < removes.size(); i++ )
            {
                BaseAudioEvent* audioEvent = removes[ i ];
                instrument->removeEvent( audioEvent, true );
            }
        }
    }
Exemplo n.º 2
0
    void collectLiveEvents( BaseInstrument* instrument )
    {
        AudioChannel* channel                    = instrument->audioChannel;
        std::vector<BaseAudioEvent*>* liveEvents = instrument->getLiveEvents();

        // removal queue
        std::vector<BaseAudioEvent*> removes;

        int i = 0;
        for ( i; i < liveEvents->size(); i++ )
        {
            BaseAudioEvent* audioEvent = liveEvents->at( i );

            if ( !audioEvent->deletable())
                channel->addLiveEvent( audioEvent );
            else
                removes.push_back( audioEvent );
        }
        // removal queue filled ? process it so we can safely
        // remove "deleted" AudioEvents without errors occurring
        if ( removes.size() > 0 )
        {
            int i = 0;
            for ( i; i < removes.size(); i++ )
            {
                BaseAudioEvent* audioEvent = removes[ i ];

                // remove audio event from the list
                if ( std::find( liveEvents->begin(), liveEvents->end(), audioEvent ) != liveEvents->end())
                {
                    liveEvents->erase( std::find( liveEvents->begin(), liveEvents->end(), audioEvent ));
                }
                instrument->removeEvent( audioEvent );
            }
        }
    }