GenePool::MIDIEventList *GenePool::getEvents(void) { list<MIDITimedBigMessage*> *events = new list<MIDITimedBigMessage*>; for (EventPool::iterator i = pool_.begin(); i != pool_.end(); ++i) { for (BreadNoteCluster::iterator j = (*i)->begin(); j != (*i)->end(); ++j) { BreadNote *e = (*j); u_int8_t pitch = e->pitch(); u_int32_t ontime = e->ontime(); u_int32_t duration = e->duration(); u_int8_t channel = e->channel(); u_int8_t dynamic = e->dynamic(); MIDITimedBigMessage *m = new MIDITimedBigMessage; m->SetTime(ontime); m->SetNoteOn(channel, pitch, dynamic); events->push_back(m); m = new MIDITimedBigMessage; m->SetTime(ontime+duration); m->SetNoteOff(channel, pitch, dynamic); events->push_back(m); // printf("(%d %d %d %d %d) ", ontime, pitch, duration, channel, // dynamic); } } return events; }
bool AddEndingPause( MIDIMultiTrack &tracks, int track_num, MIDIClockTime pause_ticks ) { MIDIClockTime t = tracks.GetTrack( track_num )->GetLastEventTime(); MIDITimedBigMessage msg; msg.SetTime( t + pause_ticks ); // add lowest "note on" in channel 0 with velocity 0 (i.e. "note off") msg.SetNoteOn( 0, 0, 0 ); return tracks.GetTrack( track_num )->PutEvent( msg ); }
void MIDIDriver::AllNotesOff ( int chan ) { MIDITimedBigMessage msg; // send a note off for every note on in the out_matrix if ( out_matrix.GetChannelCount ( chan ) > 0 ) { for ( int note = 0; note < 128; ++note ) { while ( out_matrix.GetNoteCount ( chan, note ) > 0 ) { // make a note off with note on msg, velocity 0 msg.SetNoteOn ( ( unsigned char ) chan, ( unsigned char ) note, 0 ); OutputMessage ( msg ); } } } msg.SetControlChange ( chan, C_DAMPER, 0 ); OutputMessage ( msg ); msg.SetAllNotesOff ( ( unsigned char ) chan ); OutputMessage ( msg ); }