diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-09-16 22:11:06 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-09-16 22:11:06 -0400 |
commit | fb45fdc052b23f4b2210c71a03a14bdb5986098a (patch) | |
tree | b61c6331bc7699669834600c09dcf1dc3dccd109 | |
parent | 0da34e65e3470b1c2298ddf571df6356d0d42bd8 (diff) | |
parent | c8b32e2f8bed225b8f5ceac130eea6632f595492 (diff) |
fix conflicts and merge with master
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/engine_dialog.cc | 203 | ||||
-rw-r--r-- | gtk2_ardour/engine_dialog.h | 10 | ||||
-rw-r--r-- | gtk2_ardour/utils.cc | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 11 | ||||
-rw-r--r-- | libs/ardour/session.cc | 148 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 53 | ||||
-rw-r--r-- | libs/backends/jack/jack_connection.cc | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/keyboard.cc | 8 | ||||
-rw-r--r-- | libs/surfaces/wscript | 9 |
10 files changed, 294 insertions, 162 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 50a903cf6c..c3d3211db1 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -4166,9 +4166,7 @@ ARDOUR_UI::do_audio_midi_setup (uint32_t desired_sample_rate) _audio_midi_setup->set_desired_sample_rate (desired_sample_rate); - int r = _audio_midi_setup->run (); - - switch (r) { + switch (_audio_midi_setup->run()) { case Gtk::RESPONSE_OK: return 0; case Gtk::RESPONSE_APPLY: diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index d724f4f4d3..5fff838a6f 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -31,6 +31,7 @@ #include "pbd/xml++.h" #include "pbd/unwind.h" +#include <gtkmm/alignment.h> #include <gtkmm/stock.h> #include <gtkmm/notebook.h> #include <gtkmm2ext/utils.h> @@ -66,14 +67,17 @@ EngineControl::EngineControl () , output_channels (output_channels_adjustment) , ports_adjustment (128, 8, 1024, 1, 16) , ports_spinner (ports_adjustment) - , control_app_button (_("Launch Control App")) - , lm_measure_button (_("Measure latency")) + , control_app_button (_("Device Control Panel")) + , lm_start_stop_label (_("Measure latency")) , lm_use_button (_("Use results")) , lm_table (5, 2) + , have_lm_results (false) , basic_packer (9, 3) , ignore_changes (0) , _desired_sample_rate (0) { + set_name (X_("AudioMIDISetup")); + build_notebook (); get_vbox()->set_border_width (12); @@ -82,9 +86,9 @@ EngineControl::EngineControl () control_app_button.signal_clicked().connect (mem_fun (*this, &EngineControl::control_app_button_clicked)); manage_control_app_sensitivity (); - add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); - add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_APPLY); + cancel_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + ok_button = add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); + apply_button = add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_APPLY); /* Pick up any existing audio setup configuration, if appropriate */ @@ -111,6 +115,13 @@ EngineControl::on_response (int response_id) push_state_to_backend (true); hide (); break; + case RESPONSE_DELETE_EVENT: { + GdkEventButton ev; + ev.type = GDK_BUTTON_PRESS; + ev.button = 1; + on_delete_event ((GdkEventAny*) &ev); + break; + } default: hide (); } @@ -168,18 +179,33 @@ EngineControl::build_notebook () basic_packer.attach (buffer_size_duration_label, 2, 3, row, row+1, xopt, (AttachOptions) 0); row++; + input_channels.set_name ("InputChannels"); + input_channels.set_flags(Gtk::CAN_FOCUS); + input_channels.set_digits(0); + input_channels.set_wrap(false); + output_channels.set_editable (true); label = manage (left_aligned_label (_("Input Channels:"))); basic_packer.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0); basic_packer.attach (input_channels, 1, 2, row, row+1, xopt, (AttachOptions) 0); ++row; + output_channels.set_name ("OutputChannels"); + output_channels.set_flags(Gtk::CAN_FOCUS); + output_channels.set_digits(0); + output_channels.set_wrap(false); + output_channels.set_editable (true); label = manage (left_aligned_label (_("Output Channels:"))); basic_packer.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0); basic_packer.attach (output_channels, 1, 2, row, row+1, xopt, (AttachOptions) 0); ++row; + input_latency.set_name ("InputLatency"); + input_latency.set_flags(Gtk::CAN_FOCUS); + input_latency.set_digits(0); + input_latency.set_wrap(false); + input_latency.set_editable (true); label = manage (left_aligned_label (_("Hardware input latency:"))); basic_packer.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0); @@ -188,6 +214,12 @@ EngineControl::build_notebook () basic_packer.attach (*label, 2, 3, row, row+1, xopt, (AttachOptions) 0); ++row; + output_latency.set_name ("OutputLatency"); + output_latency.set_flags(Gtk::CAN_FOCUS); + output_latency.set_digits(0); + output_latency.set_wrap(false); + output_latency.set_editable (true); + label = manage (left_aligned_label (_("Hardware output latency:"))); basic_packer.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0); basic_packer.attach (output_latency, 1, 2, row, row+1, xopt, (AttachOptions) 0); @@ -217,42 +249,75 @@ EngineControl::build_notebook () lm_table.attach (lm_title, 0, 2, row, row+1, xopt, (AttachOptions) 0); row++; - lm_preamble.set_width_chars (60); - lm_preamble.set_line_wrap (true); - lm_preamble.set_markup (_("1. <span weight=\"bold\">Turn down the volume on your hardware to a very low level.</span>\n\n\ -2. Connect the two channels that you select below using either a cable or (less ideally) a speaker \ -and microphone.\n\n\ -3. Once the channels are connected, click the \"Measure latency\" button.\n\n\ -4. When satisfied with the results, click the \"Use results\" button.")); + Gtk::Label* preamble; + + preamble = manage (new Label); + preamble->set_width_chars (60); + preamble->set_line_wrap (true); + preamble->set_markup (_("<span weight=\"bold\">Turn down the volume on your hardware to a very low level.</span>")); + + lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0); + row++; + + preamble = manage (new Label); + preamble->set_width_chars (60); + preamble->set_line_wrap (true); + preamble->set_markup (_("Select two channels below and connect them using a cable or (less ideally) a speaker and microphone.")); - lm_table.attach (lm_preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0); + lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0); row++; label = manage (new Label (_("Output channel"))); lm_table.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0); - lm_table.attach (lm_output_channel_combo, 1, 2, row, row+1, xopt, (AttachOptions) 0); + + Gtk::Alignment* misc_align = manage (new Alignment (0.0, 0.5)); + misc_align->add (lm_output_channel_combo); + lm_table.attach (*misc_align, 1, 2, row, row+1, xopt, (AttachOptions) 0); ++row; label = manage (new Label (_("Input channel"))); lm_table.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0); - lm_table.attach (lm_input_channel_combo, 1, 2, row, row+1, xopt, (AttachOptions) 0); + + misc_align = manage (new Alignment (0.0, 0.5)); + misc_align->add (lm_input_channel_combo); + lm_table.attach (*misc_align, 1, 2, row, row+1, FILL, (AttachOptions) 0); ++row; xopt = AttachOptions(0); + lm_measure_button.add (lm_start_stop_label); + lm_measure_button.signal_toggled().connect (sigc::mem_fun (*this, &EngineControl::latency_button_toggled)); lm_use_button.signal_clicked().connect (sigc::mem_fun (*this, &EngineControl::use_latency_button_clicked)); lm_use_button.set_sensitive (false); + + preamble = manage (new Label); + preamble->set_width_chars (60); + preamble->set_line_wrap (true); + preamble->set_markup (_("Once the channels are connected, click the \"Measure latency\" button.")); + lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0); + row++; + lm_table.attach (lm_measure_button, 0, 2, row, row+1, xopt, (AttachOptions) 0); ++row; lm_table.attach (lm_results, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0); ++row; + + + preamble = manage (new Label); + preamble->set_width_chars (60); + preamble->set_line_wrap (true); + preamble->set_markup (_("When satisfied with the results, click the \"Use results\" button.")); + lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0); + row++; + lm_table.attach (lm_use_button, 0, 2, row, row+1, xopt, (AttachOptions) 0); ++row; lm_results.set_markup ("<i>No measurement results yet</i>"); + lm_vbox.set_border_width (12); lm_vbox.pack_start (lm_table, false, false); /* pack it all up */ @@ -280,7 +345,6 @@ and microphone.\n\n\ input_channels.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed)); output_channels.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed)); - input_channels.signal_output().connect (sigc::bind (sigc::ptr_fun (&EngineControl::print_channel_count), &input_channels)); output_channels.signal_output().connect (sigc::bind (sigc::ptr_fun (&EngineControl::print_channel_count), &output_channels)); @@ -316,7 +380,6 @@ EngineControl::enable_latency_tab () lm_input_channel_combo.set_active_text (inputs.front()); lm_measure_button.set_sensitive (true); - lm_use_button.set_sensitive (true); } void @@ -387,8 +450,10 @@ EngineControl::list_devices () available_devices.push_back (i->name); } + ignore_changes++; set_popdown_strings (device_combo, available_devices); - + ignore_changes--; + if (!available_devices.empty()) { sample_rate_combo.set_sensitive (true); buffer_size_combo.set_sensitive (true); @@ -464,12 +529,20 @@ EngineControl::device_changed () } } - set_popdown_strings (sample_rate_combo, s); - if (desired.empty()) { - sample_rate_combo.set_active_text (s.front()); + if (!s.empty()) { + set_popdown_strings (sample_rate_combo, s); + + if (desired.empty()) { + sample_rate_combo.set_active_text (s.front()); + } else { + sample_rate_combo.set_active_text (desired); + } } else { - sample_rate_combo.set_active_text (desired); + /* hmm ... how to tell the user about the fact that we have no + * available sample rates. + */ } + vector<uint32_t> bs = backend->available_buffer_sizes(device_name); s.clear (); @@ -482,9 +555,15 @@ EngineControl::device_changed () s.push_back (buf); } - set_popdown_strings (buffer_size_combo, s); - buffer_size_combo.set_active_text (s.front()); - show_buffer_duration (); + if (!s.empty()) { + set_popdown_strings (buffer_size_combo, s); + buffer_size_combo.set_active_text (s.front()); + show_buffer_duration (); + } else { + /* hmm ... how to tell the user about the fact that we have no + * available buffer sizes. + */ + } manage_control_app_sensitivity (); @@ -631,6 +710,10 @@ EngineControl::maybe_display_saved_state () sample_rate_combo.set_active_text (state->sample_rate); } buffer_size_combo.set_active_text (state->buffer_size); + /* call this explicitly because we're ignoring changes to + the controls at this point. + */ + show_buffer_duration (); input_latency.set_value (state->input_latency); output_latency.set_value (state->output_latency); ignore_changes--; @@ -998,9 +1081,19 @@ EngineControl::on_switch_page (GtkNotebookPage*, guint page_num) if (ARDOUR::AudioEngine::instance()->prepare_for_latency_measurement()) { disable_latency_tab (); } + enable_latency_tab (); + + cancel_button->set_sensitive (false); + ok_button->set_sensitive (false); + apply_button->set_sensitive (false); + } else { ARDOUR::AudioEngine::instance()->stop_latency_detection(); + + cancel_button->set_sensitive (true); + ok_button->set_sensitive (true); + apply_button->set_sensitive (true); } } @@ -1010,15 +1103,9 @@ bool EngineControl::check_latency_measurement () { MTDM* mtdm = ARDOUR::AudioEngine::instance()->mtdm (); - static uint32_t cnt = 0; if (mtdm->resolve () < 0) { - string txt = _("No signal detected "); - uint32_t dots = cnt++%10; - for (uint32_t i = 0; i < dots; ++i) { - txt += '.'; - } - lm_results.set_text (txt); + lm_results.set_markup (string_compose ("<span foreground=\"red\">%1</span>", _("No signal detected "))); return true; } @@ -1058,6 +1145,7 @@ EngineControl::check_latency_measurement () lm_measure_button.set_active (false); lm_use_button.set_sensitive (true); strcat (buf, " (set)"); + have_lm_results = true; } lm_results.set_text (buf); @@ -1066,19 +1154,39 @@ EngineControl::check_latency_measurement () } void -EngineControl::latency_button_toggled () +EngineControl::start_latency_detection () { - if (lm_measure_button.get_active ()) { + ARDOUR::AudioEngine::instance()->set_latency_input_port (lm_input_channel_combo.get_active_text()); + ARDOUR::AudioEngine::instance()->set_latency_output_port (lm_output_channel_combo.get_active_text()); + ARDOUR::AudioEngine::instance()->start_latency_detection (); + lm_results.set_text (_("Detecting ...")); + latency_timeout = Glib::signal_timeout().connect (mem_fun (*this, &EngineControl::check_latency_measurement), 250); + lm_start_stop_label.set_text (_("Cancel measurement")); + have_lm_results = false; + lm_input_channel_combo.set_sensitive (false); + lm_output_channel_combo.set_sensitive (false); +} - ARDOUR::AudioEngine::instance()->set_latency_input_port (lm_input_channel_combo.get_active_text()); - ARDOUR::AudioEngine::instance()->set_latency_output_port (lm_output_channel_combo.get_active_text()); - ARDOUR::AudioEngine::instance()->start_latency_detection (); - lm_results.set_text (_("Detecting ...")); - latency_timeout = Glib::signal_timeout().connect (mem_fun (*this, &EngineControl::check_latency_measurement), 250); +void +EngineControl::end_latency_detection () +{ + ARDOUR::AudioEngine::instance()->stop_latency_detection (); + latency_timeout.disconnect (); + lm_start_stop_label.set_text (_("Measure latency")); + if (!have_lm_results) { + lm_results.set_markup ("<i>No measurement results yet</i>"); + } + lm_input_channel_combo.set_sensitive (true); + lm_output_channel_combo.set_sensitive (true); +} - } else { - ARDOUR::AudioEngine::instance()->stop_latency_detection (); - latency_timeout.disconnect (); +void +EngineControl::latency_button_toggled () +{ + if (lm_measure_button.get_active ()) { + start_latency_detection (); + } else { + end_latency_detection (); } } @@ -1098,3 +1206,14 @@ EngineControl::use_latency_button_clicked () input_latency_adjustment.set_value (one_way); output_latency_adjustment.set_value (one_way); } + +bool +EngineControl::on_delete_event (GdkEventAny* ev) +{ + if (notebook.get_current_page() == 2) { + /* currently on latency tab - be sure to clean up */ + end_latency_detection (); + } + return ArdourDialog::on_delete_event (ev); +} + diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h index 98ddf2c1b3..14724c8bfe 100644 --- a/gtk2_ardour/engine_dialog.h +++ b/gtk2_ardour/engine_dialog.h @@ -75,13 +75,18 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList { Gtk::ComboBoxText lm_output_channel_combo; Gtk::ComboBoxText lm_input_channel_combo; + Gtk::Label lm_start_stop_label; Gtk::ToggleButton lm_measure_button; Gtk::Button lm_use_button; Gtk::Label lm_title; - Gtk::Label lm_preamble; Gtk::Label lm_results; Gtk::Table lm_table; Gtk::VBox lm_vbox; + bool have_lm_results; + + Gtk::Button* cancel_button; + Gtk::Button* ok_button; + Gtk::Button* apply_button; /* JACK specific */ @@ -176,8 +181,11 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList { sigc::connection latency_timeout; void enable_latency_tab (); void disable_latency_tab (); + void start_latency_detection (); + void end_latency_detection (); void on_switch_page (GtkNotebookPage*, guint page_num); + bool on_delete_event (GdkEventAny*); }; #endif /* __gtk2_ardour_engine_dialog_h__ */ diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index a35d171690..bbce202ad1 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -365,12 +365,11 @@ relay_key_press (GdkEventKey* ev, Gtk::Window* win) { PublicEditor& ed (PublicEditor::instance()); - if (&ed == 0) { - /* early key press in pre-main-window-dialogs, no editor yet */ - return false; - } - if (!key_press_focus_accelerator_handler (*win, ev)) { + if (&ed == 0) { + /* early key press in pre-main-window-dialogs, no editor yet */ + return false; + } return ed.on_key_press_event(ev); } else { return true; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index d0cd3fa06e..3fa9fbcb28 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1071,7 +1071,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi boost::scoped_ptr<SessionDirectory> _session_dir; void hookup_io (); - int when_engine_running (); void graph_reordered (); /** current snapshot name, without the .ardour suffix */ @@ -1137,8 +1136,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void auto_loop_changed (Location *); void auto_loop_declick_range (Location *, framepos_t &, framepos_t &); + int ensure_engine (uint32_t desired_sample_rate); void pre_engine_init (std::string path); int post_engine_init (); + int immediately_post_engine (); void remove_empty_sounds (); void setup_midi_control (); @@ -1521,13 +1522,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi float opt ); - /* number of hardware ports we're using, - based on max (requested,available) - */ - - ChanCount n_physical_outputs; - ChanCount n_physical_inputs; - int find_all_sources (std::string path, std::set<std::string>& result); int find_all_sources_across_snapshots (std::set<std::string>& result, bool exclude_this_snapshot); @@ -1624,7 +1618,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void setup_ltc (); void setup_click (); void setup_bundles (); - int ensure_engine (uint32_t desired_sample_rate); }; } // namespace ARDOUR diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 4be42c769a..2a081086d4 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -258,17 +258,26 @@ Session::Session (AudioEngine &eng, , _suspend_timecode_transmission (0) , _speakers (new Speakers) , ignore_route_processor_changes (false) + , _midi_ports (0) + , _mmc (0) { uint32_t sr = 0; pre_engine_init (fullpath); if (_is_new) { + if (ensure_engine (sr)) { + destroy (); + throw failed_constructor (); + } + if (create (mix_template, bus_profile)) { destroy (); throw failed_constructor (); } + } else { + if (load_state (_current_snapshot_name)) { throw failed_constructor (); } @@ -284,11 +293,11 @@ Session::Session (AudioEngine &eng, sr = atoi (prop->value()); } } - } - if (ensure_engine (sr)) { - destroy (); - throw failed_constructor (); + if (ensure_engine (sr)) { + destroy (); + throw failed_constructor (); + } } if (post_engine_init ()) { @@ -361,6 +370,50 @@ Session::ensure_engine (uint32_t desired_sample_rate) return -1; } + return immediately_post_engine (); + +} + +int +Session::immediately_post_engine () +{ + /* Do various initializations that should take place directly after we + * know that the engine is running, but before we either create a + * session or set state for an existing one. + */ + + if (how_many_dsp_threads () > 1) { + /* For now, only create the graph if we are using >1 DSP threads, as + it is a bit slower than the old code with 1 thread. + */ + _process_graph.reset (new Graph (*this)); + } + + /* every time we reconnect, recompute worst case output latencies */ + + _engine.Running.connect_same_thread (*this, boost::bind (&Session::initialize_latencies, this)); + + if (synced_to_jack()) { + _engine.transport_stop (); + } + + if (config.get_jack_time_master()) { + _engine.transport_locate (_transport_frame); + } + + try { + BootMessage (_("Set up LTC")); + setup_ltc (); + BootMessage (_("Set up Click")); + setup_click (); + BootMessage (_("Set up standard connections")); + setup_bundles (); + } + + catch (failed_constructor& err) { + return -1; + } + return 0; } @@ -474,9 +527,9 @@ Session::destroy () /* not strictly necessary, but doing it here allows the shared_ptr debugging to work */ playlists.reset (); - delete _mmc; - delete _midi_ports; - delete _locations; + delete _mmc; _mmc = 0; + delete _midi_ports; _midi_ports = 0; + delete _locations; _locations = 0; DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n"); @@ -683,81 +736,6 @@ Session::setup_bundles () } -int -Session::when_engine_running () -{ - /* every time we reconnect, recompute worst case output latencies */ - - _engine.Running.connect_same_thread (*this, boost::bind (&Session::initialize_latencies, this)); - - if (synced_to_jack()) { - _engine.transport_stop (); - } - - if (config.get_jack_time_master()) { - _engine.transport_locate (_transport_frame); - } - - - try { - BootMessage (_("Set up LTC")); - setup_ltc (); - BootMessage (_("Set up Click")); - setup_click (); - BootMessage (_("Set up standard connections")); - setup_bundles (); - } - - catch (failed_constructor& err) { - return -1; - } - - BootMessage (_("Setup signal flow and plugins")); - - /* Reset all panners */ - - Delivery::reset_panners (); - - /* this will cause the CPM to instantiate any protocols that are in use - * (or mandatory), which will pass it this Session, and then call - * set_state() on each instantiated protocol to match stored state. - */ - - ControlProtocolManager::instance().set_session (this); - - /* This must be done after the ControlProtocolManager set_session above, - as it will set states for ports which the ControlProtocolManager creates. - */ - - // XXX set state of MIDI::Port's - // MidiPortManager::instance()->set_port_states (Config->midi_port_states ()); - - /* And this must be done after the MIDI::Manager::set_port_states as - * it will try to make connections whose details are loaded by set_port_states. - */ - - hookup_io (); - - /* Let control protocols know that we are now all connected, so they - * could start talking to surfaces if they want to. - */ - - ControlProtocolManager::instance().midi_connectivity_established (); - - if (_is_new && !no_auto_connect()) { - Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock()); - auto_connect_master_bus (); - } - - _state_of_the_state = StateOfTheState (_state_of_the_state & ~(CannotSave|Dirty)); - - /* update latencies */ - - initialize_latencies (); - - return 0; -} - void Session::auto_connect_master_bus () { @@ -917,14 +895,14 @@ Session::add_monitor_section () /* Monitor bus is audio only */ - uint32_t mod = n_physical_outputs.get (DataType::AUDIO); - uint32_t limit = _monitor_out->n_outputs().get (DataType::AUDIO); vector<string> outputs[DataType::num_types]; for (uint32_t i = 0; i < DataType::num_types; ++i) { _engine.get_physical_outputs (DataType (DataType::Symbol (i)), outputs[i]); } - + + uint32_t mod = outputs[DataType::AUDIO].size(); + uint32_t limit = _monitor_out->n_outputs().get (DataType::AUDIO); if (mod != 0) { diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 2d91bdd4c2..1a605d2fd5 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -211,16 +211,6 @@ Session::post_engine_init () set_block_size (_engine.samples_per_cycle()); set_frame_rate (_engine.sample_rate()); - if (how_many_dsp_threads () > 1) { - /* For now, only create the graph if we are using >1 DSP threads, as - it is a bit slower than the old code with 1 thread. - */ - _process_graph.reset (new Graph (*this)); - } - - n_physical_outputs = _engine.n_physical_outputs (); - n_physical_inputs = _engine.n_physical_inputs (); - BootMessage (_("Using configuration")); _midi_ports = new MidiPortManager; @@ -281,8 +271,47 @@ Session::post_engine_init () Config->map_parameters (ff); config.map_parameters (ft); - when_engine_running (); - + /* Reset all panners */ + + Delivery::reset_panners (); + + /* this will cause the CPM to instantiate any protocols that are in use + * (or mandatory), which will pass it this Session, and then call + * set_state() on each instantiated protocol to match stored state. + */ + + ControlProtocolManager::instance().set_session (this); + + /* This must be done after the ControlProtocolManager set_session above, + as it will set states for ports which the ControlProtocolManager creates. + */ + + // XXX set state of MIDI::Port's + // MidiPortManager::instance()->set_port_states (Config->midi_port_states ()); + + /* And this must be done after the MIDI::Manager::set_port_states as + * it will try to make connections whose details are loaded by set_port_states. + */ + + hookup_io (); + + /* Let control protocols know that we are now all connected, so they + * could start talking to surfaces if they want to. + */ + + ControlProtocolManager::instance().midi_connectivity_established (); + + if (_is_new && !no_auto_connect()) { + Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock()); + auto_connect_master_bus (); + } + + _state_of_the_state = StateOfTheState (_state_of_the_state & ~(CannotSave|Dirty)); + + /* update latencies */ + + initialize_latencies (); + _locations->changed.connect_same_thread (*this, boost::bind (&Session::locations_changed, this)); _locations->added.connect_same_thread (*this, boost::bind (&Session::locations_added, this, _1)); diff --git a/libs/backends/jack/jack_connection.cc b/libs/backends/jack/jack_connection.cc index 00b6feb5e1..7b3d35efa5 100644 --- a/libs/backends/jack/jack_connection.cc +++ b/libs/backends/jack/jack_connection.cc @@ -16,6 +16,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <iostream> #include <boost/scoped_ptr.hpp> #include <jack/session.h> diff --git a/libs/gtkmm2ext/keyboard.cc b/libs/gtkmm2ext/keyboard.cc index 5087f61a23..2bfb5fa58b 100644 --- a/libs/gtkmm2ext/keyboard.cc +++ b/libs/gtkmm2ext/keyboard.cc @@ -233,8 +233,9 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event) DEBUG_TRACE ( DEBUG::Keyboard, string_compose ( - "Snoop widget %1 key %2 type %3 state %4 magic %5\n", - widget, event->keyval, event->type, event->state, _some_magic_widget_has_focus + "Snoop widget %1 name: [%6] key %2 type %3 state %4 magic %5\n", + widget, event->keyval, event->type, event->state, _some_magic_widget_has_focus, + gtk_widget_get_name (widget) ) ); @@ -324,6 +325,8 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event) } } + DEBUG_TRACE (DEBUG::Keyboard, string_compose ("snooper returns %1\n", ret)); + return ret; } @@ -346,6 +349,7 @@ bool Keyboard::enter_window (GdkEventCrossing *, Gtk::Window* win) { current_window = win; + DEBUG_TRACE (DEBUG::Keyboard, string_compose ("Entering window, title = %1\n", win->get_title())); return false; } diff --git a/libs/surfaces/wscript b/libs/surfaces/wscript index 335d14ee87..29edc427b2 100644 --- a/libs/surfaces/wscript +++ b/libs/surfaces/wscript @@ -55,9 +55,12 @@ def configure(conf): if conf.is_defined('HAVE_CWIID_H'): conf.check_cc (header_name='bluetooth/bluetooth.h', define_name='HAVE_BLUETOOTH_H',mandatory=False) if conf.is_defined('HAVE_BLUETOOTH_H'): - autowaf.check_pkg(conf, 'cwiid', uselib_store='CWIID', atleast_version='0.6.00') - conf.define ('BUILD_WIIMOTE', 1) - sub_config_and_use(conf, 'wiimote') + autowaf.check_pkg(conf, 'cwiid', uselib_store='CWIID', atleast_version='0.6.00',mandatory=False) + if conf.is_defined ('HAVE_CWIID'): + conf.define ('BUILD_WIIMOTE', 1) + sub_config_and_use(conf, 'wiimote') + else: + print('You have the cwiid headers needed to compile wiimote support BUT you are missing the pkg-config file for cwiid') else: print('You are missing the libbluetooth headers needed to compile wiimote support') else: |