diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-17 16:14:44 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-17 16:14:44 +0000 |
commit | 5f37d769351d03acfa6e1704fb9f54fcf57c3c60 (patch) | |
tree | a113b60b3c020c03131b9a9ad82965ef374ca16b | |
parent | 98d93c221a8bd45d90369ff1b52e3f43dad35233 (diff) |
fixes for MIDI port setup; options editor now sets trace options correctly (still not saved); MTC now sent immediately after asking for it, not after first stop; add svn_revision.h to avoid compile errors
git-svn-id: svn://localhost/ardour2/trunk@1138 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/option_editor.cc | 41 | ||||
-rw-r--r-- | gtk2_ardour/option_editor.h | 6 | ||||
-rw-r--r-- | libs/ardour/globals.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 4 | ||||
-rw-r--r-- | libs/ardour/session_transport.cc | 3 | ||||
-rw-r--r-- | libs/midi++2/midi++/factory.h | 5 | ||||
-rw-r--r-- | libs/midi++2/midifactory.cc | 30 | ||||
-rw-r--r-- | libs/midi++2/midimanager.cc | 64 | ||||
-rw-r--r-- | svn_revision.h | 4 |
10 files changed, 86 insertions, 74 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 962683ebea..0f5f5987a3 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -269,7 +269,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt Gtk::Requisition requisition; scrollbar.size_request (requisition); scrollbar_height = requisition.height; - cerr << "scrollbar height = " << scrollbar_height << endl; } EventBox* spacer = manage (new EventBox); diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index 8f50cfc975..3e461a85d7 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -322,8 +322,6 @@ OptionEditor::destructo_xfade_adjustment_changed () Config->set_destructive_xfade_msecs ((uint32_t) floor (val)); - cerr << "set destructo fade to " << Config->get_destructive_xfade_msecs () << endl; - if (session) { SndFileSource::setup_standard_crossfades (session->frame_rate()); } @@ -423,19 +421,19 @@ OptionEditor::setup_midi_options () } tb->set_active (!(*i).second->input()->offline()); - tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb)); + tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb)); (*i).second->input()->OfflineStatusChanged.connect (bind (mem_fun(*this, &OptionEditor::map_port_online), (*i).second, tb)); table->attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL); tb = manage (new ToggleButton ()); tb->set_name ("OptionEditorToggleButton"); - tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb)); + tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb)); tb->set_size_request (10, 10); table->attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL); tb = manage (new ToggleButton ()); tb->set_name ("OptionEditorToggleButton"); - tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb)); + tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb)); tb->set_size_request (10, 10); table->attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL); @@ -547,15 +545,14 @@ OptionEditor::midi_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb) } } -gint -OptionEditor::port_online_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb) +void +OptionEditor::port_online_toggled (MIDI::Port* port, ToggleButton* tb) { - bool wanted = tb->get_active(); /* it hasn't changed at this point */ - + bool wanted = tb->get_active(); + if (wanted != port->input()->offline()) { port->input()->set_offline (wanted); } - return stop_signal (*tb, "button_press_event"); } void @@ -570,24 +567,24 @@ OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb) } } -gint -OptionEditor::port_trace_in_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb) +void +OptionEditor::port_trace_in_toggled (MIDI::Port* port, ToggleButton* tb) { - /* XXX not very good MVC style here */ + bool trace = tb->get_active(); - port->input()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" input: ")); - tb->set_active (!tb->get_active()); - return stop_signal (*tb, "button_press_event"); + if (port->input()->tracing() != trace) { + port->output()->trace (trace, &cerr, string (port->name()) + string (" input: ")); + } } -gint -OptionEditor::port_trace_out_toggled (GdkEventButton* ev,MIDI::Port* port, ToggleButton* tb) +void +OptionEditor::port_trace_out_toggled (MIDI::Port* port, ToggleButton* tb) { - /* XXX not very good MVC style here */ + bool trace = tb->get_active(); - port->output()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" output: ")); - tb->set_active (!tb->get_active()); - return stop_signal (*tb, "button_press_event"); + if (port->output()->tracing() != trace) { + port->output()->trace (trace, &cerr, string (port->name()) + string (" output: ")); + } } void diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index d3235164a6..2076da3935 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -116,9 +116,9 @@ class OptionEditor : public Gtk::Dialog Gtk::RadioButton::Group mmc_button_group; Gtk::RadioButton::Group midi_button_group; - gint port_online_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*); - gint port_trace_in_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*); - gint port_trace_out_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*); + void port_online_toggled (MIDI::Port*,Gtk::ToggleButton*); + void port_trace_in_toggled (MIDI::Port*,Gtk::ToggleButton*); + void port_trace_out_toggled (MIDI::Port*,Gtk::ToggleButton*); void mmc_port_chosen (MIDI::Port*,Gtk::RadioButton*); void mtc_port_chosen (MIDI::Port*,Gtk::RadioButton*); diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 1d510cfef1..e87633083b 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -127,6 +127,8 @@ setup_midi () } MIDI::Manager::instance()->add_port (request); + + nports++; } if (nports > 1) { diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 94d9fe6b50..92f95d0463 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -3026,6 +3026,10 @@ Session::config_changed (const char* parameter_name) if (_mtc_port != 0) { session_send_mtc = Config->get_send_mtc(); + if (session_send_mtc) { + /* mark us ready to send */ + next_quarter_frame_to_send = 0; + } } } else if (PARAM_IS ("send-mmc")) { diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 678a03ad4e..03a554ba0a 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -372,9 +372,6 @@ Session::non_realtime_stop (bool abort) } } } - - deliver_mmc (MIDI::MachineControl::cmdLocate, _transport_frame); - #ifdef LEAVE_TRANSPORT_UNADJUSTED } #endif diff --git a/libs/midi++2/midi++/factory.h b/libs/midi++2/midi++/factory.h index 7b4122d791..b532e6d5e6 100644 --- a/libs/midi++2/midi++/factory.h +++ b/libs/midi++2/midi++/factory.h @@ -30,9 +30,8 @@ namespace MIDI { class PortFactory { public: Port *create_port (PortRequest &req); - - static void add_port_request (std::vector<PortRequest *> &reqs, - const std::string &reqstr); + + static bool ignore_duplicate_devices (Port::Type); }; } // namespace MIDI diff --git a/libs/midi++2/midifactory.cc b/libs/midi++2/midifactory.cc index 38baada204..0a86c94cb9 100644 --- a/libs/midi++2/midifactory.cc +++ b/libs/midi++2/midifactory.cc @@ -76,20 +76,28 @@ PortFactory::create_port (PortRequest &req) return port; } -void -PortFactory::add_port_request (vector<PortRequest *> &reqs, - const string &str) - +bool +PortFactory::ignore_duplicate_devices (Port::Type type) { - PortRequest *req; + bool ret = false; - req = new PortRequest; - req->devname = strdup (str.c_str()); - req->tagname = strdup (str.c_str()); + switch (type) { +#ifdef WITH_ALSA + case Port::ALSA_Sequencer: + ret = true; + break; +#endif // WITH_ALSA - req->mode = O_RDWR; - req->type = Port::ALSA_RawMidi; +#if WITH_COREMIDI + case Port::CoreMidi_MidiPort: + ret = true; + break; +#endif // WITH_COREMIDI + + default: + break; + } - reqs.push_back (req); + return ret; } diff --git a/libs/midi++2/midimanager.cc b/libs/midi++2/midimanager.cc index e25a2737ba..44fd89108c 100644 --- a/libs/midi++2/midimanager.cc +++ b/libs/midi++2/midimanager.cc @@ -72,41 +72,43 @@ Manager::add_port (PortRequest &req) PortMap::iterator existing; pair<string, Port *> newpair; - if ((existing = ports_by_device.find (req.devname)) != - ports_by_device.end()) { - - port = (*existing).second; - if (port->mode() == req.mode) { + if (!PortFactory::ignore_duplicate_devices (req.type)) { + + if ((existing = ports_by_device.find (req.devname)) != ports_by_device.end()) { + + port = (*existing).second; + + if (port->mode() == req.mode) { + + /* Same mode - reuse the port, and just + create a new tag entry. + */ + + newpair.first = req.tagname; + newpair.second = port; + + ports_by_tag.insert (newpair); + return port; + } - /* Same mode - reuse the port, and just - create a new tag entry. + /* If the existing is duplex, and this request + is not, then fail, because most drivers won't + allow opening twice with duplex and non-duplex + operation. */ - - newpair.first = req.tagname; - newpair.second = port; - - ports_by_tag.insert (newpair); - return port; - } - - /* If the existing is duplex, and this request - is not, then fail, because most drivers won't - allow opening twice with duplex and non-duplex - operation. - */ - - if ((req.mode == O_RDWR && port->mode() != O_RDWR) || - (req.mode != O_RDWR && port->mode() == O_RDWR)) { - error << "MIDIManager: port tagged \"" - << req.tagname - << "\" cannot be opened duplex and non-duplex" - << endmsg; - return 0; + + if ((req.mode == O_RDWR && port->mode() != O_RDWR) || + (req.mode != O_RDWR && port->mode() == O_RDWR)) { + error << "MIDIManager: port tagged \"" + << req.tagname + << "\" cannot be opened duplex and non-duplex" + << endmsg; + return 0; + } + + /* modes must be different or complementary */ } - - /* modes must be different or complementary */ } - port = factory.create_port (req); diff --git a/svn_revision.h b/svn_revision.h new file mode 100644 index 0000000000..77f72965cd --- /dev/null +++ b/svn_revision.h @@ -0,0 +1,4 @@ +#ifndef __ardour_svn_revision_h__ +#define __ardour_svn_revision_h__ +static const char* ardour_svn_revision = "1137"; +#endif |