RegionViewGoingAway (this); /* EMIT_SIGNAL */
- if (_active_notes)
+ if (_active_notes) {
end_write();
+ }
_selection.clear();
clear_events();
void
MidiRegionView::extend_active_notes()
{
- if (!_active_notes)
+ if (!_active_notes) {
return;
+ }
- for (unsigned i=0; i < 128; ++i)
- if (_active_notes[i])
+ for (unsigned i=0; i < 128; ++i) {
+ if (_active_notes[i]) {
_active_notes[i]->property_x2() = trackview.editor.frame_to_pixel(_region->length());
+ }
+ }
}
MidiRingBufferBase<Byte>::write(sizeof(double), (Byte*)&time);
MidiRingBufferBase<Byte>::write(sizeof(size_t), (Byte*)&size);
if (is_channel_event(buf[0]) && get_channel_mode() == ForceChannel) {
- assert(size == 3);
+ assert(size == 2 || size == 3);
Byte tmp_buf[3];
// Force event to channel
tmp_buf[0] = (buf[0] & 0xF0) | (get_channel_mask() & 0x0F);
tmp_buf[1] = buf[1];
- tmp_buf[2] = buf[2];
+ if (size == 3) {
+ tmp_buf[2] = buf[2];
+ }
MidiRingBufferBase<Byte>::write(size, tmp_buf);
} else {
MidiRingBufferBase<Byte>::write(size, buf);
ev.buffer()[0] = MIDI_CMD_PGM_CHANGE + iter.automation_list->parameter().channel();
ev.buffer()[1] = (Byte)iter.y;
ev.time() = iter.x;
- ev.size() = 3;
+ ev.size() = 2;
return true;
case MidiPitchBenderAutomation:
= MIDI_CMD_CHANNEL_PRESSURE + iter.automation_list->parameter().channel();
ev.buffer()[1] = (Byte)iter.y;
ev.time() = iter.x;
- ev.size() = 3;
+ ev.size() = 2;
return true;
default:
Parameter param(type, id, chan);
boost::shared_ptr<AutomationControl> control = Automatable::control(param, true);
control->list()->rt_add(time, value);
- /*cerr << "control list size after fast simple add: " << control->list()->size() << endl;*/
}
void MidiModel::add_note_unlocked(const boost::shared_ptr<Note> note)
{
assert(val >= _list->parameter().min());
assert(val <= _list->parameter().max());
+ size_t size = 3;
if ( ! _list->automation_playback()) {
- Byte ev[3] = { _list->parameter().channel(), (int)val, 0.0 };
+ Byte ev[3] = { _list->parameter().channel(), int(val), 0.0 };
switch(_list->parameter().type()) {
case MidiCCAutomation:
ev[0] += MIDI_CMD_CONTROL;
break;
case MidiPgmChangeAutomation:
+ size = 2;
ev[0] += MIDI_CMD_PGM_CHANGE;
+ ev[1] = int(val);
break;
case MidiChannelAftertouchAutomation:
+ size = 2;
ev[0] += MIDI_CMD_CHANNEL_PRESSURE;
+ ev[1] = int(val);
break;
case MidiPitchBenderAutomation:
default:
assert(false);
}
- _route->write_immediate_event(3, ev);
+ _route->write_immediate_event(size, ev);
}
AutomationControl::set_value(val);