diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-09 03:05:14 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-09 03:05:14 +0000 |
commit | c38e02285fda1fd7966c9e4ad85994445247e6a6 (patch) | |
tree | a5f46d4350b8df3e0a74558169c696cbb837ce7f /gtk2_ardour | |
parent | 90f95df20707995e267bd624b28980cfd9200bed (diff) |
major design changes: use glib event loop for MIDI thread/UI; rework design of BaseUI and AbstractUI; solo & mute are both temporarily broken; OSC control up next; may segfault during exit
git-svn-id: svn://localhost/ardour2/branches/3.0@6328 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui2.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_audio_import.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/editor_timefx.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/gui_thread.h | 7 | ||||
-rw-r--r-- | gtk2_ardour/main.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/rc_option_editor.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.cc | 79 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/sfdb_ui.cc | 3 |
11 files changed, 62 insertions, 51 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 28dd679f10..a4675f4a21 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -115,7 +115,7 @@ sigc::signal<void,nframes_t, bool, nframes_t> ARDOUR_UI::Clock; ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) - : Gtkmm2ext::UI (X_("Ardour"), argcp, argvp), + : Gtkmm2ext::UI (X_("gui"), argcp, argvp), primary_clock (X_("primary"), false, X_("TransportClockDisplay"), true, true, false, true), secondary_clock (X_("secondary"), false, X_("SecondaryClockDisplay"), true, true, false, true), diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index b54fe9225a..d12ed9a817 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -478,7 +478,7 @@ void ARDOUR_UI::solo_alert_toggle () { if (session) { - session->set_all_solo (!session->soloing()); + session->set_solo (session->get_routes(), !session->soloing()); } } diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index f8b6d7c141..fb3828ab53 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -491,7 +491,7 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual (the GUI) to direct additional steps after that. */ - pthread_create_and_store ("import", &import_status.thread, 0, _import_thread, this); + pthread_create_and_store ("import", &import_status.thread, _import_thread, this); pthread_detach (import_status.thread); while (!import_status.done && !import_status.cancel) { @@ -879,7 +879,6 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t void * Editor::_import_thread (void *arg) { - PBD::notify_gui_about_thread_creation (pthread_self(), X_("Import")); SessionEvent::create_per_thread_pool ("import events", 64); Editor *ed = (Editor *) arg; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 833ac580a2..449ea42132 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -3653,7 +3653,6 @@ Editor::unfreeze_route () void* Editor::_freeze_thread (void* arg) { - PBD::notify_gui_about_thread_creation (pthread_self(), X_("Freeze")); SessionEvent::create_per_thread_pool ("freeze events", 64); return static_cast<Editor*>(arg)->freeze_thread (); @@ -3702,13 +3701,7 @@ Editor::freeze_route () itt.cancel = false; itt.progress = 0.0f; - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setstacksize(&attr, 500000); - - pthread_create_and_store (X_("freezer"), &itt.thread, &attr, _freeze_thread, this); - - pthread_attr_destroy(&attr); + pthread_create_and_store (X_("freezer"), &itt.thread, _freeze_thread, this); track_canvas->get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH)); diff --git a/gtk2_ardour/editor_timefx.cc b/gtk2_ardour/editor_timefx.cc index b52121f9c5..65c8a833e8 100644 --- a/gtk2_ardour/editor_timefx.cc +++ b/gtk2_ardour/editor_timefx.cc @@ -225,7 +225,7 @@ Editor::time_fx (RegionSelection& regions, float val, bool pitching) current_timefx->first_delete = current_timefx->signal_delete_event().connect (mem_fun (current_timefx, &TimeFXDialog::delete_in_progress)); - if (pthread_create_and_store ("timefx", ¤t_timefx->request.thread, 0, timefx_thread, current_timefx)) { + if (pthread_create_and_store ("timefx", ¤t_timefx->request.thread, timefx_thread, current_timefx)) { current_timefx->hide (); error << _("timefx cannot be started - thread creation error") << endmsg; return -1; @@ -337,7 +337,6 @@ Editor::do_timefx (TimeFXDialog& dialog) void* Editor::timefx_thread (void *arg) { - PBD::notify_gui_about_thread_creation (pthread_self(), X_("TimeFX")); SessionEvent::create_per_thread_pool ("timefx events", 64); TimeFXDialog* tsd = static_cast<TimeFXDialog*>(arg); diff --git a/gtk2_ardour/gui_thread.h b/gtk2_ardour/gui_thread.h index 388902fa28..f9e5165a03 100644 --- a/gtk2_ardour/gui_thread.h +++ b/gtk2_ardour/gui_thread.h @@ -21,16 +21,11 @@ #define __ardour_gtk_gui_thread_h__ #include <gtkmm2ext/gtk_ui.h> -#include "pbd/crossthread.h" #define ENSURE_GUI_THREAD(slot) \ - if (!Gtkmm2ext::UI::instance()->caller_is_ui_thread()) {\ + if (!Gtkmm2ext::UI::instance()->caller_is_self()) { \ Gtkmm2ext::UI::instance()->call_slot ((slot));\ return;\ } -#define GTK_SAFE(theSlot) crossthread_safe (Gtkmm2ext::UI::instance()->thread_id(),\ - *Gtkmm2ext::UI::instance(), \ - (theSlot)) - #endif /* __ardour_gtk_gui_thread_h__ */ diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index fdea4cb754..406ad714e9 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -393,7 +393,8 @@ int main (int argc, char *argv[]) ui = 0; ARDOUR::cleanup (); - pthread_cancel_all (); + // pthread_cancel (); + #ifdef HAVE_LV2 close_external_ui_windows(); #endif diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 8597995a88..c8956961c5 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -183,6 +183,7 @@ private: node.add_property ("mode", smod); if (MIDI::Manager::instance()->add_port (node) != 0) { + cerr << " there are now " << MIDI::Manager::instance()->nports() << endl; ports_changed (); } } diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 9a849257a2..9eb356ddd1 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -262,18 +262,21 @@ RouteUI::mute_press(GdkEventButton* ev) if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { +#if 0 /* Primary-Tertiary-click applies change to all routes */ _session.begin_reversible_command (_("mute change")); Session::GlobalMuteStateCommand *cmd = new Session::GlobalMuteStateCommand(_session, this); - _session.set_all_mute (!_route->muted()); + _session.set_mute (!_route->muted()); cmd->mark(); _session.add_command(cmd); _session.commit_reversible_command (); multiple_mute_change = true; +#endif } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { +#if 0 /* Primary-button1 applies change to the mix group. NOTE: Primary-button2 is MIDI learn. */ @@ -281,15 +284,18 @@ RouteUI::mute_press(GdkEventButton* ev) if (ev->button == 1) { set_route_group_mute (_route, !_route->muted()); } +#endif } else { +#if 0 /* plain click applies change to this route */ if (wait_for_release) { _route->set_mute (!_route->muted(), this); } else { reversibly_apply_route_boolean ("mute change", &Route::set_mute, !_route->muted(), this); } +#endif } } } @@ -318,6 +324,18 @@ RouteUI::mute_release(GdkEventButton*) return true; } +void +RouteUI::post_solo_cleanup (SessionEvent* ev, bool was_not_latched) +{ + ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteUI::post_solo_cleanup), ev, was_not_latched)); + + delete ev; + + if (was_not_latched) { + Config->set_solo_latched (false); + } +} + bool RouteUI::solo_press(GdkEventButton* ev) { @@ -364,6 +382,7 @@ RouteUI::solo_press(GdkEventButton* ev) /* Primary-Tertiary-click applies change to all routes */ bool was_not_latched = false; + if (!Config->get_solo_latched ()) { was_not_latched = true; /* @@ -373,28 +392,25 @@ RouteUI::solo_press(GdkEventButton* ev) */ Config->set_solo_latched (true); } - _session.begin_reversible_command (_("solo change")); - Session::GlobalSoloStateCommand *cmd = new Session::GlobalSoloStateCommand(_session, this); - _session.set_all_solo (!_route->soloed()); - cmd->mark(); - _session.add_command (cmd); - _session.commit_reversible_command (); - multiple_solo_change = true; - if (was_not_latched) { - Config->set_solo_latched (false); - } + + SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0); + ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_solo), _session.get_routes(), !_route->soloed()); + ev->rt_return = bind (sigc::mem_fun (*this, &RouteUI::post_solo_cleanup), was_not_latched); + + _session.queue_event (ev); } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) { // Primary-Secondary-click: exclusively solo this track, not a toggle */ + + //boost::shared_ptr<RouteList> rl (new RouteList); + //rl->push_back (route()); - _session.begin_reversible_command (_("solo change")); - Session::GlobalSoloStateCommand *cmd = new Session::GlobalSoloStateCommand (_session, this); - _session.set_all_solo (false); - _route->set_solo (true, this); - cmd->mark(); - _session.add_command(cmd); - _session.commit_reversible_command (); + //SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0); + // ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_just_one_solo), rl, true); + //ev->rt_return = sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup); + + //_session.queue_event (ev); } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { @@ -405,22 +421,29 @@ RouteUI::solo_press(GdkEventButton* ev) } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { +#if 0 /* Primary-button1: solo mix group. NOTE: Primary-button2 is MIDI learn. */ if (ev->button == 1) { - set_route_group_solo (_route, !_route->soloed()); + queue_route_group_op (RouteGroup::Solo, &Session::set_all_solo, !_route->soloed()); } +#endif + } else { /* click: solo this route */ - if (wait_for_release) { - _route->set_solo (!_route->soloed(), this); - } else { - reversibly_apply_route_boolean ("solo change", &Route::set_solo, !_route->soloed(), this); - } + + boost::shared_ptr<RouteList> rl (new RouteList); + rl->push_back (route()); + + SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0); + ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_solo), rl, !rec_enable_button->get_active()); + ev->rt_return = sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup); + + _session.queue_event (ev); } } } @@ -521,7 +544,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev) } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0); - ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_all_record_enable), _session.get_routes(), !rec_enable_button->get_active()); + ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_record_enable), _session.get_routes(), !rec_enable_button->get_active()); ev->rt_return = sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup); _session.queue_event (ev); @@ -533,7 +556,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev) */ if (ev->button == 1) { - queue_route_group_op (RouteGroup::RecEnable, &Session::set_all_record_enable, !rec_enable_button->get_active()); + queue_route_group_op (RouteGroup::RecEnable, &Session::set_record_enable, !rec_enable_button->get_active()); } } else if (Keyboard::is_context_menu_event (ev)) { @@ -543,9 +566,9 @@ RouteUI::rec_enable_press(GdkEventButton* ev) } else { boost::shared_ptr<RouteList> rl (new RouteList); rl->push_back (route()); - + SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0); - ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_all_record_enable), rl, !rec_enable_button->get_active()); + ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_record_enable), rl, !rec_enable_button->get_active()); ev->rt_return = sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup); _session.queue_event (ev); diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 275366cbe6..90bdaa7fb7 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -217,6 +217,7 @@ class RouteUI : public virtual AxisView void post_rtop_cleanup (ARDOUR::SessionEvent* ev); void post_group_rtop_cleanup (ARDOUR::SessionEvent* ev, ARDOUR::RouteGroup*, ARDOUR::RouteGroup::Property); + void post_solo_cleanup (ARDOUR::SessionEvent* ev, bool was_not_latched); }; #endif /* __ardour_route_ui__ */ diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index aa8d7b77f2..c719bb6515 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -733,7 +733,6 @@ SoundFileBrowser::found_search_clicked () void* freesound_search_thread_entry (void* arg) { - PBD::notify_gui_about_thread_creation (pthread_self(), X_("Freesound Search")); SessionEvent::create_per_thread_pool ("freesound events", 64); static_cast<SoundFileBrowser*>(arg)->freesound_search_thread (); @@ -757,7 +756,7 @@ SoundFileBrowser::freesound_search_clicked () searching = true; freesound_search_btn.set_label(_("Cancel")); pthread_t freesound_thr; - pthread_create_and_store ("freesound_search", &freesound_thr, 0, freesound_search_thread_entry, this); + pthread_create_and_store ("freesound_search", &freesound_thr, freesound_search_thread_entry, this); } } |