void Track_Pattern::add_noteon_event_to_buffer(char p_note,char p_velocity,int p_column,EventBuffer &p_buffer,int p_frame_offset) { EventBuffer &event_buffer=get_event_buffer(); //printf("note %i\n",p_note); if (data.last_note[p_column].is_note() && data.last_note[p_column].note==p_note) { /* IF the note is the same, we must mute it before */ Event e; SET_EVENT_MIDI(e,EventMidi::MIDI_NOTE_OFF,0,data.last_note[p_column].note,0); e.frame_offset=p_frame_offset; //off te p_buffer.push_event(e); data.last_note[p_column]=Note(Note::NOTE_OFF); //avoid the next check } /* send new note */ { int velocity=(int)p_velocity*127/99; Event e; SET_EVENT_MIDI(e,EventMidi::MIDI_NOTE_ON,0,p_note,velocity); e.frame_offset=p_frame_offset; p_buffer.push_event(e); } if (data.last_note[p_column].is_note() && data.last_note[p_column].note!=p_note) { /* If the note is different, mute it later */ Event e; SET_EVENT_MIDI(e,EventMidi::MIDI_NOTE_OFF,0,data.last_note[p_column].note,0); e.frame_offset=p_frame_offset; //off te p_buffer.push_event(e); } data.last_note[p_column]=Note(p_note); }