2017-09-07 18:30:55 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
2019-08-02 17:26:43 -04:00
|
|
|
* 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.
|
2017-09-07 18:30:55 -04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2019-08-02 17:26:43 -04:00
|
|
|
* 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.
|
2017-09-07 18:30:55 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __gtkardour_patch_change_widget_h__
|
|
|
|
#define __gtkardour_patch_change_widget_h__
|
|
|
|
|
|
|
|
#include <gtkmm/box.h>
|
2022-02-08 17:08:23 -05:00
|
|
|
#include <gtkmm/notebook.h>
|
2017-09-07 18:30:55 -04:00
|
|
|
#include <gtkmm/spinbutton.h>
|
|
|
|
#include <gtkmm/table.h>
|
|
|
|
|
2017-09-09 12:17:42 -04:00
|
|
|
#include "midi++/midnam_patch.h"
|
2022-02-08 17:08:23 -05:00
|
|
|
#include "pbd/signals.h"
|
2017-09-07 18:30:55 -04:00
|
|
|
|
|
|
|
#include "ardour/route.h"
|
|
|
|
|
|
|
|
#include "widgets/ardour_button.h"
|
|
|
|
#include "widgets/ardour_dropdown.h"
|
|
|
|
|
|
|
|
#include "ardour_dialog.h"
|
2022-02-09 12:59:15 -05:00
|
|
|
#include "ardour_window.h"
|
2019-10-25 12:01:08 -04:00
|
|
|
#include "pianokeyboard.h"
|
2017-09-07 18:30:55 -04:00
|
|
|
|
2022-02-08 17:08:23 -05:00
|
|
|
namespace ARDOUR {
|
|
|
|
class MIDITrigger;
|
|
|
|
};
|
|
|
|
|
2022-02-09 12:59:15 -05:00
|
|
|
class PatchBankList
|
2022-02-07 19:25:19 -05:00
|
|
|
{
|
|
|
|
public:
|
2022-02-09 12:59:15 -05:00
|
|
|
PatchBankList ();
|
2022-02-07 19:25:19 -05:00
|
|
|
virtual ~PatchBankList ();
|
|
|
|
|
|
|
|
protected:
|
2022-02-09 12:59:15 -05:00
|
|
|
void refill (boost::shared_ptr<MIDI::Name::ChannelNameSet>, int const bank);
|
2022-02-07 19:25:19 -05:00
|
|
|
void set_active_pgm (uint8_t);
|
|
|
|
|
2022-02-08 17:20:40 -05:00
|
|
|
virtual void select_bank (uint32_t) = 0;
|
|
|
|
virtual void select_program (uint8_t) = 0;
|
2022-02-07 19:25:19 -05:00
|
|
|
virtual void instrument_info_changed () = 0;
|
|
|
|
|
|
|
|
ArdourWidgets::ArdourDropdown _bank_select;
|
|
|
|
Gtk::SpinButton _bank_msb_spin;
|
|
|
|
Gtk::SpinButton _bank_lsb_spin;
|
|
|
|
Gtk::Table _program_table;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void select_bank_spin ();
|
|
|
|
|
|
|
|
ArdourWidgets::ArdourButton _program_btn[128];
|
|
|
|
boost::shared_ptr<MIDI::Name::PatchBank> _current_patch_bank;
|
|
|
|
bool _ignore_spin_btn_signals;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-02-08 17:08:23 -05:00
|
|
|
class PatchChangeTab : public Gtk::VBox, public PatchBankList
|
|
|
|
{
|
|
|
|
public:
|
2022-02-09 12:59:15 -05:00
|
|
|
PatchChangeTab (int channel);
|
2022-02-08 17:08:23 -05:00
|
|
|
|
|
|
|
void refresh ();
|
2022-02-09 12:59:15 -05:00
|
|
|
void reset (boost::shared_ptr<ARDOUR::Route>, boost::shared_ptr<ARDOUR::MIDITrigger>);
|
2022-02-08 17:08:23 -05:00
|
|
|
|
|
|
|
protected:
|
2022-02-09 12:59:15 -05:00
|
|
|
int bank () const;
|
2022-02-08 17:08:23 -05:00
|
|
|
uint8_t program () const;
|
|
|
|
|
|
|
|
/* Implement PatchBankList */
|
|
|
|
void select_bank (uint32_t);
|
|
|
|
void select_program (uint8_t);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void refill_banks ();
|
|
|
|
void trigger_property_changed (PBD::PropertyChange const&);
|
|
|
|
void enable_toggle ();
|
|
|
|
void update_sensitivity ();
|
2022-02-09 12:59:15 -05:00
|
|
|
void instrument_info_changed ();
|
2022-02-08 17:08:23 -05:00
|
|
|
|
|
|
|
ArdourWidgets::ArdourButton _enable_btn;
|
|
|
|
|
|
|
|
int _channel;
|
|
|
|
int _bank;
|
|
|
|
bool _ignore_callback;
|
|
|
|
|
2022-02-09 12:59:15 -05:00
|
|
|
boost::shared_ptr<ARDOUR::Route> _route;
|
2022-02-08 17:08:23 -05:00
|
|
|
boost::shared_ptr<ARDOUR::MIDITrigger> _trigger;
|
2022-02-09 12:59:15 -05:00
|
|
|
PBD::ScopedConnectionList _connections;
|
2022-02-08 17:08:23 -05:00
|
|
|
};
|
|
|
|
|
2022-02-07 19:25:19 -05:00
|
|
|
class PatchChangeWidget : public Gtk::VBox, public PatchBankList
|
2017-09-07 18:30:55 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
PatchChangeWidget (boost::shared_ptr<ARDOUR::Route>);
|
|
|
|
~PatchChangeWidget ();
|
|
|
|
|
2017-09-08 13:37:48 -04:00
|
|
|
void refresh ();
|
|
|
|
|
2017-09-07 18:30:55 -04:00
|
|
|
protected:
|
2022-02-08 17:20:40 -05:00
|
|
|
int bank (uint8_t) const;
|
2017-09-07 18:30:55 -04:00
|
|
|
uint8_t program (uint8_t) const;
|
|
|
|
|
|
|
|
void on_show ();
|
|
|
|
void on_hide ();
|
|
|
|
|
|
|
|
private:
|
2022-02-07 19:25:19 -05:00
|
|
|
void refill_banks ();
|
2017-09-07 18:30:55 -04:00
|
|
|
|
|
|
|
void select_channel (uint8_t);
|
2022-02-07 19:25:19 -05:00
|
|
|
|
|
|
|
/* Implement PatchBankList */
|
2017-09-07 18:30:55 -04:00
|
|
|
void select_bank (uint32_t);
|
|
|
|
void select_program (uint8_t);
|
2022-02-09 12:59:15 -05:00
|
|
|
|
|
|
|
/* Route Callbacks */
|
2022-02-07 19:25:19 -05:00
|
|
|
void instrument_info_changed ();
|
|
|
|
void processors_changed ();
|
2017-09-07 18:30:55 -04:00
|
|
|
|
2022-02-07 19:25:19 -05:00
|
|
|
/* callbacks from route AC */
|
2017-09-07 18:30:55 -04:00
|
|
|
void bank_changed ();
|
|
|
|
void program_changed ();
|
2017-09-09 12:17:42 -04:00
|
|
|
void bankpatch_changed (uint8_t);
|
2017-09-07 18:30:55 -04:00
|
|
|
|
2022-02-07 19:25:19 -05:00
|
|
|
/* Audition */
|
2017-09-07 19:35:43 -04:00
|
|
|
void audition_toggle ();
|
|
|
|
void check_note_range (bool);
|
|
|
|
void audition ();
|
|
|
|
void cancel_audition ();
|
|
|
|
bool audition_next ();
|
2022-02-08 17:20:40 -05:00
|
|
|
|
2022-02-09 12:59:15 -05:00
|
|
|
boost::shared_ptr<ARDOUR::Route> _route;
|
|
|
|
ARDOUR::InstrumentInfo& _info;
|
|
|
|
|
|
|
|
uint8_t _channel;
|
|
|
|
bool _no_notifications;
|
2017-09-07 19:35:43 -04:00
|
|
|
|
2022-02-09 12:59:15 -05:00
|
|
|
ArdourWidgets::ArdourDropdown _channel_select;
|
|
|
|
ArdourWidgets::ArdourButton _audition_enable;
|
|
|
|
Gtk::SpinButton _audition_start_spin; // Consider a click-box w/note-names
|
|
|
|
Gtk::SpinButton _audition_end_spin;
|
|
|
|
Gtk::SpinButton _audition_velocity;
|
|
|
|
uint8_t _audition_note_num;
|
|
|
|
bool _audition_note_on;
|
2017-09-07 21:32:31 -04:00
|
|
|
|
2019-10-25 12:01:08 -04:00
|
|
|
APianoKeyboard _piano;
|
2017-09-07 21:32:31 -04:00
|
|
|
|
2019-10-24 13:43:46 -04:00
|
|
|
void _note_on_event_handler (int, int);
|
2017-09-14 13:00:08 -04:00
|
|
|
void note_on_event_handler (int, bool for_audition);
|
2017-09-07 21:32:31 -04:00
|
|
|
void note_off_event_handler (int);
|
2022-02-09 12:59:15 -05:00
|
|
|
|
|
|
|
sigc::connection _note_queue_connection;
|
|
|
|
PBD::ScopedConnectionList _ac_connections;
|
|
|
|
PBD::ScopedConnectionList _route_connections;
|
2017-09-07 18:30:55 -04:00
|
|
|
};
|
|
|
|
|
2022-02-09 12:59:15 -05:00
|
|
|
class PatchChangeTriggerWindow : public ArdourWindow
|
2022-02-08 17:08:23 -05:00
|
|
|
{
|
|
|
|
public:
|
2022-02-09 12:59:15 -05:00
|
|
|
PatchChangeTriggerWindow ();
|
|
|
|
|
|
|
|
void reset (boost::shared_ptr<ARDOUR::Route>, boost::shared_ptr<ARDOUR::MIDITrigger>);
|
|
|
|
void clear ();
|
2022-02-08 17:08:23 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
void on_switch_page (GtkNotebookPage*, guint page_num);
|
|
|
|
|
|
|
|
Gtk::Notebook _notebook;
|
|
|
|
PatchChangeTab* _w[16];
|
2022-02-09 12:59:15 -05:00
|
|
|
|
|
|
|
PBD::ScopedConnection _route_connection;
|
2022-02-08 17:08:23 -05:00
|
|
|
};
|
|
|
|
|
2017-09-07 18:30:55 -04:00
|
|
|
class PatchChangeGridDialog : public ArdourDialog
|
|
|
|
{
|
|
|
|
public:
|
2017-09-08 13:37:48 -04:00
|
|
|
PatchChangeGridDialog (boost::shared_ptr<ARDOUR::Route>);
|
2022-02-08 17:20:40 -05:00
|
|
|
|
|
|
|
void on_hide ()
|
|
|
|
{
|
|
|
|
w.hide ();
|
|
|
|
ArdourDialog::on_hide ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void on_show ()
|
|
|
|
{
|
|
|
|
w.show ();
|
|
|
|
ArdourDialog::on_show ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void refresh ()
|
|
|
|
{
|
|
|
|
w.refresh ();
|
|
|
|
}
|
2017-09-07 18:30:55 -04:00
|
|
|
|
|
|
|
private:
|
2022-02-08 17:20:40 -05:00
|
|
|
void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route>);
|
2017-09-08 13:37:48 -04:00
|
|
|
PBD::ScopedConnection _route_connection;
|
2022-02-08 17:20:40 -05:00
|
|
|
PatchChangeWidget w;
|
2017-09-07 18:30:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|