/*
- Copyright (C) 2010 Paul Davis
- Author: Carl Hetherington <cth@carlh.net>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2010-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2011-2015 David Robillard <d@drobilla.net>
+ * Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2015-2019 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
#include <gtkmm/stock.h>
#include <gtkmm/table.h>
/** @param tc If non-0, a time converter for this patch change. If 0, time control will be desensitized */
PatchChangeDialog::PatchChangeDialog (
const ARDOUR::BeatsSamplesConverter* tc,
- ARDOUR::Session* session,
- Evoral::PatchChange<Evoral::Beats> const & patch,
- ARDOUR::InstrumentInfo& info,
- const Gtk::BuiltinStockID& ok,
- bool allow_delete,
- bool modal)
+ ARDOUR::Session* session,
+ Evoral::PatchChange<Temporal::Beats> const& patch,
+ ARDOUR::InstrumentInfo& info,
+ const Gtk::BuiltinStockID& ok,
+ bool allow_delete,
+ bool modal)
: ArdourDialog (_("Patch Change"), modal)
, _time_converter (tc)
, _info (info)
t->attach (_bank_lsb, 1, 2, r, r + 1);
++r;
+ assert (patch.bank() != UINT16_MAX);
+
_bank_msb.set_value ((patch.bank() >> 7));
_bank_msb.signal_changed().connect (sigc::mem_fun (*this, &PatchChangeDialog::bank_changed));
-
_bank_lsb.set_value ((patch.bank() & 127));
_bank_lsb.signal_changed().connect (sigc::mem_fun (*this, &PatchChangeDialog::bank_changed));
fill_patch_combo ();
}
-Evoral::PatchChange<Evoral::Beats>
+Evoral::PatchChange<Temporal::Beats>
PatchChangeDialog::patch () const
{
- Evoral::Beats t = Evoral::Beats();
+ Temporal::Beats t = Temporal::Beats();
if (_time_converter) {
t = _time_converter->from (_time.current_time ());
}
- return Evoral::PatchChange<Evoral::Beats> (
+ return Evoral::PatchChange<Temporal::Beats> (
t,
_channel.get_value_as_int() - 1,
_program.get_value_as_int() - 1,
fill_patch_combo ();
set_active_patch_combo ();
- _ignore_signals = true;
- _bank_msb.set_value (_current_patch_bank->number() >> 7);
- _bank_lsb.set_value (_current_patch_bank->number() & 127);
- _ignore_signals = false;
+ if (_current_patch_bank->number() != UINT16_MAX) {
+ _ignore_signals = true;
+ _bank_msb.set_value (_current_patch_bank->number() >> 7);
+ _bank_lsb.set_value (_current_patch_bank->number() & 127);
+ _ignore_signals = false;
+ }
}
/** Fill the contents of the patch combo */
if (n == _patch_combo.get_active_text ()) {
_ignore_signals = true;
_program.set_value ((*j)->program_number() + 1);
+ _bank_msb.set_value ((*j)->bank_number() >> 7);
+ _bank_lsb.set_value ((*j)->bank_number() & 127);
_ignore_signals = false;
break;
}