summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_track.cc
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/ardour/midi_track.cc
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/ardour/midi_track.cc')
-rw-r--r--libs/ardour/midi_track.cc60
1 files changed, 40 insertions, 20 deletions
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 ();
}
+