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
This commit is contained in:
Paul Davis 2008-10-09 11:27:22 +00:00
parent 6f6e200038
commit a5a18d2173
4 changed files with 27 additions and 16 deletions

View file

@ -88,13 +88,14 @@ namespace ARDOUR {
static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */
void setup_fpu ();
extern MIDI::Port* default_mmc_port;
extern MIDI::Port* default_mtc_port;
extern MIDI::Port* default_midi_port;
int setup_midi();
}
/* 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;
#endif /* __ardour_ardour_h__ */

View file

@ -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;
}

View file

@ -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++;
}

View file

@ -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;