partially-done (but compile-friendly) move of instrument info into a new backend object
git-svn-id: svn://localhost/ardour2/branches/3.0@12652 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
80afb6e08b
commit
960de7306f
|
@ -115,10 +115,6 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
||||||
_note_group->raise_to_top();
|
_note_group->raise_to_top();
|
||||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
||||||
|
|
||||||
/* Look up MIDNAM details from our MidiTimeAxisView */
|
|
||||||
MidiTimeAxisView& mtv = dynamic_cast<MidiTimeAxisView&> (tv);
|
|
||||||
midi_patch_settings_changed (mtv.midi_patch_model (), mtv.midi_patch_custom_device_mode ());
|
|
||||||
|
|
||||||
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&MidiRegionView::parameter_changed, this, _1), gui_context());
|
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&MidiRegionView::parameter_changed, this, _1), gui_context());
|
||||||
connect_to_diskstream ();
|
connect_to_diskstream ();
|
||||||
|
|
||||||
|
@ -156,10 +152,6 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
||||||
_note_group->raise_to_top();
|
_note_group->raise_to_top();
|
||||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
||||||
|
|
||||||
/* Look up MIDNAM details from our MidiTimeAxisView */
|
|
||||||
MidiTimeAxisView& mtv = dynamic_cast<MidiTimeAxisView&> (tv);
|
|
||||||
midi_patch_settings_changed (mtv.midi_patch_model (), mtv.midi_patch_custom_device_mode ());
|
|
||||||
|
|
||||||
connect_to_diskstream ();
|
connect_to_diskstream ();
|
||||||
|
|
||||||
SelectionCleared.connect (_selection_cleared_connection, invalidator (*this), boost::bind (&MidiRegionView::selection_cleared, this, _1), gui_context ());
|
SelectionCleared.connect (_selection_cleared_connection, invalidator (*this), boost::bind (&MidiRegionView::selection_cleared, this, _1), gui_context ());
|
||||||
|
@ -291,8 +283,11 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
|
||||||
midi_view()->signal_channel_mode_changed().connect(
|
midi_view()->signal_channel_mode_changed().connect(
|
||||||
sigc::mem_fun(this, &MidiRegionView::midi_channel_mode_changed));
|
sigc::mem_fun(this, &MidiRegionView::midi_channel_mode_changed));
|
||||||
|
|
||||||
midi_view()->signal_midi_patch_settings_changed().connect(
|
RouteUI* route_ui = dynamic_cast<RouteUI*> (&trackview);
|
||||||
sigc::mem_fun(this, &MidiRegionView::midi_patch_settings_changed));
|
if (route_ui) {
|
||||||
|
route_ui->route()->instrument_info().Changed.connect (_instrument_changed_connection, invalidator (*this),
|
||||||
|
boost::bind (&MidiRegionView::instrument_settings_changed, this), gui_context());
|
||||||
|
}
|
||||||
|
|
||||||
trackview.editor().SnapChanged.connect(snap_changed_connection, invalidator(*this),
|
trackview.editor().SnapChanged.connect(snap_changed_connection, invalidator(*this),
|
||||||
boost::bind (&MidiRegionView::snap_changed, this),
|
boost::bind (&MidiRegionView::snap_changed, this),
|
||||||
|
@ -1209,10 +1204,10 @@ MidiRegionView::display_patch_changes_on_channel (uint8_t channel, bool active_c
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
|
// MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
|
||||||
string patch_name = mtv->get_patch_name ((*i)->bank(), (*i)->program(), channel);
|
//string patch_name = mtv->get_patch_name ((*i)->bank(), (*i)->program(), channel);
|
||||||
|
|
||||||
add_canvas_patch_change (*i, patch_name, active_channel);
|
// add_canvas_patch_change (*i, patch_name, active_channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3207,10 +3202,8 @@ MidiRegionView::midi_channel_mode_changed(ChannelMode mode, uint16_t mask)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiRegionView::midi_patch_settings_changed(std::string model, std::string custom_device_mode)
|
MidiRegionView::instrument_settings_changed ()
|
||||||
{
|
{
|
||||||
_model_name = model;
|
|
||||||
_custom_device_mode = custom_device_mode;
|
|
||||||
redisplay_model();
|
redisplay_model();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,8 @@ private:
|
||||||
bool note_canvas_event(GdkEvent* ev);
|
bool note_canvas_event(GdkEvent* ev);
|
||||||
|
|
||||||
void midi_channel_mode_changed(ARDOUR::ChannelMode mode, uint16_t mask);
|
void midi_channel_mode_changed(ARDOUR::ChannelMode mode, uint16_t mask);
|
||||||
void midi_patch_settings_changed(std::string model, std::string custom_device_mode);
|
void instrument_settings_changed ();
|
||||||
|
PBD::ScopedConnection _instrument_changed_connection;
|
||||||
|
|
||||||
void change_note_channel (ArdourCanvas::CanvasNoteEvent *, int8_t, bool relative=false);
|
void change_note_channel (ArdourCanvas::CanvasNoteEvent *, int8_t, bool relative=false);
|
||||||
void change_note_velocity(ArdourCanvas::CanvasNoteEvent* ev, int8_t vel, bool relative=false);
|
void change_note_velocity(ArdourCanvas::CanvasNoteEvent* ev, int8_t vel, bool relative=false);
|
||||||
|
|
|
@ -318,14 +318,13 @@ MidiTimeAxisView::model_changed()
|
||||||
|
|
||||||
_custom_device_mode_selector.set_active(0);
|
_custom_device_mode_selector.set_active(0);
|
||||||
|
|
||||||
set_gui_property (X_("midnam-model-name"), midi_patch_model ());
|
_route->instrument_info().set_external_instrument (_model_selector.get_active_text(), _custom_device_mode_selector.get_active_text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiTimeAxisView::custom_device_mode_changed()
|
MidiTimeAxisView::custom_device_mode_changed()
|
||||||
{
|
{
|
||||||
_midi_patch_settings_changed.emit (midi_patch_model (), midi_patch_custom_device_mode ());
|
_route->instrument_info().set_external_instrument (_model_selector.get_active_text(), _custom_device_mode_selector.get_active_text());
|
||||||
set_gui_property (X_("midnam-custom-device-mode"), midi_patch_custom_device_mode ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MidiStreamView*
|
MidiStreamView*
|
||||||
|
@ -1207,33 +1206,3 @@ MidiTimeAxisView::note_range_changed ()
|
||||||
set_gui_property ("note-range-max", (int) midi_view()->highest_note ());
|
set_gui_property ("note-range-max", (int) midi_view()->highest_note ());
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
|
||||||
MidiTimeAxisView::midi_patch_model () const
|
|
||||||
{
|
|
||||||
return _model_selector.get_active_text ();
|
|
||||||
}
|
|
||||||
|
|
||||||
string
|
|
||||||
MidiTimeAxisView::midi_patch_custom_device_mode () const
|
|
||||||
{
|
|
||||||
return _custom_device_mode_selector.get_active_text ();
|
|
||||||
}
|
|
||||||
|
|
||||||
string
|
|
||||||
MidiTimeAxisView::get_patch_name (uint16_t bank, uint8_t program, uint8_t channel) const
|
|
||||||
{
|
|
||||||
MIDI::Name::PatchPrimaryKey patch_key (bank, program);
|
|
||||||
|
|
||||||
boost::shared_ptr<MIDI::Name::Patch> patch =
|
|
||||||
MIDI::Name::MidiPatchManager::instance().find_patch (midi_patch_model(), midi_patch_custom_device_mode(), channel, patch_key);
|
|
||||||
|
|
||||||
if (patch) {
|
|
||||||
return patch->name();
|
|
||||||
} else {
|
|
||||||
/* program and bank numbers are zero-based: convert to one-based: MIDI_BP_ZERO */
|
|
||||||
|
|
||||||
#define MIDI_BP_ZERO ((Config->get_first_midi_bank_is_zero())?0:1)
|
|
||||||
|
|
||||||
return string_compose ("%1 %2",program + MIDI_BP_ZERO , bank + MIDI_BP_ZERO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -86,11 +86,6 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
||||||
return _channel_selector.mode_changed;
|
return _channel_selector.mode_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigc::signal<void, std::string, std::string>& signal_midi_patch_settings_changed() {
|
|
||||||
return _midi_patch_settings_changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const MidiMultipleChannelSelector& channel_selector() { return _channel_selector; }
|
const MidiMultipleChannelSelector& channel_selector() { return _channel_selector; }
|
||||||
|
|
||||||
Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
|
Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
|
||||||
|
@ -102,10 +97,6 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
||||||
|
|
||||||
uint8_t get_channel_for_add () const;
|
uint8_t get_channel_for_add () const;
|
||||||
|
|
||||||
std::string midi_patch_model () const;
|
|
||||||
std::string midi_patch_custom_device_mode () const;
|
|
||||||
std::string get_patch_name (uint16_t bank, uint8_t program, uint8_t channel) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void start_step_editing ();
|
void start_step_editing ();
|
||||||
void stop_step_editing ();
|
void stop_step_editing ();
|
||||||
|
|
56
libs/ardour/ardour/instrument_info.h
Normal file
56
libs/ardour/ardour/instrument_info.h
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2012 Paul Davis
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ardour_instrument_info_h__
|
||||||
|
#define __ardour_instrument_info_h__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "pbd/signals.h"
|
||||||
|
|
||||||
|
#include <boost/weak_ptr.hpp>
|
||||||
|
|
||||||
|
namespace ARDOUR {
|
||||||
|
|
||||||
|
class Processor;
|
||||||
|
|
||||||
|
class InstrumentInfo {
|
||||||
|
public:
|
||||||
|
InstrumentInfo();
|
||||||
|
~InstrumentInfo ();
|
||||||
|
|
||||||
|
void set_external_instrument (const std::string& model, const std::string& mode);
|
||||||
|
void set_internal_instrument (boost::shared_ptr<ARDOUR::Processor>);
|
||||||
|
|
||||||
|
std::string get_patch_name (uint16_t bank, uint8_t program, uint8_t channel) const;
|
||||||
|
std::string get_instrument_name () const;
|
||||||
|
|
||||||
|
PBD::Signal0<void> Changed;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string external_instrument_model;
|
||||||
|
std::string external_instrument_mode;
|
||||||
|
|
||||||
|
boost::weak_ptr<ARDOUR::Processor> internal_instrument;
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace ARDOUR */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __ardour_instrument_info_h__ */
|
|
@ -41,6 +41,7 @@
|
||||||
#include "pbd/destructible.h"
|
#include "pbd/destructible.h"
|
||||||
|
|
||||||
#include "ardour/ardour.h"
|
#include "ardour/ardour.h"
|
||||||
|
#include "ardour/instrument_info.h"
|
||||||
#include "ardour/io.h"
|
#include "ardour/io.h"
|
||||||
#include "ardour/types.h"
|
#include "ardour/types.h"
|
||||||
#include "ardour/mute_master.h"
|
#include "ardour/mute_master.h"
|
||||||
|
@ -405,6 +406,7 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember,
|
||||||
special case not covered by this utility function.
|
special case not covered by this utility function.
|
||||||
*/
|
*/
|
||||||
boost::shared_ptr<Processor> the_instrument() const;
|
boost::shared_ptr<Processor> the_instrument() const;
|
||||||
|
InstrumentInfo& instrument_info() { return _instrument_info; }
|
||||||
|
|
||||||
void automation_snapshot (framepos_t now, bool force=false);
|
void automation_snapshot (framepos_t now, bool force=false);
|
||||||
void protect_automation ();
|
void protect_automation ();
|
||||||
|
@ -500,6 +502,8 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember,
|
||||||
DataType _default_type;
|
DataType _default_type;
|
||||||
FedBy _fed_by;
|
FedBy _fed_by;
|
||||||
|
|
||||||
|
InstrumentInfo _instrument_info;
|
||||||
|
|
||||||
virtual ChanCount input_streams () const;
|
virtual ChanCount input_streams () const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
100
libs/ardour/instrument_info.cc
Normal file
100
libs/ardour/instrument_info.cc
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2012 Paul Davis
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pbd/compose.h"
|
||||||
|
|
||||||
|
#include "midi++/midnam_patch.h"
|
||||||
|
|
||||||
|
#include "ardour/instrument_info.h"
|
||||||
|
#include "ardour/midi_patch_manager.h"
|
||||||
|
#include "ardour/processor.h"
|
||||||
|
#include "ardour/rc_configuration.h"
|
||||||
|
|
||||||
|
#include "i18n.h"
|
||||||
|
|
||||||
|
using namespace ARDOUR;
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
InstrumentInfo::InstrumentInfo ()
|
||||||
|
: external_instrument_model (_("Unknown"))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
InstrumentInfo::~InstrumentInfo ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InstrumentInfo::set_external_instrument (const string& model, const string& mode)
|
||||||
|
{
|
||||||
|
external_instrument_model = model;
|
||||||
|
external_instrument_mode = mode;
|
||||||
|
internal_instrument.reset ();
|
||||||
|
Changed(); /* EMIT SIGNAL */
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InstrumentInfo::set_internal_instrument (boost::shared_ptr<Processor> p)
|
||||||
|
{
|
||||||
|
internal_instrument = p;
|
||||||
|
external_instrument_model = (_("Unknown"));
|
||||||
|
external_instrument_mode = "";
|
||||||
|
Changed(); /* EMIT SIGNAL */
|
||||||
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
InstrumentInfo::get_instrument_name () const
|
||||||
|
{
|
||||||
|
boost::shared_ptr<Processor> p = internal_instrument.lock();
|
||||||
|
|
||||||
|
if (p) {
|
||||||
|
return p->name();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (external_instrument_mode.empty()) {
|
||||||
|
return external_instrument_model;
|
||||||
|
} else {
|
||||||
|
return string_compose ("%1 (%2)", external_instrument_model, external_instrument_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
InstrumentInfo::get_patch_name (uint16_t bank, uint8_t program, uint8_t channel) const
|
||||||
|
{
|
||||||
|
boost::shared_ptr<Processor> p = internal_instrument.lock();
|
||||||
|
|
||||||
|
if (p) {
|
||||||
|
return "some plugin program";
|
||||||
|
}
|
||||||
|
|
||||||
|
MIDI::Name::PatchPrimaryKey patch_key (bank, program);
|
||||||
|
|
||||||
|
boost::shared_ptr<MIDI::Name::Patch> patch =
|
||||||
|
MIDI::Name::MidiPatchManager::instance().find_patch (external_instrument_model,
|
||||||
|
external_instrument_mode, channel, patch_key);
|
||||||
|
|
||||||
|
if (patch) {
|
||||||
|
return patch->name();
|
||||||
|
} else {
|
||||||
|
/* program and bank numbers are zero-based: convert to one-based: MIDI_BP_ZERO */
|
||||||
|
|
||||||
|
#define MIDI_BP_ZERO ((Config->get_first_midi_bank_is_zero())?0:1)
|
||||||
|
|
||||||
|
return string_compose ("%1 %2",program + MIDI_BP_ZERO , bank + MIDI_BP_ZERO);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1014,6 +1014,11 @@ Route::add_processor (boost::shared_ptr<Processor> processor, boost::shared_ptr<
|
||||||
_output->set_user_latency (0);
|
_output->set_user_latency (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<Processor> instr = the_instrument();
|
||||||
|
if (instr) {
|
||||||
|
_instrument_info.set_internal_instrument (instr);
|
||||||
|
}
|
||||||
|
|
||||||
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
||||||
set_processor_positions ();
|
set_processor_positions ();
|
||||||
|
|
||||||
|
@ -1162,6 +1167,11 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor>
|
||||||
_output->set_user_latency (0);
|
_output->set_user_latency (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<Processor> instr = the_instrument();
|
||||||
|
if (instr) {
|
||||||
|
_instrument_info.set_internal_instrument (instr);
|
||||||
|
}
|
||||||
|
|
||||||
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
||||||
set_processor_positions ();
|
set_processor_positions ();
|
||||||
|
|
||||||
|
@ -1368,6 +1378,8 @@ Route::clear_processors (Placement p)
|
||||||
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
||||||
set_processor_positions ();
|
set_processor_positions ();
|
||||||
|
|
||||||
|
_instrument_info.set_internal_instrument (boost::shared_ptr<Processor>());
|
||||||
|
|
||||||
if (!already_deleting) {
|
if (!already_deleting) {
|
||||||
_session.clear_deletion_in_progress();
|
_session.clear_deletion_in_progress();
|
||||||
}
|
}
|
||||||
|
@ -1466,6 +1478,11 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<Processor> instr = the_instrument();
|
||||||
|
if (instr) {
|
||||||
|
_instrument_info.set_internal_instrument (instr);
|
||||||
|
}
|
||||||
|
|
||||||
processor->drop_references ();
|
processor->drop_references ();
|
||||||
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
||||||
set_processor_positions ();
|
set_processor_positions ();
|
||||||
|
|
|
@ -105,6 +105,7 @@ libardour_sources = [
|
||||||
'graph.cc',
|
'graph.cc',
|
||||||
'graphnode.cc',
|
'graphnode.cc',
|
||||||
'import.cc',
|
'import.cc',
|
||||||
|
'instrument_info.cc',
|
||||||
'internal_return.cc',
|
'internal_return.cc',
|
||||||
'internal_send.cc',
|
'internal_send.cc',
|
||||||
'interpolation.cc',
|
'interpolation.cc',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user