last_shuttle_request = last_peak_grab = 0; // get_microseconds();
- ARDOUR::Diskstream::DiskOverrun.connect (forever_connections, sigc::mem_fun(*this, &ARDOUR_UI::disk_overrun_handler));
- ARDOUR::Diskstream::DiskUnderrun.connect (forever_connections, sigc::mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
+ ARDOUR::Diskstream::DiskOverrun.connect (forever_connections, boost::bind (&ARDOUR_UI::disk_overrun_handler, this), gui_context());
+ ARDOUR::Diskstream::DiskUnderrun.connect (forever_connections, boost::bind (&ARDOUR_UI::disk_underrun_handler, this), gui_context());
/* handle dialog requests */
- ARDOUR::Session::Dialog.connect (forever_connections, sigc::mem_fun(*this, &ARDOUR_UI::session_dialog));
+ ARDOUR::Session::Dialog.connect (forever_connections, ui_bind (&ARDOUR_UI::session_dialog, this, _1), gui_context());
- /* handle pending state with a dialog */
+ /* handle pending state with a dialog (PROBLEM: needs to return a value and thus cannot be x-thread) */
- ARDOUR::Session::AskAboutPendingState.connect (forever_connections, sigc::mem_fun(*this, &ARDOUR_UI::pending_state_dialog));
+ ARDOUR::Session::AskAboutPendingState.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::pending_state_dialog, this));
- /* handle sr mismatch with a dialog */
+ /* handle sr mismatch with a dialog (PROBLEM: needs to return a value and thus cannot be x-thread) */
- ARDOUR::Session::AskAboutSampleRateMismatch.connect (forever_connections, sigc::mem_fun(*this, &ARDOUR_UI::sr_mismatch_dialog));
+ ARDOUR::Session::AskAboutSampleRateMismatch.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::sr_mismatch_dialog, this, _1, _2));
/* lets get this party started */
return -1;
}
- engine->Stopped.connect (forever_connections, sigc::mem_fun(*this, &ARDOUR_UI::engine_stopped));
- engine->Running.connect (forever_connections, sigc::mem_fun(*this, &ARDOUR_UI::engine_running));
- engine->Halted.connect (forever_connections, sigc::mem_fun(*this, &ARDOUR_UI::engine_halted));
- engine->SampleRateChanged.connect (forever_connections, sigc::mem_fun(*this, &ARDOUR_UI::update_sample_rate));
+ engine->Stopped.connect (forever_connections, boost::bind (&ARDOUR_UI::engine_stopped, this), gui_context());
+ engine->Running.connect (forever_connections, boost::bind (&ARDOUR_UI::engine_running, this), gui_context());
+ engine->Halted.connect (forever_connections, boost::bind (&ARDOUR_UI::engine_halted, this), gui_context());
+ engine->SampleRateChanged.connect (forever_connections, ui_bind (&ARDOUR_UI::update_sample_rate, this, _1), gui_context());
post_engine ();
update_cpu_load ();
update_sample_rate (engine->frame_rate());
- Config->ParameterChanged.connect (forever_connections, sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed));
+ Config->ParameterChanged.connect (forever_connections, ui_bind (&ARDOUR_UI::parameter_changed, this, _1), gui_context());
boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
Config->map_parameters (pc);
#include "theme_manager.h"
#include "bundle_manager.h"
#include "keyeditor.h"
+#include "gui_thread.h"
#include "i18n.h"
Blink.connect (sigc::mem_fun(*this, &ARDOUR_UI::sync_blink));
Blink.connect (sigc::mem_fun(*this, &ARDOUR_UI::audition_blink));
- _session->Xrun.connect (_session_connections, sigc::mem_fun(*this, &ARDOUR_UI::xrun_handler));
- _session->RecordStateChanged.connect (_session_connections, sigc::mem_fun (*this, &ARDOUR_UI::record_state_changed));
- _session->locations()->added.connect (_session_connections, sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change));
- _session->locations()->removed.connect (_session_connections, sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change));
- _session->TransportStateChange.connect (_session_connections, sigc::mem_fun(*this, &ARDOUR_UI::map_transport_state));
- _session->AuditionActive.connect (_session_connections, sigc::mem_fun(*this, &ARDOUR_UI::auditioning_changed));
- _session->SoloActive.connect (_session_connections, sigc::mem_fun(*this, &ARDOUR_UI::soloing_changed));
- _session->DirtyChanged.connect (_session_connections, sigc::mem_fun(*this, &ARDOUR_UI::update_autosave));
+ _session->RecordStateChanged.connect (_session_connections, boost::bind (&ARDOUR_UI::record_state_changed, this), gui_context());
+ _session->TransportStateChange.connect (_session_connections, boost::bind (&ARDOUR_UI::map_transport_state, this), gui_context());
+ _session->DirtyChanged.connect (_session_connections, boost::bind (&ARDOUR_UI::update_autosave, this), gui_context());
+
+ _session->Xrun.connect (_session_connections, ui_bind (&ARDOUR_UI::xrun_handler, this, _1), gui_context());
+ _session->SoloActive.connect (_session_connections, ui_bind (&ARDOUR_UI::soloing_changed, this, _1), gui_context());
+ _session->AuditionActive.connect (_session_connections, ui_bind (&ARDOUR_UI::auditioning_changed, this, _1), gui_context());
+ _session->locations()->added.connect (_session_connections, ui_bind (&ARDOUR_UI::handle_locations_change, this, _1), gui_context());
+ _session->locations()->removed.connect (_session_connections, ui_bind (&ARDOUR_UI::handle_locations_change, this, _1), gui_context());
/* Clocks are on by default after we are connected to a session, so show that here.
*/
void
ARDOUR_UI::setup_session_options ()
{
- _session->config.ParameterChanged.connect (_session_connections, sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed));
+ _session->config.ParameterChanged.connect (_session_connections, ui_bind (&ARDOUR_UI::parameter_changed, this, _1), gui_context());
boost::function<void (std::string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
_session->config.map_parameters (pc);
}
#include "audio_clock.h"
#include "utils.h"
#include "keyboard.h"
+#include "gui_thread.h"
#include "i18n.h"
using namespace ARDOUR;
clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
clock_base.signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &AudioClock::field_button_release_event), Timecode_Hours));
- Session::TimecodeOffsetChanged.connect (_session_connections, sigc::mem_fun (*this, &AudioClock::timecode_offset_changed));
+ Session::TimecodeOffsetChanged.connect (_session_connections, boost::bind (&AudioClock::timecode_offset_changed, this), gui_context());
if (editable) {
setup_events ();
bounds_changed (Change (StartChanged|LengthChanged|PositionChanged|Region::SyncOffsetChanged));
gain_changed ();
- _region->StateChanged.connect (state_connection, sigc::mem_fun(*this, &AudioRegionEditor::region_changed));
+ _region->StateChanged.connect (state_connection, ui_bind (&AudioRegionEditor::region_changed, this, _1), gui_context());
spin_arrow_grab = false;
gain_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &AudioRegionEditor::gain_adjustment_changed));
audition_button.signal_toggled().connect (sigc::mem_fun(*this, &AudioRegionEditor::audition_button_toggled));
- _session->AuditionActive.connect (audition_connection, sigc::mem_fun(*this, &AudioRegionEditor::audition_state_changed));
+
+ _session->AuditionActive.connect (audition_connection, ui_bind (&AudioRegionEditor::audition_state_changed, this, _1), gui_context());
}
void
// cerr << "\tchannel " << n << endl;
if (wait_for_data) {
- if (audio_region()->audio_source(n)->peaks_ready (boost::bind (&AudioRegionView::peaks_ready_handler, this, n), data_ready_connection)) {
+ if (audio_region()->audio_source(n)->peaks_ready (boost::bind (&AudioRegionView::peaks_ready_handler, this, n), data_ready_connection, gui_context())) {
// cerr << "\tData is ready\n";
create_one_wave (n, true);
} else {
ghost->set_colors();
ghosts.push_back (ghost);
- ghost->GoingAway.connect (*this, boost::bind (&RegionView::remove_ghost, this, _1));
+ ghost->GoingAway.connect (*this, ui_bind (&RegionView::remove_ghost, this, _1), gui_context());
return ghost;
}
use_rec_regions = tv.editor().show_waveforms_recording ();
- Config->ParameterChanged.connect (*this, sigc::mem_fun (*this, &AudioStreamView::parameter_changed));
+ Config->ParameterChanged.connect (*this, ui_bind (&AudioStreamView::parameter_changed, this, _1), gui_context());
}
AudioStreamView::~AudioStreamView ()
/* catch region going away */
- r->GoingAway.connect (*this, boost::bind (&AudioStreamView::remove_region_view, this, boost::weak_ptr<Region> (r)));
+ r->GoingAway.connect (*this, boost::bind (&AudioStreamView::remove_region_view, this, boost::weak_ptr<Region> (r)), gui_context());
RegionViewAdded (region_view);
boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(ds->playlist());
if (apl) {
- apl->NewCrossfade.connect (playlist_connections, boost::bind (&AudioStreamView::add_crossfade, this, _1));
+ apl->NewCrossfade.connect (playlist_connections, ui_bind (&AudioStreamView::add_crossfade, this, _1), gui_context());
}
}
region_color,
*lview, *rview);
cv->set_valid (true);
- crossfade->Invalidated.connect (*this, sigc::mem_fun (*this, &AudioStreamView::remove_crossfade));
+ crossfade->Invalidated.connect (*this, ui_bind (&AudioStreamView::remove_crossfade, this, _1), gui_context());
crossfade_views[cv->crossfade] = cv;
if (!_trackview.session()->config.get_xfades_visible() || !crossfades_visible) {
cv->hide ();
boost::shared_ptr<AudioFileSource> src = ads->write_source (n);
if (src) {
sources.push_back (src);
-
- (src->PeakRangeReady.connect (rec_data_ready_connections,
- boost::bind (&AudioStreamView::rec_peak_range_ready,
- this, _1, _2, boost::weak_ptr<Source>(src))));
+ src->PeakRangeReady.connect (rec_data_ready_connections,
+ ui_bind (&AudioStreamView::rec_peak_range_ready, this, _1, _2, boost::weak_ptr<Source>(src)),
+ gui_context());
}
}
#include "canvas_impl.h"
#include "crossfade_view.h"
#include "enums.h"
+#include "gui_thread.h"
#include "automation_time_axis.h"
#include "keyboard.h"
#include "playlist_selector.h"
}
if (_route->panner()) {
- _route->panner()->Changed.connect (*this, (boost::bind (&AudioTimeAxisView::ensure_pan_views, this, false)));
+ _route->panner()->Changed.connect (*this, boost::bind (&AudioTimeAxisView::ensure_pan_views, this, false), gui_context());
}
/* map current state of the route */
_screen_update_connection = ARDOUR_UI::RapidScreenUpdate.connect (
sigc::mem_fun (*this, &AutomationController::display_effective_value));
- ac->Changed.connect (_changed_connection, sigc::mem_fun(*this, &AutomationController::value_changed));
+ ac->Changed.connect (_changed_connection, boost::bind (&AutomationController::value_changed, this), gui_context());
}
AutomationController::~AutomationController()
#include "simplerect.h"
#include "automation_line.h"
#include "control_point.h"
+#include "gui_thread.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
#include "public_editor.h"
line->signal_event().connect (sigc::mem_fun (*this, &AutomationLine::event_handler));
- alist->StateChanged.connect (_state_connection, boost::bind (&AutomationLine::list_changed, this));
+ alist->StateChanged.connect (_state_connection, boost::bind (&AutomationLine::list_changed, this), gui_context());
trackview.session()->register_with_memento_command_factory(alist->id(), this);
#include "ardour/event_type_map.h"
#include "ardour/session.h"
#include "ardour/source.h"
+
#include "automation_region_view.h"
+#include "gui_thread.h"
#include "public_editor.h"
#include "i18n.h"
set_height (trackview.current_height());
- _region->StateChanged.connect (*this, boost::bind (&RegionView::region_changed, this, _1));
+ _region->StateChanged.connect (*this, ui_bind (&RegionView::region_changed, this, _1), gui_context());
set_colors ();
display_region(region_view);
/* catch regionview going away */
- region->GoingAway.connect (*this, boost::bind (&AutomationStreamView::remove_region_view, this, boost::weak_ptr<Region>(region)));
+ region->GoingAway.connect (*this, boost::bind (&AutomationStreamView::remove_region_view, this, boost::weak_ptr<Region>(region)), gui_context());
RegionViewAdded (region_view);
#include "ardour_ui.h"
#include "automation_time_axis.h"
#include "automation_streamview.h"
+#include "gui_thread.h"
#include "route_time_axis.h"
#include "automation_line.h"
#include "public_editor.h"
assert(!_line);
assert(line->the_list() == _control->list());
- _control->alist()->automation_state_changed.connect (automation_connection, boost::bind (&AutomationTimeAxisView::automation_state_changed, this));
+ _control->alist()->automation_state_changed.connect (automation_connection, boost::bind (&AutomationTimeAxisView::automation_state_changed, this), gui_context());
_line = line;
//_controller = AutomationController::create(_session, line->the_list(), _control);
void set_interpolation (ARDOUR::AutomationList::InterpolationStyle);
void interpolation_changed ();
- boost::signals2::scoped_connection automation_connection;
+ PBD::ScopedConnection automation_connection;
void update_extra_xml_shown (bool editor_shown);
#include <gtkmm/table.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/alignment.h>
+
#include "ardour/session.h"
#include "ardour/user_bundle.h"
#include "ardour/audioengine.h"
#include "bundle_manager.h"
+#include "gui_thread.h"
#include "i18n.h"
#include "utils.h"
(*i)[_list_model_columns.name] = u->name ();
(*i)[_list_model_columns.bundle] = u;
- u->Changed.connect (bundle_connections, boost::bind (&BundleManager::bundle_changed, this, _1, u));
+ u->Changed.connect (bundle_connections, ui_bind (&BundleManager::bundle_changed, this, _1, u), gui_context());
}
void
}
void
-BundleManager::row_activated (Gtk::TreeModel::Path const & p, Gtk::TreeViewColumn* c)
+BundleManager::row_activated (Gtk::TreeModel::Path const & p, Gtk::TreeViewColumn*)
{
Gtk::TreeModel::iterator i = _list_model->get_iter (p);
if (!i) {
curve_select_clicked (In);
- xfade->StateChanged.connect (state_connection, boost::bind (&CrossfadeEditor::xfade_changed, this, _1));
+ xfade->StateChanged.connect (state_connection, ui_bind (&CrossfadeEditor::xfade_changed, this, _1), gui_context());
- _session->AuditionActive.connect (_session_connections, sigc::mem_fun(*this, &CrossfadeEditor::audition_state_changed));
+ _session->AuditionActive.connect (_session_connections, ui_bind (&CrossfadeEditor::audition_state_changed, this, _1), gui_context());
show_all_children();
}
gdouble yoff = n * ht;
- if (region->audio_source(n)->peaks_ready (boost::bind (&CrossfadeEditor::peaks_ready, this, boost::weak_ptr<AudioRegion>(region), which), peaks_ready_connection)) {
+ if (region->audio_source(n)->peaks_ready (boost::bind (&CrossfadeEditor::peaks_ready, this, boost::weak_ptr<AudioRegion>(region), which), peaks_ready_connection, gui_context())) {
WaveView* waveview = new WaveView (*(canvas->root()));
waveview->property_data_src() = region.get();
#include "canvas-simplerect.h"
#include "canvas-curve.h"
#include "crossfade_view.h"
+#include "gui_thread.h"
#include "rgb_macros.h"
#include "audio_time_axis.h"
#include "public_editor.h"
crossfade_changed (Change (~0));
- crossfade->StateChanged.connect (*this, sigc::mem_fun(*this, &CrossfadeView::crossfade_changed));
+ crossfade->StateChanged.connect (*this, ui_bind (&CrossfadeView::crossfade_changed, this, _1), gui_context());
ColorsChanged.connect (sigc::mem_fun (*this, &CrossfadeView::color_handler));
}
_playlist_selector = new PlaylistSelector();
_playlist_selector->signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), static_cast<Window *> (_playlist_selector)));
- RegionView::RegionViewGoingAway.connect (*this, boost::bind (&Editor::catch_vanishing_regionview, this, _1));
+ RegionView::RegionViewGoingAway.connect (*this, ui_bind (&Editor::catch_vanishing_regionview, this, _1), gui_context());
/* nudge stuff */
/* allow external control surfaces/protocols to do various things */
- ControlProtocol::ZoomToSession.connect (*this, boost::bind (&Editor::temporal_zoom_session, this));
- ControlProtocol::ZoomIn.connect (*this, boost::bind (&Editor::temporal_zoom_step, this, false));
- ControlProtocol::ZoomOut.connect (*this, boost::bind (&Editor::temporal_zoom_step, this, true));
- ControlProtocol::ScrollTimeline.connect (*this, boost::bind (&Editor::control_scroll, this, _1));
- BasicUI::AccessAction.connect (*this, boost::bind (&Editor::access_action, this, _1, _2));
- Session::AskAboutPlaylistDeletion.connect (*this, boost::bind (&Editor::playlist_deletion_dialog, this, _1));
+ ControlProtocol::ZoomToSession.connect (*this, boost::bind (&Editor::temporal_zoom_session, this), gui_context());
+ ControlProtocol::ZoomIn.connect (*this, boost::bind (&Editor::temporal_zoom_step, this, false), gui_context());
+ ControlProtocol::ZoomOut.connect (*this, boost::bind (&Editor::temporal_zoom_step, this, true), gui_context());
+ ControlProtocol::ScrollTimeline.connect (*this, ui_bind (&Editor::control_scroll, this, _1), gui_context());
+ BasicUI::AccessAction.connect (*this, ui_bind (&Editor::access_action, this, _1, _2), gui_context());
+
+ /* problematic: has to return a value and thus cannot be x-thread */
+
+ Session::AskAboutPlaylistDeletion.connect_same_thread (*this, boost::bind (&Editor::playlist_deletion_dialog, this, _1));
- Config->ParameterChanged.connect (*this, boost::bind (&Editor::parameter_changed, this, _1));
+ Config->ParameterChanged.connect (*this, ui_bind (&Editor::parameter_changed, this, _1), gui_context());
_last_normalization_value = 0;
but use Gtkmm2ext::UI::instance()->call_slot();
*/
- _session->TransportStateChange.connect (_session_connections, boost::bind (&Editor::map_transport_state, this));
- _session->PositionChanged.connect (_session_connections, boost::bind (&Editor::map_position_change, this, _1));
- _session->RouteAdded.connect (_session_connections, boost::bind (&Editor::handle_new_route, this, _1));
- _session->DurationChanged.connect (_session_connections, boost::bind (&Editor::handle_new_duration, this));
- _session->DirtyChanged.connect (_session_connections, boost::bind (&Editor::update_title, this));
- _session->TimecodeOffsetChanged.connect (_session_connections, boost::bind (&Editor::update_just_timecode, this));
- _session->tempo_map().StateChanged.connect (_session_connections, boost::bind (&Editor::tempo_map_changed, this, _1));
- _session->Located.connect (_session_connections, boost::bind (&Editor::located, this));
- _session->config.ParameterChanged.connect (_session_connections, boost::bind (&Editor::parameter_changed, this, _1));
- _session->StateSaved.connect (_session_connections, boost::bind (&Editor::session_state_saved, this, _1));
- _session->locations()->added.connect (_session_connections, sigc::mem_fun(*this, &Editor::add_new_location));
- _session->locations()->removed.connect (_session_connections, sigc::mem_fun(*this, &Editor::location_gone));
- _session->locations()->changed.connect (_session_connections, sigc::mem_fun(*this, &Editor::refresh_location_display));
- _session->locations()->StateChanged.connect (_session_connections, sigc::mem_fun(*this, &Editor::refresh_location_display_s));
- _session->locations()->end_location()->changed.connect (_session_connections, sigc::mem_fun(*this, &Editor::end_location_changed));
- _session->history().Changed.connect (_session_connections, boost::bind (&Editor::history_changed, this));
+ _session->TransportStateChange.connect (_session_connections, boost::bind (&Editor::map_transport_state, this), gui_context());
+ _session->PositionChanged.connect (_session_connections, ui_bind (&Editor::map_position_change, this, _1), gui_context());
+ _session->RouteAdded.connect (_session_connections, ui_bind (&Editor::handle_new_route, this, _1), gui_context());
+ _session->DurationChanged.connect (_session_connections, boost::bind (&Editor::handle_new_duration, this), gui_context());
+ _session->DirtyChanged.connect (_session_connections, boost::bind (&Editor::update_title, this), gui_context());
+ _session->TimecodeOffsetChanged.connect (_session_connections, boost::bind (&Editor::update_just_timecode, this), gui_context());
+ _session->tempo_map().StateChanged.connect (_session_connections, ui_bind (&Editor::tempo_map_changed, this, _1), gui_context());
+ _session->Located.connect (_session_connections, boost::bind (&Editor::located, this), gui_context());
+ _session->config.ParameterChanged.connect (_session_connections, ui_bind (&Editor::parameter_changed, this, _1), gui_context());
+ _session->StateSaved.connect (_session_connections, ui_bind (&Editor::session_state_saved, this, _1), gui_context());
+ _session->locations()->added.connect (_session_connections, ui_bind (&Editor::add_new_location, this, _1), gui_context());
+ _session->locations()->removed.connect (_session_connections, ui_bind (&Editor::location_gone, this, _1), gui_context());
+ _session->locations()->changed.connect (_session_connections, boost::bind (&Editor::refresh_location_display, this), gui_context());
+ _session->locations()->StateChanged.connect (_session_connections, ui_bind (&Editor::refresh_location_display_s, this, _1), gui_context());
+ _session->locations()->end_location()->changed.connect (_session_connections, ui_bind (&Editor::end_location_changed, this, _1), gui_context());
+ _session->history().Changed.connect (_session_connections, boost::bind (&Editor::history_changed, this), gui_context());
if (Profile->get_sae()) {
BBT_Time bbt;
rtv->view()->RegionViewAdded.connect (sigc::mem_fun (*this, &Editor::region_view_added));
rtv->view()->HeightChanged.connect (sigc::mem_fun (*this, &Editor::streamview_height_changed));
- rtv->GoingAway.connect (*this, boost::bind (&Editor::remove_route, this, rtv));
+ rtv->GoingAway.connect (*this, boost::bind (&Editor::remove_route, this, rtv), gui_context());
}
_routes->routes_added (new_views);
#include "audio_region_view.h"
#include "midi_region_view.h"
#include "ardour_ui.h"
+#include "gui_thread.h"
#include "control_point.h"
#include "utils.h"
#include "region_gain_line.h"
_primary (p),
_views (v)
{
- RegionView::RegionViewGoingAway.connect (death_connection, boost::bind (&RegionDrag::region_going_away, this, _1));
+ RegionView::RegionViewGoingAway.connect (death_connection, ui_bind (&RegionDrag::region_going_away, this, _1), gui_context());
}
void
private:
void region_going_away (RegionView *);
- boost::signals2::scoped_connection death_connection;
+ PBD::ScopedConnection death_connection;
};
#include "imageframe_socket_handler.h"
#include "ardour_image_compositor_socket.h"
#include "public_editor.h"
+#include "gui_thread.h"
using namespace Gtk;
using namespace PBD;
row[route_display_columns.tv] = iftav;
route_list_display.get_selection()->select (row);
- iftav->GoingAway.connect (*this, boost::bind (&Editor::remove_route, this, (TimeAxisView*)iftav));
+ iftav->GoingAway.connect (*this, boost::bind (&Editor::remove_route, this, (TimeAxisView*)iftav), gui_context());
iftav->gui_changed.connect(sigc::mem_fun(*this, &Editor::handle_gui_changes)) ;
}
row[route_display_columns.tv] = mta;
route_list_display.get_selection()->select (row);
- mta->GoingAway.connect (*this, boost::bind (&Editor::remove_route, this, (TimeAxisView*)mta));
+ mta->GoingAway.connect (*this, boost::bind (&Editor::remove_route, this, (TimeAxisView*)mta), gui_context());
}
lam->show ();
}
- location->start_changed.connect (*this, boost::bind (&Editor::location_changed, this, _1));
- location->end_changed.connect (*this, boost::bind (&Editor::location_changed, this, _1));
- location->changed.connect (*this, boost::bind (&Editor::location_changed, this, _1));
- location->name_changed.connect (*this, boost::bind (&Editor::location_changed, this, _1));
- location->FlagsChanged.connect (*this, boost::bind (&Editor::location_flags_changed, this, _1, _2));
+ location->start_changed.connect (*this, ui_bind (&Editor::location_changed, this, _1), gui_context());
+ location->end_changed.connect (*this, ui_bind (&Editor::location_changed, this, _1), gui_context());
+ location->changed.connect (*this, ui_bind (&Editor::location_changed, this, _1), gui_context());
+ location->name_changed.connect (*this, ui_bind (&Editor::location_changed, this, _1), gui_context());
+ location->FlagsChanged.connect (*this, ui_bind (&Editor::location_flags_changed, this, _1, _2), gui_context());
pair<Location*,LocationMarkers*> newpair;
#include "editor_routes.h"
#include "editor_route_groups.h"
#include "editor_regions.h"
+#include "gui_thread.h"
#include "i18n.h"
_session,
false);
current_mixer_strip->Hiding.connect (sigc::mem_fun(*this, &Editor::current_mixer_strip_hidden));
- current_mixer_strip->GoingAway.connect (*this, boost::bind (&Editor::current_mixer_strip_removed, this));
+ current_mixer_strip->GoingAway.connect (*this, boost::bind (&Editor::current_mixer_strip_removed, this), gui_context());
#ifdef GTKOSX
current_mixer_strip->WidthChanged.connect (sigc::mem_fun(*this, &Editor::ensure_all_elements_drawn));
#endif
//ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &Editor::redisplay_regions));
ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &EditorRegions::update_all_rows));
- ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, sigc::mem_fun(*this, &EditorRegions::update_row));
+ ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, ui_bind (&EditorRegions::update_row, this, _1), gui_context());
}
EditorComponent::set_session (s);
if (_session) {
- _session->RegionsAdded.connect (_session_connections, boost::bind (&EditorRegions::handle_new_regions, this, _1));
- _session->RegionRemoved.connect (_session_connections, boost::bind (&EditorRegions::handle_region_removed, this, _1));
- _session->RegionHiddenChange.connect (_session_connections, boost::bind (&EditorRegions::region_hidden, this, _1));
+ _session->RegionsAdded.connect (_session_connections, ui_bind (&EditorRegions::handle_new_regions, this, _1), gui_context());
+ _session->RegionRemoved.connect (_session_connections, ui_bind (&EditorRegions::handle_region_removed, this, _1), gui_context());
+ _session->RegionHiddenChange.connect (_session_connections, ui_bind (&EditorRegions::region_hidden, this, _1), gui_context());
}
redisplay ();
focus = true;
}
- group->FlagsChanged.connect (flags_connection, boost::bind (&EditorRouteGroups::flags_changed, this, _1, group));
+ group->FlagsChanged.connect (flags_connection, ui_bind (&EditorRouteGroups::flags_changed, this, _1, group), gui_context());
if (focus) {
TreeViewColumn* col = _display.get_column (0);
EditorComponent::set_session (s);
if (_session) {
- _session->route_group_added.connect (_session_connections, boost::bind (&EditorRouteGroups::add, this, _1));
- _session->route_group_removed.connect (_session_connections, boost::bind (&EditorRouteGroups::groups_changed, this));
+ _session->route_group_added.connect (_session_connections, ui_bind (&EditorRouteGroups::add, this, _1), gui_context());
+ _session->route_group_removed.connect (_session_connections, boost::bind (&EditorRouteGroups::groups_changed, this), gui_context());
}
groups_changed ();
_model->signal_rows_reordered().connect (sigc::mem_fun (*this, &EditorRoutes::reordered));
_display.signal_button_press_event().connect (sigc::mem_fun (*this, &EditorRoutes::button_press), false);
- Route::SyncOrderKeys.connect (*this, (sigc::mem_fun (*this, &EditorRoutes::sync_order_keys)));
+ Route::SyncOrderKeys.connect (*this, ui_bind (&EditorRoutes::sync_order_keys, this, _1), gui_context());
}
void
initial_display ();
if (_session) {
- _session->SoloChanged.connect (*this, (sigc::mem_fun (*this, &EditorRoutes::solo_changed_so_update_mute)));
+ _session->SoloChanged.connect (*this, boost::bind (&EditorRoutes::solo_changed_so_update_mute, this), gui_context());
}
}
boost::weak_ptr<Route> wr ((*x)->route());
- (*x)->route()->gui_changed.connect (*this, boost::bind (&EditorRoutes::handle_gui_changes, this, _1, _2));
- (*x)->route()->NameChanged.connect (*this, boost::bind (&EditorRoutes::route_name_changed, this, wr));
- (*x)->GoingAway.connect (*this, boost::bind (&EditorRoutes::route_removed, this, *x));
+ (*x)->route()->gui_changed.connect (*this, ui_bind (&EditorRoutes::handle_gui_changes, this, _1, _2), gui_context());
+ (*x)->route()->NameChanged.connect (*this, boost::bind (&EditorRoutes::route_name_changed, this, wr), gui_context());
+ (*x)->GoingAway.connect (*this, boost::bind (&EditorRoutes::route_removed, this, *x), gui_context());
if ((*x)->is_track()) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> ((*x)->route());
- t->diskstream()->RecordEnableChanged.connect (*this, boost::bind (&EditorRoutes::update_rec_display, this));
+ t->diskstream()->RecordEnableChanged.connect (*this, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
}
- (*x)->route()->mute_changed.connect (*this, boost::bind (&EditorRoutes::update_mute_display, this));
- (*x)->route()->solo_changed.connect (*this, boost::bind (&EditorRoutes::update_solo_display, this));
- (*x)->route()->solo_isolated_changed.connect (*this, boost::bind (&EditorRoutes::update_solo_isolate_display, this));
+ (*x)->route()->mute_changed.connect (*this, boost::bind (&EditorRoutes::update_mute_display, this), gui_context());
+ (*x)->route()->solo_changed.connect (*this, boost::bind (&EditorRoutes::update_solo_display, this), gui_context());
+ (*x)->route()->solo_isolated_changed.connect (*this, boost::bind (&EditorRoutes::update_solo_isolate_display, this), gui_context());
}
update_rec_display ();
_zoom_dragging (false)
{
- Region::RegionPropertyChanged.connect (region_property_connection, boost::bind (&CairoWidget::set_dirty, this));
- _editor->playhead_cursor->PositionChanged.connect (position_connection, boost::bind (&EditorSummary::playhead_position_changed, this, _1));
+ Region::RegionPropertyChanged.connect (region_property_connection, boost::bind (&CairoWidget::set_dirty, this), gui_context());
+ _editor->playhead_cursor->PositionChanged.connect (position_connection, ui_bind (&EditorSummary::playhead_position_changed, this, _1), gui_context());
}
/** Connect to a session.
set_dirty ();
if (_session) {
- _session->RegionRemoved.connect (_session_connections, boost::bind (&EditorSummary::set_dirty, this));
- _session->StartTimeChanged.connect (_session_connections, boost::bind (&EditorSummary::set_dirty, this));
- _session->EndTimeChanged.connect (_session_connections, boost::bind (&EditorSummary::set_dirty, this));
+ _session->RegionRemoved.connect (_session_connections, boost::bind (&EditorSummary::set_dirty, this), gui_context());
+ _session->StartTimeChanged.connect (_session_connections, boost::bind (&EditorSummary::set_dirty, this), gui_context());
+ _session->EndTimeChanged.connect (_session_connections, boost::bind (&EditorSummary::set_dirty, this), gui_context());
}
}
*/
-#include "export_dialog.h"
#include <sigc++/signal.h>
#include "ardour/export_status.h"
#include "ardour/export_handler.h"
+#include "export_dialog.h"
+#include "gui_thread.h"
+
using namespace ARDOUR;
using namespace PBD;
timespan_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings));
channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings));
file_notebook->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings));
- status->Aborting.connect (abort_connection, sigc::mem_fun (*this, &ExportDialog::notify_errors));
+
+ status->Aborting.connect (abort_connection, boost::bind (&ExportDialog::notify_errors, this), gui_context());
update_warnings ();
}
#include "ardour/export_format_specification.h"
+#include "gui_thread.h"
#include "utils.h"
#include "i18n.h"
tab_close_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*parent, &ExportFileNotebook::remove_file_page), this));
- profile_manager->FormatListChanged.connect (format_connection, boost::bind (&ExportFormatSelector::update_format_list, &format_selector));
+ profile_manager->FormatListChanged.connect (format_connection, boost::bind (&ExportFormatSelector::update_format_list, &format_selector), gui_context());
format_selector.FormatEdited.connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::save_format_to_manager));
format_selector.FormatRemoved.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::remove_format_profile));
*/
-#include "export_format_dialog.h"
-
#include "ardour/session.h"
#include "ardour/export_format_specification.h"
+#include "export_format_dialog.h"
+#include "gui_thread.h"
#include "i18n.h"
using namespace ARDOUR;
close_button = add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_APPLY);
close_button->set_sensitive (false);
close_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportFormatDialog::end_dialog));
- manager.CompleteChanged.connect (*this, sigc::mem_fun (close_button, &Gtk::Button::set_sensitive));
+ manager.CompleteChanged.connect (*this, ui_bind (&Gtk::Button::set_sensitive, close_button, _1), gui_context());
/* Load state before hooking up the rest of the signals */
row[compatibility_cols.label] = (*it)->name();
WeakCompatPtr ptr (*it);
- (*it)->SelectChanged.connect (*this, boost::bind (&ExportFormatDialog::change_compatibility_selection, this, _1, ptr));
+ (*it)->SelectChanged.connect (*this, ui_bind (&ExportFormatDialog::change_compatibility_selection, this, _1, ptr), gui_context());
}
compatibility_view.append_column_editable ("", compatibility_cols.selected);
row[quality_cols.label] = (*it)->name();
WeakQualityPtr ptr (*it);
- (*it)->SelectChanged.connect (*this, boost::bind (&ExportFormatDialog::change_quality_selection, this, _1, ptr));
- (*it)->CompatibleChanged.connect (*this, boost::bind (&ExportFormatDialog::change_quality_compatibility, this, _1, ptr));
+ (*it)->SelectChanged.connect (*this, ui_bind (&ExportFormatDialog::change_quality_selection, this, _1, ptr), gui_context());
+ (*it)->CompatibleChanged.connect (*this, ui_bind (&ExportFormatDialog::change_quality_compatibility, this, _1, ptr), gui_context());
}
quality_view.append_column ("", quality_cols.label);
row[format_cols.label] = (*it)->name();
WeakFormatPtr ptr (*it);
- (*it)->SelectChanged.connect (*this, boost::bind (&ExportFormatDialog::change_format_selection, this, _1, ptr));
- (*it)->CompatibleChanged.connect (*this, boost::bind (&ExportFormatDialog::change_format_compatibility, this, _1, ptr));
+ (*it)->SelectChanged.connect (*this, ui_bind (&ExportFormatDialog::change_format_selection, this, _1, ptr), gui_context());
+ (*it)->CompatibleChanged.connect (*this, ui_bind (&ExportFormatDialog::change_format_compatibility, this, _1, ptr), gui_context());
/* Encoding options */
boost::shared_ptr<HasSampleFormat> hsf;
if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (*it)) {
- hsf->SampleFormatSelectChanged.connect (*this, boost::bind (&ExportFormatDialog::change_sample_format_selection, this, _1, _2));
- hsf->SampleFormatCompatibleChanged.connect (*this, boost::bind (&ExportFormatDialog::change_sample_format_compatibility, this, _1, _2));
+ hsf->SampleFormatSelectChanged.connect (*this, ui_bind (&ExportFormatDialog::change_sample_format_selection, this, _1, _2), gui_context());
+ hsf->SampleFormatCompatibleChanged.connect (*this, ui_bind (&ExportFormatDialog::change_sample_format_compatibility, this, _1, _2), gui_context());
- hsf->DitherTypeSelectChanged.connect (*this, boost::bind (&ExportFormatDialog::change_dither_type_selection, this, _1, _2));
- hsf->DitherTypeCompatibleChanged.connect (*this, boost::bind (&ExportFormatDialog::change_dither_type_compatibility, this, _1, _2));
+ hsf->DitherTypeSelectChanged.connect (*this, ui_bind (&ExportFormatDialog::change_dither_type_selection, this, _1, _2), gui_context());
+ hsf->DitherTypeCompatibleChanged.connect (*this, ui_bind (&ExportFormatDialog::change_dither_type_compatibility, this, _1, _2), gui_context());
}
}
row[sample_rate_cols.label] = (*it)->name();
WeakSampleRatePtr ptr (*it);
- (*it)->SelectChanged.connect (*this, boost::bind (&ExportFormatDialog::change_sample_rate_selection, this, _1, ptr));
- (*it)->CompatibleChanged.connect (*this, boost::bind (&ExportFormatDialog::change_sample_rate_compatibility, this, _1, ptr));
+ (*it)->SelectChanged.connect (*this, ui_bind (&ExportFormatDialog::change_sample_rate_selection, this, _1, ptr), gui_context());
+ (*it)->CompatibleChanged.connect (*this, ui_bind (&ExportFormatDialog::change_sample_rate_compatibility, this, _1, ptr), gui_context());
}
sample_rate_view.append_column ("", sample_rate_cols.label);
boost::shared_ptr<AutomationControl> gc = amp->gain_control();
- gc->alist()->automation_state_changed.connect (model_connections, boost::bind (&GainMeter::gain_automation_state_changed, this));
- gc->alist()->automation_style_changed.connect (model_connections, boost::bind (&GainMeter::gain_automation_style_changed, this));
+ gc->alist()->automation_state_changed.connect (model_connections, boost::bind (&GainMeter::gain_automation_state_changed, this), gui_context());
+ gc->alist()->automation_style_changed.connect (model_connections, boost::bind (&GainMeter::gain_automation_style_changed, this), gui_context());
gain_automation_state_changed ();
}
- amp->gain_control()->Changed.connect (model_connections, boost::bind (&GainMeterBase::gain_changed, this));
+ amp->gain_control()->Changed.connect (model_connections, boost::bind (&GainMeterBase::gain_changed, this), gui_context());
gain_changed ();
show_gain ();
main_contents.pack_start (hpacker, false, false);
}
- pi->ActiveChanged.connect (active_connection, boost::bind (&GenericPluginUI::processor_active_changed, this, boost::weak_ptr<Processor>(pi)));
+ pi->ActiveChanged.connect (active_connection, boost::bind (&GenericPluginUI::processor_active_changed, this, boost::weak_ptr<Processor>(pi)), gui_context());
bypass_button.set_active (!pi->active());
//control_ui->combo->set_value_in_list(true, false);
set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui));
control_ui->combo->signal_changed().connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::control_combo_changed), control_ui));
- mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::parameter_changed, this, control_ui));
+ mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::parameter_changed, this, control_ui), gui_context());
control_ui->pack_start(control_ui->label, true, true);
control_ui->pack_start(*control_ui->combo, false, true);
//control_ui->combo->set_value_in_list(true, false);
set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui));
control_ui->combo->signal_changed().connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::control_combo_changed), control_ui));
- mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::parameter_changed, this, control_ui));
+ mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::parameter_changed, this, control_ui), gui_context());
control_ui->pack_start(control_ui->label, true, true);
control_ui->pack_start(*control_ui->combo, false, true);
// control_ui->pack_start (control_ui->automate_button, false, false);
control_ui->button->signal_clicked().connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::control_port_toggled), control_ui));
- mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::toggle_parameter_changed, this, control_ui));
+ mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::toggle_parameter_changed, this, control_ui), gui_context());
if (plugin->get_parameter (port_index) > 0.5){
control_ui->button->set_active(true);
automation_state_changed (control_ui);
- mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::parameter_changed, this, control_ui));
- mcontrol->alist()->automation_state_changed.connect (control_connections, boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui));
+ mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::parameter_changed, this, control_ui), gui_context());
+ mcontrol->alist()->automation_state_changed.connect (control_connections, boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui), gui_context());
} else if (plugin->parameter_is_output (port_index)) {
output_controls.push_back (control_ui);
}
- mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::parameter_changed, this, control_ui));
+ mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::parameter_changed, this, control_ui), gui_context());
return control_ui;
}
#include "ardour/session.h"
#include "ardour/route_group.h"
#include "ardour/route.h"
+
+#include "gui_thread.h"
#include "route_group_dialog.h"
#include "group_tabs.h"
#include "keyboard.h"
EditorComponent::set_session (s);
if (_session) {
- _session->RouteGroupChanged.connect (_session_connections, boost::bind (&GroupTabs::set_dirty, this));
+ _session->RouteGroupChanged.connect (_session_connections, boost::bind (&GroupTabs::set_dirty, this), gui_context());
}
}
#include <gtkmm2ext/gtk_ui.h>
#include <boost/bind.hpp>
+#include <boost/bind/protect.hpp>
#define ENSURE_GUI_THREAD(obj,method, ...) \
if (!Gtkmm2ext::UI::instance()->caller_is_self()) { \
return;\
}
+#define gui_context() Gtkmm2ext::UI::instance() /* a UICallback-derived object that specifies the event loop for GUI signal handling */
+#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__))
+
#endif /* __ardour_gtk_gui_thread_h__ */
else
{
marker_time_axis_list.push_back(marker_track) ;
- marker_track->GoingAway.connect (*this, boost::bind (&ImageFrameTimeAxis::remove_time_axis_view, this, marker_track, (void*)this));
+ marker_track->GoingAway.connect (*this, boost::bind (&ImageFrameTimeAxis::remove_time_axis_view, this, marker_track, (void*)this), gui_context());
MarkerTimeAxisAdded(marker_track, src) ; /* EMIT_SIGNAL */
ret = true ;
imageframe_views.push_front(ifv) ;
- ifv->GoingAway.connect (*this, boost::bind (&ImageFrameTimeAxisGroup::remove_imageframe_item, this, (void*)this));
+ ifv->GoingAway.connect (*this, boost::bind (&ImageFrameTimeAxisGroup::remove_imageframe_item, this, (void*)this), gui_context());
ImageFrameAdded(ifv, src) ; /* EMIT_SIGNAL */
}
imageframe_groups.push_front(iftag) ;
- iftag->GoingAway.connect (*this, boost::bind (&ImageFrameTimeAxisView::remove_imageframe_group, this, iftag, (void*)this));
+ iftag->GoingAway.connect (*this, boost::bind (&ImageFrameTimeAxisView::remove_imageframe_group, this, iftag, (void*)this), gui_context());
ImageFrameGroupAdded(iftag, src) ; /* EMIT_SIGNAL */
}
{
marker_view_list.push_back(item) ;
- item->GoingAway.connect (*this, boost::bind (&ImageFrameView::remove_marker_view_item, this, (void*)this));
+ item->GoingAway.connect (*this, boost::bind (&ImageFrameView::remove_marker_view_item, this, (void*)this), gui_context());
MarkerViewAdded(item, src) ; /* EMIT_SIGNAL */
}
signal_delete_event().connect (sigc::mem_fun (*this, &PortInsertWindow::wm_delete), false);
- pi->GoingAway.connect (going_away_connection, boost::bind (&PortInsertWindow::plugin_going_away, this));
+ pi->GoingAway.connect (going_away_connection, boost::bind (&PortInsertWindow::plugin_going_away, this), gui_context());
}
bool
void accept ();
void plugin_going_away ();
- boost::signals2::scoped_connection going_away_connection;
+ PBD::ScopedConnection going_away_connection;
bool wm_delete (GdkEventAny*);
};
{
set_session (s);
set_spacing (1);
- Config->ParameterChanged.connect (_parameter_connection, boost::bind (&LevelMeter::parameter_changed, this, _1));
+ Config->ParameterChanged.connect (_parameter_connection, ui_bind (&LevelMeter::parameter_changed, this, _1), gui_context());
UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &LevelMeter::on_theme_changed));
ColorsChanged.connect (sigc::mem_fun (*this, &LevelMeter::color_handler));
max_peak = minus_infinity();
_meter = meter;
if (_meter) {
- _meter->ConfigurationChanged.connect (_configuration_connection, boost::bind (&LevelMeter::configuration_changed, this, _1, _2));
+ _meter->ConfigurationChanged.connect (_configuration_connection, ui_bind (&LevelMeter::configuration_changed, this, _1, _2), gui_context());
}
}
end_clock.set_sensitive (!location->locked());
length_clock.set_sensitive (!location->locked());
- location->start_changed.connect (connections, boost::bind (&LocationEditRow::start_changed, this, _1));
- location->end_changed.connect (connections, boost::bind (&LocationEditRow::end_changed, this, _1));
- location->name_changed.connect (connections, boost::bind (&LocationEditRow::name_changed, this, _1));
- location->changed.connect (connections, boost::bind (&LocationEditRow::location_changed, this, _1));
- location->FlagsChanged.connect (connections, boost::bind (&LocationEditRow::flags_changed, this, _1, _2));
+ location->start_changed.connect (connections, ui_bind (&LocationEditRow::start_changed, this, _1), gui_context());
+ location->end_changed.connect (connections, ui_bind (&LocationEditRow::end_changed, this, _1), gui_context());
+ location->name_changed.connect (connections, ui_bind (&LocationEditRow::name_changed, this, _1), gui_context());
+ location->changed.connect (connections, ui_bind (&LocationEditRow::location_changed, this, _1), gui_context());
+ location->FlagsChanged.connect (connections, ui_bind (&LocationEditRow::flags_changed, this, _1, _2), gui_context());
}
void
SessionHandlePtr::set_session (s);
if (_session) {
- _session->locations()->changed.connect (_session_connections, boost::bind (&LocationUI::refresh_location_list, this));
- _session->locations()->StateChanged.connect (_session_connections, boost::bind (&LocationUI::refresh_location_list, this));
- _session->locations()->added.connect (_session_connections, boost::bind (&LocationUI::location_added, this, _1));
- _session->locations()->removed.connect (_session_connections, boost::bind (&LocationUI::location_removed, this, _1));
+ _session->locations()->changed.connect (_session_connections, boost::bind (&LocationUI::refresh_location_list, this), gui_context());
+ _session->locations()->StateChanged.connect (_session_connections, boost::bind (&LocationUI::refresh_location_list, this), gui_context());
+ _session->locations()->added.connect (_session_connections, ui_bind (&LocationUI::location_added, this, _1), gui_context());
+ _session->locations()->removed.connect (_session_connections, ui_bind (&LocationUI::location_removed, this, _1), gui_context());
}
refresh_location_list ();
#include "ardour/lv2_plugin.h"
#include "ardour_ui.h"
+#include "gui_thread.h"
#include "lv2_plugin_ui.h"
using namespace Gtk;
}
}
- _lv2->ParameterChanged.connect (parameter_connection, boost::bind (&LV2PluginUI::parameter_changed, this, _1, _2));
+ _lv2->ParameterChanged.connect (parameter_connection, ui_bind (&LV2PluginUI::parameter_changed, this, _1, _2), gui_context());
}
LV2PluginUI::~LV2PluginUI ()
ifv->add_marker_view_item(mv, src) ;
marker_view_list.push_front(mv) ;
- mv->GoingAway.connect (*this, boost::bind (&MarkerTimeAxisView::remove_marker_view, this, (void*)this));
+ mv->GoingAway.connect (*this, boost::bind (&MarkerTimeAxisView::remove_marker_view, this, (void*)this), gui_context());
MarkerViewAdded(mv,src) ; /* EMIT_SIGNAL */
{
_model = model;
content_connection.disconnect ();
- _model->ContentsChanged.connect (content_connection, boost::bind (&MidiRegionView::redisplay_model, this));
+ _model->ContentsChanged.connect (content_connection, boost::bind (&MidiRegionView::redisplay_model, this), gui_context());
clear_events ();
}
}
- ghost->GoingAway.connect (*this, boost::bind (&RegionView::remove_ghost, this, _1));
+ ghost->GoingAway.connect (*this, ui_bind (&RegionView::remove_ghost, this, _1), gui_context());
return ghost;
}
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
-#include <boost/signals2.hpp>
+#include "pbd/signals.h"
#include "ardour/midi_track.h"
#include "ardour/midi_region.h"
std::vector<NoteResizeData *> _resize_data;
/* connection used to connect to model's ContentChanged signal */
- boost::signals2::scoped_connection content_connection;
+ PBD::ScopedConnection content_connection;
ArdourCanvas::CanvasNoteEvent* find_canvas_note (boost::shared_ptr<NoteType>);
Events::iterator _optimization_iterator;
display_region (region_view, wfd);
/* catch regionview going away */
- region->GoingAway.connect (*this, boost::bind (&MidiStreamView::remove_region_view, this, region));
+ region->GoingAway.connect (*this, boost::bind (&MidiStreamView::remove_region_view, this, region), gui_context());
RegionViewAdded (region_view);
sources.push_back(mds->write_source());
mds->write_source()->ViewDataRangeReady.connect
- (rec_data_ready_connections, boost::bind (&MidiStreamView::rec_data_range_ready, this,
- _1, _2, boost::weak_ptr<Source>(mds->write_source())));
+ (rec_data_ready_connections,
+ ui_bind (&MidiStreamView::rec_data_range_ready, this, _1, _2, boost::weak_ptr<Source>(mds->write_source())),
+ gui_context());
// handle multi
set_state (*xml_node, Stateful::loading_state_version);
- _route->processors_changed.connect (*this, boost::bind (&MidiTimeAxisView::processors_changed, this, _1));
+ _route->processors_changed.connect (*this, ui_bind (&MidiTimeAxisView::processors_changed, this, _1), gui_context());
if (is_track()) {
_piano_roll_header = new PianoRollHeader(*midi_view());
_packed = false;
_embedded = false;
- _session->engine().Stopped.connect (*this, boost::bind (&MixerStrip::engine_stopped, this));
- _session->engine().Running.connect (*this, boost::bind (&MixerStrip::engine_running, this));
+ _session->engine().Stopped.connect (*this, boost::bind (&MixerStrip::engine_stopped, this), gui_context());
+ _session->engine().Running.connect (*this, boost::bind (&MixerStrip::engine_running, this), gui_context());
input_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::input_press), false);
output_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::output_press), false);
boost::shared_ptr<AudioTrack> at = audio_track();
- at->FreezeChange.connect (route_connections, boost::bind (&MixerStrip::map_frozen, this));
+ at->FreezeChange.connect (route_connections, boost::bind (&MixerStrip::map_frozen, this), gui_context());
button_table.attach (*rec_enable_button, 0, 2, 2, 3);
rec_enable_button->set_sensitive (_session->writable());
_("Click to Add/Edit Comments"):
_route->comment());
- _route->meter_change.connect (route_connections, boost::bind (&MixerStrip::meter_changed, this, _1));
- _route->input()->changed.connect (route_connections, boost::bind (&MixerStrip::input_changed, this, _1, _2));
- _route->output()->changed.connect (route_connections, boost::bind (&MixerStrip::output_changed, this, _1, _2));
- _route->route_group_changed.connect (route_connections, boost::bind (&MixerStrip::route_group_changed, this));
+ _route->meter_change.connect (route_connections, ui_bind (&MixerStrip::meter_changed, this, _1), gui_context());
+ _route->input()->changed.connect (route_connections, ui_bind (&MixerStrip::input_changed, this, _1, _2), gui_context());
+ _route->output()->changed.connect (route_connections, ui_bind (&MixerStrip::output_changed, this, _1, _2), gui_context());
+ _route->route_group_changed.connect (route_connections, boost::bind (&MixerStrip::route_group_changed, this), gui_context());
if (_route->panner()) {
- _route->panner()->Changed.connect (route_connections, boost::bind (&MixerStrip::connect_to_pan, this));
+ _route->panner()->Changed.connect (route_connections, boost::bind (&MixerStrip::connect_to_pan, this), gui_context());
}
if (is_audio_track()) {
- audio_track()->DiskstreamChanged.connect (route_connections, boost::bind (&MixerStrip::diskstream_changed, this));
+ audio_track()->DiskstreamChanged.connect (route_connections, boost::bind (&MixerStrip::diskstream_changed, this), gui_context());
}
- _route->NameChanged.connect (route_connections, boost::bind (&RouteUI::name_changed, this));
- _route->comment_changed.connect (route_connections, boost::bind (&MixerStrip::comment_changed, this, _1));
- _route->gui_changed.connect (route_connections, boost::bind (&MixerStrip::route_gui_changed, this, _1, _2));
+ _route->NameChanged.connect (route_connections, boost::bind (&RouteUI::name_changed, this), gui_context());
+ _route->comment_changed.connect (route_connections, ui_bind (&MixerStrip::comment_changed, this, _1), gui_context());
+ _route->gui_changed.connect (route_connections, ui_bind (&MixerStrip::route_gui_changed, this, _1, _2), gui_context());
set_stuff_from_route ();
_route->panner()->data().control(Evoral::Parameter(PanAutomation)));
if (pan_control) {
- pan_control->alist()->automation_state_changed.connect (panstate_connection, boost::bind (&PannerUI::pan_automation_state_changed, &panners));
- pan_control->alist()->automation_style_changed.connect (panstyle_connection, boost::bind (&PannerUI::pan_automation_style_changed, &panners));
+ pan_control->alist()->automation_state_changed.connect (panstate_connection, boost::bind (&PannerUI::pan_automation_state_changed, &panners), gui_context());
+ pan_control->alist()->automation_style_changed.connect (panstyle_connection, boost::bind (&PannerUI::pan_automation_style_changed, &panners), gui_context());
}
panners.pan_changed (this);
_current_delivery = send;
send->set_metering (true);
- _current_delivery->GoingAway.connect (send_gone_connection, boost::bind (&MixerStrip::revert_to_default_display, this));
+ _current_delivery->GoingAway.connect (send_gone_connection, boost::bind (&MixerStrip::revert_to_default_display, this), gui_context());
gain_meter().set_controls (_route, send->meter(), send->amp());
gain_meter().setup_meters ();
void input_changed (ARDOUR::IOChange, void *);
void output_changed (ARDOUR::IOChange, void *);
- boost::signals2::scoped_connection panstate_connection;
- boost::signals2::scoped_connection panstyle_connection;
+ PBD::ScopedConnection panstate_connection;
+ PBD::ScopedConnection panstyle_connection;
void connect_to_pan ();
void update_diskstream_display ();
void revert_to_default_display ();
void drop_send ();
- boost::signals2::scoped_connection send_gone_connection;
+ PBD::ScopedConnection send_gone_connection;
void reset_strip_style ();
strip_redisplay_does_not_sync_order_keys = false;
ignore_sync = false;
- Route::SyncOrderKeys.connect (*this, boost::bind (&Mixer_UI::sync_order_keys, this, _1));
+ Route::SyncOrderKeys.connect (*this, ui_bind (&Mixer_UI::sync_order_keys, this, _1), gui_context());
scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
scroller_base.set_name ("MixerWindow");
route->set_order_key (N_("signal"), track_model->children().size()-1);
}
- route->NameChanged.connect (*this, boost::bind (&Mixer_UI::strip_name_changed, this, strip));
+ route->NameChanged.connect (*this, boost::bind (&Mixer_UI::strip_name_changed, this, strip), gui_context());
- strip->GoingAway.connect (*this, boost::bind (&Mixer_UI::remove_strip, this, strip));
+ strip->GoingAway.connect (*this, boost::bind (&Mixer_UI::remove_strip, this, strip), gui_context());
strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed));
strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
}
initial_track_display ();
- _session->RouteAdded.connect (_session_connections, boost::bind (&Mixer_UI::add_strip, this, _1));
- _session->route_group_added.connect (_session_connections, boost::bind (&Mixer_UI::add_route_group, this, _1));
- _session->route_group_removed.connect (_session_connections, boost::bind (&Mixer_UI::route_groups_changed, this));
- _session->config.ParameterChanged.connect (_session_connections, boost::bind (&Mixer_UI::parameter_changed, this, _1));
+ _session->RouteAdded.connect (_session_connections, ui_bind (&Mixer_UI::add_strip, this, _1), gui_context());
+ _session->route_group_added.connect (_session_connections, ui_bind (&Mixer_UI::add_route_group, this, _1), gui_context());
+ _session->route_group_removed.connect (_session_connections, boost::bind (&Mixer_UI::route_groups_changed, this), gui_context());
+ _session->config.ParameterChanged.connect (_session_connections, ui_bind (&Mixer_UI::parameter_changed, this, _1), gui_context());
route_groups_changed ();
focus = true;
}
- group->FlagsChanged.connect (*this, boost::bind (&Mixer_UI::group_flags_changed, this, _1, group));
+ group->FlagsChanged.connect (*this, ui_bind (&Mixer_UI::group_flags_changed, this, _1, group), gui_context());
if (focus) {
TreeViewColumn* col = group_display.get_column (0);
show_all_children();
/* Watch out for changes to parameters */
- _config->ParameterChanged.connect (config_connection, boost::bind (&OptionEditor::parameter_changed, this, _1));
+ _config->ParameterChanged.connect (config_connection, ui_bind (&OptionEditor::parameter_changed, this, _1), gui_context());
}
OptionEditor::~OptionEditor ()
allow_y = false;
allow_target = false;
- panner->StateChanged.connect (state_connection, boost::bind (&Panner2d::handle_state_change, this));
- panner->Changed.connect (change_connection, boost::bind (&Panner2d::handle_position_change, this));
+ panner->StateChanged.connect (state_connection, boost::bind (&Panner2d::handle_state_change, this), gui_context());
+ panner->Changed.connect (change_connection, boost::bind (&Panner2d::handle_position_change, this), gui_context());
drag_target = 0;
set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
return;
}
- _panner->Changed.connect (connections, boost::bind (&PannerUI::panner_changed, this));
- _panner->LinkStateChanged.connect (connections, boost::bind (&PannerUI::update_pan_linkage, this));
- _panner->StateChanged.connect (connections, boost::bind (&PannerUI::update_pan_state, this));
+ _panner->Changed.connect (connections, boost::bind (&PannerUI::panner_changed, this), gui_context());
+ _panner->LinkStateChanged.connect (connections, boost::bind (&PannerUI::update_pan_linkage, this), gui_context());
+ _panner->StateChanged.connect (connections, boost::bind (&PannerUI::update_pan_state, this), gui_context());
setup_pan ();
pan_adjustments.back()->set_value(rx);
pan_adjustments.back()->signal_value_changed().connect (sigc::bind (sigc::mem_fun(*this, &PannerUI::pan_adjustment_changed), (uint32_t) asz));
- _panner->pan_control( asz )->Changed.connect (connections, boost::bind (&PannerUI::pan_value_changed, this, (uint32_t) asz));
+ _panner->pan_control( asz )->Changed.connect (connections, boost::bind (&PannerUI::pan_value_changed, this, (uint32_t) asz), gui_context());
bc->set_name ("PanSlider");
bc->set_shadow_type (Gtk::SHADOW_NONE);
// Connect the realtime signal collection callback
- _plugin_insert->AnalysisDataGathered.connect (analysis_connection, boost::bind (&PluginEqGui::signal_collect_callback, this, _1, _2));
+ _plugin_insert->AnalysisDataGathered.connect (analysis_connection, ui_bind (&PluginEqGui::signal_collect_callback, this, _1, _2), gui_context());
}
PluginEqGui::~PluginEqGui()
manager = mgr;
in_row_change = false;
- manager->PluginListChanged.connect (plugin_list_changed_connection, boost::bind (&PluginSelector::build_plugin_menu, this));
+ manager->PluginListChanged.connect (plugin_list_changed_connection, boost::bind (&PluginSelector::build_plugin_menu, this), gui_context());
build_plugin_menu ();
plugin_model = Gtk::ListStore::create (plugin_columns);
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window*> (this)), false);
- insert->GoingAway.connect (death_connection, boost::bind (&PluginUIWindow::plugin_going_away, this));
+ insert->GoingAway.connect (death_connection, boost::bind (&PluginUIWindow::plugin_going_away, this), gui_context());
gint h = _pluginui->get_preferred_height ();
gint w = _pluginui->get_preferred_width ();
save_button.set_name ("PluginSaveButton");
save_button.signal_clicked().connect(sigc::mem_fun(*this, &PlugUIBase::save_plugin_setting));
- insert->ActiveChanged.connect (active_connection, boost::bind (&PlugUIBase::processor_active_changed, this, boost::weak_ptr<Processor>(insert)));
+ insert->ActiveChanged.connect (active_connection, boost::bind (&PlugUIBase::processor_active_changed, this, boost::weak_ptr<Processor>(insert)), gui_context());
bypass_button.set_active (!pi->active());
plugin_analysis_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &PlugUIBase::toggle_plugin_analysis));
plugin_analysis_expander.set_expanded(false);
- insert->GoingAway.connect (death_connection, boost::bind (&PlugUIBase::plugin_going_away, this));
+ insert->GoingAway.connect (death_connection, boost::bind (&PlugUIBase::plugin_going_away, this), gui_context());
}
PlugUIBase::~PlugUIBase()
private:
Glib::ustring _title;
PlugUIBase* _pluginui;
- boost::signals2::scoped_connection death_connection;
+ PBD::ScopedConnection death_connection;
Gtk::Window* parent;
Gtk::VBox vbox;
bool non_gtk_gui;
#include "ardour/session.h"
#include "ardour/auditioner.h"
+#include "gui_thread.h"
#include "port_group.h"
#include "port_matrix.h"
#include "time_axis_view.h"
}
BundleRecord* br = new BundleRecord (b, io, colour, has_colour);
- b->Changed.connect (br->changed_connection, boost::bind (&PortGroup::bundle_changed, this, _1));
+ b->Changed.connect (br->changed_connection, ui_bind (&PortGroup::bundle_changed, this, _1), gui_context());
_bundles.push_back (br);
Changed ();
{
_groups.push_back (g);
- g->Changed.connect (_changed_connections, boost::bind (&PortGroupList::emit_changed, this));
- g->BundleChanged.connect (_bundle_changed_connections, boost::bind (&PortGroupList::emit_bundle_changed, this, _1));
+ g->Changed.connect (_changed_connections, boost::bind (&PortGroupList::emit_changed, this), gui_context());
+ g->BundleChanged.connect (_bundle_changed_connections, ui_bind (&PortGroupList::emit_bundle_changed, this, _1), gui_context());
emit_changed ();
}
boost::shared_ptr<ARDOUR::IO> io;
Gdk::Color colour;
bool has_colour;
- boost::signals2::scoped_connection changed_connection;
+ PBD::ScopedConnection changed_connection;
BundleRecord (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO>, Gdk::Color, bool has_colour);
};
for (int i = 0; i < 2; ++i) {
/* watch for the content of _ports[] changing */
- _ports[i].Changed.connect (_changed_connections, boost::bind (&PortMatrix::setup, this));
+ _ports[i].Changed.connect (_changed_connections, boost::bind (&PortMatrix::setup, this), gui_context());
/* and for bundles in _ports[] changing */
- _ports[i].BundleChanged.connect (_bundle_changed_connections, boost::bind (&PortMatrix::setup, this));
+ _ports[i].BundleChanged.connect (_bundle_changed_connections, boost::bind (&PortMatrix::setup, this), gui_context());
}
/* scrolling stuff */
/* Part 2: notice when things have changed that require our subclass to clear and refill _ports[] */
/* watch for routes being added or removed */
- _session->RouteAdded.connect (_session_connections, boost::bind (&PortMatrix::routes_changed, this));
+ _session->RouteAdded.connect (_session_connections, boost::bind (&PortMatrix::routes_changed, this), gui_context());
/* and also bundles */
- _session->BundleAdded.connect (_session_connections, boost::bind (&PortMatrix::setup_global_ports, this));
+ _session->BundleAdded.connect (_session_connections, boost::bind (&PortMatrix::setup_global_ports, this), gui_context());
/* and also ports */
- _session->engine().PortRegisteredOrUnregistered.connect (_session_connections, boost::bind (&PortMatrix::setup_global_ports, this));
+ _session->engine().PortRegisteredOrUnregistered.connect (_session_connections, boost::bind (&PortMatrix::setup_global_ports, this), gui_context());
reconnect_to_routes ();
boost::shared_ptr<RouteList> routes = _session->get_routes ();
for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
- (*i)->processors_changed.connect (_route_connections, boost::bind (&PortMatrix::route_processors_changed, this, _1));
+ (*i)->processors_changed.connect (_route_connections, ui_bind (&PortMatrix::route_processors_changed, this, _1), gui_context());
}
}
#include <iostream>
#include "ardour/bundle.h"
#include "ardour/types.h"
+
+#include "gui_thread.h"
#include "port_matrix_body.h"
#include "port_matrix.h"
#include "port_matrix_column_labels.h"
PortGroup::BundleList r = _matrix->visible_rows()->bundles ();
for (PortGroup::BundleList::iterator i = r.begin(); i != r.end(); ++i) {
- (*i)->bundle->Changed.connect (_bundle_connections, boost::bind (&PortMatrixBody::rebuild_and_draw_row_labels, this));
+ (*i)->bundle->Changed.connect (_bundle_connections, boost::bind (&PortMatrixBody::rebuild_and_draw_row_labels, this), gui_context());
}
}
if (_matrix->visible_columns()) {
PortGroup::BundleList c = _matrix->visible_columns()->bundles ();
for (PortGroup::BundleList::iterator i = c.begin(); i != c.end(); ++i) {
- (*i)->bundle->Changed.connect (_bundle_connections, boost::bind (&PortMatrixBody::rebuild_and_draw_column_labels, this));
+ (*i)->bundle->Changed.connect (_bundle_connections, boost::bind (&PortMatrixBody::rebuild_and_draw_column_labels, this), gui_context());
}
}
_active.set_active (_processor->active ());
_active.signal_toggled().connect (sigc::mem_fun (*this, &ProcessorEntry::active_toggled));
- _processor->ActiveChanged.connect (active_connection, boost::bind (&ProcessorEntry::processor_active_changed, this));
- _processor->NameChanged.connect (name_connection, boost::bind (&ProcessorEntry::processor_name_changed, this));
+ _processor->ActiveChanged.connect (active_connection, boost::bind (&ProcessorEntry::processor_active_changed, this), gui_context());
+ _processor->NameChanged.connect (name_connection, boost::bind (&ProcessorEntry::processor_name_changed, this), gui_context());
}
EventBox&
_vbox.pack_start (_fader);
_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &SendProcessorEntry::gain_adjusted));
- _send->amp()->gain_control()->Changed.connect (send_gain_connection, boost::bind (&SendProcessorEntry::show_gain, this));
+ _send->amp()->gain_control()->Changed.connect (send_gain_connection, boost::bind (&SendProcessorEntry::show_gain, this), gui_context());
show_gain ();
}
no_processor_redisplay = false;
_route = r;
- _route->processors_changed.connect (connections, boost::bind (&ProcessorBox::route_processors_changed, this, _1));
- _route->GoingAway.connect (connections, boost::bind (&ProcessorBox::route_going_away, this));
- _route->NameChanged.connect (connections, boost::bind (&ProcessorBox::route_name_changed, this));
+ _route->processors_changed.connect (connections, ui_bind (&ProcessorBox::route_processors_changed, this, _1), gui_context());
+ _route->GoingAway.connect (connections, boost::bind (&ProcessorBox::route_going_away, this), gui_context());
+ _route->NameChanged.connect (connections, boost::bind (&ProcessorBox::route_name_changed, this), gui_context());
redisplay_processors ();
}
#include "ardour/rc_configuration.h"
#include "ardour/control_protocol_manager.h"
#include "control_protocol/control_protocol.h"
+
+#include "gui_thread.h"
#include "rc_option_editor.h"
#include "utils.h"
#include "midi_port_dialog.h"
if ((*i)->input()) {
r[_model.online] = !(*i)->input()->offline();
- (*i)->input()->OfflineStatusChanged.connect (port_connections, boost::bind (&MIDIPorts::port_offline_changed, this, (*i)));
+ (*i)->input()->OfflineStatusChanged.connect (port_connections, boost::bind (&MIDIPorts::port_offline_changed, this, (*i)), gui_context());
r[_model.trace_input] = (*i)->input()->tracing();
}
#include "ardour/region.h"
+#include "gui_thread.h"
#include "region_view.h"
#include "region_selection.h"
#include "time_axis_view.h"
*/
RegionSelection::RegionSelection ()
{
- RegionView::RegionViewGoingAway.connect (death_connection, boost::bind (&RegionSelection::remove_it, this, _1));
+ RegionView::RegionViewGoingAway.connect (death_connection, ui_bind (&RegionSelection::remove_it, this, _1), gui_context());
_current_start = 0;
_current_end = 0;
RegionSelection::RegionSelection (const RegionSelection& other)
: std::list<RegionView*>()
{
- RegionView::RegionViewGoingAway.connect (death_connection, boost::bind (&RegionSelection::remove_it, this, _1));
+ RegionView::RegionViewGoingAway.connect (death_connection, ui_bind (&RegionSelection::remove_it, this, _1), gui_context());
_current_start = other._current_start;
_current_end = other._current_end;
#include <set>
#include <list>
-#include <boost/signals2.hpp>
-
+#include "pbd/signals.h"
#include "ardour/types.h"
class RegionView;
nframes_t _current_end; ///< end position for the selection
std::list<RegionView *> _bylayer; ///< list of regions sorted by layer
- boost::signals2::scoped_connection death_connection;
+ PBD::ScopedConnection death_connection;
};
#endif /* __ardour_gtk_region_selection_h__ */
set_height (trackview.current_height());
- _region->StateChanged.connect (*this, boost::bind (&RegionView::region_changed, this, _1));
+ _region->StateChanged.connect (*this, ui_bind (&RegionView::region_changed, this, _1), gui_context());
group->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_event), group, this));
show_all ();
_return->set_metering (true);
- _return->input()->changed.connect (input_change_connection, boost::bind (&ReturnUI::ins_changed, this, _1, _2));
+ _return->input()->changed.connect (input_change_connection, ui_bind (&ReturnUI::ins_changed, this, _1, _2), gui_context());
_gpm.setup_meters ();
_gpm.set_fader_name ("ReturnUIFrame");
set_name ("ReturnUIWindow");
- r->GoingAway.connect (going_away_connection, boost::bind (&ReturnUIWindow::return_going_away, this));
+ r->GoingAway.connect (going_away_connection, boost::bind (&ReturnUIWindow::return_going_away, this), gui_context());
signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window *> (this)));
}
Gtk::HBox hpacker;
void return_going_away ();
- boost::signals2::scoped_connection going_away_connection;
+ PBD::ScopedConnection going_away_connection;
};
#endif /* __ardour_gtk_return_ui_h__ */
//route_select_list.rows().back().select ();
- route->NameChanged.connect (*this, boost::bind (&RouteParams_UI::route_name_changed, this, boost::weak_ptr<Route>(route)));
- route->GoingAway.connect (*this, boost::bind (&RouteParams_UI::route_removed, this, boost::weak_ptr<Route>(route)));
+ route->NameChanged.connect (*this, boost::bind (&RouteParams_UI::route_name_changed, this, boost::weak_ptr<Route>(route)), gui_context());
+ route->GoingAway.connect (*this, boost::bind (&RouteParams_UI::route_removed, this, boost::weak_ptr<Route>(route)), gui_context());
}
}
latency_packer.pack_start (delay_label);
latency_click_connection = latency_apply_button.signal_clicked().connect (sigc::mem_fun (*latency_widget, &LatencyGUI::finish));
- _route->signal_latency_changed.connect (latency_connections, sigc::mem_fun (*this, &RouteParams_UI::refresh_latency));
- _route->initial_delay_changed.connect (latency_connections, sigc::mem_fun (*this, &RouteParams_UI::refresh_latency));
+ _route->signal_latency_changed.connect (latency_connections, boost::bind (&RouteParams_UI::refresh_latency, this), gui_context());
+ _route->initial_delay_changed.connect (latency_connections, boost::bind (&RouteParams_UI::refresh_latency, this), gui_context());
latency_frame.add (latency_packer);
latency_frame.show_all ();
if (_session) {
boost::shared_ptr<RouteList> r = _session->get_routes();
add_routes (*r);
- _session->RouteAdded.connect (_session_connections, sigc::mem_fun(*this, &RouteParams_UI::add_routes));
+ _session->RouteAdded.connect (_session_connections, ui_bind (&RouteParams_UI::add_routes, this, _1), gui_context());
start_updating ();
} else {
stop_updating ();
setup_processor_boxes();
setup_latency_frame ();
- route->processors_changed.connect (_route_processors_connection, boost::bind (&RouteParams_UI::processors_changed, this, _1));
+ route->processors_changed.connect (_route_processors_connection, ui_bind (&RouteParams_UI::processors_changed, this, _1), gui_context());
track_input_label.set_text (_route->name());
SendUI *send_ui = new SendUI (this, send, _session);
cleanup_view();
- send->GoingAway.connect (_processor_going_away_connection, boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor>(proc)));
+ send->GoingAway.connect (_processor_going_away_connection, boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor>(proc)), gui_context());
_active_view = send_ui;
redir_hpane.add2 (*_active_view);
ReturnUI *return_ui = new ReturnUI (this, retrn, _session);
cleanup_view();
- retrn->GoingAway.connect (_processor_going_away_connection, boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor>(proc)));
+ retrn->GoingAway.connect (_processor_going_away_connection, boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor>(proc)), gui_context());
_active_view = return_ui;
redir_hpane.add2 (*_active_view);
GenericPluginUI *plugin_ui = new GenericPluginUI (plugin_insert, true);
cleanup_view();
- plugin_insert->plugin()->GoingAway.connect (_processor_going_away_connection, boost::bind (&RouteParams_UI::plugin_going_away, this, PreFader));
+ plugin_insert->plugin()->GoingAway.connect (_processor_going_away_connection, boost::bind (&RouteParams_UI::plugin_going_away, this, PreFader), gui_context());
plugin_ui->start_updating (0);
_active_view = plugin_ui;
PortInsertUI *portinsert_ui = new PortInsertUI (this, _session, port_insert);
cleanup_view();
- port_insert->GoingAway.connect (_processor_going_away_connection, boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor> (proc)));
+ port_insert->GoingAway.connect (_processor_going_away_connection, boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor> (proc)), gui_context());
_active_view = portinsert_ui;
redir_hpane.pack2 (*_active_view);
RouteRedirectSelection _rr_selection;
boost::shared_ptr<ARDOUR::Route> _route;
- boost::signals2::scoped_connection _route_processors_connection;
+ PBD::ScopedConnection _route_processors_connection;
boost::shared_ptr<ARDOUR::Processor> _processor;
- boost::signals2::scoped_connection _processor_going_away_connection;
+ PBD::ScopedConnection _processor_going_away_connection;
enum ConfigView {
{
if (find (routes.begin(), routes.end(), r) == routes.end()) {
routes.push_back (r);
- r->GoingAway.connect (*this, boost::bind (&RouteRedirectSelection::removed, this, boost::weak_ptr<Route>(r)));
+ r->GoingAway.connect (*this, boost::bind (&RouteRedirectSelection::removed, this, boost::weak_ptr<Route>(r)), gui_context());
RoutesChanged();
}
}
}
controls_hbox.pack_start(gm.get_level_meter(), false, false);
- _route->meter_change.connect (*this, boost::bind (&RouteTimeAxisView::meter_changed, this, _1));
- _route->input()->changed.connect (*this, boost::bind (&RouteTimeAxisView::io_changed, this, _1, _2));
- _route->output()->changed.connect (*this, boost::bind (&RouteTimeAxisView::io_changed, this, _1, _2));
+ _route->meter_change.connect (*this, ui_bind (&RouteTimeAxisView::meter_changed, this, _1), gui_context());
+ _route->input()->changed.connect (*this, ui_bind (&RouteTimeAxisView::io_changed, this, _1, _2), gui_context());
+ _route->output()->changed.connect (*this, ui_bind (&RouteTimeAxisView::io_changed, this, _1, _2), gui_context());
controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
_y_position = -1;
- _route->mute_changed.connect (*this, boost::bind (&RouteUI::mute_changed, this, _1));
- _route->solo_changed.connect (*this, boost::bind (&RouteUI::solo_changed, this, _1));
- _route->processors_changed.connect (*this, boost::bind (&RouteTimeAxisView::processors_changed, this, _1));
- _route->NameChanged.connect (*this, boost::bind (&RouteTimeAxisView::route_name_changed, this));
- _route->solo_isolated_changed.connect (*this, boost::bind (&RouteUI::solo_changed, this, _1));
+ _route->mute_changed.connect (*this, ui_bind (&RouteUI::mute_changed, this, _1), gui_context());
+ _route->solo_changed.connect (*this, ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
+ _route->processors_changed.connect (*this, ui_bind (&RouteTimeAxisView::processors_changed, this, _1), gui_context());
+ _route->NameChanged.connect (*this, boost::bind (&RouteTimeAxisView::route_name_changed, this), gui_context());
+ _route->solo_isolated_changed.connect (*this, ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
if (is_track()) {
- track()->TrackModeChanged.connect (*this, boost::bind (&RouteTimeAxisView::track_mode_changed, this));
- track()->FreezeChange.connect (*this, boost::bind (&RouteTimeAxisView::map_frozen, this));
- track()->DiskstreamChanged.connect (*this, boost::bind (&RouteTimeAxisView::diskstream_changed, this));
- get_diskstream()->SpeedChanged.connect (*this, boost::bind (&RouteTimeAxisView::speed_changed, this));
+ track()->TrackModeChanged.connect (*this, boost::bind (&RouteTimeAxisView::track_mode_changed, this), gui_context());
+ track()->FreezeChange.connect (*this, boost::bind (&RouteTimeAxisView::map_frozen, this), gui_context());
+ track()->DiskstreamChanged.connect (*this, boost::bind (&RouteTimeAxisView::diskstream_changed, this), gui_context());
+ get_diskstream()->SpeedChanged.connect (*this, boost::bind (&RouteTimeAxisView::speed_changed, this), gui_context());
/* pick up the correct freeze state */
map_frozen ();
if (!Profile->get_sae()) {
items.push_back (MenuElem (_("Alignment"), *alignment_menu));
- get_diskstream()->AlignmentStyleChanged.connect (route_connections, boost::bind (&RouteTimeAxisView::align_style_changed, this));
+ get_diskstream()->AlignmentStyleChanged.connect (route_connections, boost::bind (&RouteTimeAxisView::align_style_changed, this), gui_context());
RadioMenuItem::Group mode_group;
items.push_back (RadioMenuElem (mode_group, _("Normal mode"), sigc::bind (
}
}
- get_diskstream()->AlignmentStyleChanged.connect (route_connections, boost::bind (&RouteTimeAxisView::align_style_changed, this));
+ get_diskstream()->AlignmentStyleChanged.connect (route_connections, boost::bind (&RouteTimeAxisView::align_style_changed, this), gui_context());
mode_menu = build_mode_menu();
if (mode_menu)
show_sends_button->set_self_managed (true);
UI::instance()->set_tip (show_sends_button, _("make mixer strips show sends to this bus"), "");
- _session->SoloChanged.connect (_session_connections, sigc::mem_fun(*this, &RouteUI::solo_changed_so_update_mute));
- _session->TransportStateChange.connect (_session_connections, sigc::mem_fun (*this, &RouteUI::check_rec_enable_sensitivity));
- _session->RecordStateChanged.connect (_session_connections, boost::bind (&RouteUI::session_rec_enable_changed, this));
+ _session->SoloChanged.connect (_session_connections, boost::bind (&RouteUI::solo_changed_so_update_mute, this), gui_context());
+ _session->TransportStateChange.connect (_session_connections, boost::bind (&RouteUI::check_rec_enable_sensitivity, this), gui_context());
+ _session->RecordStateChanged.connect (_session_connections, boost::bind (&RouteUI::session_rec_enable_changed, this), gui_context());
- Config->ParameterChanged.connect (*this, boost::bind (&RouteUI::parameter_changed, this, _1));
+ Config->ParameterChanged.connect (*this, ui_bind (&RouteUI::parameter_changed, this, _1), gui_context());
}
void
}
if (self_destruct) {
- rp->GoingAway.connect (route_connections, boost::bind (&RouteUI::self_delete, this));
+ rp->GoingAway.connect (route_connections, boost::bind (&RouteUI::self_delete, this), gui_context());
}
mute_button->set_controllable (_route->mute_control());
solo_button->set_controllable (_route->solo_control());
- _route->active_changed.connect (route_connections, boost::bind (&RouteUI::route_active_changed, this));
- _route->mute_changed.connect (route_connections, boost::bind (&RouteUI::mute_changed, this, _1));
- _route->solo_changed.connect (route_connections, boost::bind (&RouteUI::solo_changed, this, _1));
- _route->listen_changed.connect (route_connections, boost::bind (&RouteUI::listen_changed, this, _1));
- _route->solo_isolated_changed.connect (route_connections, boost::bind (&RouteUI::solo_changed, this, _1));
+ _route->active_changed.connect (route_connections, boost::bind (&RouteUI::route_active_changed, this), gui_context());
+ _route->mute_changed.connect (route_connections, ui_bind (&RouteUI::mute_changed, this, _1), gui_context());
+ _route->solo_changed.connect (route_connections, ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
+ _route->listen_changed.connect (route_connections, ui_bind (&RouteUI::listen_changed, this, _1), gui_context());
+ _route->solo_isolated_changed.connect (route_connections, ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
if (_session->writable() && is_track()) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
- t->diskstream()->RecordEnableChanged.connect (route_connections, boost::bind (&RouteUI::route_rec_enable_changed, this));
+ t->diskstream()->RecordEnableChanged.connect (route_connections, boost::bind (&RouteUI::route_rec_enable_changed, this), gui_context());
rec_enable_button->show();
rec_enable_button->set_controllable (t->rec_enable_control());
check = new CheckMenuItem(_("Solo Isolate"));
check->set_active (_route->solo_isolated());
check->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::toggle_solo_isolated), check));
- _route->solo_isolated_changed.connect (route_connections, boost::bind (&RouteUI::solo_isolated_toggle, this, _1, check));
+ _route->solo_isolated_changed.connect (route_connections, ui_bind (&RouteUI::solo_isolated_toggle, this, _1, check), gui_context());
items.push_back (CheckMenuElem(*check));
check->show_all();
check = new CheckMenuItem(_("Solo Safe"));
check->set_active (_route->solo_safe());
check->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::toggle_solo_safe), check));
- _route->solo_safe_changed.connect (route_connections, boost::bind (&RouteUI::solo_safe_toggle, this, _1, check));
+ _route->solo_safe_changed.connect (route_connections, ui_bind (&RouteUI::solo_safe_toggle, this, _1, check), gui_context());
items.push_back (CheckMenuElem(*check));
check->show_all();
//items.push_back (SeparatorElem());
// items.push_back (MenuElem (_("MIDI Bind"), sigc::mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
- _route->mute_points_changed.connect (route_connections, boost::bind (&RouteUI::muting_change, this));
+ _route->mute_points_changed.connect (route_connections, boost::bind (&RouteUI::muting_change, this), gui_context());
}
void
#include "ardour/playlist.h"
#include "ardour/rc_configuration.h"
+#include "gui_thread.h"
#include "midi_cut_buffer.h"
#include "region_view.h"
#include "selection.h"
if ((i = find (tracks.begin(), tracks.end(), track)) == tracks.end()) {
void (Selection::*pmf)(TimeAxisView*) = &Selection::remove;
- track->GoingAway.connect (*this, boost::bind (pmf, this, track));
+ track->GoingAway.connect (*this, boost::bind (pmf, this, track), gui_context());
tracks.push_back (track);
} else {
tracks.erase (i);
for (list<TimeAxisView*>::const_iterator i = added.begin(); i != added.end(); ++i) {
void (Selection::*pmf)(TimeAxisView*) = &Selection::remove;
- (*i)->GoingAway.connect (*this, boost::bind (pmf, this, (*i)));
+ (*i)->GoingAway.connect (*this, boost::bind (pmf, this, (*i)), gui_context());
}
if (!added.empty()) {
void (Selection::*pmf)(Marker*) = &Selection::remove;
- m->GoingAway.connect (*this, boost::bind (pmf, this, m));
+ m->GoingAway.connect (*this, boost::bind (pmf, this, m), gui_context());
markers.push_back (m);
MarkersChanged();
_send->set_metering (true);
- _send->input()->changed.connect (connections, boost::bind (&SendUI::ins_changed, this, _1, _2));
- _send->output()->changed.connect (connections, boost::bind (&SendUI::outs_changed, this, _1, _2));
+ _send->input()->changed.connect (connections, ui_bind (&SendUI::ins_changed, this, _1, _2), gui_context());
+ _send->output()->changed.connect (connections, ui_bind (&SendUI::outs_changed, this, _1, _2), gui_context());
_panners.set_width (Wide);
_panners.setup_pan ();
set_name ("SendUIWindow");
- s->GoingAway.connect (going_away_connection, boost::bind (&SendUIWindow::send_going_away, this));
+ s->GoingAway.connect (going_away_connection, boost::bind (&SendUIWindow::send_going_away, this), gui_context());
signal_delete_event().connect (sigc::bind (
sigc::ptr_fun (just_hide_it),
Gtk::HBox hpacker;
void send_going_away ();
- boost::signals2::scoped_connection going_away_connection;
+ PBD::ScopedConnection going_away_connection;
};
#endif /* __ardour_gtk_send_ui_h__ */
#include <gtkmm2ext/utils.h>
+#include "gui_thread.h"
#include "prompter.h"
#include "i18n.h"
ok_button = add_button (_("Import"), Gtk::RESPONSE_ACCEPT);
ok_button->signal_clicked().connect (sigc::mem_fun (*this, &SessionImportDialog::do_merge));
- // prompt signals
- ElementImporter::Rename.connect (connections, boost::bind (&SessionImportDialog::open_rename_dialog, this, _1, _2));
- ElementImporter::Prompt.connect (connections, boost::bind (&SessionImportDialog::open_prompt_dialog, this, _1));
-
+ // prompt signals XXX: problem - handlers to be in the same thread since they return values
+ ElementImporter::Rename.connect_same_thread (connections, boost::bind (&SessionImportDialog::open_rename_dialog, this, _1, _2));
+ ElementImporter::Prompt.connect_same_thread (connections, boost::bind (&SessionImportDialog::open_prompt_dialog, this, _1));
+
// Finalize
show_all();
}
#include "ardour/auditioner.h"
#include "ardour/audioengine.h"
#include "ardour/port.h"
+
+#include "gui_thread.h"
#include "session_option_editor.h"
#include "port_matrix.h"
#include "i18n.h"
sigc::mem_fun (*_session_config, &SessionConfiguration::set_sync_source)
);
- s->MTC_PortChanged.connect (_session_connections, boost::bind (&SessionOptionEditor::populate_sync_options, this, s, ssrc));
- s->MIDIClock_PortChanged.connect (_session_connections, boost::bind (&SessionOptionEditor::populate_sync_options, this, s, ssrc));
- s->config.ParameterChanged.connect (_session_connections, boost::bind (&SessionOptionEditor::follow_sync_state, this, _1, s, ssrc));
+ s->MTC_PortChanged.connect (_session_connections, boost::bind (&SessionOptionEditor::populate_sync_options, this, s, ssrc), gui_context());
+ s->MIDIClock_PortChanged.connect (_session_connections, boost::bind (&SessionOptionEditor::populate_sync_options, this, s, ssrc), gui_context());
+ s->config.ParameterChanged.connect (_session_connections, ui_bind (&SessionOptionEditor::follow_sync_state, this, _1, s, ssrc), gui_context());
populate_sync_options (s, ssrc);
follow_sync_state (string ("external-sync"), s, ssrc);
set_default_size (pixbuf->get_width(), pixbuf->get_height());
the_splash = this;
- ARDOUR::BootMessage.connect (msg_connection, boost::bind (&Splash::boot_message, this, _1));
+ ARDOUR::BootMessage.connect (msg_connection, ui_bind (&Splash::boot_message, this, _1), gui_context());
}
void
canvas_rect, &_trackview));
if (_trackview.is_track()) {
- _trackview.track()->DiskstreamChanged.connect (*this, boost::bind (&StreamView::diskstream_changed, this));
- _trackview.get_diskstream()->RecordEnableChanged.connect (*this, boost::bind (&StreamView::rec_enable_changed, this));
+ _trackview.track()->DiskstreamChanged.connect (*this, boost::bind (&StreamView::diskstream_changed, this), gui_context());
+ _trackview.get_diskstream()->RecordEnableChanged.connect (*this, boost::bind (&StreamView::rec_enable_changed, this), gui_context());
- _trackview.session()->TransportStateChange.connect (*this, boost::bind (&StreamView::transport_changed, this));
- _trackview.session()->TransportLooped.connect (*this, boost::bind (&StreamView::transport_looped, this));
- _trackview.session()->RecordStateChanged.connect (*this, boost::bind (&StreamView::sess_rec_enable_changed, this));
+ _trackview.session()->TransportStateChange.connect (*this, boost::bind (&StreamView::transport_changed, this), gui_context());
+ _trackview.session()->TransportLooped.connect (*this, boost::bind (&StreamView::transport_looped, this), gui_context());
+ _trackview.session()->RecordStateChanged.connect (*this, boost::bind (&StreamView::sess_rec_enable_changed, this), gui_context());
}
ColorsChanged.connect (sigc::mem_fun (*this, &StreamView::color_handler));
{
playlist_change_connection.disconnect();
playlist_changed (ds);
- ds->PlaylistChanged.connect (playlist_change_connection, boost::bind (&StreamView::playlist_changed_weak, this, boost::weak_ptr<Diskstream> (ds)));
+ ds->PlaylistChanged.connect (playlist_change_connection, boost::bind (&StreamView::playlist_changed_weak, this, boost::weak_ptr<Diskstream> (ds)), gui_context());
}
void
/* catch changes */
- ds->playlist()->Modified.connect (playlist_connections, boost::bind (&StreamView::playlist_modified_weak, this, ds));
- ds->playlist()->RegionAdded.connect (playlist_connections, boost::bind (&StreamView::add_region_view_weak, this, _1));
- ds->playlist()->RegionRemoved.connect (playlist_connections, boost::bind (&StreamView::remove_region_view, this, _1));
+ ds->playlist()->Modified.connect (playlist_connections, boost::bind (&StreamView::playlist_modified_weak, this, ds), gui_context());
+ ds->playlist()->RegionAdded.connect (playlist_connections, ui_bind (&StreamView::add_region_view_weak, this, _1), gui_context());
+ ds->playlist()->RegionRemoved.connect (playlist_connections, ui_bind (&StreamView::remove_region_view, this, _1), gui_context());
}
void
uint32_t stream_base_color; ///< Background color
PBD::ScopedConnectionList playlist_connections;
- boost::signals2::scoped_connection playlist_change_connection;
+ PBD::ScopedConnection playlist_change_connection;
ARDOUR::layer_t _layers;
LayerDisplay _layer_display;
#include <gtkmm/stock.h>
#include "ardour/audioregion.h"
#include "ardour/audiosource.h"
+
#include "ardour/dB.h"
#include "ardour_ui.h"
+#include "gui_thread.h"
#include "strip_silence_dialog.h"
#include "canvas_impl.h"
#include "waveview.h"
int n = 0;
for (std::list<Wave>::iterator i = _waves.begin(); i != _waves.end(); ++i) {
- if (i->region->audio_source(0)->peaks_ready (boost::bind (&StripSilenceDialog::peaks_ready, this), _peaks_ready_connection)) {
+ if (i->region->audio_source(0)->peaks_ready (boost::bind (&StripSilenceDialog::peaks_ready, this), _peaks_ready_connection, gui_context())) {
i->view = new WaveView (*(_canvas->root()));
i->view->property_data_src() = static_cast<gpointer>(i->region.get());
i->view->property_cache() = WaveView::create_cache ();
int _wave_width;
int _wave_height;
- boost::signals2::scoped_connection _peaks_ready_connection;
+ PBD::ScopedConnection _peaks_ready_connection;
};
/* every time the wave data changes and peaks are ready, redraw */
for (uint32_t n = 0; n < audio_region()->n_channels(); ++n) {
- audio_region()->audio_source(n)->PeaksReady.connect (*this, boost::bind (&TapeAudioRegionView::update, this, n));
+ audio_region()->audio_source(n)->PeaksReady.connect (*this, boost::bind (&TapeAudioRegionView::update, this, n), gui_context());
}
}
#include "ardour/location.h"
#include "ardour_ui.h"
+#include "gui_thread.h"
#include "public_editor.h"
#include "time_axis_view.h"
#include "region_view.h"
if(gr) {
ghosts.push_back(gr);
- gr->GoingAway.connect (*this, boost::bind (&TimeAxisView::erase_ghost, this, _1));
+ gr->GoingAway.connect (*this, ui_bind (&TimeAxisView::erase_ghost, this, _1), gui_context());
}
}
sframes_t start, nframes_t cnt, double samples_per_visual_peak) const;
int build_peaks ();
- bool peaks_ready (boost::function<void()> callWhenReady, PBD::Connection& connection_created_if_not_ready) const;
+ bool peaks_ready (boost::function<void()> callWhenReady, PBD::Connection& connection_created_if_not_ready, PBD::EventLoop* event_loop) const;
mutable PBD::Signal0<void> PeaksReady;
mutable PBD::Signal2<void,nframes_t,nframes_t> PeakRangeReady;
public:
MidiControlUI (Session& s);
~MidiControlUI ();
+
+ static MidiControlUI* instance() { return _instance; }
static BaseUI::RequestType PortChange;
bool midi_input_handler (Glib::IOCondition, MIDI::Port*);
void reset_ports ();
void clear_ports ();
+
+ static MidiControlUI* _instance;
};
}
#include "pbd/pool.h"
#include "pbd/ringbuffer.h"
-#include "pbd/ui_callback.h"
+#include "pbd/event_loop.h"
#include "ardour/types.h"
boost::shared_ptr<RouteList> routes; /* apply to */
boost::function<void (void)> rt_slot; /* what to call in RT context */
RTeventCallback rt_return; /* called after rt_slot, with this event as an argument */
- PBD::UICallback* ui;
+ PBD::EventLoop* event_loop;
std::list<AudioRange> audio_range;
std::list<MusicRange> music_range;
, speed (spd)
, yes_or_no (yn)
, second_yes_or_no (yn2)
- , ui (0) {}
+ , event_loop (0) {}
void set_ptr (void* p) {
ptr = p;
#include "ardour/audio_port.h"
#include "ardour/audioengine.h"
#include "ardour/audiofilesource.h"
+
#include "ardour/audioplaylist.h"
#include "ardour/audioregion.h"
#include "ardour/butler.h"
continue; /* XXX is this OK? */
}
- region->GoingAway.connect (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
+ region->GoingAway.connect_same_thread (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
_last_capture_regions.push_back (region);
} else {
_crossfades.push_back (xfade);
- xfade->Invalidated.connect (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
- xfade->StateChanged.connect (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
+ xfade->Invalidated.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
+ xfade->StateChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
notify_crossfade_added (xfade);
}
try {
boost::shared_ptr<Crossfade> xfade = boost::shared_ptr<Crossfade> (new Crossfade (*((const Playlist *)this), *child));
_crossfades.push_back (xfade);
- xfade->Invalidated.connect (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
- xfade->StateChanged.connect (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
+ xfade->Invalidated.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
+ xfade->StateChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
NewCrossfade(xfade);
}
if (audio_diskstream()->deprecated_io_node) {
if (!IO::connecting_legal) {
- IO::ConnectingLegal.connect (*this, boost::bind (&AudioTrack::deprecated_use_diskstream_connections, this));
+ IO::ConnectingLegal.connect_same_thread (*this, boost::bind (&AudioTrack::deprecated_use_diskstream_connections, this));
} else {
deprecated_use_diskstream_connections ();
}
pending_state = const_cast<XMLNode*> (&node);
if (_session.state_of_the_state() & Session::Loading) {
- _session.StateReady.connect (*this, boost::bind (&AudioTrack::set_state_part_two, this));
+ _session.StateReady.connect_same_thread (*this, boost::bind (&AudioTrack::set_state_part_two, this));
} else {
set_state_part_two ();
}
{
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
if (afs) {
- afs->HeaderPositionOffsetChanged.connect (*this, boost::bind (&AudioRegion::source_offset_changed, this));
+ afs->HeaderPositionOffsetChanged.connect_same_thread (*this, boost::bind (&AudioRegion::source_offset_changed, this));
}
init ();
{
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
if (afs) {
- afs->HeaderPositionOffsetChanged.connect (*this, boost::bind (&AudioRegion::source_offset_changed, this));
+ afs->HeaderPositionOffsetChanged.connect_same_thread (*this, boost::bind (&AudioRegion::source_offset_changed, this));
}
init ();
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> ((*i));
if (afs) {
- afs->HeaderPositionOffsetChanged.connect (*this, boost::bind (&AudioRegion::source_offset_changed, this));
+ afs->HeaderPositionOffsetChanged.connect_same_thread (*this, boost::bind (&AudioRegion::source_offset_changed, this));
}
}
{
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
if (afs) {
- afs->HeaderPositionOffsetChanged.connect (*this, boost::bind (&AudioRegion::source_offset_changed, this));
+ afs->HeaderPositionOffsetChanged.connect_same_thread (*this, boost::bind (&AudioRegion::source_offset_changed, this));
}
init ();
AudioRegion::connect_to_analysis_changed ()
{
for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) {
- (*i)->AnalysisChanged.connect (*this, boost::bind (&AudioRegion::invalidate_transients, this));
+ (*i)->AnalysisChanged.connect_same_thread (*this, boost::bind (&AudioRegion::invalidate_transients, this));
}
}
unique_srcs.insert (*i);
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (*i);
if (afs) {
- afs->HeaderPositionOffsetChanged.connect (*this, boost::bind (&AudioRegion::source_offset_changed, this));
+ afs->HeaderPositionOffsetChanged.connect_same_thread (*this, boost::bind (&AudioRegion::source_offset_changed, this));
}
}
}
void
AudioRegion::listen_to_my_curves ()
{
- _envelope->StateChanged.connect (*this, boost::bind (&AudioRegion::envelope_changed, this));
- _fade_in->StateChanged.connect (*this, boost::bind (&AudioRegion::fade_in_changed, this));
- _fade_out->StateChanged.connect (*this, boost::bind (&AudioRegion::fade_out_changed, this));
+ _envelope->StateChanged.connect_same_thread (*this, boost::bind (&AudioRegion::envelope_changed, this));
+ _fade_in->StateChanged.connect_same_thread (*this, boost::bind (&AudioRegion::fade_in_changed, this));
+ _fade_out->StateChanged.connect_same_thread (*this, boost::bind (&AudioRegion::fade_out_changed, this));
}
void
***********************************************************************/
bool
-AudioSource::peaks_ready (boost::function<void()> doThisWhenReady, Connection& connect_here_if_not) const
+AudioSource::peaks_ready (boost::function<void()> doThisWhenReady, Connection& connect_here_if_not, EventLoop* event_loop) const
{
bool ret;
Glib::Mutex::Lock lm (_peaks_ready_lock);
*/
if (!(ret = _peaks_built)) {
- PeaksReady.connect (connect_here_if_not, doThisWhenReady);
+ PeaksReady.connect (connect_here_if_not, doThisWhenReady, event_loop);
}
return ret;
_main_outs->allow_pan_reset ();
_main_outs->reset_panner ();
- _output->changed.connect (*this, boost::bind (&Auditioner::output_changed, this, _1, _2));
+ _output->changed.connect_same_thread (*this, boost::bind (&Auditioner::output_changed, this, _1, _2));
the_region.reset ((AudioRegion*) 0);
g_atomic_int_set (&_active, 0);
_display_to_user = false;
if (_output) {
- _output->changed.connect (*this, boost::bind (&Delivery::output_changed, this, _1, _2));
+ _output->changed.connect_same_thread (*this, boost::bind (&Delivery::output_changed, this, _1, _2));
}
- CycleStart.connect (*this, boost::bind (&Delivery::cycle_start, this, _1));
+ CycleStart.connect_same_thread (*this, boost::bind (&Delivery::cycle_start, this, _1));
}
/* deliver to a new IO object */
_display_to_user = false;
if (_output) {
- _output->changed.connect (*this, boost::bind (&Delivery::output_changed, this, _1, _2));
+ _output->changed.connect_same_thread (*this, boost::bind (&Delivery::output_changed, this, _1, _2));
}
- CycleStart.connect (*this, boost::bind (&Delivery::cycle_start, this, _1));
+ CycleStart.connect_same_thread (*this, boost::bind (&Delivery::cycle_start, this, _1));
}
/* deliver to a new IO object, reconstruct from XML */
}
if (_output) {
- _output->changed.connect (*this, boost::bind (&Delivery::output_changed, this, _1, _2));
+ _output->changed.connect_same_thread (*this, boost::bind (&Delivery::output_changed, this, _1, _2));
}
- CycleStart.connect (*this, boost::bind (&Delivery::cycle_start, this, _1));
+ CycleStart.connect_same_thread (*this, boost::bind (&Delivery::cycle_start, this, _1));
}
/* deliver to an existing IO object, reconstruct from XML */
}
if (_output) {
- _output->changed.connect (*this, boost::bind (&Delivery::output_changed, this, _1, _2));
+ _output->changed.connect_same_thread (*this, boost::bind (&Delivery::output_changed, this, _1, _2));
}
- CycleStart.connect (*this, boost::bind (&Delivery::cycle_start, this, _1));
+ CycleStart.connect_same_thread (*this, boost::bind (&Delivery::cycle_start, this, _1));
}
std::string
}
} else {
panner_legal_c.disconnect ();
- PannersLegal.connect (panner_legal_c, boost::bind (&Delivery::panners_became_legal, this));
+ PannersLegal.connect_same_thread (panner_legal_c, boost::bind (&Delivery::panners_became_legal, this));
}
}
_io = _route->input();
ic_connection.disconnect();
- _io->changed.connect (ic_connection, boost::bind (&Diskstream::handle_input_change, this, _1, _2));
+ _io->changed.connect_same_thread (ic_connection, boost::bind (&Diskstream::handle_input_change, this, _1, _2));
input_change_pending = ConfigurationChanged;
non_realtime_input_change ();
set_align_style_from_io ();
- _route->GoingAway.connect (*this, boost::bind (&Diskstream::route_going_away, this));
+ _route->GoingAway.connect_same_thread (*this, boost::bind (&Diskstream::route_going_away, this));
}
void
reset_write_sources (false);
}
- _playlist->Modified.connect (playlist_connections, boost::bind (&Diskstream::playlist_modified, this));
- _playlist->GoingAway.connect (playlist_connections, boost::bind (&Diskstream::playlist_deleted, this, boost::weak_ptr<Playlist>(_playlist)));
- _playlist->RangesMoved.connect (playlist_connections, boost::bind (&Diskstream::playlist_ranges_moved, this, _1));
+ _playlist->Modified.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_modified, this));
+ _playlist->GoingAway.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_deleted, this, boost::weak_ptr<Playlist>(_playlist)));
+ _playlist->RangesMoved.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_ranges_moved, this, _1));
}
/* don't do this if we've already asked for it *or* if we are setting up
throw ExportFailed ("Unhandled type in ExportChannelFactory constructor");
}
- session->ProcessExport.connect (export_connection, boost::bind (&RegionExportChannelFactory::new_cycle_started, this, _1));
+ session->ProcessExport.connect_same_thread (export_connection, boost::bind (&RegionExportChannelFactory::new_cycle_started, this, _1));
buffers.set_count (ChanCount (DataType::AUDIO, n_channels));
buffers.ensure_buffers (DataType::AUDIO, n_channels, frames_per_cycle);
ExportFormatManager::add_compatibility (CompatPtr ptr)
{
compatibilities.push_back (ptr);
- ptr->SelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_compatibility_selection, this, _1, WeakCompatPtr (ptr)));
+ ptr->SelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_compatibility_selection, this, _1, WeakCompatPtr (ptr)));
}
void
ExportFormatManager::add_quality (QualityPtr ptr)
{
- ptr->SelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_quality_selection, this, _1, WeakQualityPtr (ptr)));
+ ptr->SelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_quality_selection, this, _1, WeakQualityPtr (ptr)));
qualities.push_back (ptr);
}
ExportFormatManager::add_format (FormatPtr ptr)
{
formats.push_back (ptr);
- ptr->SelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_format_selection, this, _1, WeakFormatPtr (ptr)));
+ ptr->SelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_format_selection, this, _1, WeakFormatPtr (ptr)));
universal_set = universal_set->get_union (*ptr);
/* Encoding options */
boost::shared_ptr<HasSampleFormat> hsf;
if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (ptr)) {
- hsf->SampleFormatSelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_sample_format_selection, this, _1, _2));
- hsf->DitherTypeSelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_dither_type_selection, this, _1, _2));
+ hsf->SampleFormatSelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_sample_format_selection, this, _1, _2));
+ hsf->DitherTypeSelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_dither_type_selection, this, _1, _2));
}
}
void
ExportFormatManager::add_sample_rate (SampleRatePtr ptr)
{
- ptr->SelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_sample_rate_selection, this, _1, WeakSampleRatePtr (ptr)));
+ ptr->SelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_sample_rate_selection, this, _1, WeakSampleRatePtr (ptr)));
sample_rates.push_back (ptr);
}
SampleFormatPtr ptr (new SampleFormatState (format, get_sample_format_name (format)));
sample_format_states.push_back (ptr);
- ptr->SelectChanged.connect (*this, boost::bind (&HasSampleFormat::update_sample_format_selection, this, _1));
+ ptr->SelectChanged.connect_same_thread (*this, boost::bind (&HasSampleFormat::update_sample_format_selection, this, _1));
// BOOST SIGNALS how to connect one signal to another
- // ptr->SelectChanged.connect (*this, boost::bind (SampleFormatSelectChanged, _1, WeakSampleFormatPtr (ptr));
- // ptr->CompatibleChanged.connect (*this, boost::bind (SampleFormatCompatibleChanged, _1, WeakSampleFormatPtr (ptr));
+ // ptr->SelectChanged.connect_same_thread (*this, boost::bind (SampleFormatSelectChanged, _1, WeakSampleFormatPtr (ptr));
+ // ptr->CompatibleChanged.connect_same_thread (*this, boost::bind (SampleFormatCompatibleChanged, _1, WeakSampleFormatPtr (ptr));
}
void
{
DitherTypePtr ptr (new DitherTypeState (type, name));
dither_type_states.push_back (ptr);
- ptr->SelectChanged.connect (*this, boost::bind (&HasSampleFormat::update_dither_type_selection, this, _1));
+ ptr->SelectChanged.connect_same_thread (*this, boost::bind (&HasSampleFormat::update_dither_type_selection, this, _1));
// BOOST SIGNALS how to connect one signal to another
- // ptr->SelectChanged.connect (*this, boost::bind (DitherTypeSelectChanged, _1, WeakDitherTypePtr (ptr));
- // ptr->CompatibleChanged.connect (*this, boost::bind (DitherTypeCompatibleChanged, _1, WeakDitherTypePtr (ptr));
+ // ptr->SelectChanged.connect_same_thread (*this, boost::bind (DitherTypeSelectChanged, _1, WeakDitherTypePtr (ptr));
+ // ptr->CompatibleChanged.connect_same_thread (*this, boost::bind (DitherTypeCompatibleChanged, _1, WeakDitherTypePtr (ptr));
}
HasSampleFormat::SampleFormatPtr
{
processor.reset (new ExportProcessor (session));
- ExportProcessor::WritingFile.connect (files_written_connection, boost::bind (&ExportHandler::add_file, this, _1));
+ ExportProcessor::WritingFile.connect_same_thread (files_written_connection, boost::bind (&ExportHandler::add_file, this, _1));
}
ExportHandler::~ExportHandler ()
realtime = rt;
- session.ExportReadFinished.connect (export_read_finished_connection, boost::bind (&ExportHandler::finish_timespan, this));
+ session.ExportReadFinished.connect_same_thread (export_read_finished_connection, boost::bind (&ExportHandler::finish_timespan, this));
start_timespan ();
}
/* connect stuff and start export */
- session.ProcessExport.connect (current_timespan->process_connection, boost::bind (&ExportTimespan::process, current_timespan, _1));
+ session.ProcessExport.connect_same_thread (current_timespan->process_connection, boost::bind (&ExportTimespan::process, current_timespan, _1));
session.start_audio_export (current_timespan->get_start(), realtime);
}
cc = current_map_it->second.channel_config;
}
- cc->FilesWritten.connect (channel_config_connection, boost::bind (&ExportHandler::timespan_thread_finished, this));
+ cc->FilesWritten.connect_same_thread (channel_config_connection, boost::bind (&ExportHandler::timespan_thread_finished, this));
++current_map_it;
} else { /* All files are written from current timespan, reset timespan and start new */
: Return (s, true)
, user_count (0)
{
- CycleStart.connect (*this, boost::bind (&InternalReturn::cycle_start, this, _1));
+ CycleStart.connect_same_thread (*this, boost::bind (&InternalReturn::cycle_start, this, _1));
}
InternalReturn::InternalReturn (Session& s, const XMLNode& node)
: Return (s, node, true)
, user_count (0)
{
- CycleStart.connect (*this, boost::bind (&InternalReturn::cycle_start, this, _1));
+ CycleStart.connect_same_thread (*this, boost::bind (&InternalReturn::cycle_start, this, _1));
}
void
set_name (sendto->name());
- _send_to->GoingAway.connect (*this, boost::bind (&InternalSend::send_to_going_away, this));
- _send_to->NameChanged.connect (*this, boost::bind (&InternalSend::send_to_name_changed, this));
+ _send_to->GoingAway.connect_same_thread (*this, boost::bind (&InternalSend::send_to_going_away, this));
+ _send_to->NameChanged.connect_same_thread (*this, boost::bind (&InternalSend::send_to_name_changed, this));
}
InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
*/
if (!IO::connecting_legal) {
- IO::ConnectingLegal.connect (connect_c, boost::bind (&InternalSend::connect_when_legal, this));
+ IO::ConnectingLegal.connect_same_thread (connect_c, boost::bind (&InternalSend::connect_when_legal, this));
} else {
connect_when_legal ();
}
pending_state_node = new XMLNode (node);
pending_state_node_version = version;
pending_state_node_in = false;
- ConnectingLegal.connect (connection_legal_c, boost::bind (&IO::connecting_became_legal, this));
+ ConnectingLegal.connect_same_thread (connection_legal_c, boost::bind (&IO::connecting_became_legal, this));
}
pending_state_node = new XMLNode (node);
pending_state_node_version = version;
pending_state_node_in = in;
- ConnectingLegal.connect (connection_legal_c, boost::bind (&IO::connecting_became_legal, this));
+ ConnectingLegal.connect_same_thread (connection_legal_c, boost::bind (&IO::connecting_became_legal, this));
}
return 0;
IO::UserBundleInfo::UserBundleInfo (IO* io, boost::shared_ptr<UserBundle> b)
{
bundle = b;
- b->Changed.connect (changed, boost::bind (&IO::bundle_changed, io, _1));
+ b->Changed.connect_same_thread (changed, boost::bind (&IO::bundle_changed, io, _1));
}
std::string
std::cerr << "MIDIClock_Slave: connecting to port " << port->name() << std::endl;
#endif
- port->input()->timing.connect (port_connections, boost::bind (&MIDIClock_Slave::update_midi_clock, this, _1, _2));
- port->input()->start.connect (port_connections, boost::bind (&MIDIClock_Slave::start, this, _1, _2));
- port->input()->contineu.connect (port_connections, boost::bind (&MIDIClock_Slave::contineu, this, _1, _2));
- port->input()->stop.connect (port_connections, boost::bind (&MIDIClock_Slave::stop, this, _1, _2));
- port->input()->position.connect (port_connections, boost::bind (&MIDIClock_Slave::position, this, _1, _2, 3));
+ port->input()->timing.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::update_midi_clock, this, _1, _2));
+ port->input()->start.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::start, this, _1, _2));
+ port->input()->contineu.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::contineu, this, _1, _2));
+ port->input()->stop.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::stop, this, _1, _2));
+ port->input()->position.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::position, this, _1, _2, 3));
}
void
continue; /* XXX is this OK? */
}
- region->GoingAway.connect (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
+ region->GoingAway.connect_same_thread (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
_last_capture_regions.push_back (region);
: Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::MIDI, 0, Region::Flag(Region::DefaultFlags|Region::External))
{
assert(_name.find("/") == string::npos);
- midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1));
+ midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
/* Basic MidiRegion constructor (one channel) */
: Region (src, start, length, name, DataType::MIDI, layer, flags)
{
assert(_name.find("/") == string::npos);
- midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1));
+ midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
/* Basic MidiRegion constructor (many channels) */
: Region (srcs, start, length, name, DataType::MIDI, layer, flags)
{
assert(_name.find("/") == string::npos);
- midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1));
+ midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
: Region (other, offset, length, name, layer, flags)
{
assert(_name.find("/") == string::npos);
- midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1));
+ midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other)
: Region (other)
{
assert(_name.find("/") == string::npos);
- midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1));
+ midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node)
throw failed_constructor();
}
- midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1));
+ midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
assert(_name.find("/") == string::npos);
assert(_type == DataType::MIDI);
}
throw failed_constructor();
}
- midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1));
+ midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
assert(_name.find("/") == string::npos);
assert(_type == DataType::MIDI);
}
pending_state = const_cast<XMLNode*> (&node);
if (_session.state_of_the_state() & Session::Loading) {
- _session.StateReady.connect (*this, boost::bind (&MidiTrack::set_state_part_two, this));
+ _session.StateReady.connect_same_thread (*this, boost::bind (&MidiTrack::set_state_part_two, this));
} else {
set_state_part_two ();
}
#include "i18n.h"
BaseUI::RequestType MidiControlUI::PortChange = BaseUI::new_request_type();
+MidiControlUI* MidiControlUI::_instance = 0;
#include "pbd/abstract_ui.cc" /* instantiate the template */
: AbstractUI<MidiUIRequest> (_("midiui"))
, _session (s)
{
- MIDI::Manager::instance()->PortsChanged.connect (rebind_connection, boost::bind (&MidiControlUI::change_midi_ports, this));
+ MIDI::Manager::instance()->PortsChanged.connect_same_thread (rebind_connection, boost::bind (&MidiControlUI::change_midi_ports, this));
+ _instance = this;
}
MidiControlUI::~MidiControlUI ()
{
clear_ports ();
+ _instance = 0;
}
void
port = &p;
- port->input()->mtc_time.connect (port_connections, boost::bind (&MTC_Slave::update_mtc_time, this, _1, _2, _3));
- port->input()->mtc_qtr.connect (port_connections, boost::bind (&MTC_Slave::update_mtc_qtr, this, _1, _2, _3));
- port->input()->mtc_status.connect (port_connections, boost::bind (&MTC_Slave::update_mtc_status, this, _1));
+ port->input()->mtc_time.connect_same_thread (port_connections, boost::bind (&MTC_Slave::update_mtc_time, this, _1, _2, _3));
+ port->input()->mtc_qtr.connect_same_thread (port_connections, boost::bind (&MTC_Slave::update_mtc_qtr, this, _1, _2, _3));
+ port->input()->mtc_status.connect_same_thread (port_connections, boost::bind (&MTC_Slave::update_mtc_status, this, _1));
}
void
freeze_length = 0;
_explicit_relayering = false;
- Modified.connect (*this, boost::bind (&Playlist::mark_session_dirty, this));
+ Modified.connect_same_thread (*this, boost::bind (&Playlist::mark_session_dirty, this));
}
Playlist::~Playlist ()
}
}
- region->StateChanged.connect (region_state_changed_connections, boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region)));
+ region->StateChanged.connect_same_thread (region_state_changed_connections, boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region)));
return true;
}
_sources.push_back (src);
_master_sources.push_back (src);
- src->GoingAway.connect (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(src)));
+ src->GoingAway.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(src)));
assert(_sources.size() > 0);
_positional_lock_style = AudioTime;
for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) {
_sources.push_back (*i);
- (*i)->GoingAway.connect (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
+ (*i)->GoingAway.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
unique_srcs.insert (*i);
}
for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) {
_master_sources.push_back (*i);
if (unique_srcs.find (*i) == unique_srcs.end()) {
- (*i)->GoingAway.connect (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
+ (*i)->GoingAway.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
}
}
}
/* now that we have _meter, its safe to connect to this */
- Metering::Meter.connect (*this, (boost::bind (&Route::meter, this)));
+ Metering::Meter.connect_same_thread (*this, (boost::bind (&Route::meter, this)));
}
Route::Route (Session& sess, const XMLNode& node, DataType default_type)
/* now that we have _meter, its safe to connect to this */
- Metering::Meter.connect (*this, (boost::bind (&Route::meter, this)));
+ Metering::Meter.connect_same_thread (*this, (boost::bind (&Route::meter, this)));
}
void
_input.reset (new IO (_session, _name, IO::Input, _default_type));
_output.reset (new IO (_session, _name, IO::Output, _default_type));
- _input->changed.connect (*this, boost::bind (&Route::input_change_handler, this, _1, _2));
- _output->changed.connect (*this, boost::bind (&Route::output_change_handler, this, _1, _2));
+ _input->changed.connect_same_thread (*this, boost::bind (&Route::input_change_handler, this, _1, _2));
+ _output->changed.connect_same_thread (*this, boost::bind (&Route::output_change_handler, this, _1, _2));
/* add amp processor */
// XXX: do we want to emit the signal here ? change call order.
processor->activate ();
}
- processor->ActiveChanged.connect (*this, boost::bind (&Session::update_latency_compensation, &_session, false, false));
+ processor->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, &_session, false, false));
_output->set_user_latency (0);
}
return -1;
}
- (*i)->ActiveChanged.connect (*this, boost::bind (&Session::update_latency_compensation, &_session, false, false));
+ (*i)->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, &_session, false, false));
}
_output->set_user_latency (0);
routes->push_back (r);
r->join_route_group (this);
- r->GoingAway.connect (*this, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
+ r->GoingAway.connect_same_thread (*this, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
_session.set_dirty ();
changed (); /* EMIT SIGNAL */
_state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
- Config->ParameterChanged.connect (*this, boost::bind (&Session::config_changed, this, _1, false));
- config.ParameterChanged.connect (*this, boost::bind (&Session::config_changed, this, _1, true));
+ Config->ParameterChanged.connect_same_thread (*this, boost::bind (&Session::config_changed, this, _1, false));
+ config.ParameterChanged.connect_same_thread (*this, boost::bind (&Session::config_changed, this, _1, true));
if (was_dirty) {
DirtyChanged (); /* EMIT SIGNAL */
_state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
- Config->ParameterChanged.connect (*this, boost::bind (&Session::config_changed, this, _1, false));
+ Config->ParameterChanged.connect_same_thread (*this, boost::bind (&Session::config_changed, this, _1, false));
}
Session::~Session ()
/* every time we reconnect, recompute worst case output latencies */
- _engine.Running.connect (*this, boost::bind (&Session::set_worst_io_latencies, this));
+ _engine.Running.connect_same_thread (*this, boost::bind (&Session::set_worst_io_latencies, this));
if (synced_to_jack()) {
_engine.transport_stop ();
boost::shared_ptr<Playlist> playlist;
if ((playlist = dstream->playlist()) != 0) {
- playlist->LengthChanged.connect (*this, boost::bind (&Session::playlist_length_changed, this));
+ playlist->LengthChanged.connect_same_thread (*this, boost::bind (&Session::playlist_length_changed, this));
}
/* see comment in playlist_length_changed () */
punch_connections.drop_connections ();
- location->start_changed.connect (punch_connections, boost::bind (&Session::auto_punch_start_changed, this, _1));
- location->end_changed.connect (punch_connections, boost::bind (&Session::auto_punch_end_changed, this, _1));
- location->changed.connect (punch_connections, boost::bind (&Session::auto_punch_changed, this, _1));
+ location->start_changed.connect_same_thread (punch_connections, boost::bind (&Session::auto_punch_start_changed, this, _1));
+ location->end_changed.connect_same_thread (punch_connections, boost::bind (&Session::auto_punch_end_changed, this, _1));
+ location->changed.connect_same_thread (punch_connections, boost::bind (&Session::auto_punch_changed, this, _1));
location->set_auto_punch (true, this);
loop_connections.drop_connections ();
- location->start_changed.connect (loop_connections, boost::bind (&Session::auto_loop_changed, this, _1));
- location->end_changed.connect (loop_connections, boost::bind (&Session::auto_loop_changed, this, _1));
- location->changed.connect (loop_connections, boost::bind (&Session::auto_loop_changed, this, _1));
+ location->start_changed.connect_same_thread (loop_connections, boost::bind (&Session::auto_loop_changed, this, _1));
+ location->end_changed.connect_same_thread (loop_connections, boost::bind (&Session::auto_loop_changed, this, _1));
+ location->changed.connect_same_thread (loop_connections, boost::bind (&Session::auto_loop_changed, this, _1));
location->set_auto_loop (true, this);
route_group->add (track);
}
- track->DiskstreamChanged.connect (*this, boost::bind (&Session::resort_routes, this));
+ track->DiskstreamChanged.connect_same_thread (*this, boost::bind (&Session::resort_routes, this));
//track->set_remote_control_id (control_id);
new_routes.push_back (track);
track->audio_diskstream()->non_realtime_input_change();
- track->DiskstreamChanged.connect (*this, boost::bind (&Session::resort_routes, this));
+ track->DiskstreamChanged.connect_same_thread (*this, boost::bind (&Session::resort_routes, this));
track->set_remote_control_id (control_id);
++control_id;
boost::weak_ptr<Route> wpr (*x);
- (*x)->listen_changed.connect (*this, boost::bind (&Session::route_listen_changed, this, _1, wpr));
- (*x)->solo_changed.connect (*this, boost::bind (&Session::route_solo_changed, this, _1, wpr));
- (*x)->mute_changed.connect (*this, boost::bind (&Session::route_mute_changed, this, _1));
- (*x)->output()->changed.connect (*this, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2));
- (*x)->processors_changed.connect (*this, boost::bind (&Session::route_processors_changed, this, _1));
- (*x)->route_group_changed.connect (*this, boost::bind (&Session::route_group_changed, this));
+ (*x)->listen_changed.connect_same_thread (*this, boost::bind (&Session::route_listen_changed, this, _1, wpr));
+ (*x)->solo_changed.connect_same_thread (*this, boost::bind (&Session::route_solo_changed, this, _1, wpr));
+ (*x)->mute_changed.connect_same_thread (*this, boost::bind (&Session::route_mute_changed, this, _1));
+ (*x)->output()->changed.connect_same_thread (*this, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2));
+ (*x)->processors_changed.connect_same_thread (*this, boost::bind (&Session::route_processors_changed, this, _1));
+ (*x)->route_group_changed.connect_same_thread (*this, boost::bind (&Session::route_group_changed, this));
if ((*x)->is_master()) {
_master_out = (*x);
/* writer goes out of scope, copies ds back to main */
}
- dstream->PlaylistChanged.connect (*this, boost::bind (&Session::diskstream_playlist_changed, this, boost::weak_ptr<Diskstream> (dstream)));
+ dstream->PlaylistChanged.connect_same_thread (*this, boost::bind (&Session::diskstream_playlist_changed, this, boost::weak_ptr<Diskstream> (dstream)));
/* this will connect to future changes, and check the current length */
diskstream_playlist_changed (boost::weak_ptr<Diskstream> (dstream));
- dstream->RecordEnableChanged.connect (*this, boost::bind (&Session::update_have_rec_enabled_diskstream, this));
+ dstream->RecordEnableChanged.connect_same_thread (*this, boost::bind (&Session::update_have_rec_enabled_diskstream, this));
dstream->prepare ();
}
}
- region->StateChanged.connect (*this, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
- region->GoingAway.connect (*this, boost::bind (&Session::remove_region, this, boost::weak_ptr<Region>(region)));
+ region->StateChanged.connect_same_thread (*this, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
+ region->GoingAway.connect_same_thread (*this, boost::bind (&Session::remove_region, this, boost::weak_ptr<Region>(region)));
update_region_name_map (region);
}
}
if (result.second) {
- source->GoingAway.connect (*this, boost::bind (&Session::remove_source, this, boost::weak_ptr<Source> (source)));
+ source->GoingAway.connect_same_thread (*this, boost::bind (&Session::remove_source, this, boost::weak_ptr<Source> (source)));
set_dirty();
}
bool existing = playlists->add (playlist);
if (!existing) {
- playlist->GoingAway.connect (*this, boost::bind (&Session::remove_playlist, this, boost::weak_ptr<Playlist>(playlist)));
+ playlist->GoingAway.connect_same_thread (*this, boost::bind (&Session::remove_playlist, this, boost::weak_ptr<Playlist>(playlist)));
}
if (unused) {
void
Session::add_processor (Processor* processor)
{
- processor->GoingAway.connect (*this, boost::bind (&Session::remove_processor, this, processor));
+ processor->GoingAway.connect_same_thread (*this, boost::bind (&Session::remove_processor, this, processor));
set_dirty();
}
_exporting = true;
export_status->running = true;
- export_status->Aborting.connect (*this, boost::bind (&Session::stop_audio_export, this));
- export_status->Finished.connect (*this, boost::bind (&Session::finalize_audio_export, this));
+ export_status->Aborting.connect_same_thread (*this, boost::bind (&Session::stop_audio_export, this));
+ export_status->Finished.connect_same_thread (*this, boost::bind (&Session::finalize_audio_export, this));
return 0;
}
last_process_function = process_function;
process_function = &Session::process_export;
} else {
- _engine.Freewheel.connect (export_freewheel_connection, boost::bind (&Session::process_export_fw, this, _1));
+ _engine.Freewheel.connect_same_thread (export_freewheel_connection, boost::bind (&Session::process_export_fw, this, _1));
return _engine.freewheel (true);
}
: _session (s)
{
if (_session) {
- _session->GoingAway.connect (_session_connections, boost::bind (&SessionHandlePtr::session_going_away, this));
+ _session->GoingAway.connect_same_thread (_session_connections, boost::bind (&SessionHandlePtr::session_going_away, this));
}
}
if (s) {
_session = s;
- _session->GoingAway.connect (_session_connections, boost::bind (&SessionHandlePtr::session_going_away, this));
+ _session->GoingAway.connect_same_thread (_session_connections, boost::bind (&SessionHandlePtr::session_going_away, this));
}
}
SessionHandleRef::SessionHandleRef (Session& s)
: _session (s)
{
- _session.GoingAway.connect (*this, boost::bind (&SessionHandleRef::session_going_away, this));
+ _session.GoingAway.connect_same_thread (*this, boost::bind (&SessionHandleRef::session_going_away, this));
}
void
mmc->set_send_device_id (old_send_device_id);
}
- mmc->Play.connect (*this, boost::bind (&Session::mmc_deferred_play, this, _1));
- mmc->DeferredPlay.connect (*this, boost::bind (&Session::mmc_deferred_play, this, _1));
- mmc->Stop.connect (*this, boost::bind (&Session::mmc_stop, this, _1));
- mmc->FastForward.connect (*this, boost::bind (&Session::mmc_fast_forward, this, _1));
- mmc->Rewind.connect (*this, boost::bind (&Session::mmc_rewind, this, _1));
- mmc->Pause.connect (*this, boost::bind (&Session::mmc_pause, this, _1));
- mmc->RecordPause.connect (*this, boost::bind (&Session::mmc_record_pause, this, _1));
- mmc->RecordStrobe.connect (*this, boost::bind (&Session::mmc_record_strobe, this, _1));
- mmc->RecordExit.connect (*this, boost::bind (&Session::mmc_record_exit, this, _1));
- mmc->Locate.connect (*this, boost::bind (&Session::mmc_locate, this, _1, _2));
- mmc->Step.connect (*this, boost::bind (&Session::mmc_step, this, _1, _2));
- mmc->Shuttle.connect (*this, boost::bind (&Session::mmc_shuttle, this, _1, _2, _3));
- mmc->TrackRecordStatusChange.connect (*this, boost::bind (&Session::mmc_record_enable, this, _1, _2, _3));
+ mmc->Play.connect_same_thread (*this, boost::bind (&Session::mmc_deferred_play, this, _1));
+ mmc->DeferredPlay.connect_same_thread (*this, boost::bind (&Session::mmc_deferred_play, this, _1));
+ mmc->Stop.connect_same_thread (*this, boost::bind (&Session::mmc_stop, this, _1));
+ mmc->FastForward.connect_same_thread (*this, boost::bind (&Session::mmc_fast_forward, this, _1));
+ mmc->Rewind.connect_same_thread (*this, boost::bind (&Session::mmc_rewind, this, _1));
+ mmc->Pause.connect_same_thread (*this, boost::bind (&Session::mmc_pause, this, _1));
+ mmc->RecordPause.connect_same_thread (*this, boost::bind (&Session::mmc_record_pause, this, _1));
+ mmc->RecordStrobe.connect_same_thread (*this, boost::bind (&Session::mmc_record_strobe, this, _1));
+ mmc->RecordExit.connect_same_thread (*this, boost::bind (&Session::mmc_record_exit, this, _1));
+ mmc->Locate.connect_same_thread (*this, boost::bind (&Session::mmc_locate, this, _1, _2));
+ mmc->Step.connect_same_thread (*this, boost::bind (&Session::mmc_step, this, _1, _2));
+ mmc->Shuttle.connect_same_thread (*this, boost::bind (&Session::mmc_shuttle, this, _1, _2, _3));
+ mmc->TrackRecordStatusChange.connect_same_thread (*this, boost::bind (&Session::mmc_record_enable, this, _1, _2, _3));
/* also handle MIDI SPP because its so common */
- _mmc_port->input()->start.connect (*this, boost::bind (&Session::spp_start, this, _1, _2));
- _mmc_port->input()->contineu.connect (*this, boost::bind (&Session::spp_continue, this, _1, _2));
- _mmc_port->input()->stop.connect (*this, boost::bind (&Session::spp_stop, this, _1, _2));
+ _mmc_port->input()->start.connect_same_thread (*this, boost::bind (&Session::spp_start, this, _1, _2));
+ _mmc_port->input()->contineu.connect_same_thread (*this, boost::bind (&Session::spp_continue, this, _1, _2));
+ _mmc_port->input()->stop.connect_same_thread (*this, boost::bind (&Session::spp_stop, this, _1, _2));
Config->set_mmc_port_name (port_tag);
if (!existing) {
playlists.insert (playlists.begin(), playlist);
- playlist->InUse.connect (*this, boost::bind (&SessionPlaylists::track, this, _1, boost::weak_ptr<Playlist>(playlist)));
+ playlist->InUse.connect_same_thread (*this, boost::bind (&SessionPlaylists::track, this, _1, boost::weak_ptr<Playlist>(playlist)));
}
return existing;
SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0);
ev->rt_slot = boost::bind (method, this, rl, yn, group_override);
ev->rt_return = after;
- ev->ui = UICallback::get_ui_for_thread ();
+ ev->event_loop = EventLoop::get_event_loop_for_thread ();
return ev;
}
{
ev->rt_slot ();
- if (ev->ui) {
- ev->ui->call_slot (boost::bind (ev->rt_return, ev));
+ if (ev->event_loop) {
+ ev->event_loop->call_slot (boost::bind (ev->rt_return, ev));
} else {
warning << string_compose ("programming error: %1", X_("Session RT event queued from thread without a UI - cleanup in RT thread!")) << endmsg;
ev->rt_return (ev);
_base_frame_rate = _current_frame_rate;
_tempo_map = new TempoMap (_current_frame_rate);
- _tempo_map->StateChanged.connect (*this, boost::bind (&Session::tempo_map_changed, this, _1));
+ _tempo_map->StateChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
_non_soloed_outs_muted = false;
delta_accumulator_cnt = 0;
_slave_state = Stopped;
- _engine.GraphReordered.connect (*this, boost::bind (&Session::graph_reordered, this));
+ _engine.GraphReordered.connect_same_thread (*this, boost::bind (&Session::graph_reordered, this));
/* These are all static "per-class" signals */
- RegionFactory::CheckNewRegion.connect (*this, boost::bind (&Session::add_region, this, _1));
- SourceFactory::SourceCreated.connect (*this, boost::bind (&Session::add_source, this, _1));
- PlaylistFactory::PlaylistCreated.connect (*this, boost::bind (&Session::add_playlist, this, _1, _2));
- Processor::ProcessorCreated.connect (*this, boost::bind (&Session::add_processor, this, _1));
- NamedSelection::NamedSelectionCreated.connect (*this, boost::bind (&Session::add_named_selection, this, _1));
- AutomationList::AutomationListCreated.connect (*this, boost::bind (&Session::add_automation_list, this, _1));
- Controllable::Destroyed.connect (*this, boost::bind (&Session::remove_controllable, this, _1));
- IO::PortCountChanged.connect (*this, boost::bind (&Session::ensure_buffers, this, _1));
+ RegionFactory::CheckNewRegion.connect_same_thread (*this, boost::bind (&Session::add_region, this, _1));
+ SourceFactory::SourceCreated.connect_same_thread (*this, boost::bind (&Session::add_source, this, _1));
+ PlaylistFactory::PlaylistCreated.connect_same_thread (*this, boost::bind (&Session::add_playlist, this, _1, _2));
+ Processor::ProcessorCreated.connect_same_thread (*this, boost::bind (&Session::add_processor, this, _1));
+ NamedSelection::NamedSelectionCreated.connect_same_thread (*this, boost::bind (&Session::add_named_selection, this, _1));
+ AutomationList::AutomationListCreated.connect_same_thread (*this, boost::bind (&Session::add_automation_list, this, _1));
+ Controllable::Destroyed.connect_same_thread (*this, boost::bind (&Session::remove_controllable, this, _1));
+ IO::PortCountChanged.connect_same_thread (*this, boost::bind (&Session::ensure_buffers, this, _1));
/* stop IO objects from doing stuff until we're ready for them */
_state_of_the_state = StateOfTheState (_state_of_the_state|CannotSave|Loading);
- _locations.changed.connect (*this, boost::bind (&Session::locations_changed, this));
- _locations.added.connect (*this, boost::bind (&Session::locations_added, this, _1));
+ _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));
setup_click_sounds (0);
setup_midi_control ();
/* Pay attention ... */
- _engine.Halted.connect (*this, boost::bind (&Session::engine_halted, this));
- _engine.Xrun.connect (*this, boost::bind (&Session::xrun_recovery, this));
+ _engine.Halted.connect_same_thread (*this, boost::bind (&Session::engine_halted, this));
+ _engine.Xrun.connect_same_thread (*this, boost::bind (&Session::xrun_recovery, this));
try {
when_engine_running();
_timeline_position = header_position_offset;
}
- AudioFileSource::HeaderPositionOffsetChanged.connect (header_position_connection, boost::bind (&SndFileSource::handle_header_position_change, this));
+ AudioFileSource::HeaderPositionOffsetChanged.connect_same_thread (header_position_connection, boost::bind (&SndFileSource::handle_header_position_change, this));
}
int
SessionHandlePtr::set_session (s);
if (_session) {
- _session->tick.connect (_session_connections, boost::bind (&Ticker::tick, this, _1, _2, _3));
+ _session->tick.connect_same_thread (_session_connections, boost::bind (&Ticker::tick, this, _1, _2, _3));
}
}
Ticker::set_session (s);
if (_session) {
- _session->MIDIClock_PortChanged.connect (_session_connections, boost::bind (&MidiClockTicker::update_midi_clock_port, this));
- _session->TransportStateChange.connect (_session_connections, boost::bind (&MidiClockTicker::transport_state_changed, this));
- _session->PositionChanged.connect (_session_connections, boost::bind (&MidiClockTicker::position_changed, this, _1));
- _session->TransportLooped.connect (_session_connections, boost::bind (&MidiClockTicker::transport_looped, this));
+ _session->MIDIClock_PortChanged.connect_same_thread (_session_connections, boost::bind (&MidiClockTicker::update_midi_clock_port, this));
+ _session->TransportStateChange.connect_same_thread (_session_connections, boost::bind (&MidiClockTicker::transport_state_changed, this));
+ _session->PositionChanged.connect_same_thread (_session_connections, boost::bind (&MidiClockTicker::position_changed, this, _1));
+ _session->TransportLooped.connect_same_thread (_session_connections, boost::bind (&MidiClockTicker::transport_looped, this));
update_midi_clock_port();
}
}
}
prompter->set_text (prompt);
prompter->touch (); // shows popup
- controllable->LearningFinished.connect (learning_connection, boost::bind (&BindingProxy::learning_finished, this));
+ controllable->LearningFinished.connect_same_thread (learning_connection, boost::bind (&BindingProxy::learning_finished, this));
}
return true;
}
as for previous line.
*/
- set_ui_for_thread (this);
+ set_event_loop_for_thread (this);
/* attach our request source to the default main context */
void
Channel::connect_input_signals ()
{
- _port.input()->channel_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_chanpress, this, _1, _2));
- _port.input()->channel_note_on[_channel_number].connect (*this, boost::bind (&Channel::process_note_on, this, _1, _2));
- _port.input()->channel_note_off[_channel_number].connect (*this, boost::bind (&Channel::process_note_off, this, _1, _2));
- _port.input()->channel_poly_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_polypress, this, _1, _2));
- _port.input()->channel_program_change[_channel_number].connect (*this, boost::bind (&Channel::process_program_change, this, _1, _2));
- _port.input()->channel_controller[_channel_number].connect (*this, boost::bind (&Channel::process_controller, this, _1, _2));
- _port.input()->channel_pitchbend[_channel_number].connect (*this, boost::bind (&Channel::process_pitchbend, this, _1, _2));
-
- _port.input()->reset.connect (*this, boost::bind (&Channel::process_reset, this, _1));
+ _port.input()->channel_pressure[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_chanpress, this, _1, _2));
+ _port.input()->channel_note_on[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_note_on, this, _1, _2));
+ _port.input()->channel_note_off[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_note_off, this, _1, _2));
+ _port.input()->channel_poly_pressure[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_polypress, this, _1, _2));
+ _port.input()->channel_program_change[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_program_change, this, _1, _2));
+ _port.input()->channel_controller[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_controller, this, _1, _2));
+ _port.input()->channel_pitchbend[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_pitchbend, this, _1, _2));
+
+ _port.input()->reset.connect_same_thread (*this, boost::bind (&Channel::process_reset, this, _1));
}
void
Channel::connect_output_signals ()
-
{
- _port.output()->channel_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_chanpress, this, _1, _2));
- _port.output()->channel_note_on[_channel_number].connect (*this, boost::bind (&Channel::process_note_on, this, _1, _2));
- _port.output()->channel_note_off[_channel_number].connect (*this, boost::bind (&Channel::process_note_off, this, _1, _2));
- _port.output()->channel_poly_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_polypress, this, _1, _2));
- _port.output()->channel_program_change[_channel_number].connect (*this, boost::bind (&Channel::process_program_change, this, _1, _2));
- _port.output()->channel_controller[_channel_number].connect (*this, boost::bind (&Channel::process_controller, this, _1, _2));
- _port.output()->channel_pitchbend[_channel_number].connect (*this, boost::bind (&Channel::process_pitchbend, this, _1, _2));
-
- _port.output()->reset.connect (*this, boost::bind (&Channel::process_reset, this, _1));
+ _port.output()->channel_pressure[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_chanpress, this, _1, _2));
+ _port.output()->channel_note_on[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_note_on, this, _1, _2));
+ _port.output()->channel_note_off[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_note_off, this, _1, _2));
+ _port.output()->channel_poly_pressure[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_polypress, this, _1, _2));
+ _port.output()->channel_program_change[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_program_change, this, _1, _2));
+ _port.output()->channel_controller[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_controller, this, _1, _2));
+ _port.output()->channel_pitchbend[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_pitchbend, this, _1, _2));
+
+ _port.output()->reset.connect_same_thread (*this, boost::bind (&Channel::process_reset, this, _1));
}
void
bytes_written += nwritten;
if (output_parser) {
- output_parser->raw_preparse
- (*output_parser, msg, nwritten);
+ output_parser->raw_preparse (*output_parser, msg, nwritten);
for (int i = 0; i < nwritten; i++) {
output_parser->scanner (msg[i]);
}
- output_parser->raw_postparse
- (*output_parser, msg, nwritten);
+ output_parser->raw_postparse (*output_parser, msg, nwritten);
}
}
return nwritten;
_send_device_id = 0x7f;
if ((parser = _port.input()) != 0) {
- parser->mmc.connect (mmc_connection, boost::bind (&MachineControl::process_mmc_message, this, _1, _2, _3));
+ parser->mmc.connect_same_thread (mmc_connection, boost::bind (&MachineControl::process_mmc_message, this, _1, _2, _3));
} else {
warning << "MMC connected to a non-input port: useless!"
<< endmsg;
cerr << "enabling tracing for port " << _port.name() << endl;
trace_stream = o;
trace_prefix = prefix;
- any.connect (trace_connection, boost::bind (&Parser::trace_event, this, _1, _2, _3));
+ any.connect_same_thread (trace_connection, boost::bind (&Parser::trace_event, this, _1, _2, _3));
} else {
trace_prefix = "";
trace_stream = 0;
void
BaseUI::main_thread ()
{
- set_ui_for_thread (this);
+ set_event_loop_for_thread (this);
thread_init ();
_main_loop->run ();
}
/* Controllable::remove() is static - no need to manage this connection */
- ctl.GoingAway.connect (registry_connections, boost::bind (&Controllable::remove, ref (ctl)));
+ ctl.GoingAway.connect_same_thread (registry_connections, boost::bind (&Controllable::remove, ref (ctl)));
}
void
--- /dev/null
+#include "pbd/event_loop.h"
+
+using namespace PBD;
+
+Glib::StaticPrivate<EventLoop> EventLoop::thread_event_loop;
+
+static void do_not_delete_the_loop_pointer (void*) { }
+
+EventLoop*
+EventLoop::get_event_loop_for_thread() {
+ return thread_event_loop.get ();
+}
+
+void
+EventLoop::set_event_loop_for_thread (EventLoop* loop)
+{
+ thread_event_loop.set (loop, do_not_delete_the_loop_pointer);
+}
+
#include <glibmm/main.h>
#include "pbd/crossthread.h"
-#include "pbd/ui_callback.h"
+#include "pbd/event_loop.h"
-class BaseUI : virtual public sigc::trackable, public PBD::UICallback
+class BaseUI : virtual public sigc::trackable, public PBD::EventLoop
{
public:
BaseUI (const std::string& name);
--- /dev/null
+/*
+ Copyright (C) 2009 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __pbd_event_loop_h__
+#define __pbd_event_loop_h__
+
+#include <boost/function.hpp>
+#include <boost/bind.hpp> /* we don't need this here, but anything calling call_slot() probably will, so this is convenient */
+#include <glibmm/thread.h>
+
+namespace PBD
+{
+
+class EventLoop
+{
+ public:
+ EventLoop() {}
+ virtual ~EventLoop() {}
+
+ virtual void call_slot (const boost::function<void()>&) = 0;
+
+ static EventLoop* get_event_loop_for_thread();
+ static void set_event_loop_for_thread (EventLoop* ui);
+
+ private:
+ static Glib::StaticPrivate<EventLoop> thread_event_loop;
+
+};
+
+}
+
+#endif /* __pbd_event_loop_h__ */
: obj(a_object), before(a_before), after(a_after)
{
/* if the object dies, make sure that we die and that everyone knows about it */
- obj.GoingAway.connect (obj_death_connection, boost::bind (&MementoCommand::object_died, this));
+ obj.GoingAway.connect_same_thread (obj_death_connection, boost::bind (&MementoCommand::object_died, this));
}
~MementoCommand () {
+++ /dev/null
-/*
- Copyright (C) 2000-2007 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __pbd_shiva_h__
-#define __pbd_shiva_h__
-
-#include <sigc++/sigc++.h>
-
-namespace PBD {
-
-/* named after the Hindu god Shiva, The Destroyer */
-
-template<typename ObjectWithGoingAway, typename ObjectToBeDestroyed>
-class Shiva : public sigc::trackable
-{
- public:
- Shiva (ObjectWithGoingAway& emitter, ObjectToBeDestroyed& receiver) {
-
- /* if the emitter goes away, destroy the receiver */
-
- _connection = emitter.GoingAway.connect
- (sigc::bind (sigc::mem_fun
- (*this, &Shiva<ObjectWithGoingAway,ObjectToBeDestroyed>::destroy),
- &receiver));
- }
-
- ~Shiva() {
- forget ();
- }
-
- private:
- sigc::connection _connection;
-
- void destroy (ObjectToBeDestroyed* obj) {
- delete obj;
- forget ();
- }
-
- void forget () {
- _connection.disconnect ();
- }
-
-};
-
-template<typename ObjectWithGoingAway, typename ObjectToBeDestroyed>
-class ProxyShiva : public sigc::trackable
-{
- public:
- ProxyShiva (ObjectWithGoingAway& emitter, ObjectToBeDestroyed& receiver, void (*callback)(ObjectToBeDestroyed*, ObjectWithGoingAway*)) {
-
- /* if the emitter goes away, destroy the receiver */
-
- _callback = callback;
- _callback_argument = &emitter;
-
- _connection = emitter.GoingAway.connect
- (sigc::bind (sigc::mem_fun
- (*this, &ProxyShiva<ObjectWithGoingAway,ObjectToBeDestroyed>::destroy),
- &receiver));
- }
-
- ~ProxyShiva () {
- forget ();
- }
-
- private:
- sigc::connection _connection;
- void (*_callback) (ObjectToBeDestroyed*, ObjectWithGoingAway*);
- ObjectWithGoingAway* _callback_argument;
-
- void destroy (ObjectToBeDestroyed* obj) {
- /* callback must destroy obj if appropriate, not done here */
- _callback (obj, _callback_argument);
- forget ();
- }
-
- void forget () {
- _connection.disconnect ();
- }
-};
-
-template<typename ObjectWithGoingAway, typename ObjectToBeDestroyed>
-class PairedShiva : public sigc::trackable
-{
- public:
- PairedShiva (ObjectWithGoingAway& emitter, ObjectToBeDestroyed& receiver) {
-
- /* if the emitter goes away, destroy the receiver */
-
- _connection1 = emitter.GoingAway.connect
- (sigc::bind (sigc::mem_fun
- (*this, &PairedShiva<ObjectWithGoingAway,ObjectToBeDestroyed>::destroy),
- &receiver));
-
- /* if the receiver goes away, forget all this nonsense */
-
- _connection2 = receiver.GoingAway.connect
- (sigc::mem_fun (*this, &PairedShiva<ObjectWithGoingAway,ObjectToBeDestroyed>::forget));
- }
-
- ~PairedShiva() {
- forget ();
- }
-
- private:
- sigc::connection _connection1;
- sigc::connection _connection2;
-
- void destroy (ObjectToBeDestroyed* obj) {
- delete obj;
- forget ();
- }
-
- void forget () {
- _connection1.disconnect ();
- _connection2.disconnect ();
- }
-
-};
-
-}
-
-#endif /* __pbd_shiva_h__ */
#include <list>
#include <glibmm/thread.h>
+
#include <boost/signals2.hpp>
#include <boost/noncopyable.hpp>
+#include <boost/bind.hpp>
+#include <boost/bind/protect.hpp>
+
+#include "pbd/event_loop.h"
namespace PBD {
void add_connection (const UnscopedConnection& c);
void drop_connections ();
- template<typename S> void scoped_connect (S& sig, const typename S::slot_function_type& sf) {
- add_connection (sig.connect (sf));
- }
-
private:
/* this class is not copyable */
ScopedConnectionList(const ScopedConnectionList&);
Signal0 () {}
typedef boost::signals2::signal<R()> SignalType;
- void connect (ScopedConnectionList& clist,
+ void connect_same_thread (Connection& c,
+ const typename SignalType::slot_function_type& slot) {
+ c = _signal.connect (slot);
+ }
+
+ void connect_same_thread (ScopedConnectionList& clist,
const typename SignalType::slot_function_type& slot) {
clist.add_connection (_signal.connect (slot));
}
+
+ void connect (ScopedConnectionList& clist,
+ const typename SignalType::slot_function_type& slot,
+ PBD::EventLoop* event_loop) {
+ clist.add_connection (_signal.connect (boost::bind (&EventLoop::call_slot, event_loop, slot)));
+ }
void connect (Connection& c,
- const typename SignalType::slot_function_type& slot) {
- c = _signal.connect (slot);
+ const typename SignalType::slot_function_type& slot,
+ PBD::EventLoop* event_loop) {
+ c = _signal.connect (boost::bind (&EventLoop::call_slot, event_loop, slot));
}
typename SignalType::result_type operator()() {
Signal1 () {}
typedef boost::signals2::signal<R(A)> SignalType;
- void connect (ScopedConnectionList& clist,
+ void connect_same_thread (ScopedConnectionList& clist,
const typename SignalType::slot_function_type& slot) {
clist.add_connection (_signal.connect (slot));
}
- void connect (Connection& c,
- const typename SignalType::slot_function_type& slot) {
+ void connect_same_thread (Connection& c,
+ const typename SignalType::slot_function_type& slot) {
c = _signal.connect (slot);
}
+
+ static void compositor (typename boost::function<void(A)> f, EventLoop* event_loop, A arg) {
+ event_loop->call_slot (boost::bind (f, arg));
+ }
+
+ void connect (ScopedConnectionList& clist,
+ const typename SignalType::slot_function_type& slot,
+ PBD::EventLoop* event_loop) {
+ clist.add_connection (_signal.connect (boost::bind (&compositor, slot, event_loop, _1)));
+ }
+
+ void connect (Connection& c,
+ const typename SignalType::slot_function_type& slot,
+ PBD::EventLoop* event_loop) {
+ c = _signal.connect (boost::bind (&compositor, slot, event_loop, _1));
+
+ }
typename SignalType::result_type operator()(A arg1) {
return _signal (arg1);
Signal2 () {}
typedef boost::signals2::signal<R(A1, A2)> SignalType;
- void connect (ScopedConnectionList& clist,
+ void connect_same_thread (ScopedConnectionList& clist,
const typename SignalType::slot_function_type& slot) {
clist.add_connection (_signal.connect (slot));
}
-
- void connect (Connection& c,
- const typename SignalType::slot_function_type& slot) {
+
+ void connect_same_thread (Connection& c,
+ const typename SignalType::slot_function_type& slot) {
c = _signal.connect (slot);
}
-
+
+ static void compositor (typename boost::function<void(A1,A2)> f, PBD::EventLoop* event_loop, A1 arg1, A2 arg2) {
+ event_loop->call_slot (boost::bind (f, arg1, arg2));
+ }
+
+ void connect (ScopedConnectionList& clist,
+ const typename SignalType::slot_function_type& slot,
+ PBD::EventLoop* event_loop) {
+ clist.add_connection (_signal.connect (boost::bind (&compositor, slot, event_loop, _1, _2)));
+ }
+
+ void connect (Connection& c,
+ const typename SignalType::slot_function_type& slot,
+ PBD::EventLoop* event_loop) {
+ c = _signal.connect (boost::bind (&compositor, slot, event_loop, _1, _2));
+ }
+
typename SignalType::result_type operator()(A1 arg1, A2 arg2) {
return _signal (arg1, arg2);
}
Signal3 () {}
typedef boost::signals2::signal<R(A1,A2,A3)> SignalType;
- void connect (ScopedConnectionList& clist,
+ void connect_same_thread (ScopedConnectionList& clist,
const typename SignalType::slot_function_type& slot) {
clist.add_connection (_signal.connect (slot));
}
+
+ void connect_same_thread (Connection& c,
+ const typename SignalType::slot_function_type& slot) {
+ c = _signal.connect (slot);
+ }
+
+ static void compositor (typename boost::function<void(A1,A2,A3)> f, PBD::EventLoop* event_loop, A1 arg1, A2 arg2, A3 arg3) {
+ event_loop->call_slot (boost::bind (f, arg1, arg2, arg3));
+ }
+
+ void connect (ScopedConnectionList& clist,
+ const typename SignalType::slot_function_type& slot,
+ PBD::EventLoop* event_loop) {
+ clist.add_connection (_signal.connect (boost::bind (&compositor, slot, event_loop, _1, _2, _3)));
+ }
void connect (Connection& c,
- const typename SignalType::slot_function_type& slot) {
- c = _signal.connect (slot);
+ const typename SignalType::slot_function_type& slot,
+ PBD::EventLoop* event_loop) {
+ c = _signal.connect (_signal.connect (boost::bind (&compositor, slot, event_loop, _1, _2, _3)));
}
typename SignalType::result_type operator()(A1 arg1, A2 arg2, A3 arg3) {
+++ /dev/null
-/*
- Copyright (C) 2009 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __pbd_ui_callback_h__
-#define __pbd_ui_callback_h__
-
-#include <boost/function.hpp>
-#include <boost/bind.hpp> /* we don't need this here, but anything calling call_slot() probably will, so this is convenient */
-#include <glibmm/thread.h>
-
-namespace PBD
-{
-
-class UICallback
-{
- public:
- UICallback() {}
- virtual ~UICallback() {}
-
- virtual void call_slot (const boost::function<void()>&) = 0;
-
- static UICallback* get_ui_for_thread();
- static void set_ui_for_thread (UICallback* ui);
-
- private:
- static Glib::StaticPrivate<UICallback> thread_ui;
-
-};
-
-}
-
-#endif /* __pbd_ui_callback_h__ */
+++ /dev/null
-#include "pbd/ui_callback.h"
-
-using namespace PBD;
-
-Glib::StaticPrivate<UICallback> UICallback::thread_ui;
-
-static void do_not_delete_the_ui_pointer (void*) { }
-
-UICallback*
-UICallback::get_ui_for_thread() {
- return thread_ui.get ();
-}
-
-void
-UICallback::set_ui_for_thread (UICallback* ui)
-{
- thread_ui.set (ui, do_not_delete_the_ui_pointer);
-}
-
so there is no need to manage this connection.
*/
- action->GoingAway.connect (*this, boost::bind (&command_death, this, action));
+ action->GoingAway.connect_same_thread (*this, boost::bind (&command_death, this, action));
actions.push_back (action);
}
{
uint32_t current_depth = UndoList.size();
- ut->GoingAway.connect (*this, boost::bind (&UndoHistory::remove, this, ut));
+ ut->GoingAway.connect_same_thread (*this, boost::bind (&UndoHistory::remove, this, ut));
/* if the current undo history is larger than or equal to the currently
requested depth, then pop off at least 1 element to make space
controllable.cc
crossthread.cc
enumwriter.cc
+ event_loop.cc
dmalloc.cc
error.cc
filesystem.cc
strsplit.cc
textreceiver.cc
transmitter.cc
- ui_callback.cc
undo.cc
uuid.cc
version.cc
*/
+#include "pbd/error.h"
+
#include "ardour/session.h"
#include "ardour/route.h"
#include "ardour/audio_track.h"
using namespace ARDOUR;
using namespace std;
+using namespace PBD;
-PBD::Signal0<void> ControlProtocol::ZoomToSession;
-PBD::Signal0<void> ControlProtocol::ZoomOut;
-PBD::Signal0<void> ControlProtocol::ZoomIn;
-PBD::Signal0<void> ControlProtocol::Enter;
-PBD::Signal1<void,float> ControlProtocol::ScrollTimeline;
+Signal0<void> ControlProtocol::ZoomToSession;
+Signal0<void> ControlProtocol::ZoomOut;
+Signal0<void> ControlProtocol::ZoomIn;
+Signal0<void> ControlProtocol::Enter;
+Signal1<void,float> ControlProtocol::ScrollTimeline;
-ControlProtocol::ControlProtocol (Session& s, string str)
+ControlProtocol::ControlProtocol (Session& s, string str, EventLoop* evloop)
: BasicUI (s),
_name (str)
{
+ if (evloop) {
+ _own_event_loop = false;
+ _event_loop = evloop;
+ } else {
+ _own_event_loop = true;
+ fatal << "programming error: cannot create control protocols without an existing event loop (yet)" << endmsg;
+ /*NOTREACHED*/
+ }
+
_active = false;
- session->RouteAdded.connect (*this, boost::bind (&ControlProtocol::add_strip, this, _1));
+
+ session->RouteAdded.connect (*this, boost::protect (boost::bind (&ControlProtocol::add_strip, this, _1)), _event_loop);
}
ControlProtocol::~ControlProtocol ()
}
void
-ControlProtocol::add_strip (std::list<boost::shared_ptr<ARDOUR::Route> >)
+ControlProtocol::add_strip (ARDOUR::RouteList&)
{
route_list_changed();
}
class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI {
public:
- ControlProtocol (Session&, std::string name);
+ ControlProtocol (Session&, std::string name, PBD::EventLoop* event_loop);
virtual ~ControlProtocol();
std::string name() const { return _name; }
std::string route_get_name (uint32_t table_index);
protected:
+ PBD::EventLoop* _event_loop;
+ bool _own_event_loop;
std::vector<boost::shared_ptr<ARDOUR::Route> > route_table;
std::string _name;
bool _active;
- void add_strip (std::list<boost::shared_ptr<ARDOUR::Route> >);
+ void add_strip (std::list<boost::shared_ptr<ARDOUR::Route> >&);
void next_track (uint32_t initial_id);
void prev_track (uint32_t initial_id);
#include "ardour/session.h"
#include "ardour/route.h"
+#include "ardour/midi_ui.h"
#include "generic_midi_control_protocol.h"
#include "midicontrollable.h"
#include "i18n.h"
+#define midi_ui_context() MidiControlUI::instance() /* a UICallback-derived object that specifies the event loop for signal handling */
+#define ui_bind(x) boost::protect (boost::bind ((x)))
+
GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s)
- : ControlProtocol (s, _("Generic MIDI"))
+ : ControlProtocol (s, _("Generic MIDI"), MidiControlUI::instance())
{
MIDI::Manager* mm = MIDI::Manager::instance();
_feedback_interval = 10000; // microseconds
last_feedback_time = 0;
- auto_binding = FALSE;
+ /* XXX is it right to do all these in the same thread as whatever emits the signal? */
- Controllable::StartLearning.connect (*this, boost::bind (&GenericMidiControlProtocol::start_learning, this, _1));
- Controllable::StopLearning.connect (*this, boost::bind (&GenericMidiControlProtocol::stop_learning, this, _1));
- Controllable::CreateBinding.connect (*this, boost::bind (&GenericMidiControlProtocol::create_binding, this, _1, _2, _3));
- Controllable::DeleteBinding.connect (*this, boost::bind (&GenericMidiControlProtocol::delete_binding, this, _1));
+ Controllable::StartLearning.connect_same_thread (*this, boost::bind (&GenericMidiControlProtocol::start_learning, this, _1));
+ Controllable::StopLearning.connect_same_thread (*this, boost::bind (&GenericMidiControlProtocol::stop_learning, this, _1));
+ Controllable::CreateBinding.connect_same_thread (*this, boost::bind (&GenericMidiControlProtocol::create_binding, this, _1, _2, _3));
+ Controllable::DeleteBinding.connect_same_thread (*this, boost::bind (&GenericMidiControlProtocol::delete_binding, this, _1));
- Session::SendFeedback.connect (*this, boost::bind (&GenericMidiControlProtocol::send_feedback, this));
- Session::AutoBindingOn.connect (*this, boost::bind (&GenericMidiControlProtocol::auto_binding_on, this));
- Session::AutoBindingOff.connect (*this, boost::bind (&GenericMidiControlProtocol::auto_binding_off, this));
+ Session::SendFeedback.connect (*this, boost::bind (&GenericMidiControlProtocol::send_feedback, this), midi_ui_context());;
}
GenericMidiControlProtocol::~GenericMidiControlProtocol ()
MIDIPendingControllable* element = new MIDIPendingControllable;
element->first = mc;
- c->LearningFinished.connect (element->second, boost::bind (&GenericMidiControlProtocol::learning_stopped, this, mc));
+ c->LearningFinished.connect_same_thread (element->second, boost::bind (&GenericMidiControlProtocol::learning_stopped, this, mc));
pending_controllables.push_back (element);
}
}
}
-void
-GenericMidiControlProtocol::auto_binding_on()
-{
- auto_binding = TRUE;
-}
-
-void
-GenericMidiControlProtocol::auto_binding_off()
-{
- auto_binding = FALSE;
-}
-
XMLNode&
GenericMidiControlProtocol::get_state ()
{
_feedback_interval = 10000;
}
- if ( !auto_binding ) {
-
- boost::shared_ptr<Controllable> c;
-
- {
- Glib::Mutex::Lock lm (pending_lock);
- for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ++i) {
- delete *i;
- }
- pending_controllables.clear ();
- }
-
- Glib::Mutex::Lock lm2 (controllables_lock);
- controllables.clear ();
- nlist = node.children(); // "controls"
-
- if (nlist.empty()) {
- return 0;
+ boost::shared_ptr<Controllable> c;
+
+ {
+ Glib::Mutex::Lock lm (pending_lock);
+ for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ++i) {
+ delete *i;
}
+ pending_controllables.clear ();
+ }
+
+ Glib::Mutex::Lock lm2 (controllables_lock);
+ controllables.clear ();
+ nlist = node.children(); // "controls"
+
+ if (nlist.empty()) {
+ return 0;
+ }
+
+ nlist = nlist.front()->children ();
- nlist = nlist.front()->children ();
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
- for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+ if ((prop = (*niter)->property ("id")) != 0) {
- if ((prop = (*niter)->property ("id")) != 0) {
-
- ID id = prop->value ();
- c = session->controllable_by_id (id);
-
- if (c) {
- MIDIControllable* mc = new MIDIControllable (*_port, *c);
- if (mc->set_state (**niter, version) == 0) {
- controllables.insert (mc);
- }
-
- } else {
- warning << string_compose (
- _("Generic MIDI control: controllable %1 not found in session (ignored)"),
- id) << endmsg;
+ ID id = prop->value ();
+ c = session->controllable_by_id (id);
+
+ if (c) {
+ MIDIControllable* mc = new MIDIControllable (*_port, *c);
+ if (mc->set_state (**niter, version) == 0) {
+ controllables.insert (mc);
}
+
+ } else {
+ warning << string_compose (
+ _("Generic MIDI control: controllable %1 not found in session (ignored)"),
+ id) << endmsg;
}
}
}
ARDOUR::microseconds_t last_feedback_time;
bool do_feedback;
- bool auto_binding;
void _send_feedback ();
void send_feedback ();
void create_binding (PBD::Controllable*, int, int);
void delete_binding (PBD::Controllable*);
-
- void auto_binding_on();
- void auto_binding_off();
-
};
#endif /* ardour_generic_midi_control_protocol_h */
#include <cstdio> /* for sprintf, sigh */
#include <climits>
+
#include "pbd/error.h"
#include "pbd/xml++.h"
+
#include "midi++/port.h"
#include "midi++/channel.h"
+
#include "ardour/automation_control.h"
#include "midicontrollable.h"
MIDIControllable::learn_about_external_control ()
{
drop_external_control ();
- _port.input()->any.connect (midi_learn_connection, boost::bind (&MIDIControllable::midi_receiver, this, _1, _2, _3));
+ _port.input()->any.connect_same_thread (midi_learn_connection, boost::bind (&MIDIControllable::midi_receiver, this, _1, _2, _3));
}
void
int chn_i = chn;
switch (ev) {
case MIDI::off:
- p.channel_note_off[chn_i].connect (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2));
+ p.channel_note_off[chn_i].connect_same_thread (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2));
/* if this is a bistate, connect to noteOn as well,
and we'll toggle back and forth between the two.
*/
if (bistate) {
- p.channel_note_on[chn_i].connect (midi_sense_connection[1], boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2));
+ p.channel_note_on[chn_i].connect_same_thread (midi_sense_connection[1], boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2));
}
_control_description = "MIDI control: NoteOff";
break;
case MIDI::on:
- p.channel_note_on[chn_i].connect (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2));
+ p.channel_note_on[chn_i].connect_same_thread (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2));
if (bistate) {
- p.channel_note_off[chn_i].connect (midi_sense_connection[1], boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2));
+ p.channel_note_off[chn_i].connect_same_thread (midi_sense_connection[1], boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2));
}
_control_description = "MIDI control: NoteOn";
break;
case MIDI::controller:
- p.channel_controller[chn_i].connect (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_controller, this, _1, _2));
+ p.channel_controller[chn_i].connect_same_thread (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_controller, this, _1, _2));
snprintf (buf, sizeof (buf), "MIDI control: Controller %d", control_additional);
_control_description = buf;
break;
case MIDI::program:
if (!bistate) {
- p.channel_program_change[chn_i].connect (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_program_change, this, _1, _2));
+ p.channel_program_change[chn_i].connect_same_thread (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_program_change, this, _1, _2));
_control_description = "MIDI control: ProgramChange";
}
break;
case MIDI::pitchbend:
if (!bistate) {
- p.channel_pitchbend[chn_i].connect (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_pitchbend, this, _1, _2));
+ p.channel_pitchbend[chn_i].connect_same_thread (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_pitchbend, this, _1, _2));
_control_description = "MIDI control: Pitchbend";
}
break;
#include "ardour/dB.h"
#include "ardour/debug.h"
#include "ardour/location.h"
+#include "ardour/midi_ui.h"
#include "ardour/panner.h"
#include "ardour/route.h"
#include "ardour/session.h"
MackieMidiBuilder builder;
+#define midi_ui_context() MidiControlUI::instance() /* a UICallback-derived object that specifies the event loop for signal handling */
+#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__))
+
MackieControlProtocol::MackieControlProtocol (Session& session)
- : ControlProtocol (session, X_("Mackie"))
+ : ControlProtocol (session, X_("Mackie"), MidiControlUI::instance())
, _current_initial_bank (0)
, _surface (0)
, _jog_wheel (*this)
MackieControlProtocol::connect_session_signals()
{
// receive routes added
- session->RouteAdded.connect(session_connections, boost::bind (&MackieControlProtocol::notify_route_added, this, _1));
+ session->RouteAdded.connect(session_connections, ui_bind (&MackieControlProtocol::notify_route_added, this, _1), midi_ui_context());
// receive record state toggled
- session->RecordStateChanged.connect(session_connections, boost::bind (&MackieControlProtocol::notify_record_state_changed, this));
+ session->RecordStateChanged.connect(session_connections, ui_bind (&MackieControlProtocol::notify_record_state_changed, this), midi_ui_context());
// receive transport state changed
- session->TransportStateChange.connect(session_connections, boost::bind (&MackieControlProtocol::notify_transport_state_changed, this));
+ session->TransportStateChange.connect(session_connections, ui_bind (&MackieControlProtocol::notify_transport_state_changed, this), midi_ui_context());
// receive punch-in and punch-out
- Config->ParameterChanged.connect(session_connections, boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1));
- session->config.ParameterChanged.connect (session_connections, boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1));
+ Config->ParameterChanged.connect(session_connections, ui_bind (&MackieControlProtocol::notify_parameter_changed, this, _1), midi_ui_context());
+ session->config.ParameterChanged.connect (session_connections, ui_bind (&MackieControlProtocol::notify_parameter_changed, this, _1), midi_ui_context());
// receive rude solo changed
- session->SoloActive.connect(session_connections, boost::bind (&MackieControlProtocol::notify_solo_active_changed, this, _1));
+ session->SoloActive.connect(session_connections, ui_bind (&MackieControlProtocol::notify_solo_active_changed, this, _1), midi_ui_context());
// make sure remote id changed signals reach here
// see also notify_route_added
Sorted sorted = get_sorted_routes();
for (Sorted::iterator it = sorted.begin(); it != sorted.end(); ++it) {
- ((*it)->RemoteControlIDChanged.connect (route_connections, boost::bind(&MackieControlProtocol::notify_remote_id_changed, this)));
+ (*it)->RemoteControlIDChanged.connect (route_connections, ui_bind(&MackieControlProtocol::notify_remote_id_changed, this), midi_ui_context());
}
}
MackiePort * sport = new MackiePort (*this, midi_port, number);
_ports.push_back (sport);
- sport->init_event.connect (port_connections, boost::bind (&MackieControlProtocol::handle_port_init, this, sport));
- sport->active_event.connect (port_connections, boost::bind (&MackieControlProtocol::handle_port_active, this, sport));
- sport->inactive_event.connect (port_connections, boost::bind (&MackieControlProtocol::handle_port_inactive, this, sport));
+ sport->init_event.connect_same_thread (port_connections, boost::bind (&MackieControlProtocol::handle_port_init, this, sport));
+ sport->active_event.connect_same_thread (port_connections, boost::bind (&MackieControlProtocol::handle_port_active, this, sport));
+ sport->inactive_event.connect_same_thread (port_connections, boost::bind (&MackieControlProtocol::handle_port_inactive, this, sport));
}
}
// Connect events. Must be after route table otherwise there will be trouble
for (MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it) {
- (*it)->control_event.connect (port_connections, boost::bind (&MackieControlProtocol::handle_control_event, this, _1, _2, _3));
+ (*it)->control_event.connect_same_thread (port_connections, boost::bind (&MackieControlProtocol::handle_control_event, this, _1, _2, _3));
}
}
typedef ARDOUR::RouteList ARS;
for (ARS::iterator it = rl.begin(); it != rl.end(); ++it) {
- (*it)->RemoteControlIDChanged.connect (route_connections, boost::bind (&MackieControlProtocol::notify_remote_id_changed, this));
+ (*it)->RemoteControlIDChanged.connect (route_connections, ui_bind (&MackieControlProtocol::notify_remote_id_changed, this), midi_ui_context());
}
}
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("MackiePort::open %1\n", *this));
- port().input()->sysex.connect (sysex_connection, boost::bind (&MackiePort::handle_midi_sysex, this, _1, _2, _3));
+ port().input()->sysex.connect_same_thread (sysex_connection, boost::bind (&MackiePort::handle_midi_sysex, this, _1, _2, _3));
// make sure the device is connected
init();
void MackiePort::connect_any()
{
if (!any_connection.connected()) {
- port().input()->any.connect (any_connection, boost::bind (&MackiePort::handle_midi_any, this, _1, _2, _3));
+ port().input()->any.connect_same_thread (any_connection, boost::bind (&MackiePort::handle_midi_any, this, _1, _2, _3));
}
}
#include "ardour/route.h"
#include "ardour/track.h"
+#include "ardour/midi_ui.h"
#include "ardour/panner.h"
#include "mackie_control_protocol.h"
using namespace Mackie;
using namespace std;
+#define midi_ui_context() MidiControlUI::instance() /* a UICallback-derived object that specifies the event loop for signal handling */
+#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__))
+
void RouteSignal::connect()
{
if (_strip.has_solo()) {
- _route->solo_control()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_solo_changed, &_mcp, this));
+ _route->solo_control()->Changed.connect(connections, ui_bind (&MackieControlProtocol::notify_solo_changed, &_mcp, this), midi_ui_context());
}
if (_strip.has_mute()) {
- _route->mute_control()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_mute_changed, &_mcp, this));
+ _route->mute_control()->Changed.connect(connections, ui_bind (&MackieControlProtocol::notify_mute_changed, &_mcp, this), midi_ui_context());
}
if (_strip.has_gain()) {
- _route->gain_control()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_gain_changed, &_mcp, this, false));
+ _route->gain_control()->Changed.connect(connections, ui_bind (&MackieControlProtocol::notify_gain_changed, &_mcp, this, false), midi_ui_context());
}
- _route->NameChanged.connect (connections, boost::bind (&MackieControlProtocol::notify_name_changed, &_mcp, this));
+ _route->NameChanged.connect (connections, ui_bind (&MackieControlProtocol::notify_name_changed, &_mcp, this), midi_ui_context());
if (_route->panner()) {
- _route->panner()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false));
+ _route->panner()->Changed.connect(connections, ui_bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false), midi_ui_context());
for ( unsigned int i = 0; i < _route->panner()->npanners(); ++i ) {
- _route->panner()->streampanner(i).Changed.connect (connections, boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false));
+ _route->panner()->streampanner(i).Changed.connect (connections, ui_bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false), midi_ui_context());
}
}
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route);
if (trk) {
- trk->rec_enable_control()->Changed .connect(connections, boost::bind (&MackieControlProtocol::notify_record_enable_changed, &_mcp, this));
+ trk->rec_enable_control()->Changed .connect(connections, ui_bind (&MackieControlProtocol::notify_record_enable_changed, &_mcp, this), midi_ui_context());
}
// TODO this works when a currently-banked route is made inactive, but not
// when a route is activated which should be currently banked.
- _route->active_changed.connect (connections, boost::bind (&MackieControlProtocol::notify_active_changed, &_mcp, this));
+ _route->active_changed.connect (connections, ui_bind (&MackieControlProtocol::notify_active_changed, &_mcp, this), midi_ui_context());
// TODO
// SelectedChanged
using namespace std;
using namespace Glib;
-
#include "pbd/abstract_ui.cc" // instantiate template
+#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__))
+
+OSC* OSC::_instance = 0;
+
#ifdef DEBUG
static void error_callback(int num, const char *m, const char *path)
{
#endif
OSC::OSC (Session& s, uint32_t port)
- : ControlProtocol (s, "OSC")
+ : ControlProtocol (s, "OSC", this)
, AbstractUI<OSCUIRequest> ("osc")
, _port(port)
{
+ _instance = this;
_shutdown = false;
_osc_server = 0;
_osc_unix_server = 0;
// "Application Hooks"
session_loaded (s);
- session->Exported.connect (*this, boost::bind (&OSC::session_exported, this, _1, _2));
+ session->Exported.connect (*this, ui_bind (&OSC::session_exported, this, _1, _2), this);
}
OSC::~OSC()
{
stop ();
+ _instance = 0;
}
void
*/
if (!route_exists) {
- route->GoingAway.connect (*this, boost::bind (&OSC::drop_route, this, boost::weak_ptr<Route> (route)));
+ route->GoingAway.connect (*this, boost::bind (&OSC::drop_route, this, boost::weak_ptr<Route> (route)), this);
}
}
OSC (ARDOUR::Session&, uint32_t port);
virtual ~OSC();
+ static OSC* instance() { return _instance; }
+
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
void drop_route (boost::weak_ptr<ARDOUR::Route>);
typedef std::list<OSCControllable*> Controllables;
-
+
Controllables controllables;
+
+ static OSC* _instance;
};
#endif // ardour_osc_h
#include "ardour/route.h"
+#include "osc.h"
#include "osc_controllable.h"
using namespace sigc;
, addr (a)
, path (p)
{
- c->Changed.connect (changed_connection, mem_fun (*this, &OSCControllable::send_change));
+ c->Changed.connect (changed_connection, boost::bind (&OSCControllable::send_change, this), OSC::instance());
}
OSCControllable::~OSCControllable ()
#include "ardour/types.h"
namespace ARDOUR {
-
-class Route;
-
+ class Route;
}
class OSCControllable : public PBD::Stateful
}
PowermateControlProtocol::PowermateControlProtocol (Session& s)
- : ControlProtocol (s, "powermate")
+ : ControlProtocol (s, "powermate", 0 /* XXX need an event loop here */)
{
}