summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-07-01 15:48:24 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-07-01 15:48:24 +0000
commit67e21fd82ee3a2bf326b652b99484941bbb7efbb (patch)
treea1f13e395fc89e825e2c01a4ab9f90c1726fc71e /libs
parent10e12dc28774afa92ce64ebc76d9b3a55dd81c91 (diff)
add MIDI input control column to editor route list; tweak SVG for MIDI not DIN
git-svn-id: svn://localhost/ardour2/branches/3.0@9779 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/midi_track.h6
-rw-r--r--libs/ardour/lv2_plugin_lilv.cc1
-rw-r--r--libs/ardour/midi_track.cc60
-rw-r--r--libs/ardour/plugin_insert.cc19
4 files changed, 61 insertions, 25 deletions
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index 5ceeefd307..15a3d3decc 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -39,6 +39,8 @@ public:
MidiTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
~MidiTrack ();
+ int init ();
+
int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
int declick, bool can_record, bool rec_monitors_input, bool& need_butler);
@@ -129,6 +131,7 @@ protected:
NoteMode _note_mode;
bool _step_editing;
bool _midi_thru;
+ bool _input_active;
int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
bool state_changing, bool can_record, bool rec_monitors_input);
@@ -136,6 +139,9 @@ protected:
void diskstream_data_recorded (boost::shared_ptr<MidiBuffer>, boost::weak_ptr<MidiSource>);
PBD::ScopedConnection _diskstream_data_recorded_connection;
+
+ void track_input_active (IOChange, void*);
+ void map_input_active (bool);
};
} /* namespace ARDOUR*/
diff --git a/libs/ardour/lv2_plugin_lilv.cc b/libs/ardour/lv2_plugin_lilv.cc
index 6839d37c49..36b0a8e139 100644
--- a/libs/ardour/lv2_plugin_lilv.cc
+++ b/libs/ardour/lv2_plugin_lilv.cc
@@ -582,6 +582,7 @@ LV2Plugin::add_state(XMLNode* root) const
if (_supports_persist) {
// Create state directory for this plugin instance
+ cerr << "Create statefile name from ID " << _insert_id << endl;
const std::string state_filename = _insert_id.to_s() + ".rdff";
const std::string state_path = Glib::build_filename(
_session.plugins_dir(), state_filename);
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 2dcee645a9..7d7b51aa7f 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -57,6 +57,7 @@ MidiTrack::MidiTrack (Session& sess, string name, Route::Flag flag, TrackMode mo
, _note_mode(Sustained)
, _step_editing (false)
, _midi_thru (true)
+ , _input_active (true)
{
}
@@ -64,6 +65,18 @@ MidiTrack::~MidiTrack ()
{
}
+int
+MidiTrack::init ()
+{
+ if (Track::init ()) {
+ return -1;
+ }
+
+ _input->changed.connect_same_thread (*this, boost::bind (&MidiTrack::track_input_active, this, _1, _2));
+
+ return 0;
+}
+
void
MidiTrack::use_new_diskstream ()
{
@@ -146,7 +159,11 @@ MidiTrack::_set_state (const XMLNode& node, int version, bool call_base)
}
if ((prop = node.property ("midi-thru")) != 0) {
- set_midi_thru (prop->value() == "yes");
+ set_midi_thru (string_is_affirmative (prop->value()));
+ }
+
+ if ((prop = node.property ("input-active")) != 0) {
+ set_input_active (string_is_affirmative (prop->value()));
}
XMLNodeList nlist;
@@ -222,6 +239,7 @@ MidiTrack::state(bool full_state)
root.add_property ("step-editing", (_step_editing ? "yes" : "no"));
root.add_property ("note-mode", enum_2_string (_note_mode));
root.add_property ("midi-thru", (_midi_thru ? "yes" : "no"));
+ root.add_property ("input-active", (_input_active ? "yes" : "no"));
return root;
}
@@ -677,9 +695,25 @@ MidiTrack::send_silence () const
return false;
}
+bool
+MidiTrack::input_active () const
+{
+ return _input_active;
+}
+
void
MidiTrack::set_input_active (bool yn)
{
+ if (yn != _input_active) {
+ _input_active = yn;
+ map_input_active (yn);
+ InputActiveChanged (); /* EMIT SIGNAL */
+ }
+}
+
+void
+MidiTrack::map_input_active (bool yn)
+{
bool changed = false;
if (!_input) {
@@ -695,27 +729,13 @@ MidiTrack::set_input_active (bool yn)
changed = true;
}
}
-
- if (changed) {
- InputActiveChanged (); /* EMIT SIGNAL */
- }
}
-bool
-MidiTrack::input_active () const
+void
+MidiTrack::track_input_active (IOChange change, void* /* src */)
{
- if (!_input) {
- cerr << " no input\n";
- return false;
- }
-
- if (_input->ports().count().n_midi() == 0) {
- cerr << "no input MIDI ports, " << _input->ports().count() << endl;
- return false;
+ if (change.type & IOChange::ConfigurationChanged) {
+ map_input_active (_input_active);
}
-
- PortSet::iterator p = _input->ports().begin(DataType::MIDI);
- MidiPort* mp = dynamic_cast<MidiPort*> (&*p);
- cerr << "first port is active: " << mp->input_active() << endl;
- return mp->input_active ();
}
+
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index fadf588ffe..fd8f0e3dee 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -70,9 +70,7 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
/* the first is the master */
if (plug) {
- plug->set_insert_info (this);
- _plugins.push_back (plug);
-
+ add_plugin (plug);
create_automatable_parameters ();
Glib::Mutex::Lock em (_session.engine().process_lock());
@@ -884,6 +882,17 @@ PluginInsert::set_state(const XMLNode& node, int version)
uint32_t count = 1;
+#if 0
+ // Processor::set_state() will set this, but too late
+ // for it to be available when setting up plugin
+ // state. We can't call Processor::set_state() until
+ // the plugins themselves are created and added.
+
+ if ((prop = node.property ("id")) != 0) {
+ _id = prop->value();
+ }
+#endif
+
if (_plugins.empty()) {
/* if we are adding the first plugin, we will need to set
up automatable controls.
@@ -903,6 +912,8 @@ PluginInsert::set_state(const XMLNode& node, int version)
}
}
+ Processor::set_state (node, version);
+
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
/* find the node with the type-specific node name ("lv2", "ladspa", etc)
@@ -921,8 +932,6 @@ PluginInsert::set_state(const XMLNode& node, int version)
}
}
- Processor::set_state (node, version);
-
if (version < 3000) {
/* Only 2.X sessions need a call to set_parameter_state() - in 3.X and above