summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_region_view.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-17 19:43:09 -0500
committerDavid Robillard <d@drobilla.net>2014-12-17 19:43:09 -0500
commitd2cafbe95a5784b7c306c24b0008379a41a909f7 (patch)
tree03216b0bd933f4d774634a7f8e14965fcf79c990 /gtk2_ardour/midi_region_view.cc
parent6e912a0aa31313636e2957ec0aa97d4103ee117f (diff)
Remove some aborts that don't really need to be.
Enforce PatchPrimaryKey sanity at the type level rather than attempting to check for it everywhere. Remove dead file.
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r--gtk2_ardour/midi_region_view.cc67
1 files changed, 14 insertions, 53 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 2879e65af7..11534dd035 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -1881,15 +1881,11 @@ MidiRegionView::get_patch_key_at (Evoral::MusicalTime time, uint8_t channel, MID
}
if (i != _model->patch_changes().end() && patch_applies(*i, time, channel)) {
- key.bank_number = (*i)->bank();
- key.program_number = (*i)->program ();
+ key.set_bank((*i)->bank());
+ key.set_program((*i)->program ());
} else {
- key.bank_number = key.program_number = 0;
- }
-
- if (!key.is_sane()) {
- error << string_compose(_("insane MIDI patch key %1:%2"),
- key.bank_number, key.program_number) << endmsg;
+ key.set_bank(0);
+ key.set_program(0);
}
}
@@ -1898,11 +1894,11 @@ MidiRegionView::change_patch_change (PatchChange& pc, const MIDI::Name::PatchPri
{
MidiModel::PatchChangeDiffCommand* c = _model->new_patch_change_diff_command (_("alter patch change"));
- if (pc.patch()->program() != new_patch.program_number) {
- c->change_program (pc.patch (), new_patch.program_number);
+ if (pc.patch()->program() != new_patch.program()) {
+ c->change_program (pc.patch (), new_patch.program());
}
- int const new_bank = new_patch.bank_number;
+ int const new_bank = new_patch.bank();
if (pc.patch()->bank() != new_bank) {
c->change_bank (pc.patch (), new_bank);
}
@@ -1988,47 +1984,12 @@ MidiRegionView::delete_patch_change (PatchChange* pc)
}
void
-MidiRegionView::previous_patch (PatchChange& patch)
-{
- if (patch.patch()->program() < 127) {
- MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
- key.program_number++;
- change_patch_change (patch, key);
- }
-}
-
-void
-MidiRegionView::next_patch (PatchChange& patch)
-{
- if (patch.patch()->program() > 0) {
- MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
- key.program_number--;
- change_patch_change (patch, key);
- }
-}
-
-void
-MidiRegionView::next_bank (PatchChange& patch)
-{
- if (patch.patch()->program() < 127) {
- MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
- if (key.bank_number > 0) {
- key.bank_number--;
- change_patch_change (patch, key);
- }
- }
-}
-
-void
-MidiRegionView::previous_bank (PatchChange& patch)
+MidiRegionView::step_patch (PatchChange& patch, int dbank, int dprog)
{
- if (patch.patch()->program() > 0) {
- MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
- if (key.bank_number < 127) {
- key.bank_number++;
- change_patch_change (patch, key);
- }
- }
+ MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key(patch.patch());
+ key.set_bank(key.bank() + dbank);
+ key.set_program(key.program() + dprog);
+ change_patch_change(patch, key);
}
void
@@ -3893,8 +3854,8 @@ MidiRegionView::show_verbose_cursor (boost::shared_ptr<NoteType> n) const
get_patch_key_at(n->time(), n->channel(), patch_key);
name = device_names->note_name(mtv->gui_property(X_("midnam-custom-device-mode")),
n->channel(),
- patch_key.bank_number,
- patch_key.program_number,
+ patch_key.bank(),
+ patch_key.program(),
n->note());
}
}