diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-10-09 11:27:22 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-10-09 11:27:22 +0000 |
commit | a5a18d21736026ea5b1fe082ae2e5c43fad64db5 (patch) | |
tree | 818985eb9f589e9bc21535ed11a98b8db9cd4725 /libs | |
parent | 6f6e2000385a323c3aa140f317ed3fbf4baf0d77 (diff) |
fix reload & use of MIDI port configuration, so that per-session setup is actually used
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3894 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/ardour.h | 11 | ||||
-rw-r--r-- | libs/ardour/globals.cc | 15 | ||||
-rw-r--r-- | libs/ardour/session_midi.cc | 3 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 14 |
4 files changed, 27 insertions, 16 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index cab4601d07..e900577ea1 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -88,13 +88,14 @@ namespace ARDOUR { static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */ void setup_fpu (); -} -/* how do we make these be within the Ardour namespace? */ + extern MIDI::Port* default_mmc_port; + extern MIDI::Port* default_mtc_port; + extern MIDI::Port* default_midi_port; + + int setup_midi(); +} -extern MIDI::Port* default_mmc_port; -extern MIDI::Port* default_mtc_port; -extern MIDI::Port* default_midi_port; #endif /* __ardour_ardour_h__ */ diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 916f4cd38e..08b87bdd36 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -90,9 +90,9 @@ using namespace ARDOUR; using namespace std; using namespace PBD; -MIDI::Port *default_mmc_port = 0; -MIDI::Port *default_mtc_port = 0; -MIDI::Port *default_midi_port = 0; +MIDI::Port *ARDOUR::default_mmc_port = 0; +MIDI::Port *ARDOUR::default_mtc_port = 0; +MIDI::Port *ARDOUR::default_midi_port = 0; Change ARDOUR::StartChanged = ARDOUR::new_change (); Change ARDOUR::LengthChanged = ARDOUR::new_change (); @@ -121,8 +121,8 @@ setup_osc () } #endif -static int -setup_midi () +int +ARDOUR::setup_midi () { if (Config->midi_ports.size() == 0) { warning << _("no MIDI ports specified: no MMC or MTC control possible") << endmsg; @@ -186,16 +186,17 @@ setup_midi () << endmsg; return 0; } + if (default_mtc_port == 0) { warning << string_compose (_("No MTC support (MIDI port \"%1\" not available)"), Config->get_mtc_port_name()) << endmsg; - } + } if (default_midi_port == 0) { warning << string_compose (_("No MIDI parameter support (MIDI port \"%1\" not available)"), Config->get_midi_port_name()) << endmsg; - } + } return 0; } diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 5b1b9060d4..2f090ec4eb 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -1187,6 +1187,7 @@ Session::midi_thread_work () pfd[nfds].fd = _mmc_port->selectable(); pfd[nfds].events = POLLIN|POLLHUP|POLLERR; ports[nfds] = _mmc_port; + //cerr << "MIDI port " << nfds << " = MMC @ " << _mmc_port << endl; nfds++; } @@ -1199,6 +1200,7 @@ Session::midi_thread_work () pfd[nfds].fd = _mtc_port->selectable(); pfd[nfds].events = POLLIN|POLLHUP|POLLERR; ports[nfds] = _mtc_port; + //cerr << "MIDI port " << nfds << " = MTC @ " << _mtc_port << endl; nfds++; } @@ -1206,6 +1208,7 @@ Session::midi_thread_work () pfd[nfds].fd = _midi_port->selectable(); pfd[nfds].events = POLLIN|POLLHUP|POLLERR; ports[nfds] = _midi_port; + // cerr << "MIDI port " << nfds << " = MIDI @ " << _midi_port << endl; nfds++; } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index f14eaaefcb..e1ed93918a 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -859,6 +859,12 @@ Session::load_options (const XMLNode& node) Config->set_variables (node, ConfigVariableBase::Session); + /* now reset MIDI ports because the session can have its own + MIDI configuration. + */ + + setup_midi (); + if ((child = find_named_node (node, "end-marker-is-free")) != 0) { if ((prop = child->property ("val")) != 0) { _end_location_is_free = (prop->value() == "yes"); @@ -1188,10 +1194,10 @@ Session::set_state (const XMLNode& node) /* Object loading order: - MIDI Path extra Options/Config + MIDI <= relies on data from Options/Config Locations Sources AudioRegions @@ -1204,9 +1210,6 @@ Session::set_state (const XMLNode& node) ControlProtocols */ - if (use_config_midi_ports ()) { - } - if ((child = find_named_node (node, "extra")) != 0) { _extra_xml = new XMLNode (*child); } @@ -1219,6 +1222,9 @@ Session::set_state (const XMLNode& node) error << _("Session: XML state has no options section") << endmsg; } + if (use_config_midi_ports ()) { + } + if ((child = find_named_node (node, "Locations")) == 0) { error << _("Session: XML state has no locations section") << endmsg; goto out; |