diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2008-05-09 16:10:36 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2008-05-09 16:10:36 +0000 |
commit | 4e745fc17c22ade138bc7decc93df2e3d8cd354f (patch) | |
tree | 1ec759922ea6095edfd9258a322724995f9a3f20 /libs/ardour/midi_model.cc | |
parent | 8d44391f4ba571c4dbcec0a87033c83414f515e8 (diff) |
* formatting/style guide
* bugfix: midi_util.h only considered channel events up to E0, but had to be EF
* bugfix: parameter.h operator == should also compare channel (drobilla, correct me if I am wrong)
* added some assert() guards
git-svn-id: svn://localhost/ardour2/branches/3.0@3330 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_model.cc')
-rw-r--r-- | libs/ardour/midi_model.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index 8c6f569c5c..3cef80deb6 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -171,7 +171,7 @@ const MidiModel::const_iterator& MidiModel::const_iterator::operator++() //cerr << "control_iter x:" << _control_iter->x << " y:" << _control_iter->y << endl; if (ret) { - cerr << "Incremented " << _control_iter->automation_list->parameter().id() << " to " << x << endl; + //cerr << "Incremented " << _control_iter->automation_list->parameter().id() << " to " << x << endl; _control_iter->x = x; _control_iter->y = y; } else { @@ -243,10 +243,11 @@ const MidiModel::const_iterator& MidiModel::const_iterator::operator++() bool MidiModel::const_iterator::operator==(const const_iterator& other) const { - if (_is_end || other._is_end) + if (_is_end || other._is_end) { return (_is_end == other._is_end); - else + } else { return (_event == other._event); + } } MidiModel::const_iterator& MidiModel::const_iterator::operator=(const const_iterator& other) @@ -352,17 +353,16 @@ bool MidiModel::control_to_midi_event(MIDI::Event& ev, return true; case MidiPgmChangeAutomation: - if (ev.size() < 3) { - ev.set_buffer((Byte*)malloc(3), true); + if (ev.size() < 2) { + ev.set_buffer((Byte*)malloc(2), true); } assert(iter.automation_list); assert(iter.automation_list->parameter().channel() < 16); - assert(iter.automation_list->parameter().id() <= INT8_MAX); + assert(iter.automation_list->parameter().id() == 0); assert(iter.y <= INT8_MAX); ev.buffer()[0] = MIDI_CMD_PGM_CHANGE + iter.automation_list->parameter().channel(); ev.buffer()[1] = (Byte)iter.y; - ev.buffer()[2] = 0; ev.time() = iter.x; ev.size() = 3; return true; @@ -374,7 +374,7 @@ bool MidiModel::control_to_midi_event(MIDI::Event& ev, assert(iter.automation_list); assert(iter.automation_list->parameter().channel() < 16); - assert(iter.automation_list->parameter().id() <= INT8_MAX); + assert(iter.automation_list->parameter().id() == 0); assert(iter.y < (1<<14)); ev.buffer()[0] = MIDI_CMD_BENDER + iter.automation_list->parameter().channel(); ev.buffer()[1] = ((Byte)iter.y) & 0x7F; // LSB @@ -384,18 +384,17 @@ bool MidiModel::control_to_midi_event(MIDI::Event& ev, return true; case MidiChannelAftertouchAutomation: - if (ev.size() < 3) { - ev.set_buffer((Byte*)malloc(3), true); + if (ev.size() < 2) { + ev.set_buffer((Byte*)malloc(2), true); } assert(iter.automation_list); assert(iter.automation_list->parameter().channel() < 16); - assert(iter.automation_list->parameter().id() <= INT8_MAX); + assert(iter.automation_list->parameter().id() == 0); assert(iter.y <= INT8_MAX); ev.buffer()[0] = MIDI_CMD_CHANNEL_PRESSURE + iter.automation_list->parameter().channel(); ev.buffer()[1] = (Byte)iter.y; - ev.buffer()[2] = 0; ev.time() = iter.x; ev.size() = 3; return true; @@ -580,9 +579,10 @@ void MidiModel::append_note_off_unlocked(uint8_t chan, double time, } } - if (!resolved) + if (!resolved) { cerr << "MidiModel " << this << " spurious note off chan " << (int)chan << ", note " << (int)note_num << " @ " << time << endl; + } } void MidiModel::append_automation_event_unlocked(AutomationType type, @@ -618,7 +618,7 @@ void MidiModel::append_automation_event_unlocked(AutomationType type, Parameter param(type, id, chan); boost::shared_ptr<AutomationControl> control = Automatable::control(param, true); - control->list()->fast_simple_add(time, value); + control->list()->rt_add(time, value); /*cerr << "control list size after fast simple add: " << control->list()->size() << endl;*/ } |