summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-20 08:56:00 +0000
committerDavid Robillard <d@drobilla.net>2013-01-20 08:56:00 +0000
commit4e6d0c9e61b62931a4a2120b548f0ff02a966351 (patch)
tree17c395d18338fb92d7af62fa635a8e957d523f93 /libs/ardour
parent0ebad4279b765d3fbe85649e9ef29e5b61c1d162 (diff)
Show matching controller name in automation lane header.
Completely eliminate static MIDI controller name code. Reduce dependency on midnam_patch.h (which would have saved me several hours if I did it earlier). Store controller name numbers as an integer. Keep controller names in a map keyed by int instead of a list for fast lookup. More cleanup of MIDI::Name code. git-svn-id: svn://localhost/ardour2/branches/3.0@13927 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/instrument_info.h17
-rw-r--r--libs/ardour/ardour/midi_track.h20
-rw-r--r--libs/ardour/automatable.cc5
-rw-r--r--libs/ardour/instrument_info.cc43
-rw-r--r--libs/ardour/midi_track.cc7
5 files changed, 70 insertions, 22 deletions
diff --git a/libs/ardour/ardour/instrument_info.h b/libs/ardour/ardour/instrument_info.h
index f83b2c0632..8691db24e5 100644
--- a/libs/ardour/ardour/instrument_info.h
+++ b/libs/ardour/ardour/instrument_info.h
@@ -22,11 +22,19 @@
#include <string>
#include <stdint.h>
+#include <boost/weak_ptr.hpp>
+
#include "pbd/signals.h"
-#include "midi++/midnam_patch.h"
+#include "evoral/Parameter.hpp"
-#include <boost/weak_ptr.hpp>
+namespace MIDI {
+namespace Name {
+class ChannelNameSet;
+class Patch;
+typedef std::list<boost::shared_ptr<Patch> > PatchNameList;
+}
+}
namespace ARDOUR {
@@ -41,13 +49,14 @@ class InstrumentInfo {
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_controller_name (Evoral::Parameter param) const;
std::string get_instrument_name () const;
boost::shared_ptr<MIDI::Name::ChannelNameSet> get_patches (uint8_t channel);
PBD::Signal0<void> Changed;
- static const MIDI::Name::PatchBank::PatchNameList& general_midi_patches();
+ static const MIDI::Name::PatchNameList& general_midi_patches();
private:
std::string external_instrument_model;
@@ -58,7 +67,7 @@ class InstrumentInfo {
boost::shared_ptr<MIDI::Name::ChannelNameSet> plugin_programs_to_channel_name_set (boost::shared_ptr<Processor> p);
std::string get_plugin_patch_name (boost::shared_ptr<ARDOUR::Processor>, uint16_t bank, uint8_t program, uint8_t channel) const;
- static MIDI::Name::PatchBank::PatchNameList _gm_patches;
+ static MIDI::Name::PatchNameList _gm_patches;
};
} /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index cf7167e3af..c5f3bb977b 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -60,10 +60,18 @@ public:
bool bounceable (boost::shared_ptr<Processor>, bool) const { return false; }
boost::shared_ptr<Region> bounce (InterThreadInfo&);
- boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo&,
- boost::shared_ptr<Processor> endpoint, bool include_endpoint);
- int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t end_frame,
- boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export);
+ boost::shared_ptr<Region> bounce_range (framepos_t start,
+ framepos_t end,
+ InterThreadInfo& iti,
+ boost::shared_ptr<Processor> endpoint,
+ bool include_endpoint);
+
+ int export_stuff (BufferSet& bufs,
+ framepos_t start_frame,
+ framecnt_t end_frame,
+ boost::shared_ptr<Processor> endpoint,
+ bool include_endpoint,
+ bool for_export);
int set_state (const XMLNode&, int version);
@@ -86,6 +94,8 @@ public:
NoteMode note_mode() const { return _note_mode; }
void set_note_mode (NoteMode m);
+ std::string describe_parameter (Evoral::Parameter param);
+
bool step_editing() const { return _step_editing; }
void set_step_editing (bool yn);
MidiRingBuffer<framepos_t>& step_edit_ring_buffer() { return _step_edit_ring_buffer; }
@@ -102,7 +112,7 @@ public:
boost::shared_ptr<MidiBuffer> get_gui_feed_buffer () const;
void set_monitoring (MonitorChoice);
- MonitorState monitoring_state () const;
+ MonitorState monitoring_state () const;
void set_input_active (bool);
bool input_active () const;
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc
index 1689528123..84f8cd56cc 100644
--- a/libs/ardour/automatable.cc
+++ b/libs/ardour/automatable.cc
@@ -25,8 +25,6 @@
#include "pbd/error.h"
-#include "midi++/names.h"
-
#include "ardour/amp.h"
#include "ardour/automatable.h"
#include "ardour/event_type_map.h"
@@ -159,8 +157,7 @@ Automatable::describe_parameter (Evoral::Parameter param)
if (param == Evoral::Parameter(GainAutomation)) {
return _("Fader");
} else if (param.type() == MidiCCAutomation) {
- return string_compose("%1: %2 [%3]",
- param.id(), midi_name(param.id()), int(param.channel()) + 1);
+ return string_compose("Controller %1 [%2]", param.id(), int(param.channel()) + 1);
} else if (param.type() == MidiPgmChangeAutomation) {
return string_compose("Program [%1]", int(param.channel()) + 1);
} else if (param.type() == MidiPitchBenderAutomation) {
diff --git a/libs/ardour/instrument_info.cc b/libs/ardour/instrument_info.cc
index 8bae716f4a..725dc3b5e9 100644
--- a/libs/ardour/instrument_info.cc
+++ b/libs/ardour/instrument_info.cc
@@ -34,7 +34,7 @@ using namespace ARDOUR;
using namespace MIDI::Name;
using std::string;
-MIDI::Name::PatchBank::PatchNameList InstrumentInfo::_gm_patches;
+MIDI::Name::PatchNameList InstrumentInfo::_gm_patches;
InstrumentInfo::InstrumentInfo ()
: external_instrument_model (_("Unknown"))
@@ -45,7 +45,6 @@ InstrumentInfo::~InstrumentInfo ()
{
}
-
void
InstrumentInfo::set_external_instrument (const string& model, const string& mode)
{
@@ -68,7 +67,6 @@ string
InstrumentInfo::get_instrument_name () const
{
boost::shared_ptr<Processor> p = internal_instrument.lock();
-
if (p) {
return p->name();
}
@@ -84,7 +82,6 @@ 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 get_plugin_patch_name (p, bank, program, channel);
}
@@ -106,11 +103,41 @@ InstrumentInfo::get_patch_name (uint16_t bank, uint8_t program, uint8_t channel)
}
}
+string
+InstrumentInfo::get_controller_name (Evoral::Parameter param) const
+{
+ boost::shared_ptr<Processor> p = internal_instrument.lock();
+ if (p || param.type() != MidiCCAutomation) {
+ return "";
+ }
+
+ boost::shared_ptr<MIDI::Name::MasterDeviceNames> dev_names(
+ MIDI::Name::MidiPatchManager::instance().master_device_by_model(
+ external_instrument_model));
+ if (!dev_names) {
+ return "";
+ }
+
+ boost::shared_ptr<ChannelNameSet> chan_names(
+ dev_names->channel_name_set_by_device_mode_and_channel(
+ external_instrument_mode, param.channel()));
+ if (!chan_names) {
+ return "";
+ }
+
+ boost::shared_ptr<ControlNameList> control_names(
+ dev_names->control_name_list(chan_names->control_list_name()));
+ if (!control_names) {
+ return "";
+ }
+
+ return control_names->control(param.id())->name();
+}
+
boost::shared_ptr<MIDI::Name::ChannelNameSet>
InstrumentInfo::get_patches (uint8_t channel)
{
boost::shared_ptr<Processor> p = internal_instrument.lock();
-
if (p) {
return plugin_programs_to_channel_name_set (p);
}
@@ -128,10 +155,9 @@ InstrumentInfo::get_patches (uint8_t channel)
boost::shared_ptr<MIDI::Name::ChannelNameSet>
InstrumentInfo::plugin_programs_to_channel_name_set (boost::shared_ptr<Processor> p)
{
- PatchBank::PatchNameList patch_list;
+ PatchNameList patch_list;
boost::shared_ptr<PluginInsert> insert = boost::dynamic_pointer_cast<PluginInsert> (p);
-
if (!insert) {
return boost::shared_ptr<ChannelNameSet>();
}
@@ -177,7 +203,7 @@ InstrumentInfo::plugin_programs_to_channel_name_set (boost::shared_ptr<Processor
return cns;
}
-const MIDI::Name::PatchBank::PatchNameList&
+const MIDI::Name::PatchNameList&
InstrumentInfo::general_midi_patches()
{
if (_gm_patches.empty()) {
@@ -193,7 +219,6 @@ string
InstrumentInfo::get_plugin_patch_name (boost::shared_ptr<Processor> p, uint16_t bank, uint8_t program, uint8_t /*channel*/) const
{
boost::shared_ptr<PluginInsert> insert = boost::dynamic_pointer_cast<PluginInsert> (p);
-
if (insert) {
boost::shared_ptr<Plugin> pp = insert->plugin();
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 525db3ab96..65a42836a3 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -525,6 +525,13 @@ MidiTrack::set_note_mode (NoteMode m)
midi_diskstream()->set_note_mode(m);
}
+std::string
+MidiTrack::describe_parameter (Evoral::Parameter param)
+{
+ const std::string str(instrument_info().get_controller_name(param));
+ return str.empty() ? Automatable::describe_parameter(param) : str;
+}
+
void
MidiTrack::midi_panic()
{