std::vector<std::string> AddRouteDialog::track_mode_strings;
std::vector<std::string> AddRouteDialog::bus_mode_strings;
-AddRouteDialog::AddRouteDialog (Session & s)
+AddRouteDialog::AddRouteDialog (Session* s)
: ArdourDialog (X_("add route dialog"))
- , _session (s)
, routes_adjustment (1, 1, 128, 1, 4)
, routes_spinner (routes_adjustment)
, mode_label (_("Track mode:"))
{
+ set_session (s);
+
if (track_mode_strings.empty()) {
track_mode_strings = I18N (track_mode_names);
return 0;
}
- return _session.route_group_by_name (route_group_combo.get_active_text());
+ return _session->route_group_by_name (route_group_combo.get_active_text());
}
void
route_group_combo.append_text (_("No group"));
- _session.foreach_route_group (sigc::mem_fun (*this, &AddRouteDialog::add_route_group));
+ _session->foreach_route_group (sigc::mem_fun (*this, &AddRouteDialog::add_route_group));
route_group_combo.set_active (2);
}
void
AddRouteDialog::group_changed ()
{
- if (route_group_combo.get_active_text () == _("New group...")) {
- RouteGroup* g = new RouteGroup (_session, "", RouteGroup::Active);
+ if (_session && route_group_combo.get_active_text () == _("New group...")) {
+ RouteGroup* g = new RouteGroup (*_session, "", RouteGroup::Active);
RouteGroupDialog d (g, Gtk::Stock::NEW);
int const r = d.do_run ();
if (r == Gtk::RESPONSE_OK) {
- _session.add_route_group (g);
+ _session->add_route_group (g);
add_route_group (g);
route_group_combo.set_active (3);
} else {
class AddRouteDialog : public ArdourDialog
{
public:
- AddRouteDialog (ARDOUR::Session &);
+ AddRouteDialog (ARDOUR::Session*);
~AddRouteDialog ();
bool track ();
ARDOUR::RouteGroup* route_group ();
private:
- ARDOUR::Session& _session;
Gtk::Entry name_template_entry;
Gtk::ComboBoxText track_bus_combo;
Gtk::Adjustment routes_adjustment;
Sample *mixbuf = (Sample *) malloc(sizeof(Sample) * fft_graph.windowSize());
float *gain = (float *) malloc(sizeof(float) * fft_graph.windowSize());
- Selection s = PublicEditor::instance().get_selection();
+ Selection& s (PublicEditor::instance().get_selection());
TimeSelection ts = s.time;
RegionSelection ars = s.regions;
#include <glibmm/thread.h>
+#include "ardour/session_handle.h"
+
#include "fft_graph.h"
#include "fft_result.h"
class Session;
}
-class AnalysisWindow : public Gtk::Window
+
+class AnalysisWindow : public Gtk::Window, public ARDOUR::SessionHandlePtr
{
public:
AnalysisWindow ();
void analyze ();
- void set_session(ARDOUR::Session *session) { _session = session; };
-
private:
-
- ARDOUR::Session *_session;
-
void clear_tracklist();
void source_selection_changed (Gtk::RadioButton *);
void
ArdourDialog::init ()
{
- session = 0;
set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
set_border_width (10);
CloseAllDialogs.connect (sigc::bind (sigc::mem_fun (*this, &ArdourDialog::response), RESPONSE_CANCEL));
#ifndef __ardour_dialog_h__
#define __ardour_dialog_h__
-#include "ardour/ardour.h"
#include <gtkmm/window.h>
#include <gtkmm/dialog.h>
+#include "ardour/ardour.h"
+#include "ardour/session_handle.h"
+
namespace ARDOUR {
class Session;
}
/*
* This virtual parent class is so that each dialog box uses the
- * same mechanism to declare its closing, and to have a common
- * method of connecting and disconnecting from a Session.
+ * same mechanism to declare its closing. It shares a common
+ * method of connecting and disconnecting from a Session with
+ * all other objects that have a handle on a Session.
*/
-class ArdourDialog : public Gtk::Dialog
+class ArdourDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr
{
public:
ArdourDialog (std::string title, bool modal = false, bool use_separator = false);
void on_unmap ();
void on_show ();
- ARDOUR::Session *session;
-
- virtual void set_session (ARDOUR::Session* s) {
- session = s;
- }
-
- virtual void session_gone () {
- set_session (0);
- }
-
static void close_all_dialogs () { CloseAllDialogs(); }
private:
editor = 0;
mixer = 0;
- session = 0;
editor = 0;
engine = 0;
_session_is_new = false;
/* now start and maybe save state */
if (do_engine_start () == 0) {
- if (session && _session_is_new) {
+ if (_session && _session_is_new) {
/* we need to retain initial visual
settings for a new session
*/
- session->save_state ("");
+ _session->save_state ("");
}
}
}
XMLNode enode(static_cast<Stateful*>(editor)->get_state());
XMLNode mnode(mixer->get_state());
- if (session) {
- session->add_instant_xml (enode);
- session->add_instant_xml (mnode);
+ if (_session) {
+ _session->add_instant_xml (enode);
+ _session->add_instant_xml (mnode);
} else {
Config->add_instant_xml (enode);
Config->add_instant_xml (mnode);
return 1;
}
- if (session) {
- session->maybe_write_autosave();
+ if (_session) {
+ _session->maybe_write_autosave();
}
return 1;
{
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::update_autosave)
- if (session && session->dirty()) {
+ if (_session && _session->dirty()) {
if (_autosave_connection.connected()) {
_autosave_connection.disconnect();
}
void
ARDOUR_UI::finish()
{
- if (session) {
+ if (_session) {
- if (session->transport_rolling()) {
- session->request_stop ();
+ if (_session->transport_rolling()) {
+ _session->request_stop ();
usleep (250000);
}
- if (session->dirty()) {
+ if (_session->dirty()) {
switch (ask_about_saving_session(_("quit"))) {
case -1:
return;
point_oh_five_second_connection.disconnect ();
point_zero_one_second_connection.disconnect();
- // session->set_deletion_in_progress ();
- session->remove_pending_capture_state ();
- delete session;
- session = 0;
+ // _session->set_deletion_in_progress ();
+ _session->remove_pending_capture_state ();
+ delete _session;
+ _session = 0;
}
ArdourDialog::close_all_dialogs ();
string prompt;
string type;
- if (session->snap_name() == session->name()) {
+ if (_session->snap_name() == _session->name()) {
type = _("session");
} else {
type = _("snapshot");
}
prompt = string_compose(_("The %1 \"%2\"\nhas not been saved.\n\nAny changes made this time\nwill be lost unless you save it.\n\nWhat do you want to do?"),
- type, session->snap_name());
+ type, _session->snap_name());
prompt_label.set_text (prompt);
prompt_label.set_name (X_("PrompterLabel"));
char buf[64];
uint32_t c, p;
- if (session) {
- c = session->capture_load ();
- p = session->playback_load ();
+ if (_session) {
+ c = _session->capture_load ();
+ p = _session->playback_load ();
push_buffer_stats (c, p);
snprintf (buf, sizeof (buf), _("Buffers p:%" PRIu32 "%% c:%" PRIu32 "%%"),
- session->playback_load(), session->capture_load());
+ _session->playback_load(), _session->capture_load());
buffer_load_label.set_text (buf);
} else {
buffer_load_label.set_text ("");
void
ARDOUR_UI::update_disk_space()
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
- nframes_t frames = session->available_capture_duration();
+ nframes_t frames = _session->available_capture_duration();
char buf[64];
- nframes_t fr = session->frame_rate();
+ nframes_t fr = _session->frame_rate();
if (frames == max_frames) {
strcpy (buf, _("Disk: 24hrs+"));
} else {
rec_enabled_streams = 0;
- session->foreach_route (this, &ARDOUR_UI::count_recenabled_streams);
+ _session->foreach_route (this, &ARDOUR_UI::count_recenabled_streams);
if (rec_enabled_streams) {
frames /= rec_enabled_streams;
void
ARDOUR_UI::open_recent_session ()
{
- bool can_return = (session != 0);
+ bool can_return = (_session != 0);
if (session_selector_window == 0) {
build_session_selector ();
{
list<boost::shared_ptr<MidiTrack> > tracks;
- if (session == 0) {
+ if (_session == 0) {
warning << _("You cannot add a track without a session already loaded.") << endmsg;
return;
}
try {
if (disk) {
- tracks = session->new_midi_track (ARDOUR::Normal, route_group, how_many);
+ tracks = _session->new_midi_track (ARDOUR::Normal, route_group, how_many);
if (tracks.size() != how_many) {
if (how_many == 1) {
}
}
} /*else {
- if ((route = session->new_midi_route ()) == 0) {
+ if ((route = _session->new_midi_route ()) == 0) {
error << _("could not create new midi bus") << endmsg;
}
}*/
list<boost::shared_ptr<AudioTrack> > tracks;
RouteList routes;
- if (session == 0) {
+ if (_session == 0) {
warning << _("You cannot add a track or bus without a session already loaded.") << endmsg;
return;
}
try {
if (track) {
- tracks = session->new_audio_track (input_channels, output_channels, mode, route_group, how_many);
+ tracks = _session->new_audio_track (input_channels, output_channels, mode, route_group, how_many);
if (tracks.size() != how_many) {
if (how_many == 1) {
} else {
- routes = session->new_audio_route (aux, input_channels, output_channels, route_group, how_many);
+ routes = _session->new_audio_route (aux, input_channels, output_channels, route_group, how_many);
if (routes.size() != how_many) {
if (how_many == 1) {
{
nframes_t _preroll = 0;
- if (session) {
+ if (_session) {
// XXX CONFIG_CHANGE FIX - requires AnyTime handling
- // _preroll = session->convert_to_frames_at (new_position, Config->get_preroll());
+ // _preroll = _session->convert_to_frames_at (new_position, Config->get_preroll());
if (new_position > _preroll) {
new_position -= _preroll;
new_position = 0;
}
- session->request_locate (new_position);
+ _session->request_locate (new_position);
}
}
void
ARDOUR_UI::transport_goto_start ()
{
- if (session) {
- session->goto_start();
+ if (_session) {
+ _session->goto_start();
/* force displayed area in editor to start no matter
what "follow playhead" setting is.
*/
if (editor) {
- editor->center_screen (session->current_start_frame ());
+ editor->center_screen (_session->current_start_frame ());
}
}
}
void
ARDOUR_UI::transport_goto_zero ()
{
- if (session) {
- session->request_locate (0);
+ if (_session) {
+ _session->request_locate (0);
/* force displayed area in editor to start no matter
void
ARDOUR_UI::transport_goto_wallclock ()
{
- if (session && editor) {
+ if (_session && editor) {
time_t now;
struct tm tmnow;
time (&now);
localtime_r (&now, &tmnow);
- frames = tmnow.tm_hour * (60 * 60 * session->frame_rate());
- frames += tmnow.tm_min * (60 * session->frame_rate());
- frames += tmnow.tm_sec * session->frame_rate();
+ frames = tmnow.tm_hour * (60 * 60 * _session->frame_rate());
+ frames += tmnow.tm_min * (60 * _session->frame_rate());
+ frames += tmnow.tm_sec * _session->frame_rate();
- session->request_locate (frames);
+ _session->request_locate (frames);
/* force displayed area in editor to start no matter
what "follow playhead" setting is.
void
ARDOUR_UI::transport_goto_end ()
{
- if (session) {
- nframes_t const frame = session->current_end_frame();
- session->request_locate (frame);
+ if (_session) {
+ nframes_t const frame = _session->current_end_frame();
+ _session->request_locate (frame);
/* force displayed area in editor to start no matter
what "follow playhead" setting is.
void
ARDOUR_UI::transport_stop ()
{
- if (!session) {
+ if (!_session) {
return;
}
- if (session->is_auditioning()) {
- session->cancel_audition ();
+ if (_session->is_auditioning()) {
+ _session->cancel_audition ();
return;
}
- session->request_stop ();
+ _session->request_stop ();
}
void
ARDOUR_UI::transport_stop_and_forget_capture ()
{
- if (session) {
- session->request_stop (true);
+ if (_session) {
+ _session->request_stop (true);
}
}
ARDOUR_UI::transport_record (bool roll)
{
- if (session) {
- switch (session->record_status()) {
+ if (_session) {
+ switch (_session->record_status()) {
case Session::Disabled:
- if (session->ntracks() == 0) {
+ if (_session->ntracks() == 0) {
MessageDialog msg (*editor, _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu."));
msg.run ();
return;
}
- session->maybe_enable_record ();
+ _session->maybe_enable_record ();
if (roll) {
transport_roll ();
}
break;
case Session::Recording:
if (roll) {
- session->request_stop();
+ _session->request_stop();
} else {
- session->disable_record (false, true);
+ _session->disable_record (false, true);
}
break;
case Session::Enabled:
- session->disable_record (false, true);
+ _session->disable_record (false, true);
}
}
- //cerr << "ARDOUR_UI::transport_record () called roll = " << roll << " session->record_status() = " << session->record_status() << endl;
+ //cerr << "ARDOUR_UI::transport_record () called roll = " << roll << " _session->record_status() = " << _session->record_status() << endl;
}
void
ARDOUR_UI::transport_roll ()
{
- if (!session) {
+ if (!_session) {
return;
}
- if (session->is_auditioning()) {
+ if (_session->is_auditioning()) {
return;
}
- if (session->config.get_external_sync()) {
- switch (session->config.get_sync_source()) {
+ if (_session->config.get_external_sync()) {
+ switch (_session->config.get_sync_source()) {
case JACK:
break;
default:
}
}
- bool rolling = session->transport_rolling();
+ bool rolling = _session->transport_rolling();
- if (session->get_play_loop()) {
- session->request_play_loop (false, true);
- } else if (session->get_play_range ()) {
- session->request_play_range (false, true);
+ if (_session->get_play_loop()) {
+ _session->request_play_loop (false, true);
+ } else if (_session->get_play_range ()) {
+ _session->request_play_range (false, true);
}
if (!rolling) {
- session->request_transport_speed (1.0f);
+ _session->request_transport_speed (1.0f);
}
map_transport_state ();
ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
{
- if (!session) {
+ if (!_session) {
return;
}
- if (session->is_auditioning()) {
- session->cancel_audition ();
+ if (_session->is_auditioning()) {
+ _session->cancel_audition ();
return;
}
- if (session->config.get_external_sync()) {
- switch (session->config.get_sync_source()) {
+ if (_session->config.get_external_sync()) {
+ switch (_session->config.get_sync_source()) {
case JACK:
break;
default:
}
}
- bool rolling = session->transport_rolling();
+ bool rolling = _session->transport_rolling();
bool affect_transport = true;
if (rolling && roll_out_of_bounded_mode) {
/* drop out of loop/range playback but leave transport rolling */
- if (session->get_play_loop()) {
+ if (_session->get_play_loop()) {
if (Config->get_seamless_loop()) {
/* the disk buffers contain copies of the loop - we can't
just keep playing, so stop the transport. the user
/* disk buffers are normal, so we can keep playing */
affect_transport = false;
}
- session->request_play_loop (false, true);
- } else if (session->get_play_range ()) {
+ _session->request_play_loop (false, true);
+ } else if (_session->get_play_range ()) {
affect_transport = false;
- session->request_play_range (0, true);
+ _session->request_play_range (0, true);
}
}
if (affect_transport) {
if (rolling) {
- session->request_stop (with_abort, true);
+ _session->request_stop (with_abort, true);
} else {
- session->request_transport_speed (1.0f);
+ _session->request_transport_speed (1.0f);
}
}
void
ARDOUR_UI::toggle_session_auto_loop ()
{
- if (session) {
- if (session->get_play_loop()) {
- if (session->transport_rolling()) {
- Location * looploc = session->locations()->auto_loop_location();
+ if (_session) {
+ if (_session->get_play_loop()) {
+ if (_session->transport_rolling()) {
+ Location * looploc = _session->locations()->auto_loop_location();
if (looploc) {
- session->request_locate (looploc->start(), true);
+ _session->request_locate (looploc->start(), true);
}
} else {
- session->request_play_loop (false);
+ _session->request_play_loop (false);
}
} else {
- Location * looploc = session->locations()->auto_loop_location();
+ Location * looploc = _session->locations()->auto_loop_location();
if (looploc) {
- session->request_play_loop (true);
+ _session->request_play_loop (true);
}
}
}
void
ARDOUR_UI::transport_play_selection ()
{
- if (!session) {
+ if (!_session) {
return;
}
{
float current_transport_speed;
- if (session) {
- current_transport_speed = session->transport_speed();
+ if (_session) {
+ current_transport_speed = _session->transport_speed();
if (current_transport_speed >= 0.0f) {
switch (option) {
case 0:
- session->request_transport_speed (-1.0f);
+ _session->request_transport_speed (-1.0f);
break;
case 1:
- session->request_transport_speed (-4.0f);
+ _session->request_transport_speed (-4.0f);
break;
case -1:
- session->request_transport_speed (-0.5f);
+ _session->request_transport_speed (-0.5f);
break;
}
} else {
/* speed up */
- session->request_transport_speed (current_transport_speed * 1.5f);
+ _session->request_transport_speed (current_transport_speed * 1.5f);
}
}
}
{
float current_transport_speed;
- if (session) {
- current_transport_speed = session->transport_speed();
+ if (_session) {
+ current_transport_speed = _session->transport_speed();
if (current_transport_speed <= 0.0f) {
switch (option) {
case 0:
- session->request_transport_speed (1.0f);
+ _session->request_transport_speed (1.0f);
break;
case 1:
- session->request_transport_speed (4.0f);
+ _session->request_transport_speed (4.0f);
break;
case -1:
- session->request_transport_speed (0.5f);
+ _session->request_transport_speed (0.5f);
break;
}
} else {
/* speed up */
- session->request_transport_speed (current_transport_speed * 1.5f);
+ _session->request_transport_speed (current_transport_speed * 1.5f);
}
}
void
ARDOUR_UI::toggle_record_enable (uint32_t dstream)
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
boost::shared_ptr<Route> r;
- if ((r = session->route_by_remote_id (dstream)) != 0) {
+ if ((r = _session->route_by_remote_id (dstream)) != 0) {
Track* t;
t->diskstream()->set_record_enabled (!t->diskstream()->record_enabled());
}
}
- if (session == 0) {
+ if (_session == 0) {
return;
}
}
{
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::map_transport_state)
- if (!session) {
+ if (!_session) {
auto_loop_button.set_visual_state (0);
play_selection_button.set_visual_state (0);
roll_button.set_visual_state (0);
return;
}
- float sp = session->transport_speed();
+ float sp = _session->transport_speed();
if (sp == 1.0f) {
shuttle_fract = SHUTTLE_FRACT_SPEED1; /* speed = 1.0, believe it or not */
if (sp != 0.0) {
- if (session->get_play_range()) {
+ if (_session->get_play_range()) {
play_selection_button.set_visual_state (1);
roll_button.set_visual_state (0);
auto_loop_button.set_visual_state (0);
- } else if (session->get_play_loop ()) {
+ } else if (_session->get_play_loop ()) {
auto_loop_button.set_visual_state (1);
play_selection_button.set_visual_state (0);
ARDOUR_UI::update_clocks ()
{
if (!editor || !editor->dragging_playhead()) {
- Clock (session->audible_frame(), false, editor->get_preferred_edit_position()); /* EMIT_SIGNAL */
+ Clock (_session->audible_frame(), false, editor->get_preferred_edit_position()); /* EMIT_SIGNAL */
}
}
bool do_save = (snapname.length() != 0);
vector<sys::path> p;
- get_state_files_in_directory (session->session_directory().root_path(), p);
+ get_state_files_in_directory (_session->session_directory().root_path(), p);
vector<string> n = get_file_names_no_extension (p);
if (find (n.begin(), n.end(), snapname) != n.end()) {
int
ARDOUR_UI::save_state_canfail (string name)
{
- if (session) {
+ if (_session) {
int ret;
if (name.length() == 0) {
- name = session->snap_name();
+ name = _session->snap_name();
}
- if ((ret = session->save_state (name)) != 0) {
+ if ((ret = _session->save_state (name)) != 0) {
return ret;
}
}
void
ARDOUR_UI::primary_clock_value_changed ()
{
- if (session) {
- session->request_locate (primary_clock.current_time ());
+ if (_session) {
+ _session->request_locate (primary_clock.current_time ());
}
}
void
ARDOUR_UI::big_clock_value_changed ()
{
- if (session) {
- session->request_locate (big_clock.current_time ());
+ if (_session) {
+ _session->request_locate (big_clock.current_time ());
}
}
void
ARDOUR_UI::secondary_clock_value_changed ()
{
- if (session) {
- session->request_locate (secondary_clock.current_time ());
+ if (_session) {
+ _session->request_locate (secondary_clock.current_time ());
}
}
void
ARDOUR_UI::transport_rec_enable_blink (bool onoff)
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
- Session::RecordState const r = session->record_status ();
- bool const h = session->have_rec_enabled_diskstream ();
+ Session::RecordState const r = _session->record_status ();
+ bool const h = _session->have_rec_enabled_diskstream ();
if (r == Session::Enabled || (r == Session::Recording && !h)) {
if (onoff) {
prompter.set_name (X_("Prompter"));
prompter.set_title (_("Save Mix Template"));
prompter.set_prompt (_("Name for mix template:"));
- prompter.set_initial_text(session->name() + _("-template"));
+ prompter.set_initial_text(_session->name() + _("-template"));
prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
switch (prompter.run()) {
prompter.get_result (name);
if (name.length()) {
- session->save_template (name);
+ _session->save_template (name);
}
break;
ARDOUR_UI::edit_metadata ()
{
SessionMetadataEditor dialog;
- dialog.set_session (session);
+ dialog.set_session (_session);
editor->ensure_float (dialog);
dialog.run ();
}
ARDOUR_UI::import_metadata ()
{
SessionMetadataImporter dialog;
- dialog.set_session (session);
+ dialog.set_session (_session);
editor->ensure_float (dialog);
dialog.run ();
}
void
ARDOUR_UI::idle_load (const Glib::ustring& path)
{
- if (session) {
+ if (_session) {
if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
/* /path/to/foo => /path/to/foo, foo */
load_session (path, basename_nosuffix (path));
ret = load_session (session_path, session_name, template_name);
if (!ARDOUR_COMMAND_LINE::immediate_save.empty()) {
- session->save_state (ARDOUR_COMMAND_LINE::immediate_save, false);
+ _session->save_state (ARDOUR_COMMAND_LINE::immediate_save, false);
exit (1);
}
}
goto out;
}
- connect_to_session (new_session);
+ set_session (new_session);
session_loaded = true;
goto_editor_window ();
- if (session) {
- session->set_clean ();
+ if (_session) {
+ _session->set_clean ();
}
flush_pending ();
return -1;
}
- connect_to_session (new_session);
+ set_session (new_session);
session_loaded = true;
dimage->set_alignment(ALIGN_LEFT, ALIGN_TOP);
- const string dead_sound_directory = session->session_directory().dead_sound_path().to_string();
+ const string dead_sound_directory = _session->session_directory().dead_sound_path().to_string();
void
ARDOUR_UI::cleanup ()
{
- if (session == 0) {
+ if (_session == 0) {
/* shouldn't happen: menu item is insensitive */
return;
}
act->set_sensitive (false);
}
- if (session->cleanup_sources (rep)) {
+ if (_session->cleanup_sources (rep)) {
editor->finish_cleanup ();
return;
}
void
ARDOUR_UI::flush_trash ()
{
- if (session == 0) {
+ if (_session == 0) {
/* shouldn't happen: menu item is insensitive */
return;
}
ARDOUR::CleanupReport rep;
- if (session->cleanup_trash_sources (rep)) {
+ if (_session->cleanup_trash_sources (rep)) {
return;
}
{
int count;
- if (!session) {
+ if (!_session) {
return;
}
if (add_route_dialog == 0) {
- add_route_dialog = new AddRouteDialog (*session);
+ add_route_dialog = new AddRouteDialog (_session);
if (float_window) {
add_route_dialog->set_transient_for (*float_window);
}
string template_path = add_route_dialog->track_template();
if (!template_path.empty()) {
- session->new_route_from_template (count, template_path);
+ _session->new_route_from_template (count, template_path);
return;
}
AutoConnectOption oac = Config->get_output_auto_connect();
if (oac & AutoConnectMaster) {
- output_chan = (session->master_out() ? session->master_out()->n_inputs().n_audio() : input_chan);
+ output_chan = (_session->master_out() ? _session->master_out()->n_inputs().n_audio() : input_chan);
} else {
output_chan = input_chan;
}
{
XMLNode* node = 0;
- if (session) {
- node = session->instant_xml(X_("Mixer"));
+ if (_session) {
+ node = _session->instant_xml(X_("Mixer"));
} else {
node = Config->instant_xml(X_("Mixer"));
}
{
XMLNode* node = 0;
- if (session) {
- node = session->instant_xml(X_("Editor"));
+ if (_session) {
+ node = _session->instant_xml(X_("Editor"));
} else {
node = Config->instant_xml(X_("Editor"));
}
void
ARDOUR_UI::xrun_handler(nframes_t where)
{
- if (!session) {
+ if (!_session) {
return;
}
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::xrun_handler, where)
- if (session && Config->get_create_xrun_marker() && session->actively_recording()) {
+ if (_session && Config->get_create_xrun_marker() && _session->actively_recording()) {
create_xrun_marker(where);
}
- if (session && Config->get_stop_recording_on_xrun() && session->actively_recording()) {
+ if (_session && Config->get_stop_recording_on_xrun() && _session->actively_recording()) {
halt_on_xrun_message ();
}
}
void
ARDOUR_UI::record_state_changed ()
{
- ENSURE_GUI_THREAD (*this, &ARDOUR_UI::record_state_changed)
+ ENSURE_GUI_THREAD (*this, &ARDOUR_UI::record_state_changed);
- if (!session || !big_clock_window) {
+ if (!_session || !big_clock_window) {
/* why bother - the clock isn't visible */
return;
}
- Session::RecordState const r = session->record_status ();
- bool const h = session->have_rec_enabled_diskstream ();
+ Session::RecordState const r = _session->record_status ();
+ bool const h = _session->have_rec_enabled_diskstream ();
if (r == Session::Recording && h) {
big_clock.set_widget_name ("BigClockRecording");
bool
ARDOUR_UI::first_idle ()
{
- if (session) {
- session->allow_auto_play (true);
+ if (_session) {
+ _session->allow_auto_play (true);
}
if (editor) {
node->add_property ((*x)->name().c_str(), enum_2_string ((*x)->mode()));
}
- session->add_extra_xml (*node);
- session->set_dirty ();
+ _session->add_extra_xml (*node);
+ _session->set_dirty ();
}
#include "ardour/ardour.h"
#include "ardour/types.h"
#include "ardour/utils.h"
+#include "ardour/session_handle.h"
#include "audio_clock.h"
#include "ardour_dialog.h"
extern sigc::signal<void> ColorsChanged;
extern sigc::signal<void> DPIReset;
-class ARDOUR_UI : public Gtkmm2ext::UI
+class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
{
public:
ARDOUR_UI (int *argcp, char **argvp[]);
nframes_t initial_length);
bool session_is_new() const { return _session_is_new; }
- ARDOUR::Session* the_session() { return session; }
+ ARDOUR::Session* the_session() { return _session; }
bool will_create_new_session_automatically() const {
return _will_create_new_session_automatically;
private:
ArdourStartup* _startup;
ARDOUR::AudioEngine *engine;
- ARDOUR::Session *session;
Gtk::Tooltips _tooltips;
void goto_editor_window ();
void toggle_roll (bool with_abort, bool roll_out_of_bounded_mode);
bool _session_is_new;
- void connect_to_session (ARDOUR::Session *);
+ void set_session (ARDOUR::Session *);
void connect_dependents_to_session (ARDOUR::Session *);
void we_have_dependents ();
void
ARDOUR_UI::audition_alert_toggle ()
{
- if (session) {
- session->cancel_audition();
+ if (_session) {
+ _session->cancel_audition();
}
}
void
ARDOUR_UI::solo_alert_toggle ()
{
- if (session) {
- session->set_solo (session->get_routes(), !session->soloing());
+ if (_session) {
+ _session->set_solo (_session->get_routes(), !_session->soloing());
}
}
void
ARDOUR_UI::solo_blink (bool onoff)
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
- if (session->soloing()) {
+ if (_session->soloing()) {
if (onoff) {
solo_alert_button.set_state (STATE_ACTIVE);
} else {
void
ARDOUR_UI::sync_blink (bool onoff)
{
- if (session == 0 || !session->config.get_external_sync()) {
+ if (_session == 0 || !_session->config.get_external_sync()) {
/* internal sync */
sync_button.set_visual_state (0);
return;
}
- if (!session->transport_locked()) {
+ if (!_session->transport_locked()) {
/* not locked, so blink on and off according to the onoff argument */
if (onoff) {
void
ARDOUR_UI::audition_blink (bool onoff)
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
- if (session->is_auditioning()) {
+ if (_session->is_auditioning()) {
if (onoff) {
auditioning_alert_button.set_state (STATE_ACTIVE);
} else {
gint
ARDOUR_UI::shuttle_box_button_press (GdkEventButton* ev)
{
- if (!session) {
+ if (!_session) {
return true;
}
gint
ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
{
- if (!session) {
+ if (!_session) {
return true;
}
shuttle_grabbed = false;
shuttle_box.remove_modal_grab ();
if (Config->get_shuttle_behaviour() == Sprung) {
- if (session->config.get_auto_play() || roll_button.get_visual_state()) {
+ if (_session->config.get_auto_play() || roll_button.get_visual_state()) {
shuttle_fract = SHUTTLE_FRACT_SPEED1;
- session->request_transport_speed (1.0);
+ _session->request_transport_speed (1.0);
stop_button.set_visual_state (0);
roll_button.set_visual_state (1);
} else {
shuttle_fract = 0;
- session->request_transport_speed (0.0);
+ _session->request_transport_speed (0.0);
}
shuttle_box.queue_draw ();
}
return true;
case 2:
- if (session->transport_rolling()) {
+ if (_session->transport_rolling()) {
shuttle_fract = SHUTTLE_FRACT_SPEED1;
- session->request_transport_speed (1.0);
+ _session->request_transport_speed (1.0);
stop_button.set_visual_state (0);
roll_button.set_visual_state (1);
} else {
gint
ARDOUR_UI::shuttle_box_scroll (GdkEventScroll* ev)
{
- if (!session) {
+ if (!_session) {
return true;
}
gint
ARDOUR_UI::shuttle_box_motion (GdkEventMotion* ev)
{
- if (!session || !shuttle_grabbed) {
+ if (!_session || !shuttle_grabbed) {
return true;
}
semitones = round (shuttle_fract / step);
speed = pow (2.0, (semitones / 12.0));
- session->request_transport_speed (speed);
+ _session->request_transport_speed (speed);
} else {
fract = -fract;
}
- session->request_transport_speed (shuttle_max_speed * fract);
+ _session->request_transport_speed (shuttle_max_speed * fract);
}
shuttle_box.queue_draw ();
void
ARDOUR_UI::update_speed_display ()
{
- if (!session) {
+ if (!_session) {
if (last_speed_displayed != 0) {
speed_display_label.set_text (_("stop"));
last_speed_displayed = 0;
}
char buf[32];
- float x = session->transport_speed ();
+ float x = _session->transport_speed ();
if (x != last_speed_displayed) {
ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s)
{
BootMessage (_("Setup Editor"));
- editor->connect_to_session (s);
+ editor->set_session (s);
BootMessage (_("Setup Mixer"));
- mixer->connect_to_session (s);
+ mixer->set_session (s);
/* its safe to do this now */
using namespace Gtkmm2ext;
void
-ARDOUR_UI::connect_to_session (Session *s)
+ARDOUR_UI::set_session (Session *s)
{
- session = s;
+ SessionHandlePtr::set_session (s);
- session->Xrun.connect (sigc::mem_fun(*this, &ARDOUR_UI::xrun_handler));
- session->RecordStateChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::record_state_changed));
+ if (location_ui) {
+ location_ui->set_session(s);
+ }
+
+ if (route_params) {
+ route_params->set_session (s);
+ }
+
+ primary_clock.set_session (s);
+ secondary_clock.set_session (s);
+ big_clock.set_session (s);
+ preroll_clock.set_session (s);
+ postroll_clock.set_session (s);
+
+ if (!_session) {
+ return;
+ }
/* sensitize menu bar options that are now valid */
ActionManager::set_sensitive (ActionManager::session_sensitive_actions, true);
- ActionManager::set_sensitive (ActionManager::write_sensitive_actions, session->writable());
+ ActionManager::set_sensitive (ActionManager::write_sensitive_actions, _session->writable());
- if (session->locations()->num_range_markers()) {
+ if (_session->locations()->num_range_markers()) {
ActionManager::set_sensitive (ActionManager::range_sensitive_actions, true);
} else {
ActionManager::set_sensitive (ActionManager::range_sensitive_actions, false);
}
- if (!session->control_out()) {
+ if (!_session->control_out()) {
Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), X_("SoloViaBus"));
if (act) {
act->set_sensitive (false);
ActionManager::set_sensitive (ActionManager::point_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::playlist_selection_sensitive_actions, false);
- session->locations()->added.connect (sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change));
- session->locations()->removed.connect (sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change));
-
rec_button.set_sensitive (true);
shuttle_box.set_sensitive (true);
-
- if (location_ui) {
- location_ui->set_session(s);
- }
-
- if (route_params) {
- route_params->set_session (s);
- }
+ solo_alert_button.set_active (_session->soloing());
setup_session_options ();
Blink.connect (sigc::mem_fun(*this, &ARDOUR_UI::sync_blink));
Blink.connect (sigc::mem_fun(*this, &ARDOUR_UI::audition_blink));
- /* these are all need to be handled in an RT-safe and MT way, so don't
- do any GUI work, just queue it for handling by the GUI thread.
- */
-
- session->TransportStateChange.connect (sigc::mem_fun(*this, &ARDOUR_UI::map_transport_state));
-
- /* alert the user to these things happening */
-
- session->AuditionActive.connect (sigc::mem_fun(*this, &ARDOUR_UI::auditioning_changed));
- session->SoloActive.connect (sigc::mem_fun(*this, &ARDOUR_UI::soloing_changed));
-
- solo_alert_button.set_active (session->soloing());
+ _session_connections.add_connection (_session->Xrun.connect (sigc::mem_fun(*this, &ARDOUR_UI::xrun_handler)));
+ _session_connections.add_connection (_session->RecordStateChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::record_state_changed)));
+ _session_connections.add_connection (_session->locations()->added.connect (sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change)));
+ _session_connections.add_connection (_session->locations()->removed.connect (sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change)));
+ _session_connections.add_connection (_session->TransportStateChange.connect (sigc::mem_fun(*this, &ARDOUR_UI::map_transport_state)));
+ _session_connections.add_connection (_session->AuditionActive.connect (sigc::mem_fun(*this, &ARDOUR_UI::auditioning_changed)));
+ _session_connections.add_connection (_session->SoloActive.connect (sigc::mem_fun(*this, &ARDOUR_UI::soloing_changed)));
+ _session_connections.add_connection (_session->DirtyChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::update_autosave)));
- /* update autochange callback on dirty state changing */
-
- session->DirtyChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::update_autosave));
-
- /* can't be auditioning here */
-
- primary_clock.set_session (s);
- secondary_clock.set_session (s);
- big_clock.set_session (s);
- preroll_clock.set_session (s);
- postroll_clock.set_session (s);
/* Clocks are on by default after we are connected to a session, so show that here.
*/
int
ARDOUR_UI::unload_session (bool hide_stuff)
{
- if (session && session->dirty()) {
+ if (_session && _session->dirty()) {
switch (ask_about_saving_session (_("close"))) {
case -1:
// cancel
return 1;
case 1:
- session->save_state ("");
+ _session->save_state ("");
break;
}
}
Blink.clear ();
- primary_clock.set_session (0);
- secondary_clock.set_session (0);
- big_clock.set_session (0);
- preroll_clock.set_session (0);
- postroll_clock.set_session (0);
-
- delete session;
- session = 0;
+ delete _session;
update_buffer_load ();
if (rc_option_editor == 0) {
rc_option_editor = new RCOptionEditor;
rc_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleRCOptionsEditor")));
- rc_option_editor->set_session (session);
+ rc_option_editor->set_session (_session);
}
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleRCOptionsEditor"));
ARDOUR_UI::toggle_session_options_window ()
{
if (session_option_editor == 0) {
- session_option_editor = new SessionOptionEditor (session);
+ session_option_editor = new SessionOptionEditor (_session);
session_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleSessionOptionsEditor")));
}
{
if (location_ui == 0) {
location_ui = new LocationUIWindow ();
- location_ui->set_session (session);
+ location_ui->set_session (_session);
location_ui->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleLocations")));
}
return 0;
ARDOUR_UI::create_bundle_manager ()
{
if (bundle_manager == 0) {
- bundle_manager = new BundleManager (session);
+ bundle_manager = new BundleManager (_session);
bundle_manager->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleBundleManager")));
}
}
{
if (route_params == 0) {
route_params = new RouteParams_UI ();
- route_params->set_session (session);
+ route_params->set_session (_session);
route_params->signal_unmap().connect (sigc::bind(sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleInspector")));
}
return 0;
void
ARDOUR_UI::handle_locations_change (Location *)
{
- if (session) {
- if (session->locations()->num_range_markers()) {
+ if (_session) {
+ if (_session->locations()->num_range_markers()) {
ActionManager::set_sensitive (ActionManager::range_sensitive_actions, true);
} else {
ActionManager::set_sensitive (ActionManager::range_sensitive_actions, false);
void
ARDOUR_UI::toggle_external_sync()
{
- ActionManager::toggle_config_state_foo ("Transport", "ToggleExternalSync", sigc::mem_fun (session->config, &SessionConfiguration::set_external_sync), sigc::mem_fun (session->config, &SessionConfiguration::get_external_sync));
+ ActionManager::toggle_config_state_foo ("Transport", "ToggleExternalSync", sigc::mem_fun (_session->config, &SessionConfiguration::set_external_sync), sigc::mem_fun (_session->config, &SessionConfiguration::get_external_sync));
}
void
ARDOUR_UI::toggle_time_master ()
{
- ActionManager::toggle_config_state_foo ("Transport", "ToggleTimeMaster", sigc::mem_fun (session->config, &SessionConfiguration::set_jack_time_master), sigc::mem_fun (session->config, &SessionConfiguration::get_jack_time_master));
+ ActionManager::toggle_config_state_foo ("Transport", "ToggleTimeMaster", sigc::mem_fun (_session->config, &SessionConfiguration::set_jack_time_master), sigc::mem_fun (_session->config, &SessionConfiguration::get_jack_time_master));
}
void
void
ARDOUR_UI::toggle_auto_input ()
{
- ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoInput", sigc::mem_fun (session->config, &SessionConfiguration::set_auto_input), sigc::mem_fun (session->config, &SessionConfiguration::get_auto_input));
+ ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoInput", sigc::mem_fun (_session->config, &SessionConfiguration::set_auto_input), sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_input));
}
void
ARDOUR_UI::toggle_auto_play ()
{
- ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoPlay", sigc::mem_fun (session->config, &SessionConfiguration::set_auto_play), sigc::mem_fun (session->config, &SessionConfiguration::get_auto_play));
+ ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoPlay", sigc::mem_fun (_session->config, &SessionConfiguration::set_auto_play), sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_play));
}
void
ARDOUR_UI::toggle_auto_return ()
{
- ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoReturn", sigc::mem_fun (session->config, &SessionConfiguration::set_auto_return), sigc::mem_fun (session->config, &SessionConfiguration::get_auto_return));
+ ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoReturn", sigc::mem_fun (_session->config, &SessionConfiguration::set_auto_return), sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_return));
}
void
return;
}
- if (tact->get_active() != session->config.get_punch_in()) {
- session->config.set_punch_in (tact->get_active ());
+ if (tact->get_active() != _session->config.get_punch_in()) {
+ _session->config.set_punch_in (tact->get_active ());
}
if (tact->get_active()) {
return;
}
- if (tact->get_active() != session->config.get_punch_out()) {
- session->config.set_punch_out (tact->get_active ());
+ if (tact->get_active() != _session->config.get_punch_out()) {
+ _session->config.set_punch_out (tact->get_active ());
}
if (tact->get_active()) {
void
ARDOUR_UI::reenable_hide_loop_punch_ruler_if_appropriate ()
{
- if (!session->config.get_punch_in() && !session->config.get_punch_out()) {
+ if (!_session->config.get_punch_in() && !_session->config.get_punch_out()) {
/* if punch in/out are now both off, reallow hiding of the loop/punch ruler */
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Rulers"), "toggle-loop-punch-ruler");
if (act) {
Glib::RefPtr<Action> act = ActionManager::get_action ("Transport", "ToggleVideoSync");
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
- session->config.set_use_video_sync (tact->get_active());
+ _session->config.set_use_video_sync (tact->get_active());
}
}
void
ARDOUR_UI::setup_session_options ()
{
- session->config.ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed));
+ _session->config.ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed));
boost::function<void (std::string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
- session->config.map_parameters (pc);
+ _session->config.map_parameters (pc);
}
#if 0
void
ARDOUR_UI::handle_sync_change ()
{
- if (!session) {
+ if (!_session) {
return;
}
- if (!session->config.get_external_sync()) {
+ if (!_session->config.get_external_sync()) {
sync_button.set_label (_("Internal"));
ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true);
ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (true);
if (p == "external-sync") {
- ActionManager::map_some_state ("Transport", "ToggleExternalSync", sigc::mem_fun (session->config, &SessionConfiguration::get_external_sync));
+ ActionManager::map_some_state ("Transport", "ToggleExternalSync", sigc::mem_fun (_session->config, &SessionConfiguration::get_external_sync));
- if (!session->config.get_external_sync()) {
+ if (!_session->config.get_external_sync()) {
sync_button.set_label (_("Internal"));
ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true);
ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (true);
} else {
- sync_button.set_label (sync_source_to_string (session->config.get_sync_source()));
+ sync_button.set_label (sync_source_to_string (_session->config.get_sync_source()));
/* XXX need to make auto-play is off as well as insensitive */
ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (false);
ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (false);
} else if (p == "midi-feedback") {
ActionManager::map_some_state ("options", "SendMIDIfeedback", &RCConfiguration::get_midi_feedback);
} else if (p == "auto-play") {
- ActionManager::map_some_state ("Transport", "ToggleAutoPlay", sigc::mem_fun (session->config, &SessionConfiguration::get_auto_play));
+ ActionManager::map_some_state ("Transport", "ToggleAutoPlay", sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_play));
} else if (p == "auto-return") {
- ActionManager::map_some_state ("Transport", "ToggleAutoReturn", sigc::mem_fun (session->config, &SessionConfiguration::get_auto_return));
+ ActionManager::map_some_state ("Transport", "ToggleAutoReturn", sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_return));
} else if (p == "auto-input") {
- ActionManager::map_some_state ("Transport", "ToggleAutoInput", sigc::mem_fun (session->config, &SessionConfiguration::get_auto_input));
+ ActionManager::map_some_state ("Transport", "ToggleAutoInput", sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_input));
} else if (p == "punch-out") {
- ActionManager::map_some_state ("Transport", "TogglePunchOut", sigc::mem_fun (session->config, &SessionConfiguration::get_punch_out));
- if (!session->config.get_punch_out()) {
+ ActionManager::map_some_state ("Transport", "TogglePunchOut", sigc::mem_fun (_session->config, &SessionConfiguration::get_punch_out));
+ if (!_session->config.get_punch_out()) {
unset_dual_punch ();
}
} else if (p == "punch-in") {
- ActionManager::map_some_state ("Transport", "TogglePunchIn", sigc::mem_fun (session->config, &SessionConfiguration::get_punch_in));
- if (!session->config.get_punch_in()) {
+ ActionManager::map_some_state ("Transport", "TogglePunchIn", sigc::mem_fun (_session->config, &SessionConfiguration::get_punch_in));
+ if (!_session->config.get_punch_in()) {
unset_dual_punch ();
}
} else if (p == "clicking") {
ActionManager::map_some_state ("Transport", "ToggleClick", &RCConfiguration::get_clicking);
} else if (p == "jack-time-master") {
- ActionManager::map_some_state ("Transport", "ToggleTimeMaster", sigc::mem_fun (session->config, &SessionConfiguration::get_jack_time_master));
+ ActionManager::map_some_state ("Transport", "ToggleTimeMaster", sigc::mem_fun (_session->config, &SessionConfiguration::get_jack_time_master));
} else if (p == "use-video-sync") {
- ActionManager::map_some_state ("Transport", "ToggleVideoSync", sigc::mem_fun (session->config, &SessionConfiguration::get_use_video_sync));
+ ActionManager::map_some_state ("Transport", "ToggleVideoSync", sigc::mem_fun (_session->config, &SessionConfiguration::get_use_video_sync));
} else if (p == "shuttle-behaviour") {
switch (Config->get_shuttle_behaviour ()) {
shuttle_style_button.set_active_text (_("sprung"));
shuttle_fract = 0.0;
shuttle_box.queue_draw ();
- if (session) {
- if (session->transport_rolling()) {
+ if (_session) {
+ if (_session->transport_rolling()) {
shuttle_fract = SHUTTLE_FRACT_SPEED1;
- session->request_transport_speed (1.0);
+ _session->request_transport_speed (1.0);
}
}
break;
{
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::reset_main_clocks)
- if (session) {
- primary_clock.set (session->audible_frame(), true);
- secondary_clock.set (session->audible_frame(), true);
+ if (_session) {
+ primary_clock.set (_session->audible_frame(), true);
+ secondary_clock.set (_session->audible_frame(), true);
} else {
primary_clock.set (0, true);
secondary_clock.set (0, true);
10 /* Audio Frame */
};
-AudioClock::AudioClock (
- std::string clock_name, bool transient, std::string widget_name, bool allow_edit, bool follows_playhead, bool duration, bool with_info
- )
+AudioClock::AudioClock (std::string clock_name, bool transient, std::string widget_name,
+ bool allow_edit, bool follows_playhead, bool duration, bool with_info)
: _name (clock_name),
is_transient (transient),
is_duration (duration),
b2 ("|"),
last_when(0)
{
- session = 0;
last_when = 0;
last_pdelta = 0;
last_sdelta = 0;
AudioClock::set (nframes_t when, bool force, nframes_t offset, char which)
{
- if ((!force && !is_visible()) || session == 0) {
+ if ((!force && !is_visible()) || _session == 0) {
return;
}
audio_frames_label.set_text (buf);
if (frames_upper_info_label) {
- nframes_t rate = session->frame_rate();
+ nframes_t rate = _session->frame_rate();
if (fmod (rate, 1000.0) == 0.000) {
sprintf (buf, "%uK", rate/1000);
frames_upper_info_label->set_text (buf);
}
- float vid_pullup = session->config.get_video_pullup();
+ float vid_pullup = _session->config.get_video_pullup();
if (vid_pullup == 0.0) {
if (frames_lower_info_label->get_text () != _("none")) {
float secs;
left = when;
- hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
- left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
- mins = (int) floor (left / (session->frame_rate() * 60.0f));
- left -= (nframes_t) floor (mins * session->frame_rate() * 60.0f);
- secs = left / (float) session->frame_rate();
+ hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f));
+ left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f);
+ mins = (int) floor (left / (_session->frame_rate() * 60.0f));
+ left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f);
+ secs = left / (float) _session->frame_rate();
if (force || hrs != ms_last_hrs) {
sprintf (buf, "%02d", hrs);
Timecode::Time timecode;
if (is_duration) {
- session->timecode_duration (when, timecode);
+ _session->timecode_duration (when, timecode);
} else {
- session->timecode_time (when, timecode);
+ _session->timecode_time (when, timecode);
}
if (force || timecode.hours != last_hrs || timecode.negative != last_negative) {
}
if (timecode_upper_info_label) {
- double timecode_frames = session->timecode_frames_per_second();
+ double timecode_frames = _session->timecode_frames_per_second();
if ( fmod(timecode_frames, 1.0) == 0.0) {
sprintf (buf, "%u", int (timecode_frames));
}
if ((fabs(timecode_frames - 29.97) < 0.0001) || timecode_frames == 30) {
- if (session->timecode_drop_frames()) {
+ if (_session->timecode_drop_frames()) {
sprintf (buf, "DF");
} else {
sprintf (buf, "NDF");
bbt.beats = 0;
bbt.ticks = 0;
} else {
- session->tempo_map().bbt_time (when, bbt);
+ _session->tempo_map().bbt_time (when, bbt);
bbt.bars--;
bbt.beats--;
}
} else {
- session->tempo_map().bbt_time (when, bbt);
+ _session->tempo_map().bbt_time (when, bbt);
}
sprintf (buf, "%03" PRIu32, bbt.bars);
pos = bbt_reference_time;
}
- TempoMetric m (session->tempo_map().metric_at (pos));
+ TempoMetric m (_session->tempo_map().metric_at (pos));
sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
if (bbt_lower_info_label->get_text() != buf) {
void
AudioClock::set_session (Session *s)
{
- session = s;
+ SessionHandlePtr::set_session (s);
- if (s) {
+ if (_session) {
XMLProperty* prop;
- XMLNode* node = session->extra_xml (X_("ClockModes"));
+ XMLNode* node = _session->extra_xml (X_("ClockModes"));
AudioClock::Mode amode;
if (node) {
bool
AudioClock::field_button_press_event (GdkEventButton *ev, Field /*field*/)
{
- if (session == 0) {
+ if (_session == 0) {
return false;
}
bool
AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field)
{
- if (session == 0) {
+ if (_session == 0) {
return false;
}
bool
AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field)
{
- if (session == 0 || !dragging) {
+ if (_session == 0 || !dragging) {
return false;
}
BBT_Time bbt;
switch (field) {
case Timecode_Hours:
- frames = (nframes_t) floor (3600.0 * session->frame_rate());
+ frames = (nframes_t) floor (3600.0 * _session->frame_rate());
break;
case Timecode_Minutes:
- frames = (nframes_t) floor (60.0 * session->frame_rate());
+ frames = (nframes_t) floor (60.0 * _session->frame_rate());
break;
case Timecode_Seconds:
- frames = session->frame_rate();
+ frames = _session->frame_rate();
break;
case Timecode_Frames:
- frames = (nframes_t) floor (session->frame_rate() / session->timecode_frames_per_second());
+ frames = (nframes_t) floor (_session->frame_rate() / _session->timecode_frames_per_second());
break;
case AudioFrames:
break;
case MS_Hours:
- frames = (nframes_t) floor (3600.0 * session->frame_rate());
+ frames = (nframes_t) floor (3600.0 * _session->frame_rate());
break;
case MS_Minutes:
- frames = (nframes_t) floor (60.0 * session->frame_rate());
+ frames = (nframes_t) floor (60.0 * _session->frame_rate());
break;
case MS_Seconds:
- frames = session->frame_rate();
+ frames = _session->frame_rate();
break;
case Bars:
bbt.bars = 1;
bbt.beats = 0;
bbt.ticks = 0;
- frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
+ frames = _session->tempo_map().bbt_duration_at(pos,bbt,dir);
break;
case Beats:
bbt.bars = 0;
bbt.beats = 1;
bbt.ticks = 0;
- frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
+ frames = _session->tempo_map().bbt_duration_at(pos,bbt,dir);
break;
case Ticks:
bbt.bars = 0;
bbt.beats = 0;
bbt.ticks = 1;
- frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
+ frames = _session->tempo_map().bbt_duration_at(pos,bbt,dir);
break;
}
seconds_label.set_text("59");
}
- switch ((long)rint(session->timecode_frames_per_second())) {
+ switch ((long)rint(_session->timecode_frames_per_second())) {
case 24:
if (atoi(frames_label.get_text()) > 23) {
frames_label.set_text("23");
break;
}
- if (session->timecode_drop_frames()) {
+ if (_session->timecode_drop_frames()) {
if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) {
frames_label.set_text("02");
}
nframes_t
AudioClock::timecode_frame_from_display () const
{
- if (session == 0) {
+ if (_session == 0) {
return 0;
}
timecode.minutes = atoi (minutes_label.get_text());
timecode.seconds = atoi (seconds_label.get_text());
timecode.frames = atoi (frames_label.get_text());
- timecode.rate = session->timecode_frames_per_second();
- timecode.drop= session->timecode_drop_frames();
+ timecode.rate = _session->timecode_frames_per_second();
+ timecode.drop= _session->timecode_drop_frames();
- session->timecode_to_sample( timecode, sample, false /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample( timecode, sample, false /* use_offset */, false /* use_subframes */ );
#if 0
Timecode::Time timecode2;
nframes_t sample_increment;
- sample_increment = (long)rint(session->frame_rate() / session->timecode_frames_per_second);
+ sample_increment = (long)rint(_session->frame_rate() / _session->timecode_frames_per_second);
#ifdef Timecode_SAMPLE_TEST_1
// Test 1: use_offset = false, use_subframes = false
cout << "use_offset = false, use_subframes = false" << endl;
for (int i = 0; i < 108003; i++) {
- session->timecode_to_sample( timecode1, sample1, false /* use_offset */, false /* use_subframes */ );
- session->sample_to_timecode( sample1, timecode2, false /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample( timecode1, sample1, false /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode2, false /* use_offset */, false /* use_subframes */ );
if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
break;
}
oldsample = sample1;
- session->timecode_increment( timecode1 );
+ _session->timecode_increment( timecode1 );
}
cout << "sample_increment: " << sample_increment << endl;
timecode1.subframes = 0;
sample1 = oldsample = 0;
- session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
cout << "Starting at sample: " << sample1 << " -> ";
cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
for (int i = 0; i < 108003; i++) {
- session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
- session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
// cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
// cout << "sample: " << sample1 << endl;
break;
}
oldsample = sample1;
- session->timecode_increment( timecode1 );
+ _session->timecode_increment( timecode1 );
}
cout << "sample_increment: " << sample_increment << endl;
// Test 3: use_offset = true, use_subframes = false, decrement
cout << "use_offset = true, use_subframes = false, decrement" << endl;
- session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
cout << "Starting at sample: " << sample1 << " -> ";
cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
for (int i = 0; i < 108003; i++) {
- session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
- session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
// cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
// cout << "sample: " << sample1 << endl;
break;
}
oldsample = sample1;
- session->timecode_decrement( timecode1 );
+ _session->timecode_decrement( timecode1 );
}
cout << "sample_decrement: " << sample_increment << endl;
timecode1.subframes = 0;
sample1 = oldsample = (sample_increment * sub) / 80;
- session->sample_to_timecode( sample1, timecode1, true /* use_offset */, true /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, true /* use_subframes */ );
cout << "starting at sample: " << sample1 << " -> ";
cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
for (int i = 0; i < 108003; i++) {
- session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ );
- session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ );
+ _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ );
if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
break;
}
oldsample = sample1;
- session->timecode_increment( timecode1 );
+ _session->timecode_increment( timecode1 );
}
cout << "sample_increment: " << sample_increment << endl;
cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
for (int i = 0; i < 108003; i++) {
- session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ );
- session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ );
+ _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ );
if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
break;
}
oldsample = sample1;
- session->timecode_decrement( timecode1 );
+ _session->timecode_decrement( timecode1 );
}
cout << "sample_decrement: " << sample_increment << endl;
timecode1.frames = 0;
timecode1.subframes = 0;
sample1 = oldsample = 0;
- sample_increment = session->frame_rate();
+ sample_increment = _session->frame_rate();
- session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
cout << "Starting at sample: " << sample1 << " -> ";
cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
for (int i = 0; i < 3600; i++) {
- session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
- session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
// cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
// cout << "sample: " << sample1 << endl;
break;
}
oldsample = sample1;
- session->timecode_increment_seconds( timecode1 );
+ _session->timecode_increment_seconds( timecode1 );
}
cout << "sample_increment: " << sample_increment << endl;
timecode1.frames = 0;
timecode1.subframes = 0;
sample1 = oldsample = 0;
- sample_increment = session->frame_rate() * 60;
+ sample_increment = _session->frame_rate() * 60;
- session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
cout << "Starting at sample: " << sample1 << " -> ";
cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
for (int i = 0; i < 60; i++) {
- session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
- session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
// cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
// cout << "sample: " << sample1 << endl;
break;
}
oldsample = sample1;
- session->timecode_increment_minutes( timecode1 );
+ _session->timecode_increment_minutes( timecode1 );
}
cout << "sample_increment: " << sample_increment << endl;
timecode1.frames = 0;
timecode1.subframes = 0;
sample1 = oldsample = 0;
- sample_increment = session->frame_rate() * 60 * 60;
+ sample_increment = _session->frame_rate() * 60 * 60;
- session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
cout << "Starting at sample: " << sample1 << " -> ";
cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
for (int i = 0; i < 10; i++) {
- session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
- session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
// cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
// cout << "sample: " << sample1 << endl;
break;
}
oldsample = sample1;
- session->timecode_increment_hours( timecode1 );
+ _session->timecode_increment_hours( timecode1 );
}
cout << "sample_increment: " << sample_increment << endl;
nframes_t
AudioClock::minsec_frame_from_display () const
{
- if (session == 0) {
+ if (_session == 0) {
return 0;
}
int mins = atoi (ms_minutes_label.get_text());
float secs = atof (ms_seconds_label.get_text());
- nframes_t sr = session->frame_rate();
+ nframes_t sr = _session->frame_rate();
return (nframes_t) floor ((hrs * 60.0f * 60.0f * sr) + (mins * 60.0f * sr) + (secs * sr));
}
nframes_t
AudioClock::bbt_frame_from_display (nframes_t pos) const
{
- if (session == 0) {
+ if (_session == 0) {
error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
return 0;
}
any.bbt.beats++;
}
- nframes_t ret = session->convert_to_frames_at (pos, any);
+ nframes_t ret = _session->convert_to_frames_at (pos, any);
return ret;
}
nframes_t
AudioClock::bbt_frame_duration_from_display (nframes_t pos) const
{
- if (session == 0) {
+ if (_session == 0) {
error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
return 0;
}
bbt.beats = atoi (beats_label.get_text());
bbt.ticks = atoi (ticks_label.get_text());
- return session->tempo_map().bbt_duration_at(pos,bbt,1);
+ return _session->tempo_map().bbt_duration_at(pos,bbt,1);
}
nframes_t
void
AudioClock::set_from_playhead ()
{
- if (!session) {
+ if (!_session) {
return;
}
- set (session->transport_frame());
+ set (_session->transport_frame());
}
void
AudioClock::locate ()
{
- if (!session || is_duration) {
+ if (!_session || is_duration) {
return;
}
- session->request_locate (current_time(), false);
+ _session->request_locate (current_time(), false);
}
void
#include <gtkmm/label.h>
#include <gtkmm/frame.h>
#include "ardour/ardour.h"
+#include "ardour/session_handle.h"
namespace ARDOUR {
class Session;
}
-class AudioClock : public Gtk::HBox
+class AudioClock : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{
public:
enum Mode {
static bool has_focus() { return _has_focus; }
private:
- ARDOUR::Session *session;
Mode _mode;
uint32_t key_entry_state;
std::string _name;
using namespace std;
using namespace Gtkmm2ext;
-AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion> r, AudioRegionView& rv)
+AudioRegionEditor::AudioRegionEditor (Session* s, boost::shared_ptr<AudioRegion> r, AudioRegionView& rv)
: RegionEditor (s),
_region (r),
_region_view (rv),
gain_adjustment(accurate_coefficient_to_dB(_region->scale_amplitude()), -40.0, +40.0, 0.1, 1.0, 0)
{
- position_clock.set_session (&_session);
- end_clock.set_session (&_session);
- length_clock.set_session (&_session);
- sync_offset_relative_clock.set_session (&_session);
- sync_offset_absolute_clock.set_session (&_session);
- start_clock.set_session (&_session);
+ position_clock.set_session (_session);
+ end_clock.set_session (_session);
+ length_clock.set_session (_session);
+ sync_offset_relative_clock.set_session (_session);
+ sync_offset_absolute_clock.set_session (_session);
+ start_clock.set_session (_session);
name_entry.set_name ("AudioRegionEditorEntry");
name_label.set_name ("AudioRegionEditorLabel");
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 (sigc::mem_fun(*this, &AudioRegionEditor::audition_state_changed));
+ _session->AuditionActive.connect (sigc::mem_fun(*this, &AudioRegionEditor::audition_state_changed));
}
void
AudioRegionEditor::position_clock_changed ()
{
- _session.begin_reversible_command (_("change region start position"));
+ _session->begin_reversible_command (_("change region start position"));
boost::shared_ptr<Playlist> pl = _region->playlist();
XMLNode &before = pl->get_state();
_region->set_position (position_clock.current_time(), this);
XMLNode &after = pl->get_state();
- _session.add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
}
- _session.commit_reversible_command ();
+ _session->commit_reversible_command ();
}
void
AudioRegionEditor::end_clock_changed ()
{
- _session.begin_reversible_command (_("change region end position"));
+ _session->begin_reversible_command (_("change region end position"));
boost::shared_ptr<Playlist> pl = _region->playlist();
XMLNode &before = pl->get_state();
_region->trim_end (end_clock.current_time(), this);
XMLNode &after = pl->get_state();
- _session.add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
}
- _session.commit_reversible_command ();
+ _session->commit_reversible_command ();
end_clock.set (_region->position() + _region->length() - 1, true);
}
{
nframes_t frames = length_clock.current_time();
- _session.begin_reversible_command (_("change region length"));
+ _session->begin_reversible_command (_("change region length"));
boost::shared_ptr<Playlist> pl = _region->playlist();
XMLNode &before = pl->get_state();
_region->trim_end (_region->position() + frames - 1, this);
XMLNode &after = pl->get_state();
- _session.add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
}
- _session.commit_reversible_command ();
+ _session->commit_reversible_command ();
length_clock.set (_region->length());
}
AudioRegionEditor::audition_button_toggled ()
{
if (audition_button.get_active()) {
- _session.audition_region (_region);
+ _session->audition_region (_region);
} else {
- _session.cancel_audition ();
+ _session->cancel_audition ();
}
}
void
AudioRegionEditor::sync_offset_absolute_clock_changed ()
{
- _session.begin_reversible_command (_("change region sync point"));
+ _session->begin_reversible_command (_("change region sync point"));
XMLNode& before = _region->get_state ();
_region->set_sync_position (sync_offset_absolute_clock.current_time());
XMLNode& after = _region->get_state ();
- _session.add_command (new MementoCommand<AudioRegion> (*_region.get(), &before, &after));
+ _session->add_command (new MementoCommand<AudioRegion> (*_region.get(), &before, &after));
- _session.commit_reversible_command ();
+ _session->commit_reversible_command ();
}
void
AudioRegionEditor::sync_offset_relative_clock_changed ()
{
- _session.begin_reversible_command (_("change region sync point"));
+ _session->begin_reversible_command (_("change region sync point"));
XMLNode& before = _region->get_state ();
_region->set_sync_position (sync_offset_relative_clock.current_time() + _region->position ());
XMLNode& after = _region->get_state ();
- _session.add_command (new MementoCommand<AudioRegion> (*_region.get(), &before, &after));
+ _session->add_command (new MementoCommand<AudioRegion> (*_region.get(), &before, &after));
- _session.commit_reversible_command ();
+ _session->commit_reversible_command ();
}
bool
class AudioRegionEditor : public RegionEditor
{
public:
- AudioRegionEditor (ARDOUR::Session&, boost::shared_ptr<ARDOUR::AudioRegion>, AudioRegionView& rv);
+ AudioRegionEditor (ARDOUR::Session*, boost::shared_ptr<ARDOUR::AudioRegion>, AudioRegionView& rv);
~AudioRegionEditor ();
private:
setup_fade_handle_positions ();
- if (!trackview.session().config.get_show_region_fades()) {
+ if (!trackview.session()->config.get_show_region_fades()) {
set_fade_visibility (false);
}
const string line_name = _region->name() + ":gain";
if (!Profile->get_sae()) {
- gain_line = new AudioRegionGainLine (line_name, trackview.session(), *this, *group,
- audio_region()->envelope());
+ gain_line = new AudioRegionGainLine (line_name, *this, *group, audio_region()->envelope());
}
if (!(_flags & EnvelopeVisible)) {
{
Glib::ustring str = RegionView::make_name ();
- if (audio_region()->speed_mismatch (trackview.session().frame_rate())) {
+ if (audio_region()->speed_mismatch (trackview.session()->frame_rate())) {
str = string ("*") + str;
}
fade_in_handle->hide();
fade_out_handle->hide();
} else {
- if (trackview.session().config.get_show_region_fades()) {
+ if (trackview.session()->config.get_show_region_fades()) {
fade_in_handle->show();
fade_out_handle->show();
}
return;
}
- if (trackview.session().config.get_show_region_fades()) {
+ if (trackview.session()->config.get_show_region_fades()) {
fade_in_shape->show();
}
return;
}
- if (trackview.session().config.get_show_region_fades()) {
+ if (trackview.session()->config.get_show_region_fades()) {
fade_out_shape->show();
}
// cerr << "\tchannel " << n << endl;
if (wait_for_data) {
- if (audio_region()->audio_source(n)->peaks_ready (sigc::bind (sigc::mem_fun(*this, &AudioRegionView::peaks_ready_handler), n), data_ready_connection)) {
+ if (audio_region()->audio_source(n)->peaks_ready (boost::bind (&AudioRegionView::peaks_ready_handler, this, n), data_ready_connection)) {
// cerr << "\tData is ready\n";
create_one_wave (n, true);
} else {
gain_line->view_to_model_coord (x, y);
- trackview.session().begin_reversible_command (_("add gain control point"));
+ trackview.session()->begin_reversible_command (_("add gain control point"));
XMLNode &before = audio_region()->envelope()->get_state();
if (!audio_region()->envelope_active()) {
XMLNode ®ion_before = audio_region()->get_state();
audio_region()->set_envelope_active(true);
XMLNode ®ion_after = audio_region()->get_state();
- trackview.session().add_command (new MementoCommand<AudioRegion>(*(audio_region().get()), ®ion_before, ®ion_after));
+ trackview.session()->add_command (new MementoCommand<AudioRegion>(*(audio_region().get()), ®ion_before, ®ion_after));
}
audio_region()->envelope()->add (fx, y);
XMLNode &after = audio_region()->envelope()->get_state();
- trackview.session().add_command (new MementoCommand<AutomationList>(*audio_region()->envelope().get(), &before, &after));
- trackview.session().commit_reversible_command ();
+ trackview.session()->add_command (new MementoCommand<AutomationList>(*audio_region()->envelope().get(), &before, &after));
+ trackview.session()->commit_reversible_command ();
}
void
ghost->set_colors();
ghosts.push_back (ghost);
- ghost->GoingAway.connect (sigc::mem_fun(*this, &AudioRegionView::remove_ghost));
+ ghost->GoingAway.connect (boost::bind (&RegionView::remove_ghost, this, _1));
return ghost;
}
region_views.push_front (region_view);
- /* catch regionview going away */
- cerr << this << " connected to region " << r << endl;
- r->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &AudioStreamView::remove_region_view), boost::weak_ptr<Region> (r)));
+ /* catch region going away */
+
+ scoped_connect (r->GoingAway, boost::bind (&AudioStreamView::remove_region_view, this, boost::weak_ptr<Region> (r)));
RegionViewAdded (region_view);
void
AudioStreamView::remove_region_view (boost::weak_ptr<Region> weak_r)
{
- cerr << this << " RRV entry\n";
+ ENSURE_GUI_THREAD (*this, &AudioStreamView::remove_region_view, weak_r);
- ENSURE_GUI_THREAD (*this, &AudioStreamView::remove_region_view, weak_r)
+ cerr << "a region went way, it appears to be ours (" << this << ")\n";
boost::shared_ptr<Region> r (weak_r.lock());
return;
}
- cerr << this << " RRV action for " << r << endl;
-
- if (!_trackview.session().deletion_in_progress()) {
+ if (!_trackview.session()->deletion_in_progress()) {
for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end();) {
CrossfadeViewList::iterator tmp;
StreamView::playlist_changed(ds);
boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(ds->playlist());
+
if (apl) {
- playlist_connections.push_back (apl->NewCrossfade.connect (
- sigc::mem_fun (*this, &AudioStreamView::add_crossfade)));
+ playlist_connections.add_connection (apl->NewCrossfade.connect (boost::bind (&AudioStreamView::add_crossfade, this, _1)));
}
}
cv->set_valid (true);
crossfade->Invalidated.connect (sigc::mem_fun (*this, &AudioStreamView::remove_crossfade));
crossfade_views[cv->crossfade] = cv;
- if (!_trackview.session().config.get_xfades_visible() || !crossfades_visible) {
+ if (!_trackview.session()->config.get_xfades_visible() || !crossfades_visible) {
cv->hide ();
}
{
//cerr << _trackview.name() << " streamview SRB region_views.size() = " << region_views.size() << endl;
- if (_trackview.session().transport_rolling()) {
+ if (_trackview.session()->transport_rolling()) {
// cerr << "\trolling\n";
if (!rec_active &&
- _trackview.session().record_status() == Session::Recording &&
+ _trackview.session()->record_status() == Session::Recording &&
_trackview.get_diskstream()->record_enabled()) {
if (_trackview.audio_track()->mode() == Normal && use_rec_regions && rec_regions.size() == rec_rects.size()) {
SourceList sources;
- for (list<sigc::connection>::iterator prc = rec_data_ready_connections.begin();
- prc != rec_data_ready_connections.end(); ++prc) {
- (*prc).disconnect();
- }
- rec_data_ready_connections.clear();
-
+ rec_data_ready_connections.drop_connections ();
boost::shared_ptr<AudioDiskstream> ads = _trackview.audio_track()->audio_diskstream();
for (uint32_t n=0; n < ads->n_channels().n_audio(); ++n) {
if (src) {
sources.push_back (src);
- rec_data_ready_connections.push_back (src->PeakRangeReady.connect (sigc::bind
- (sigc::mem_fun (*this, &AudioStreamView::rec_peak_range_ready),
- boost::weak_ptr<Source>(src))));
+ rec_data_ready_connections.add_connection
+ (src->PeakRangeReady.connect
+ (boost::bind (&AudioStreamView::rec_peak_range_ready, this, _1, _2, boost::weak_ptr<Source>(src))));
}
}
RegionFactory::create (sources, start, 1, "", 0, Region::DefaultFlags, false)));
assert(region);
region->block_property_changes ();
- region->set_position (_trackview.session().transport_frame(), this);
+ region->set_position (_trackview.session()->transport_frame(), this);
rec_regions.push_back (make_pair(region, (RegionView*)0));
}
RecBoxInfo recbox;
recbox.rectangle = rec_rect;
- recbox.start = _trackview.session().transport_frame();
+ recbox.start = _trackview.session()->transport_frame();
recbox.length = 0;
rec_rects.push_back (recbox);
rec_active = true;
} else if (rec_active &&
- (_trackview.session().record_status() != Session::Recording ||
+ (_trackview.session()->record_status() != Session::Recording ||
!_trackview.get_diskstream()->record_enabled())) {
screen_update_connection.disconnect();
rec_active = false;
/* disconnect rapid update */
screen_update_connection.disconnect();
-
- for (list<sigc::connection>::iterator prc = rec_data_ready_connections.begin();
- prc != rec_data_ready_connections.end(); ++prc) {
- (*prc).disconnect();
- }
- rec_data_ready_connections.clear();
-
+ rec_data_ready_connections.drop_connections ();
rec_updating = false;
rec_active = false;
using namespace Gtk;
using namespace Editing;
-AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
+AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session* sess, boost::shared_ptr<Route> rt, Canvas& canvas)
: AxisView(sess)
, RouteTimeAxisView(ed, sess, rt, canvas)
{
class AudioTimeAxisView : public RouteTimeAxisView
{
public:
- AudioTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
+ AudioTimeAxisView (PublicEditor&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
virtual ~AudioTimeAxisView ();
AudioStreamView* audio_view();
alist->StateChanged.connect (sigc::mem_fun(*this, &AutomationLine::list_changed));
- trackview.session().register_with_memento_command_factory(alist->id(), this);
+ trackview.session()->register_with_memento_command_factory(alist->id(), this);
if (alist->parameter().type() == GainAutomation ||
alist->parameter().type() == EnvelopeAutomation) {
double const x = trackview.editor().frame_to_unit (_time_converter.to((*cp.model())->when));
- trackview.editor().current_session()->begin_reversible_command (_("automation event move"));
- trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
+ trackview.editor().session()->begin_reversible_command (_("automation event move"));
+ trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
cp.move_to (x, y, ControlPoint::Full);
reset_line_coords (cp);
update_pending = false;
- trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
- trackview.editor().current_session()->commit_reversible_command ();
- trackview.editor().current_session()->set_dirty ();
+ trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
+ trackview.editor().session()->commit_reversible_command ();
+ trackview.editor().session()->set_dirty ();
}
void
AutomationLine::start_drag (ControlPoint* cp, nframes_t x, float fraction)
{
- if (trackview.editor().current_session() == 0) { /* how? */
+ if (trackview.editor().session() == 0) { /* how? */
return;
}
str = _("automation range drag");
}
- trackview.editor().current_session()->begin_reversible_command (str);
- trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
+ trackview.editor().session()->begin_reversible_command (str);
+ trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
drag_x = x;
drag_distance = 0;
update_pending = false;
- trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
- trackview.editor().current_session()->commit_reversible_command ();
- trackview.editor().current_session()->set_dirty ();
+ trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
+ trackview.editor().session()->commit_reversible_command ();
+ trackview.editor().session()->set_dirty ();
}
model_representation (cp, mr);
- trackview.editor().current_session()->begin_reversible_command (_("remove control point"));
+ trackview.editor().session()->begin_reversible_command (_("remove control point"));
XMLNode &before = alist->get_state();
alist->erase (mr.start, mr.end);
- trackview.editor().current_session()->add_command(new MementoCommand<AutomationList>(
+ trackview.editor().session()->add_command(new MementoCommand<AutomationList>(
*alist.get(), &before, &alist->get_state()));
- trackview.editor().current_session()->commit_reversible_command ();
- trackview.editor().current_session()->set_dirty ();
+ trackview.editor().session()->commit_reversible_command ();
+ trackview.editor().session()->set_dirty ();
}
void
if (collecting) {
- results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, trackview));
+ results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, &trackview));
collecting = false;
nstart = max_frames;
nend = 0;
}
if (collecting) {
- results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, trackview));
+ results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, &trackview));
}
}
for (PointSelection::iterator r = points.begin(); r != points.end(); ++r) {
- if (&(*r).track != &trackview) {
+ if ((*r).track != &trackview) {
continue;
}
/* parent must create command */
XMLNode &before = get_state();
alist->clear();
- trackview.editor().current_session()->add_command (
+ trackview.editor().session()->add_command (
new MementoCommand<AutomationLine>(*this, &before, &get_state()));
- trackview.editor().current_session()->commit_reversible_command ();
- trackview.editor().current_session()->set_dirty ();
+ trackview.editor().session()->commit_reversible_command ();
+ trackview.editor().session()->set_dirty ();
}
void
}
}
-class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoingAway
+class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
{
public:
AutomationLine (const std::string& name, TimeAxisView&, ArdourCanvas::Group&,
_line->view_to_model_coord (x, y);
- view->session().begin_reversible_command (_("add automation event"));
+ view->session()->begin_reversible_command (_("add automation event"));
XMLNode& before = _line->the_list()->get_state();
_line->the_list()->add (x, y);
XMLNode& after = _line->the_list()->get_state();
- view->session().commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(
+ view->session()->commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(
*_line->the_list(), &before, &after));
- view->session().set_dirty ();
+ view->session()->set_dirty ();
}
void
nframes_t end;
double low_fract;
double high_fract;
- TimeAxisView& track;
+ TimeAxisView* track; // ref would be better, but ARDOUR::SessionHandlePtr is non-assignable
- AutomationSelectable (nframes_t s, nframes_t e, double l, double h, TimeAxisView& atv)
+ AutomationSelectable (nframes_t s, nframes_t e, double l, double h, TimeAxisView* atv)
: start (s), end (e), low_fract (l), high_fract (h), track (atv) {}
bool operator== (const AutomationSelectable& other) {
return start == other.start &&
- end == other.end &&
- low_fract == other.low_fract &&
- high_fract == other.high_fract &&
- &track == &other.track;
+ end == other.end &&
+ low_fract == other.low_fract &&
+ high_fract == other.high_fract &&
+ track == other.track;
}
};
display_region(region_view);
/* catch regionview going away */
- region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &AutomationStreamView::remove_region_view), region));
+ scoped_connect (region->GoingAway, boost::bind (&AutomationStreamView::remove_region_view, this, boost::weak_ptr<Region>(region)));
RegionViewAdded (region_view);
* For route child (e.g. plugin) automation, pass the child for \a.
* For region automation (e.g. MIDI CC), pass null for \a.
*/
-AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r,
+AutomationTimeAxisView::AutomationTimeAxisView (Session* s, boost::shared_ptr<Route> r,
boost::shared_ptr<Automatable> a, boost::shared_ptr<AutomationControl> c,
PublicEditor& e, TimeAxisView& parent, bool show_regions,
ArdourCanvas::Canvas& canvas, const string & nom, const string & nomparent)
void
AutomationTimeAxisView::clear_clicked ()
{
- _session.begin_reversible_command (_("clear automation"));
+ _session->begin_reversible_command (_("clear automation"));
if (_line) {
_line->clear ();
}
- _session.commit_reversible_command ();
+ _session->commit_reversible_command ();
}
void
_line->view_to_model_coord (x, y);
- _session.begin_reversible_command (_("add automation event"));
+ _session->begin_reversible_command (_("add automation event"));
XMLNode& before = _control->alist()->get_state();
_control->alist()->add (when, y);
XMLNode& after = _control->alist()->get_state();
- _session.commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(*_control->alist(), &before, &after));
+ _session->commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(*_control->alist(), &before, &after));
- _session.set_dirty ();
+ _session->set_dirty ();
}
bool
case Cut:
if ((what_we_got = alist->cut (selection.time.front().start, selection.time.front().end)) != 0) {
_editor.get_cut_buffer().add (what_we_got);
- _session.add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
+ _session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
ret = true;
}
break;
case Clear:
if ((what_we_got = alist->cut (selection.time.front().start, selection.time.front().end)) != 0) {
- _session.add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
+ _session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
ret = true;
}
break;
{
boost::shared_ptr<AutomationList> alist(line.the_list());
- _session.add_command (new MementoCommand<AutomationList>(*alist.get(), &alist->get_state(), 0));
+ _session->add_command (new MementoCommand<AutomationList>(*alist.get(), &alist->get_state(), 0));
for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) {
- if (&(*i).track != this) {
+ if ((*i).track != this) {
continue;
}
for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) {
- if (&(*i).track != this) {
+ if ((*i).track != this) {
continue;
}
case Cut:
if ((what_we_got = alist->cut ((*i).start, (*i).end)) != 0) {
_editor.get_cut_buffer().add (what_we_got);
- _session.add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state()));
+ _session->add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state()));
ret = true;
}
break;
case Clear:
if ((what_we_got = alist->cut ((*i).start, (*i).end)) != 0) {
- _session.add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state()));
+ _session->add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state()));
ret = true;
}
break;
XMLNode &before = alist->get_state();
alist->paste (copy, pos, times);
- _session.add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
+ _session->add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
return true;
}
assert(line->the_list() == _control->list());
automation_connection = _control->alist()->automation_state_changed.connect
- (sigc::mem_fun(*this, &AutomationTimeAxisView::automation_state_changed));
+ (boost::bind (&AutomationTimeAxisView::automation_state_changed, this));
_line = line;
//_controller = AutomationController::create(_session, line->the_list(), _control);
class AutomationTimeAxisView : public TimeAxisView {
public:
- AutomationTimeAxisView (ARDOUR::Session&,
+ AutomationTimeAxisView (ARDOUR::Session*,
boost::shared_ptr<ARDOUR::Route>,
boost::shared_ptr<ARDOUR::Automatable>,
boost::shared_ptr<ARDOUR::AutomationControl>,
void set_interpolation (ARDOUR::AutomationList::InterpolationStyle);
void interpolation_changed ();
- sigc::connection automation_connection;
+ boost::signals2::scoped_connection automation_connection;
void update_extra_xml_shown (bool editor_shown);
using namespace std;
using namespace Gtk;
using namespace Gtkmm2ext;
+using namespace ARDOUR;
list<Gdk::Color> AxisView::used_colors;
-AxisView::AxisView (ARDOUR::Session& sess) : _session(sess)
+AxisView::AxisView (ARDOUR::Session* sess)
+ : SessionHandlePtr (sess)
{
_selected = false;
_marked_for_display = false;
#include <gdkmm/color.h>
#include "pbd/xml++.h"
+#include "pbd/destructible.h"
+
+#include "ardour/session_handle.h"
+
#include "prompter.h"
#include "selectable.h"
* AxisView defines the abstract base class for time-axis trackviews and routes.
*
*/
-class AxisView : public virtual Selectable
+class AxisView : public virtual Selectable, public PBD::Destructible, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
{
public:
/**
*/
Gdk::Color color() const { return _color; }
- ARDOUR::Session& session() const { return _session; }
+ ARDOUR::Session* session() const { return _session; }
virtual std::string name() const = 0;
}
sigc::signal<void> Hiding;
- sigc::signal<void> GoingAway;
void set_old_order_key (uint32_t ok) { _old_order_key = ok; }
uint32_t old_order_key() const { return _old_order_key; }
protected:
- AxisView (ARDOUR::Session& sess);
+ AxisView (ARDOUR::Session* sess);
virtual ~AxisView();
-
/**
* Generate a new random TrackView color, unique from those colors already used.
*
static Gdk::Color unique_random_color();
- ARDOUR::Session& _session;
Gdk::Color _color;
static std::list<Gdk::Color> used_colors;
using namespace std;
using namespace ARDOUR;
-BundleEditorMatrix::BundleEditorMatrix (
- Gtk::Window* parent, Session* session, boost::shared_ptr<Bundle> bundle
- )
- : PortMatrix (parent, session, bundle->type()),
- _bundle (bundle)
+BundleEditorMatrix::BundleEditorMatrix (Gtk::Window* parent, Session* session, boost::shared_ptr<Bundle> bundle)
+ : PortMatrix (parent, session, bundle->type())
+ , _bundle (bundle)
{
_port_group = boost::shared_ptr<PortGroup> (new PortGroup (""));
_port_group->add_bundle (_bundle);
BundleManager::BundleManager (Session* session)
- : ArdourDialog (_("Bundle Manager")), _session (session), edit_button (_("Edit")), delete_button (_("Delete"))
+ : ArdourDialog (_("Bundle Manager"))
+ , edit_button (_("Edit"))
+ , delete_button (_("Delete"))
{
+ set_session (session);
+
_list_model = Gtk::ListStore::create (_list_model_columns);
_tree_view.set_model (_list_model);
_tree_view.append_column (_("Name"), _list_model_columns.name);
Gtk::TreeView _tree_view;
Glib::RefPtr<Gtk::ListStore> _list_model;
ModelColumns _list_model_columns;
- ARDOUR::Session* _session;
Gtk::Button edit_button;
Gtk::Button delete_button;
};
{
}
-CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, double my, double mxy)
+CrossfadeEditor::CrossfadeEditor (Session* s, boost::shared_ptr<Crossfade> xf, double my, double mxy)
: ArdourDialog (_("ardour: x-fade edit")),
xfade (xf),
- session (s),
clear_button (_("Clear")),
revert_button (_("Reset")),
audition_both_button (_("Fade")),
select_in_button (_("Fade In")),
select_out_button (_("Fade Out"))
{
+ set_session (s);
+
set_wmclass (X_("ardour_automationedit"), "Ardour");
set_name ("CrossfadeEditWindow");
set_position (Gtk::WIN_POS_MOUSE);
xfade->StateChanged.connect (sigc::mem_fun(*this, &CrossfadeEditor::xfade_changed));
- session.AuditionActive.connect (sigc::mem_fun(*this, &CrossfadeEditor::audition_state_changed));
+ _session_connections.add_connection (_session->AuditionActive.connect (sigc::mem_fun(*this, &CrossfadeEditor::audition_state_changed)));
show_all_children();
}
gdouble yoff = n * ht;
- if (region->audio_source(n)->peaks_ready (sigc::bind (sigc::mem_fun(*this, &CrossfadeEditor::peaks_ready), 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)) {
WaveView* waveview = new WaveView (*(canvas->root()));
waveview->property_data_src() = region.get();
}
void
-CrossfadeEditor::peaks_ready (boost::shared_ptr<AudioRegion> r, WhichFade which)
+CrossfadeEditor::peaks_ready (boost::weak_ptr<AudioRegion> wr, WhichFade which)
{
+ boost::shared_ptr<AudioRegion> r (wr.lock());
+
+ if (!r) {
+ return;
+ }
+
/* this should never be called, because the peak files for an xfade
will be ready by the time we want them. but our API forces us
to provide this, so ..
void
CrossfadeEditor::audition (Audition which)
{
- AudioPlaylist& pl (session.the_auditioner()->prepare_playlist());
+ AudioPlaylist& pl (_session->the_auditioner()->prepare_playlist());
nframes_t preroll;
nframes_t postroll;
nframes_t left_start_offset;
nframes_t left_length;
if (which != Right && preroll_button.get_active()) {
- preroll = session.frame_rate() * 2; //2 second hardcoded preroll for now
+ preroll = _session->frame_rate() * 2; //2 second hardcoded preroll for now
} else {
preroll = 0;
}
if (which != Left && postroll_button.get_active()) {
- postroll = session.frame_rate() * 2; //2 second hardcoded postroll for now
+ postroll = _session->frame_rate() * 2; //2 second hardcoded postroll for now
} else {
postroll = 0;
}
//apply a 20ms declicking fade at the start and end of auditioning
left->set_fade_in_active(true);
- left->set_fade_in_length(session.frame_rate() / 50);
+ left->set_fade_in_length(_session->frame_rate() / 50);
right->set_fade_out_active(true);
- right->set_fade_out_length(session.frame_rate() / 50);
+ right->set_fade_out_length(_session->frame_rate() / 50);
pl.add_region (left, 0);
pl.add_region (right, 1 + preroll);
/* there is only one ... */
pl.foreach_crossfade (sigc::mem_fun (*this, &CrossfadeEditor::setup));
- session.audition_playlist ();
+ _session->audition_playlist ();
}
void
boost::shared_ptr<AudioRegion> left (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->out(), xfade->out()->length() - xfade->length(), xfade->length(), "xfade left",
0, Region::DefaultFlags, false)));
- session.audition_region (left);
+ _session->audition_region (left);
}
void
{
boost::shared_ptr<AudioRegion> right (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->in(), 0, xfade->length(), "xfade in",
0, Region::DefaultFlags, false)));
- session.audition_region (right);
+ _session->audition_region (right);
}
void
void
CrossfadeEditor::cancel_audition ()
{
- session.cancel_audition ();
+ _session->cancel_audition ();
}
void
{
bool x;
- if ((x = audition_both_button.get_active ()) != session.is_auditioning()) {
+ if ((x = audition_both_button.get_active ()) != _session->is_auditioning()) {
if (x) {
audition_both ();
{
bool x;
- if ((x = audition_right_button.get_active ()) != session.is_auditioning()) {
+ if ((x = audition_right_button.get_active ()) != _session->is_auditioning()) {
if (x) {
audition_right ();
{
bool x;
- if ((x = audition_right_dry_button.get_active ()) != session.is_auditioning()) {
+ if ((x = audition_right_dry_button.get_active ()) != _session->is_auditioning()) {
if (x) {
audition_right_dry ();
{
bool x;
- if ((x = audition_left_button.get_active ()) != session.is_auditioning()) {
+ if ((x = audition_left_button.get_active ()) != _session->is_auditioning()) {
if (x) {
audition_left ();
{
bool x;
- if ((x = audition_left_dry_button.get_active ()) != session.is_auditioning()) {
+ if ((x = audition_left_dry_button.get_active ()) != _session->is_auditioning()) {
if (x) {
audition_left_dry ();
break;
case GDK_space:
- if (session.is_auditioning()) {
+ if (_session->is_auditioning()) {
cancel_audition ();
} else {
audition_both_button.set_active (!audition_both_button.get_active());
#include <gtkmm/radiobutton.h>
#include "evoral/Curve.hpp"
+#include "ardour/session_handle.h"
+
#include "ardour_dialog.h"
#include "canvas.h"
class CrossfadeEditor : public ArdourDialog
{
public:
- CrossfadeEditor (ARDOUR::Session&, boost::shared_ptr<ARDOUR::Crossfade>, double miny, double maxy);
+ CrossfadeEditor (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Crossfade>, double miny, double maxy);
~CrossfadeEditor ();
void apply ();
private:
boost::shared_ptr<ARDOUR::Crossfade> xfade;
- ARDOUR::Session& session;
Gtk::VBox vpacker;
void set (const ARDOUR::AutomationList& alist, WhichFade);
- sigc::connection peaks_ready_connection;
+ boost::signals2::scoped_connection peaks_ready_connection;
void make_waves (boost::shared_ptr<ARDOUR::AudioRegion>, WhichFade);
- void peaks_ready (boost::shared_ptr<ARDOUR::AudioRegion> r, WhichFade);
+ void peaks_ready (boost::weak_ptr<ARDOUR::AudioRegion> r, WhichFade);
void _apply_to (boost::shared_ptr<ARDOUR::Crossfade> xf);
void setup (boost::shared_ptr<ARDOUR::Crossfade>);
using namespace Gnome;
using namespace Canvas;
-sigc::signal<void,CrossfadeView*> CrossfadeView::GoingAway;
+boost::signals2::signal<void(CrossfadeView*)> CrossfadeView::GoingAway;
CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
RouteTimeAxisView &tv,
#include <vector>
#include <libgnomecanvasmm.h>
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
#include "ardour/crossfade.h"
#include "time_axis_view_item.h"
bool visible() const { return _visible; }
void set_valid (bool yn);
- static sigc::signal<void,CrossfadeView*> GoingAway;
+ static boost::signals2::signal<void(CrossfadeView*)> GoingAway;
AudioRegionView& upper_regionview () const;
PublicEditor::_instance = this;
- session = 0;
_have_idled = false;
selection = new Selection (this);
_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 (sigc::mem_fun(*this, &Editor::catch_vanishing_regionview));
+ scoped_connect (RegionView::RegionViewGoingAway, boost::bind (&Editor::catch_vanishing_regionview, this, _1));
/* nudge stuff */
return;
}
- if (session) {
- session->add_instant_xml(get_state());
+ if (_session) {
+ _session->add_instant_xml(get_state());
} else {
Config->add_instant_xml(get_state());
}
void
Editor::zoom_adjustment_changed ()
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
if (fpu < 1.0) {
fpu = 1.0;
zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
- } else if (fpu > session->current_end_frame() / _canvas_width) {
- fpu = session->current_end_frame() / _canvas_width;
+ } else if (fpu > _session->current_end_frame() / _canvas_width) {
+ fpu = _session->current_end_frame() / _canvas_width;
zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
}
{
ENSURE_GUI_THREAD (*this, &Editor::control_scroll, fraction)
- if (!session) {
+ if (!_session) {
return;
}
*/
if (!_control_scroll_target) {
- _control_scroll_target = session->transport_frame();
+ _control_scroll_target = _session->transport_frame();
_dragging_playhead = true;
}
bool
Editor::deferred_control_scroll (nframes64_t /*target*/)
{
- session->request_locate (*_control_scroll_target, session->transport_rolling());
+ _session->request_locate (*_control_scroll_target, _session->transport_rolling());
// reset for next stream
_control_scroll_target = boost::none;
_dragging_playhead = false;
void
Editor::access_action (std::string action_group, std::string action_item)
{
- if (!session) {
+ if (!_session) {
return;
}
{
ENSURE_GUI_THREAD (*this, &Editor::map_position_change, frame)
- if (session == 0 || !_follow_playhead) {
+ if (_session == 0 || !_follow_playhead) {
return;
}
void
Editor::handle_new_duration ()
{
- if (!session) {
+ if (!_session) {
return;
}
ENSURE_GUI_THREAD (*this, &Editor::handle_new_duration)
- nframes64_t new_end = session->current_end_frame() + (nframes64_t) floorf (current_page_frames() * 0.10f);
+ nframes64_t new_end = _session->current_end_frame() + (nframes64_t) floorf (current_page_frames() * 0.10f);
horizontal_adjustment.set_upper (new_end / frames_per_unit);
horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit);
//cerr << "Editor::handle_new_duration () called ha v:l:u:ps:lcf = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << endl;//DEBUG
}
-void
-Editor::update_title_s (const string & snap_name)
-{
- ENSURE_GUI_THREAD (*this, &Editor::update_title_s, snap_name)
-
- update_title ();
-}
-
void
Editor::update_title ()
{
ENSURE_GUI_THREAD (*this, &Editor::update_title)
- if (session) {
- bool dirty = session->dirty();
+ if (_session) {
+ bool dirty = _session->dirty();
string session_name;
- if (session->snap_name() != session->name()) {
- session_name = session->snap_name();
+ if (_session->snap_name() != _session->name()) {
+ session_name = _session->snap_name();
} else {
- session_name = session->name();
+ session_name = _session->name();
}
if (dirty) {
}
void
-Editor::connect_to_session (Session *t)
+Editor::set_session (Session *t)
{
- session = t;
+ SessionHandlePtr::set_session (t);
+
+ zoom_range_clock.set_session (_session);
+ _playlist_selector->set_session (_session);
+ nudge_clock.set_session (_session);
+ _summary->set_session (_session);
+ _group_tabs->set_session (_session);
+ _route_groups->set_session (_session);
+ _regions->set_session (_session);
+ _snapshots->set_session (_session);
+ _routes->set_session (_session);
+ _locations->set_session (_session);
+
+ if (rhythm_ferret) {
+ rhythm_ferret->set_session (_session);
+ }
+
+ if (analysis_window) {
+ analysis_window->set_session (_session);
+ }
+
+ if (sfbrowser) {
+ sfbrowser->set_session (_session);
+ }
+
+ if (!_session) {
+ return;
+ }
compute_fixed_ruler_scale ();
/* catch up with the playhead */
- session->request_locate (playhead_cursor->current_frame);
+ _session->request_locate (playhead_cursor->current_frame);
update_title ();
- session->GoingAway.connect (sigc::mem_fun(*this, &Editor::session_going_away));
- session->history().Changed.connect (sigc::mem_fun (*this, &Editor::history_changed));
+ _session_connections.add_connection (_session->history().Changed.connect (boost::bind (&Editor::history_changed, this)));
/* These signals can all be emitted by a non-GUI thread. Therefore the
handlers for them must not attempt to directly interact with the GUI,
but use Gtkmm2ext::UI::instance()->call_slot();
*/
- session_connections.push_back (session->TransportStateChange.connect (sigc::mem_fun(*this, &Editor::map_transport_state)));
- session_connections.push_back (session->PositionChanged.connect (sigc::mem_fun(*this, &Editor::map_position_change)));
- session_connections.push_back (session->RouteAdded.connect (sigc::mem_fun(*this, &Editor::handle_new_route)));
- session_connections.push_back (session->DurationChanged.connect (sigc::mem_fun(*this, &Editor::handle_new_duration)));
- session_connections.push_back (session->DirtyChanged.connect (sigc::mem_fun(*this, &Editor::update_title)));
- session_connections.push_back (session->StateSaved.connect (sigc::mem_fun(*this, &Editor::update_title_s)));
- session_connections.push_back (session->AskAboutPlaylistDeletion.connect (sigc::mem_fun(*this, &Editor::playlist_deletion_dialog)));
-
- session_connections.push_back (session->TimecodeOffsetChanged.connect (sigc::mem_fun(*this, &Editor::update_just_timecode)));
+ _session_connections.add_connection (_session->TransportStateChange.connect (boost::bind (&Editor::map_transport_state, this)));
+ _session_connections.add_connection (_session->PositionChanged.connect (boost::bind (&Editor::map_position_change, this, _1)));
+ _session_connections.add_connection (_session->RouteAdded.connect (boost::bind (&Editor::handle_new_route, this, _1)));
+ _session_connections.add_connection (_session->DurationChanged.connect (boost::bind (&Editor::handle_new_duration, this)));
+ _session_connections.add_connection (_session->DirtyChanged.connect (boost::bind (&Editor::update_title, this)));
+ _session_connections.add_connection (_session->StateSaved.connect (boost::bind (&Editor::update_title, this)));
+ _session_connections.add_connection (_session->AskAboutPlaylistDeletion.connect (boost::bind (&Editor::playlist_deletion_dialog, this, _1)));
+ _session_connections.add_connection (_session->TimecodeOffsetChanged.connect (boost::bind (&Editor::update_just_timecode, this)));
+ _session_connections.add_connection (_session->tempo_map().StateChanged.connect (boost::bind (&Editor::tempo_map_changed, this, _1)));
+ _session_connections.add_connection (_session->Located.connect (boost::bind (&Editor::located, this)));
+ _session_connections.add_connection (_session->config.ParameterChanged.connect (boost::bind (&Editor::parameter_changed, this, _1)));
- session_connections.push_back (session->tempo_map().StateChanged.connect (sigc::mem_fun(*this, &Editor::tempo_map_changed)));
-
- session_connections.push_back (session->Located.connect (sigc::mem_fun (*this, &Editor::located)));
- session_connections.push_back (session->config.ParameterChanged.connect (sigc::mem_fun (*this, &Editor::parameter_changed)));
-
- zoom_range_clock.set_session (session);
- _playlist_selector->set_session (session);
- nudge_clock.set_session (session);
if (Profile->get_sae()) {
BBT_Time bbt;
bbt.bars = 0;
bbt.beats = 0;
bbt.ticks = 120;
- nframes_t pos = session->tempo_map().bbt_duration_at (0, bbt, 1);
+ nframes_t pos = _session->tempo_map().bbt_duration_at (0, bbt, 1);
nudge_clock.set_mode(AudioClock::BBT);
nudge_clock.set (pos, true, 0, AudioClock::BBT);
} else {
- nudge_clock.set (session->frame_rate() * 5, true, 0, AudioClock::Timecode); // default of 5 seconds
+ nudge_clock.set (_session->frame_rate() * 5, true, 0, AudioClock::Timecode); // default of 5 seconds
}
playhead_cursor->canvas_item.show ();
- if (rhythm_ferret) {
- rhythm_ferret->set_session (session);
- }
-
- if (analysis_window != 0)
- analysis_window->set_session (session);
-
- Location* loc = session->locations()->auto_loop_location();
+ Location* loc = _session->locations()->auto_loop_location();
if (loc == 0) {
- loc = new Location (0, session->current_end_frame(), _("Loop"),(Location::Flags) (Location::IsAutoLoop | Location::IsHidden));
+ loc = new Location (0, _session->current_end_frame(), _("Loop"),(Location::Flags) (Location::IsAutoLoop | Location::IsHidden));
if (loc->start() == loc->end()) {
loc->set_end (loc->start() + 1);
}
- session->locations()->add (loc, false);
- session->set_auto_loop_location (loc);
+ _session->locations()->add (loc, false);
+ _session->set_auto_loop_location (loc);
} else {
// force name
loc->set_name (_("Loop"));
}
- loc = session->locations()->auto_punch_location();
+ loc = _session->locations()->auto_punch_location();
if (loc == 0) {
- loc = new Location (0, session->current_end_frame(), _("Punch"), (Location::Flags) (Location::IsAutoPunch | Location::IsHidden));
+ loc = new Location (0, _session->current_end_frame(), _("Punch"), (Location::Flags) (Location::IsAutoPunch | Location::IsHidden));
if (loc->start() == loc->end()) {
loc->set_end (loc->start() + 1);
}
- session->locations()->add (loc, false);
- session->set_auto_punch_location (loc);
+ _session->locations()->add (loc, false);
+ _session->set_auto_punch_location (loc);
} else {
// force name
loc->set_name (_("Punch"));
boost::function<void (string)> pc (boost::bind (&Editor::parameter_changed, this, _1));
Config->map_parameters (pc);
- session->config.map_parameters (pc);
+ _session->config.map_parameters (pc);
- session->StateSaved.connect (sigc::mem_fun(*this, &Editor::session_state_saved));
refresh_location_display ();
- session->locations()->added.connect (sigc::mem_fun(*this, &Editor::add_new_location));
- session->locations()->removed.connect (sigc::mem_fun(*this, &Editor::location_gone));
- session->locations()->changed.connect (sigc::mem_fun(*this, &Editor::refresh_location_display));
- session->locations()->StateChanged.connect (sigc::mem_fun(*this, &Editor::refresh_location_display_s));
- session->locations()->end_location()->changed.connect (sigc::mem_fun(*this, &Editor::end_location_changed));
- if (sfbrowser) {
- sfbrowser->set_session (session);
- }
+ /* static signal - no need to drop connection when session is deleted (XXX or we are?)*/
+
+ _session->StateSaved.connect (sigc::mem_fun(*this, &Editor::session_state_saved));
+
+ _session_connections.add_connection (_session->locations()->added.connect (sigc::mem_fun(*this, &Editor::add_new_location)));
+ _session_connections.add_connection (_session->locations()->removed.connect (sigc::mem_fun(*this, &Editor::location_gone)));
+ _session_connections.add_connection (_session->locations()->changed.connect (sigc::mem_fun(*this, &Editor::refresh_location_display)));
+ _session_connections.add_connection (_session->locations()->StateChanged.connect (sigc::mem_fun(*this, &Editor::refresh_location_display_s)));
+ _session_connections.add_connection (_session->locations()->end_location()->changed.connect (sigc::mem_fun(*this, &Editor::end_location_changed)));
handle_new_duration ();
restore_ruler_visibility ();
//tempo_map_changed (Change (0));
- session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
+ _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(static_cast<TimeAxisView*>(*i))->set_samples_per_unit (frames_per_unit);
}
/* register for undo history */
- session->register_with_memento_command_factory(_id, this);
-
- _summary->connect_to_session (session);
- _group_tabs->connect_to_session (session);
- _route_groups->connect_to_session (session);
- _regions->connect_to_session (session);
- _snapshots->connect_to_session (session);
- _routes->connect_to_session (session);
- _locations->connect_to_session (session);
+ _session->register_with_memento_command_factory(_id, this);
start_updating ();
}
if (analysis_window == 0) {
analysis_window = new AnalysisWindow();
- if (session != 0)
- analysis_window->set_session(session);
+ if (_session != 0)
+ analysis_window->set_session(_session);
analysis_window->show_all();
}
if (analysis_window == 0) {
analysis_window = new AnalysisWindow();
- if (session != 0)
- analysis_window->set_session(session);
+ if (_session != 0)
+ analysis_window->set_session(_session);
analysis_window->show_all();
}
set_default_size (g.base_width, g.base_height);
move (x, y);
- if (session && (prop = node.property ("playhead"))) {
+ if (_session && (prop = node.property ("playhead"))) {
nframes64_t pos = atol (prop->value().c_str());
playhead_cursor->set_position (pos);
} else {
void
Editor::snap_to_with_modifier (nframes64_t& start, GdkEvent const * event, int32_t direction, bool for_mark)
{
- if (!session) {
+ if (!_session) {
return;
}
void
Editor::snap_to (nframes64_t& start, int32_t direction, bool for_mark)
{
- if (!session || _snap_mode == SnapOff) {
+ if (!_session || _snap_mode == SnapOff) {
return;
}
void
Editor::timecode_snap_to_internal (nframes64_t& start, int32_t direction, bool /*for_mark*/)
{
- const nframes64_t one_timecode_second = (nframes64_t)(rint(session->timecode_frames_per_second()) * session->frames_per_timecode_frame());
- nframes64_t one_timecode_minute = (nframes64_t)(rint(session->timecode_frames_per_second()) * session->frames_per_timecode_frame() * 60);
+ const nframes64_t one_timecode_second = (nframes64_t)(rint(_session->timecode_frames_per_second()) * _session->frames_per_timecode_frame());
+ nframes64_t one_timecode_minute = (nframes64_t)(rint(_session->timecode_frames_per_second()) * _session->frames_per_timecode_frame() * 60);
switch (_snap_type) {
case SnapToTimecodeFrame:
- if (((direction == 0) && (fmod((double)start, (double)session->frames_per_timecode_frame()) > (session->frames_per_timecode_frame() / 2))) || (direction > 0)) {
- start = (nframes64_t) (ceil ((double) start / session->frames_per_timecode_frame()) * session->frames_per_timecode_frame());
+ if (((direction == 0) && (fmod((double)start, (double)_session->frames_per_timecode_frame()) > (_session->frames_per_timecode_frame() / 2))) || (direction > 0)) {
+ start = (nframes64_t) (ceil ((double) start / _session->frames_per_timecode_frame()) * _session->frames_per_timecode_frame());
} else {
- start = (nframes64_t) (floor ((double) start / session->frames_per_timecode_frame()) * session->frames_per_timecode_frame());
+ start = (nframes64_t) (floor ((double) start / _session->frames_per_timecode_frame()) * _session->frames_per_timecode_frame());
}
break;
case SnapToTimecodeSeconds:
- if (session->timecode_offset_negative())
+ if (_session->timecode_offset_negative())
{
- start += session->timecode_offset ();
+ start += _session->timecode_offset ();
} else {
- start -= session->timecode_offset ();
+ start -= _session->timecode_offset ();
}
if (((direction == 0) && (start % one_timecode_second > one_timecode_second / 2)) || direction > 0) {
start = (nframes64_t) ceil ((double) start / one_timecode_second) * one_timecode_second;
start = (nframes64_t) floor ((double) start / one_timecode_second) * one_timecode_second;
}
- if (session->timecode_offset_negative())
+ if (_session->timecode_offset_negative())
{
- start -= session->timecode_offset ();
+ start -= _session->timecode_offset ();
} else {
- start += session->timecode_offset ();
+ start += _session->timecode_offset ();
}
break;
case SnapToTimecodeMinutes:
- if (session->timecode_offset_negative())
+ if (_session->timecode_offset_negative())
{
- start += session->timecode_offset ();
+ start += _session->timecode_offset ();
} else {
- start -= session->timecode_offset ();
+ start -= _session->timecode_offset ();
}
if (((direction == 0) && (start % one_timecode_minute > one_timecode_minute / 2)) || direction > 0) {
start = (nframes64_t) ceil ((double) start / one_timecode_minute) * one_timecode_minute;
} else {
start = (nframes64_t) floor ((double) start / one_timecode_minute) * one_timecode_minute;
}
- if (session->timecode_offset_negative())
+ if (_session->timecode_offset_negative())
{
- start -= session->timecode_offset ();
+ start -= _session->timecode_offset ();
} else {
- start += session->timecode_offset ();
+ start += _session->timecode_offset ();
}
break;
default:
void
Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark)
{
- const nframes64_t one_second = session->frame_rate();
- const nframes64_t one_minute = session->frame_rate() * 60;
+ const nframes64_t one_second = _session->frame_rate();
+ const nframes64_t one_minute = _session->frame_rate() * 60;
nframes64_t presnap = start;
nframes64_t before;
nframes64_t after;
break;
case SnapToBar:
- start = session->tempo_map().round_to_bar (start, direction);
+ start = _session->tempo_map().round_to_bar (start, direction);
break;
case SnapToBeat:
- start = session->tempo_map().round_to_beat (start, direction);
+ start = _session->tempo_map().round_to_beat (start, direction);
break;
case SnapToAThirtysecondBeat:
- start = session->tempo_map().round_to_beat_subdivision (start, 32, direction);
+ start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction);
break;
case SnapToASixteenthBeat:
- start = session->tempo_map().round_to_beat_subdivision (start, 16, direction);
+ start = _session->tempo_map().round_to_beat_subdivision (start, 16, direction);
break;
case SnapToAEighthBeat:
- start = session->tempo_map().round_to_beat_subdivision (start, 8, direction);
+ start = _session->tempo_map().round_to_beat_subdivision (start, 8, direction);
break;
case SnapToAQuarterBeat:
- start = session->tempo_map().round_to_beat_subdivision (start, 4, direction);
+ start = _session->tempo_map().round_to_beat_subdivision (start, 4, direction);
break;
case SnapToAThirdBeat:
- start = session->tempo_map().round_to_beat_subdivision (start, 3, direction);
+ start = _session->tempo_map().round_to_beat_subdivision (start, 3, direction);
break;
case SnapToMark:
return;
}
- session->locations()->marks_either_side (start, before, after);
+ _session->locations()->marks_either_side (start, before, after);
if (before == max_frames) {
start = after;
{
cerr << "MIDI panic\n";
- if (session) {
- session->midi_panic();
+ if (_session) {
+ _session->midi_panic();
}
}
guint /*info*/,
guint /*time*/)
{
- if (session == 0) {
+ if (_session == 0) {
return -1;
}
{
ENSURE_GUI_THREAD (*this, &Editor::map_transport_state)
- if (session->transport_stopped()) {
+ if (_session->transport_stopped()) {
have_pending_keyboard_selection = false;
}
void
Editor::begin_reversible_command (string name)
{
- if (session) {
+ if (_session) {
before = &get_state();
- session->begin_reversible_command (name);
+ _session->begin_reversible_command (name);
}
}
void
Editor::commit_reversible_command ()
{
- if (session) {
- session->commit_reversible_command (new MementoCommand<Editor>(*this, before, &get_state()));
+ if (_session) {
+ _session->commit_reversible_command (new MementoCommand<Editor>(*this, before, &get_state()));
}
}
{
string label;
- if (undo_action && session) {
- if (session->undo_depth() == 0) {
+ if (undo_action && _session) {
+ if (_session->undo_depth() == 0) {
label = _("Undo");
} else {
- label = string_compose(_("Undo (%1)"), session->next_undo());
+ label = string_compose(_("Undo (%1)"), _session->next_undo());
}
undo_action->property_label() = label;
}
- if (redo_action && session) {
- if (session->redo_depth() == 0) {
+ if (redo_action && _session) {
+ if (_session->redo_depth() == 0) {
label = _("Redo");
} else {
- label = string_compose(_("Redo (%1)"), session->next_redo());
+ label = string_compose(_("Redo (%1)"), _session->next_redo());
}
redo_action->property_label() = label;
}
void
Editor::edit_mode_selection_done ()
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
return;
}
- CrossfadeEditor cew (*session, xfade, xfade->fade_in().get_min_y(), 1.0);
+ CrossfadeEditor cew (_session, xfade, xfade->fade_in().get_min_y(), 1.0);
ensure_float (cew);
break;
case SnapToBar:
- if (session) {
- return session->tempo_map().meter_at (position).beats_per_bar();
+ if (_session) {
+ return _session->tempo_map().meter_at (position).beats_per_bar();
}
break;
Location*
Editor::transport_loop_location()
{
- if (session) {
- return session->locations()->auto_loop_location();
+ if (_session) {
+ return _session->locations()->auto_loop_location();
} else {
return 0;
}
Location*
Editor::transport_punch_location()
{
- if (session) {
- return session->locations()->auto_punch_location();
+ if (_session) {
+ return _session->locations()->auto_punch_location();
} else {
return 0;
}
{
begin_reversible_command (_("new playlists"));
vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
- session->playlists->get (playlists);
+ _session->playlists->get (playlists);
mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_use_new_playlist), playlists), v, RouteGroup::Edit);
commit_reversible_command ();
}
{
begin_reversible_command (_("copy playlists"));
vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
- session->playlists->get (playlists);
+ _session->playlists->get (playlists);
mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_use_copy_playlist), playlists), v, RouteGroup::Edit);
commit_reversible_command ();
}
{
begin_reversible_command (_("clear playlists"));
vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
- session->playlists->get (playlists);
+ _session->playlists->get (playlists);
mapover_tracks (sigc::mem_fun (*this, &Editor::mapped_clear_playlist), v, RouteGroup::Edit);
commit_reversible_command ();
}
ZoomChanged (); /* EMIT_SIGNAL */
- if (session) {
- cef = session->current_end_frame() + (current_page_frames() / 10);// Add a little extra so we can see the end marker
+ if (_session) {
+ cef = _session->current_end_frame() + (current_page_frames() / 10);// Add a little extra so we can see the end marker
}
horizontal_adjustment.set_upper (cef / frames_per_unit);
can reach.
*/
- if (session && (where > session->current_end_frame())) {
+ if (_session && (where > _session->current_end_frame())) {
horizontal_adjustment.set_upper ((where + current_page_frames()) / frames_per_unit);
}
nframes64_t csf=0, cef=0;
nframes64_t current_time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
- if (session) {
- csf = session->current_start_frame();
- cef = session->current_end_frame();
+ if (_session) {
+ csf = _session->current_start_frame();
+ cef = _session->current_end_frame();
}
/* if we seek beyond the current end of the canvas, move the end */
switch (ep) {
case EditAtPlayhead:
- where = session->audible_frame();
+ where = _session->audible_frame();
break;
case EditAtSelectedMarker:
void
Editor::set_loop_range (nframes64_t start, nframes64_t end, string cmd)
{
- if (!session) return;
+ if (!_session) return;
begin_reversible_command (cmd);
if ((tll = transport_loop_location()) == 0) {
Location* loc = new Location (start, end, _("Loop"), Location::IsAutoLoop);
- XMLNode &before = session->locations()->get_state();
- session->locations()->add (loc, true);
- session->set_auto_loop_location (loc);
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->add (loc, true);
+ _session->set_auto_loop_location (loc);
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
} else {
XMLNode &before = tll->get_state();
tll->set_hidden (false, this);
tll->set (start, end);
XMLNode &after = tll->get_state();
- session->add_command (new MementoCommand<Location>(*tll, &before, &after));
+ _session->add_command (new MementoCommand<Location>(*tll, &before, &after));
}
commit_reversible_command ();
void
Editor::set_punch_range (nframes64_t start, nframes64_t end, string cmd)
{
- if (!session) return;
+ if (!_session) return;
begin_reversible_command (cmd);
if ((tpl = transport_punch_location()) == 0) {
Location* loc = new Location (start, end, _("Loop"), Location::IsAutoPunch);
- XMLNode &before = session->locations()->get_state();
- session->locations()->add (loc, true);
- session->set_auto_loop_location (loc);
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->add (loc, true);
+ _session->set_auto_loop_location (loc);
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
}
else {
XMLNode &before = tpl->get_state();
tpl->set_hidden (false, this);
tpl->set (start, end);
XMLNode &after = tpl->get_state();
- session->add_command (new MementoCommand<Location>(*tpl, &before, &after));
+ _session->add_command (new MementoCommand<Location>(*tpl, &before, &after));
}
commit_reversible_command ();
rhythm_ferret = new RhythmFerret(*this);
}
- rhythm_ferret->set_session (session);
+ rhythm_ferret->set_session (_session);
rhythm_ferret->show ();
rhythm_ferret->present ();
}
Editor::show_global_port_matrix (ARDOUR::DataType t)
{
if (_global_port_matrix[t] == 0) {
- _global_port_matrix[t] = new GlobalPortMatrixWindow (session, t);
+ _global_port_matrix[t] = new GlobalPortMatrixWindow (_session, t);
}
_global_port_matrix[t]->show ();
DataType dt = route->input()->default_type();
if (dt == ARDOUR::DataType::AUDIO) {
- rtv = new AudioTimeAxisView (*this, *session, route, *track_canvas);
+ rtv = new AudioTimeAxisView (*this, _session, route, *track_canvas);
} else if (dt == ARDOUR::DataType::MIDI) {
- rtv = new MidiTimeAxisView (*this, *session, route, *track_canvas);
+ rtv = new MidiTimeAxisView (*this, _session, route, *track_canvas);
} else {
throw unknown_type();
}
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 (sigc::bind (sigc::mem_fun(*this, &Editor::remove_route), rtv));
+ scoped_connect (rtv->GoingAway, boost::bind (&Editor::remove_route, this, rtv));
}
_routes->routes_added (new_views);
boost::shared_ptr<AudioRegion> r = boost::dynamic_pointer_cast<AudioRegion> (region);
if (r == 0) {
- session->cancel_audition ();
+ _session->cancel_audition ();
return;
}
- if (session->is_auditioning()) {
- session->cancel_audition ();
+ if (_session->is_auditioning()) {
+ _session->cancel_audition ();
if (r == last_audition_region) {
return;
}
}
- session->audition_region (r);
+ _session->audition_region (r);
last_audition_region = r;
}
void
Editor::remove_a_region (boost::shared_ptr<Region> r)
{
- session->remove_region_from_region_list (r);
+ _session->remove_region_from_region_list (r);
}
void
#include <gtkmm2ext/dndtreeview.h>
#include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
+
#include "ardour/import_status.h"
#include "ardour/tempo.h"
#include "ardour/location.h"
sigc::signal<void, nframes64_t> PositionChanged;
};
-class Editor : public PublicEditor
+class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
{
public:
Editor ();
~Editor ();
- void connect_to_session (ARDOUR::Session *);
- ARDOUR::Session* current_session() const { return session; }
+ void set_session (ARDOUR::Session *);
+ ARDOUR::Session* session() const { return _session; }
+
void first_idle ();
virtual bool have_idled () const { return _have_idled; }
void color_handler ();
- ARDOUR::Session *session; ///< The session that we are editing, or 0
bool constructed;
// to keep track of the playhead position for control_scroll
int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
- std::vector<sigc::connection> session_connections;
+ PBD::ScopedConnectionList session_connections;
/* tracking step changes of track height */
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleSummary"));
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
- session->config.set_show_summary (tact->get_active ());
+ _session->config.set_show_summary (tact->get_active ());
}
}
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleGroupTabs"));
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
- session->config.set_show_group_tabs (tact->get_active ());
+ _session->config.set_show_group_tabs (tact->get_active ());
}
}
toggle_meter_updating();
} else if (p == "show-summary") {
- bool const s = session->config.get_show_summary ();
+ bool const s = _session->config.get_show_summary ();
if (s) {
_summary->show ();
} else {
}
} else if (p == "show-group-tabs") {
- bool const s = session->config.get_show_group_tabs ();
+ bool const s = _session->config.get_show_group_tabs ();
if (s) {
_group_tabs->show ();
} else {
void
Editor::add_external_audio_action (ImportMode mode_hint)
{
- if (session == 0) {
+ if (_session == 0) {
MessageDialog msg (_("You can't import or embed an audiofile until you have a session loaded."));
msg.run ();
return;
}
-
+
if (sfbrowser == 0) {
- sfbrowser = new SoundFileOmega (*this, _("Add Existing Media"), session, 0, true, mode_hint);
+ sfbrowser = new SoundFileOmega (*this, _("Add Existing Media"), _session, 0, true, mode_hint);
} else {
sfbrowser->set_mode (mode_hint);
}
vector<Glib::ustring> paths;
uint32_t track_cnt;
- if (session == 0) {
+ if (_session == 0) {
MessageDialog msg (_("You can't import or embed an audiofile until you have a session loaded."));
msg.run ();
return;
}
if (sfbrowser == 0) {
- sfbrowser = new SoundFileOmega (*this, _("Add Existing Media"), session, track_cnt, true);
+ sfbrowser = new SoundFileOmega (*this, _("Add Existing Media"), _session, track_cnt, true);
} else {
sfbrowser->reset (track_cnt);
}
where = playhead_cursor->current_frame;
break;
case ImportAtStart:
- where = session->current_start_frame();
+ where = _session->current_start_frame();
break;
}
void
Editor::session_import_dialog ()
{
- SessionImportDialog dialog (*session);
+ SessionImportDialog dialog (_session);
ensure_float (dialog);
dialog.run ();
}
{
string wave_name (Glib::path_get_basename(path));
- SourceMap all_sources = session->get_sources();
+ SourceMap all_sources = _session->get_sources();
bool wave_name_exists = false;
for (SourceMap::iterator i = all_sources.begin(); i != all_sources.end(); ++i) {
out:
if (ok) {
- session->save_state ("");
+ _session->save_state ("");
}
}
import_status.target_regions,
import_status.target_tracks,
import_status.track, false) == 0) {
- session->save_state ("");
+ _session->save_state ("");
}
/* update position from results */
/* lets see if we can link it into the session */
- sys::path tmp = session->session_directory().sound_path() / Glib::path_get_basename(path);
+ sys::path tmp = _session->session_directory().sound_path() / Glib::path_get_basename(path);
linked_path = tmp.to_string();
path_to_use = linked_path;
goto out;
}
- if (check_sample_rate && (finfo.samplerate != (int) session->frame_rate())) {
+ if (check_sample_rate && (finfo.samplerate != (int) _session->frame_rate())) {
vector<string> choices;
if (multifile) {
boost::shared_ptr<Source> s;
- if ((s = session->source_by_path_and_channel (path, n)) == 0) {
+ if ((s = _session->source_by_path_and_channel (path, n)) == 0) {
source = boost::dynamic_pointer_cast<AudioFileSource> (
- SourceFactory::createReadable (DataType::AUDIO, *session,
+ SourceFactory::createReadable (DataType::AUDIO, *_session,
path_to_use, n,
(mode == ImportAsTapeTrack
? Source::Destructive
}
if (Config->get_output_auto_connect() & AutoConnectMaster) {
- output_chan = (session->master_out() ? session->master_out()->n_inputs().n_audio() : input_chan);
+ output_chan = (_session->master_out() ? _session->master_out()->n_inputs().n_audio() : input_chan);
} else {
output_chan = input_chan;
}
begin_reversible_command (_("insert file"));
XMLNode &before = playlist->get_state();
playlist->add_region (copy, pos);
- session->add_command (new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
commit_reversible_command ();
break;
}
{
if (!existing_track) {
if (ar) {
- list<boost::shared_ptr<AudioTrack> > at (session->new_audio_track (in_chans, out_chans, Normal, 0, 1));
+ list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (in_chans, out_chans, Normal, 0, 1));
if (at.empty()) {
return -1;
existing_track = at.front();
} else if (mr) {
- list<boost::shared_ptr<MidiTrack> > mt (session->new_midi_track (Normal, 0, 1));
+ list<boost::shared_ptr<MidiTrack> > mt (_session->new_midi_track (Normal, 0, 1));
if (mt.empty()) {
return -1;
if (!ar)
return -1;
- list<boost::shared_ptr<AudioTrack> > at (session->new_audio_track (in_chans, out_chans, Destructive));
+ list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (in_chans, out_chans, Destructive));
if (!at.empty()) {
boost::shared_ptr<Region> copy (RegionFactory::create (region));
at.front()->set_name (basename_nosuffix (copy->name()));
void *
Editor::import_thread ()
{
- session->import_audiofiles (import_status);
+ _session->import_audiofiles (import_status);
pthread_exit_pbd (0);
/*NOTREACHED*/
return 0;
RouteTimeAxisView* rtv;
//cerr << "Editor::start_updating () called" << endl;//DEBUG
- if (is_mapped() && session) {
+ if (is_mapped() && _session) {
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
rtv->reset_meter ();
meters_running = false;
fast_screen_update_connection.disconnect();
//cerr << "Editor::stop_updating () called" << endl;//DEBUG
- if (is_mapped() && session) {
+ if (is_mapped() && _session) {
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
rtv->hide_meter ();
{
RouteTimeAxisView* rtv;
- if (is_mapped() && session) {
+ if (is_mapped() && _session) {
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
rtv->fast_update ();
_canvas_width = canvas_allocation.get_width();
_canvas_height = canvas_allocation.get_height();
- if (session) {
+ if (_session) {
TrackViewList::iterator i;
double height = 0;
void
Editor::start_canvas_autoscroll (int dx, int dy)
{
- if (!session || autoscroll_active) {
+ if (!_session || autoscroll_active) {
return;
}
/*
redisplay_tempo (true);
- if (session)
- session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
+ if (_session)
+ _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
*/
}
*/
-#include "ardour/session.h"
#include "editor_component.h"
-using namespace std;
-using namespace ARDOUR;
-
EditorComponent::EditorComponent (Editor* e)
- : _editor (e),
- _session (0)
+ : _editor (e)
{
-
}
-void
-EditorComponent::connect_to_session (Session* s)
-{
- _session = s;
-
- _session_connections.push_back (_session->GoingAway.connect (sigc::mem_fun (*this, &EditorComponent::session_going_away)));
-}
-
-void
-EditorComponent::session_going_away ()
-{
- for (list<sigc::connection>::iterator i = _session_connections.begin(); i != _session_connections.end(); ++i) {
- i->disconnect ();
- }
-
- _session = 0;
-}
#define __ardour_gtk_editor_component_h__
#include <list>
-#include <sigc++/sigc++.h>
-namespace ARDOUR {
- class Session;
-}
+#include "ardour/session_handle.h"
class Editor;
-class EditorComponent
+class EditorComponent : public ARDOUR::SessionHandlePtr
{
public:
EditorComponent (Editor *);
virtual ~EditorComponent() {}
- virtual void connect_to_session (ARDOUR::Session *);
-
protected:
-
Editor* _editor;
- ARDOUR::Session* _session;
- std::list<sigc::connection> _session_connections;
-
-private:
-
- void session_going_away ();
-
};
#endif
*cursor,
event->button.time);
- if (_editor->session && _editor->session->transport_rolling()) {
+ if (_editor->session() && _editor->session()->transport_rolling()) {
_was_rolling = true;
} else {
_was_rolling = false;
_primary (p),
_views (v)
{
- RegionView::RegionViewGoingAway.connect (sigc::mem_fun (*this, &RegionDrag::region_going_away));
+ death_connection = RegionView::RegionViewGoingAway.connect (sigc::mem_fun (*this, &RegionDrag::region_going_away));
}
void
insert_result = modified_playlists.insert (to_playlist);
if (insert_result.second) {
- _editor->session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
+ _editor->session()->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
}
to_playlist->add_region (new_region, where);
insert_result = modified_playlists.insert (playlist);
if (insert_result.second) {
- _editor->session->add_command (new MementoCommand<Playlist>(*playlist, &playlist->get_state(), 0));
+ _editor->session()->add_command (new MementoCommand<Playlist>(*playlist, &playlist->get_state(), 0));
}
/* freeze to avoid lots of relayering in the case of a multi-region drag */
frozen_insert_result = frozen_playlists.insert(playlist);
insert_result = modified_playlists.insert (from_playlist);
if (insert_result.second) {
- _editor->session->add_command (new MementoCommand<Playlist>(*from_playlist, &from_playlist->get_state(), 0));
+ _editor->session()->add_command (new MementoCommand<Playlist>(*from_playlist, &from_playlist->get_state(), 0));
}
from_playlist->remove_region (rv->region());
out:
for (set<boost::shared_ptr<Playlist> >::iterator p = modified_playlists.begin(); p != modified_playlists.end(); ++p) {
- _editor->session->add_command (new MementoCommand<Playlist>(*(*p), 0, &(*p)->get_state()));
+ _editor->session()->add_command (new MementoCommand<Playlist>(*(*p), 0, &(*p)->get_state()));
}
_editor->commit_reversible_command ();
_editor->begin_reversible_command (_("insert region"));
XMLNode& before = playlist->get_state ();
playlist->add_region (_primary->region (), _last_frame_position);
- _editor->session->add_command (new MementoCommand<Playlist> (*playlist, &before, &playlist->get_state()));
+ _editor->session()->add_command (new MementoCommand<Playlist> (*playlist, &before, &playlist->get_state()));
_editor->commit_reversible_command ();
delete _primary;
insert_result = _editor->motion_frozen_playlists.insert (pl);
if (insert_result.second) {
- _editor->session->add_command(new MementoCommand<Playlist>(*pl, &pl->get_state(), 0));
+ _editor->session()->add_command(new MementoCommand<Playlist>(*pl, &pl->get_state(), 0));
pl->freeze();
}
}
for (set<boost::shared_ptr<Playlist> >::iterator p = _editor->motion_frozen_playlists.begin(); p != _editor->motion_frozen_playlists.end(); ++p) {
(*p)->thaw ();
if (_have_transaction) {
- _editor->session->add_command (new MementoCommand<Playlist>(*(*p).get(), 0, &(*p)->get_state()));
+ _editor->session()->add_command (new MementoCommand<Playlist>(*(*p).get(), 0, &(*p)->get_state()));
}
}
BBT_Time when;
- TempoMap& map (_editor->session->tempo_map());
+ TempoMap& map (_editor->session()->tempo_map());
map.bbt_time (_last_pointer_frame, when);
if (_copy == true) {
XMLNode &before = map.get_state();
map.add_meter (_marker->meter(), when);
XMLNode &after = map.get_state();
- _editor->session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
+ _editor->session()->add_command(new MementoCommand<TempoMap>(map, &before, &after));
_editor->commit_reversible_command ();
// delete the dummy marker we used for visual representation of copying.
XMLNode &before = map.get_state();
map.move_meter (_marker->meter(), when);
XMLNode &after = map.get_state();
- _editor->session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
+ _editor->session()->add_command(new MementoCommand<TempoMap>(map, &before, &after));
_editor->commit_reversible_command ();
}
}
BBT_Time when;
- TempoMap& map (_editor->session->tempo_map());
+ TempoMap& map (_editor->session()->tempo_map());
map.bbt_time (_last_pointer_frame, when);
if (_copy == true) {
XMLNode &before = map.get_state();
map.add_tempo (_marker->tempo(), when);
XMLNode &after = map.get_state();
- _editor->session->add_command (new MementoCommand<TempoMap>(map, &before, &after));
+ _editor->session()->add_command (new MementoCommand<TempoMap>(map, &before, &after));
_editor->commit_reversible_command ();
// delete the dummy marker we used for visual representation of copying.
XMLNode &before = map.get_state();
map.move_tempo (_marker->tempo(), when);
XMLNode &after = map.get_state();
- _editor->session->add_command (new MementoCommand<TempoMap>(map, &before, &after));
+ _editor->session()->add_command (new MementoCommand<TempoMap>(map, &before, &after));
_editor->commit_reversible_command ();
}
}
if (_cursor == _editor->playhead_cursor) {
_editor->_dragging_playhead = true;
- if (_editor->session && _was_rolling && _stop) {
- _editor->session->request_stop ();
+ if (_editor->session() && _was_rolling && _stop) {
+ _editor->session()->request_stop ();
}
- if (_editor->session && _editor->session->is_auditioning()) {
- _editor->session->cancel_audition ();
+ if (_editor->session() && _editor->session()->is_auditioning()) {
+ _editor->session()->cancel_audition ();
}
}
motion (event, false);
if (_item == &_editor->playhead_cursor->canvas_item) {
- if (_editor->session) {
- _editor->session->request_locate (_editor->playhead_cursor->current_frame, _was_rolling);
+ if (_editor->session()) {
+ _editor->session()->request_locate (_editor->playhead_cursor->current_frame, _was_rolling);
_editor->_pending_locate_request = true;
}
}
tmp->audio_region()->set_fade_in_active (true);
XMLNode &after = alist->get_state();
- _editor->session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
+ _editor->session()->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
}
_editor->commit_reversible_command ();
tmp->audio_region()->set_fade_out_active (true);
XMLNode &after = alist->get_state();
- _editor->session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
+ _editor->session()->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
}
_editor->commit_reversible_command ();
if (e < max_frames) {
++e;
}
- _editor->session->locations()->find_all_between (s, e, ll, Location::Flags (0));
+ _editor->session()->locations()->find_all_between (s, e, ll, Location::Flags (0));
for (Locations::LocationList::iterator i = ll.begin(); i != ll.end(); ++i) {
Editor::LocationMarkers* lm = _editor->find_location_markers (*i);
if (lm) {
_editor->_dragging_edit_point = false;
_editor->begin_reversible_command ( _("move marker") );
- XMLNode &before = _editor->session->locations()->get_state();
+ XMLNode &before = _editor->session()->locations()->get_state();
MarkerSelection::iterator i;
list<Location*>::iterator x;
}
}
- XMLNode &after = _editor->session->locations()->get_state();
- _editor->session->add_command(new MementoCommand<Locations>(*(_editor->session->locations()), &before, &after));
+ XMLNode &after = _editor->session()->locations()->get_state();
+ _editor->session()->add_command(new MementoCommand<Locations>(*(_editor->session()->locations()), &before, &after));
_editor->commit_reversible_command ();
_line->hide();
void
ScrubDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
{
- if (movement_occurred && _editor->session) {
+ if (movement_occurred && _editor->session()) {
/* make sure we stop */
- _editor->session->request_transport_speed (0.0);
+ _editor->session()->request_transport_speed (0.0);
}
}
nframes64_t start = 0;
nframes64_t end = 0;
- if (_editor->session == 0) {
+ if (_editor->session() == 0) {
return;
}
void
SelectionDrag::finished (GdkEvent* event, bool movement_occurred)
{
- Session* s = _editor->session;
+ Session* s = _editor->session();
if (movement_occurred) {
motion (event, false);
void
RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
{
- if (_editor->session == 0) {
+ if (_editor->session() == 0) {
return;
}
case CreateCDMarker:
{
_editor->begin_reversible_command (_("new range marker"));
- XMLNode &before = _editor->session->locations()->get_state();
- _editor->session->locations()->next_available_name(rangename,"unnamed");
+ XMLNode &before = _editor->session()->locations()->get_state();
+ _editor->session()->locations()->next_available_name(rangename,"unnamed");
if (_operation == CreateCDMarker) {
flags = Location::IsRangeMarker | Location::IsCDMarker;
_editor->cd_marker_bar_drag_rect->hide();
_editor->range_bar_drag_rect->hide();
}
newloc = new Location(_editor->temp_location->start(), _editor->temp_location->end(), rangename, (Location::Flags) flags);
- _editor->session->locations()->add (newloc, true);
- XMLNode &after = _editor->session->locations()->get_state();
- _editor->session->add_command(new MementoCommand<Locations>(*(_editor->session->locations()), &before, &after));
+ _editor->session()->locations()->add (newloc, true);
+ XMLNode &after = _editor->session()->locations()->get_state();
+ _editor->session()->add_command(new MementoCommand<Locations>(*(_editor->session()->locations()), &before, &after));
_editor->commit_reversible_command ();
break;
}
nframes64_t start;
nframes64_t end;
- _editor->session->locations()->marks_either_side (_grab_frame, start, end);
+ _editor->session()->locations()->marks_either_side (_grab_frame, start, end);
if (end == max_frames) {
- end = _editor->session->current_end_frame ();
+ end = _editor->session()->current_end_frame ();
}
if (start == max_frames) {
- start = _editor->session->current_start_frame ();
+ start = _editor->session()->current_start_frame ();
}
switch (_editor->mouse_mode) {
private:
void region_going_away (RegionView *);
+ boost::signals2::scoped_connection death_connection;
};
Editor::export_audio ()
{
ExportDialog dialog (*this);
- dialog.set_session (session);
+ dialog.set_session (_session);
dialog.run();
}
Editor::export_selection ()
{
ExportSelectionDialog dialog (*this);
- dialog.set_session (session);
+ dialog.set_session (_session);
dialog.run();
}
if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) {
ExportRangeDialog dialog (*this, l->id().to_s());
- dialog.set_session (session);
+ dialog.set_session (_session);
dialog.run();
}
}
AudioTrack & track (dynamic_cast<AudioTrack &> (*rtv.route()));
ExportRegionDialog dialog (*this, region, track);
- dialog.set_session (session);
+ dialog.set_session (_session);
dialog.run();
} catch (std::bad_cast & e) {
vector<boost::shared_ptr<AudioFileSource> > sources;
uint32_t nchans;
- const string sound_directory = session->session_directory().sound_path().to_string();
+ const string sound_directory = _session->session_directory().sound_path().to_string();
nchans = region->n_channels();
try {
fs = boost::dynamic_pointer_cast<AudioFileSource> (
- SourceFactory::createWritable (DataType::AUDIO, *session,
+ SourceFactory::createWritable (DataType::AUDIO, *_session,
path, true,
- false, session->frame_rate()));
+ false, _session->frame_rate()));
}
catch (failed_constructor& err) {
string path;
vector<boost::shared_ptr<AudioFileSource> > sources;
- const string sound_directory = session->session_directory().sound_path().to_string();
+ const string sound_directory = _session->session_directory().sound_path().to_string();
uint32_t channels = count.n_audio();
try {
fs = boost::dynamic_pointer_cast<AudioFileSource> (
- SourceFactory::createWritable (DataType::AUDIO, *session,
+ SourceFactory::createWritable (DataType::AUDIO, *_session,
path, true,
- false, session->frame_rate()));
+ false, _session->frame_rate()));
}
catch (failed_constructor& err) {
row[route_display_columns.tv] = iftav;
route_list_display.get_selection()->select (row);
- iftav->GoingAway.connect(sigc::bind(sigc::mem_fun(*this, &Editor::remove_route), (TimeAxisView*)iftav)) ;
+ scoped_connect (iftav->GoingAway, boost::bind (&Editor::remove_route, this, (TimeAxisView*)iftav));
iftav->gui_changed.connect(sigc::mem_fun(*this, &Editor::handle_gui_changes)) ;
}
void
Editor::handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track)
{
- MarkerTimeAxis* mta = new MarkerTimeAxis (*this, *this->current_session(), *track_canvas, track_name, marked_track) ;
+ MarkerTimeAxis* mta = new MarkerTimeAxis (*this, *this->session(), *track_canvas, track_name, marked_track) ;
((ImageFrameTimeAxis*)marked_track)->add_marker_time_axis(mta, this) ;
track_views.push_back(mta) ;
row[route_display_columns.tv] = mta;
route_list_display.get_selection()->select (row);
- mta->GoingAway.connect(sigc::bind(sigc::mem_fun(*this, &Editor::remove_route), (TimeAxisView*)mta)) ;
+ scoped_connect (mta->GoingAway, boost::bind (&Editor::remove_route, this, (TimeAxisView*)mta));
}
(*i)->region()->set_muted (!(*i)->region()->muted ());
XMLNode &after = (*i)->region()->playlist()->get_state ();
- session->add_command (new MementoCommand<ARDOUR::Playlist>(*((*i)->region()->playlist()), &before, &after));
+ _session->add_command (new MementoCommand<ARDOUR::Playlist>(*((*i)->region()->playlist()), &before, &after));
}
entered_regionview->region()->set_muted (!entered_regionview->region()->muted());
XMLNode &after = entered_regionview->region()->playlist()->get_state();
- session->add_command (new MementoCommand<ARDOUR::Playlist>(*(entered_regionview->region()->playlist()), &before, &after));
+ _session->add_command (new MementoCommand<ARDOUR::Playlist>(*(entered_regionview->region()->playlist()), &before, &after));
commit_reversible_command();
}
void
Editor::keyboard_selection_finish (bool add)
{
- if (session && have_pending_keyboard_selection) {
+ if (_session && have_pending_keyboard_selection) {
nframes64_t end;
bool ignored;
- if (session->transport_rolling()) {
- end = session->audible_frame();
+ if (_session->transport_rolling()) {
+ end = _session->audible_frame();
} else {
if (!mouse_frame (end, ignored)) {
return;
void
Editor::keyboard_selection_begin ()
{
- if (session) {
- if (session->transport_rolling()) {
- pending_keyboard_selection_start = session->audible_frame();
+ if (_session) {
+ if (_session->transport_rolling()) {
+ pending_keyboard_selection_start = _session->audible_frame();
have_pending_keyboard_selection = true;
} else {
bool ignored;
}
void
-EditorLocations::connect_to_session (ARDOUR::Session* s)
+EditorLocations::set_session (ARDOUR::Session* s)
{
- EditorComponent::connect_to_session (s);
+ EditorComponent::set_session (s);
locations->set_session (s);
}
public:
EditorLocations (Editor *);
- void connect_to_session (ARDOUR::Session *);
+ void set_session (ARDOUR::Session *);
Gtk::Widget& widget ();
{
ENSURE_GUI_THREAD (*this, &Editor::refresh_location_display)
- if (session) {
- session->locations()->apply (*this, &Editor::refresh_location_display_internal);
+ if (_session) {
+ _session->locations()->apply (*this, &Editor::refresh_location_display_internal);
}
}
{
ENSURE_GUI_THREAD (*this, &Editor::refresh_location_display_s, ignored)
- if (session) {
- session->locations()->apply (*this, &Editor::refresh_location_display_internal);
+ if (_session) {
+ _session->locations()->apply (*this, &Editor::refresh_location_display_internal);
}
}
markerprefix = "mark";
}
- if (session) {
- session->locations()->next_available_name(markername, markerprefix);
+ if (_session) {
+ _session->locations()->next_available_name(markername, markerprefix);
if (!is_xrun && !choose_new_marker_name(markername)) {
return;
}
Location *location = new Location (where, where, markername, (Location::Flags) flags);
- session->begin_reversible_command (_("add marker"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->add (location, true);
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ _session->begin_reversible_command (_("add marker"));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->add (location, true);
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
/* find the marker we just added */
Location* loc = find_location_from_marker (marker, is_start);
- if (session && loc) {
+ if (_session && loc) {
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::really_remove_marker), loc));
}
}
gint
Editor::really_remove_marker (Location* loc)
{
- session->begin_reversible_command (_("remove marker"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->remove (loc);
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ _session->begin_reversible_command (_("remove marker"));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->remove (loc);
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
return FALSE;
}
if ((l = find_location_from_marker (marker, is_start)) != 0) {
if (l->is_mark()) {
- session->request_locate (l->start(), true);
+ _session->request_locate (l->start(), true);
}
else {
- //session->request_bounded_roll (l->start(), l->end());
+ //_session->request_bounded_roll (l->start(), l->end());
if (is_start) {
- session->request_locate (l->start(), true);
+ _session->request_locate (l->start(), true);
} else {
- session->request_locate (l->end(), true);
+ _session->request_locate (l->end(), true);
}
}
}
if ((l = find_location_from_marker (marker, is_start)) != 0) {
if (l->is_mark()) {
- session->request_locate (l->start(), false);
+ _session->request_locate (l->start(), false);
}
else {
if (is_start) {
- session->request_locate (l->start(), false);
+ _session->request_locate (l->start(), false);
} else {
- session->request_locate (l->end(), false);
+ _session->request_locate (l->end(), false);
}
}
}
Editor::marker_menu_range_to_next ()
{
Marker* marker;
- if (!session) {
+ if (!_session) {
return;
}
nframes64_t start;
nframes64_t end;
- session->locations()->marks_either_side (marker->position(), start, end);
+ _session->locations()->marks_either_side (marker->position(), start, end);
if (end != max_frames) {
string range_name = l->name();
range_name += "-range";
Location* newrange = new Location (marker->position(), end, range_name, Location::IsRangeMarker);
- session->locations()->add (newrange);
+ _session->locations()->add (newrange);
}
}
if ((l = find_location_from_marker (marker, is_start)) != 0) {
if (l->is_mark()) {
- l->set_start (session->audible_frame ());
+ l->set_start (_session->audible_frame ());
}
else {
if (is_start) {
- l->set_start (session->audible_frame ());
+ l->set_start (_session->audible_frame ());
} else {
- l->set_end (session->audible_frame ());
+ l->set_end (_session->audible_frame ());
}
}
}
if ((l = find_location_from_marker (marker, is_start)) != 0) {
if (l->is_mark()) {
- session->request_locate (l->start(), true);
+ _session->request_locate (l->start(), true);
}
else {
- session->request_bounded_roll (l->start(), l->end());
+ _session->request_bounded_roll (l->start(), l->end());
}
}
l2->set (l->start(), l->end());
// enable looping, reposition and start rolling
- session->request_play_loop(true);
- session->request_locate (l2->start(), true);
+ _session->request_play_loop(true);
+ _session->request_locate (l2->start(), true);
}
}
}
}
begin_reversible_command ( _("rename marker") );
- XMLNode &before = session->locations()->get_state();
+ XMLNode &before = _session->locations()->get_state();
dialog.get_result(txt);
loc->set_name (txt);
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
commit_reversible_command ();
}
void
Editor::update_loop_range_view (bool visibility)
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
Location* tll;
- if (session->get_play_loop() && ((tll = transport_loop_location()) != 0)) {
+ if (_session->get_play_loop() && ((tll = transport_loop_location()) != 0)) {
double x1 = frame_to_pixel (tll->start());
double x2 = frame_to_pixel (tll->end());
void
Editor::update_punch_range_view (bool visibility)
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
Location* tpl;
- if ((session->config.get_punch_in() || session->config.get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
+ if ((_session->config.get_punch_in() || _session->config.get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
guint track_canvas_width,track_canvas_height;
track_canvas->get_size(track_canvas_width,track_canvas_height);
- if (session->config.get_punch_in()) {
+ if (_session->config.get_punch_in()) {
transport_punch_range_rect->property_x1() = frame_to_pixel (tpl->start());
- transport_punch_range_rect->property_x2() = (session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
+ transport_punch_range_rect->property_x2() = (_session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
} else {
transport_punch_range_rect->property_x1() = 0;
- transport_punch_range_rect->property_x2() = (session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width);
+ transport_punch_range_rect->property_x2() = (_session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width);
}
if (visibility) {
void
Editor::marker_selection_changed ()
{
- if (session && session->deletion_in_progress()) {
+ if (_session && _session->deletion_in_progress()) {
return;
}
void
Editor::goto_nth_marker (int n)
{
- if (!session) {
+ if (!_session) {
return;
}
- const Locations::LocationList& l (session->locations()->list());
+ const Locations::LocationList& l (_session->locations()->list());
Locations::LocationList ordered;
ordered = l;
for (Locations::LocationList::iterator i = ordered.begin(); n >= 0 && i != ordered.end(); ++i) {
if ((*i)->is_mark() && !(*i)->is_hidden() && !(*i)->is_start()) {
if (n == 0) {
- session->request_locate ((*i)->start(), session->transport_rolling());
+ _session->request_locate ((*i)->start(), _session->transport_rolling());
break;
}
--n;
show_editor_mixer_when_tracks_arrive = false;
- if (!session) {
+ if (!_session) {
show_editor_mixer_when_tracks_arrive = yn;
return;
}
Editor::create_editor_mixer ()
{
current_mixer_strip = new MixerStrip (*ARDOUR_UI::instance()->the_mixer(),
- *session,
+ _session,
false);
current_mixer_strip->Hiding.connect (sigc::mem_fun(*this, &Editor::current_mixer_strip_hidden));
- current_mixer_strip->GoingAway.connect (sigc::mem_fun(*this, &Editor::current_mixer_strip_removed));
+ scoped_connect (current_mixer_strip->GoingAway, boost::bind (&Editor::current_mixer_strip_removed, this));
#ifdef GTKOSX
current_mixer_strip->WidthChanged.connect (sigc::mem_fun(*this, &Editor::ensure_all_elements_drawn));
#endif
{
RouteTimeAxisView* at;
- if (!session || (at = dynamic_cast<RouteTimeAxisView*>(&view)) == 0) {
+ if (!_session || (at = dynamic_cast<RouteTimeAxisView*>(&view)) == 0) {
return;
}
return;
}
- if (session && session->engine().running()) {
+ if (_session && _session->engine().running()) {
- nframes64_t const frame = session->audible_frame();
+ nframes64_t const frame = _session->audible_frame();
if (_dragging_playhead) {
goto almost_done;
/* only update if the playhead is on screen or we are following it */
- if (_follow_playhead && session->requested_return_frame() < 0) {
+ if (_follow_playhead && _session->requested_return_frame() < 0) {
//playhead_cursor->canvas_item.show();
#ifndef CONTINUOUS_SCROLL
if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
- if (session->transport_speed() < 0) {
+ if (_session->transport_speed() < 0) {
if (frame > (current_page_frames()/2)) {
center_screen (frame-(current_page_frames()/2));
} else {
editor canvas
*/
- if (session->transport_speed()) {
+ if (_session->transport_speed()) {
double target = ((double)frame - (double)current_page_frames()/2.0) / frames_per_unit;
if (target <= 0.0) target = 0.0;
if ( fabs(target - current) < current_page_frames()/frames_per_unit ) {
{
_have_idled = false;
- for (vector<sigc::connection>::iterator i = session_connections.begin(); i != session_connections.end(); ++i) {
- (*i).disconnect ();
- }
+ _session_connections.drop_connections ();
stop_scrolling ();
selection->clear ();
set_title (title.get_string());
- session = 0;
+ SessionHandlePtr::session_going_away ();
}
void
track_canvas->grab_focus();
- if (session && session->actively_recording()) {
+ if (_session && _session->actively_recording()) {
return true;
}
/* no action if we're recording */
- if (session && session->actively_recording()) {
+ if (_session && _session->actively_recording()) {
return true;
}
}
} else {
/* make sure we stop */
- session->request_transport_speed (0.0);
+ _session->request_transport_speed (0.0);
}
break;
if (scrubbing_direction == 0) {
/* first move */
- session->request_locate (_drag->current_pointer_frame(), false);
- session->request_transport_speed (0.1);
+ _session->request_locate (_drag->current_pointer_frame(), false);
+ _session->request_transport_speed (0.1);
scrubbing_direction = 1;
} else {
scrub_reverse_distance = 0;
delta = 0.01 * (last_scrub_x - _drag->current_pointer_x());
- session->request_transport_speed (session->transport_speed() - delta);
+ _session->request_transport_speed (_session->transport_speed() - delta);
}
} else {
scrub_reverse_distance = 0;
delta = 0.01 * (_drag->current_pointer_x() - last_scrub_x);
- session->request_transport_speed (session->transport_speed() + delta);
+ _session->request_transport_speed (_session->transport_speed() + delta);
}
}
if (scrubbing_direction > 0) {
/* was forwards, go backwards */
- session->request_transport_speed (-0.1);
+ _session->request_transport_speed (-0.1);
scrubbing_direction = -1;
} else {
/* was backwards, go forwards */
- session->request_transport_speed (0.1);
+ _session->request_transport_speed (0.1);
scrubbing_direction = 1;
}
step_timeout.disconnect ();
}
- if (session && session->actively_recording()) {
+ if (_session && _session->actively_recording()) {
/* Sorry. no dragging stuff around while we record */
return true;
}
nframes64_t frame_rate;
float secs;
- if (session == 0) {
+ if (_session == 0) {
return;
}
switch (m) {
case AudioClock::BBT:
- session->bbt_time (frame, bbt);
+ _session->bbt_time (frame, bbt);
snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks);
break;
case AudioClock::Timecode:
- session->timecode_time (frame, timecode);
+ _session->timecode_time (frame, timecode);
snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
break;
case AudioClock::MinSec:
/* XXX this is copied from show_verbose_duration_cursor() */
- frame_rate = session->frame_rate();
+ frame_rate = _session->frame_rate();
hours = frame / (frame_rate * 3600);
frame = frame % (frame_rate * 3600);
mins = frame / (frame_rate * 60);
int hours, mins;
nframes64_t distance, frame_rate;
float secs;
- Meter meter_at_start(session->tempo_map().meter_at(start));
+ Meter meter_at_start(_session->tempo_map().meter_at(start));
- if (session == 0) {
+ if (_session == 0) {
return;
}
switch (m) {
case AudioClock::BBT:
- session->bbt_time (start, sbbt);
- session->bbt_time (end, ebbt);
+ _session->bbt_time (start, sbbt);
+ _session->bbt_time (end, ebbt);
/* subtract */
/* XXX this computation won't work well if the
break;
case AudioClock::Timecode:
- session->timecode_duration (end - start, timecode);
+ _session->timecode_duration (end - start, timecode);
snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
break;
case AudioClock::MinSec:
/* XXX this stuff should be elsewhere.. */
distance = end - start;
- frame_rate = session->frame_rate();
+ frame_rate = _session->frame_rate();
hours = distance / (frame_rate * 3600);
distance = distance % (frame_rate * 3600);
mins = distance / (frame_rate * 60);
(*i)->region()->trim_front (new_bound, this);
XMLNode &after = pl->get_state();
- session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
}
}
XMLNode &before = pl->get_state();
rv->region()->trim_front (new_bound, this);
XMLNode &after = pl->get_state();
- session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
}
}
XMLNode &before = pl->get_state();
(*i)->region()->trim_end (new_bound, this);
XMLNode &after = pl->get_state();
- session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
}
}
XMLNode &before = pl->get_state();
rv->region()->trim_end (new_bound, this);
XMLNode &after = pl->get_state();
- session->add_command (new MementoCommand<Playlist>(*pl.get(), &before, &after));
+ _session->add_command (new MementoCommand<Playlist>(*pl.get(), &before, &after));
}
}
XMLNode &before = playlist->get_state();
playlist->add_region (RegionFactory::create (rv->region()), (nframes64_t) (pos * speed));
XMLNode &after = playlist->get_state();
- session->add_command(new MementoCommand<Playlist>(*playlist.get(), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*playlist.get(), &before, &after));
// playlist is frozen, so we have to update manually
XMLNode *before = &(playlist->get_state());
clicked_routeview->playlist()->add_region (region, selection->time[clicked_selection].start);
XMLNode *after = &(playlist->get_state());
- session->add_command(new MementoCommand<Playlist>(*playlist, before, after));
+ _session->add_command(new MementoCommand<Playlist>(*playlist, before, after));
commit_reversible_command ();
void
Editor::undo (uint32_t n)
{
- if (session) {
- session->undo (n);
+ if (_session) {
+ _session->undo (n);
}
}
void
Editor::redo (uint32_t n)
{
- if (session) {
- session->redo (n);
+ if (_session) {
+ _session->redo (n);
}
}
XMLNode &before = pl->get_state();
pl->split_region ((*a)->region(), where);
XMLNode &after = pl->get_state();
- session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
}
a = tmp;
get_regions_for_action (rs);
- if (!session) return;
+ if (!_session) return;
if (!force_playhead && !rs.empty()) {
XMLNode &before = r->playlist()->get_state();
r->set_position (r->position() + distance, this);
XMLNode &after = r->playlist()->get_state();
- session->add_command (new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+ _session->add_command (new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
}
commit_reversible_command ();
}
}
XMLNode& after (loc->get_state());
- session->add_command (new MementoCommand<Location>(*loc, &before, &after));
+ _session->add_command (new MementoCommand<Location>(*loc, &before, &after));
}
}
} else {
distance = get_nudge_distance (playhead_cursor->current_frame, next_distance);
- session->request_locate (playhead_cursor->current_frame + distance);
+ _session->request_locate (playhead_cursor->current_frame + distance);
}
}
get_regions_for_action (rs);
- if (!session) return;
+ if (!_session) return;
if (!force_playhead && !rs.empty()) {
r->set_position (0, this);
}
XMLNode &after = r->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
}
commit_reversible_command ();
}
XMLNode& after (loc->get_state());
- session->add_command (new MementoCommand<Location>(*loc, &before, &after));
+ _session->add_command (new MementoCommand<Location>(*loc, &before, &after));
}
}
distance = get_nudge_distance (playhead_cursor->current_frame, next_distance);
if (playhead_cursor->current_frame > distance) {
- session->request_locate (playhead_cursor->current_frame - distance);
+ _session->request_locate (playhead_cursor->current_frame - distance);
} else {
- session->goto_start();
+ _session->goto_start();
}
}
}
get_regions_for_action (rs);
- if (!session) return;
+ if (!_session) return;
if (!rs.empty()) {
begin_reversible_command (_("nudge forward"));
- distance = session->worst_output_latency();
+ distance = _session->worst_output_latency();
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
boost::shared_ptr<Region> r ((*i)->region());
XMLNode &before = r->playlist()->get_state();
r->set_position (r->position() + distance, this);
XMLNode &after = r->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
}
commit_reversible_command ();
get_regions_for_action (rs);
- if (!session) return;
+ if (!_session) return;
if (!rs.empty()) {
begin_reversible_command (_("nudge forward"));
- distance = session->worst_output_latency();
+ distance = _session->worst_output_latency();
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
boost::shared_ptr<Region> r ((*i)->region());
r->set_position (0, this);
}
XMLNode &after = r->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
}
commit_reversible_command ();
void
Editor::move_to_start ()
{
- session->goto_start ();
+ _session->goto_start ();
}
void
Editor::move_to_end ()
{
- session->request_locate (session->current_end_frame());
+ _session->request_locate (_session->current_end_frame());
}
void
region_boundary_cache.clear ();
- if (session == 0) {
+ if (_session == 0) {
return;
}
tlist = track_views;
}
- while (pos < session->current_end_frame() && !at_end) {
+ while (pos < _session->current_end_frame() && !at_end) {
nframes64_t rpos;
nframes64_t lpos = max_frames;
break;
}
- // rpos is a "track frame", converting it to "session frame"
+ // rpos is a "track frame", converting it to "_session frame"
rpos = track_frame_to_session_frame(rpos, track_speed);
if (rpos > frame) {
nframes64_t pos = playhead_cursor->current_frame;
nframes64_t target;
- if (!session) {
+ if (!_session) {
return;
}
}
- session->request_locate (target);
+ _session->request_locate (target);
}
void
boost::shared_ptr<Region> r;
nframes64_t pos = cursor->current_frame;
- if (!session) {
+ if (!_session) {
return;
}
pos = track_frame_to_session_frame(pos, speed);
if (cursor == playhead_cursor) {
- session->request_locate (pos);
+ _session->request_locate (pos);
} else {
cursor->set_position (pos);
}
}
if (cursor == playhead_cursor) {
- session->request_locate (pos);
+ _session->request_locate (pos);
} else {
cursor->set_position (pos);
}
}
if (cursor == playhead_cursor) {
- session->request_locate (pos);
+ _session->request_locate (pos);
} else {
cursor->set_position (pos);
}
Location* loc;
bool ignored;
- if (!session) {
+ if (!_session) {
return;
}
Location* loc;
bool ignored;
- if (!session || selection->markers.empty()) {
+ if (!_session || selection->markers.empty()) {
return;
}
Location* loc;
bool ignored;
- if (!session || selection->markers.empty()) {
+ if (!_session || selection->markers.empty()) {
return;
}
Location* loc;
bool ignored;
- if (!session || selection->markers.empty()) {
+ if (!_session || selection->markers.empty()) {
return;
}
}
}
- session->request_locate (pos);
+ _session->request_locate (pos);
}
void
cnt = 1;
} else {
if (was_floating) {
- cnt = (nframes64_t) floor (prefix * session->frame_rate ());
+ cnt = (nframes64_t) floor (prefix * _session->frame_rate ());
} else {
cnt = (nframes64_t) prefix;
}
reload, just to move 1 sample !!!
*/
- session->request_locate (pos);
+ _session->request_locate (pos);
}
void
cnt = 1;
} else {
if (was_floating) {
- cnt = (nframes64_t) floor (prefix * session->frame_rate ());
+ cnt = (nframes64_t) floor (prefix * _session->frame_rate ());
} else {
cnt = (nframes64_t) floor (prefix);
}
reload, just to move 1 sample !!!
*/
- session->request_locate (pos+cnt);
+ _session->request_locate (pos+cnt);
}
void
Editor::cursor_align (bool playhead_to_edit)
{
- if (!session) {
+ if (!_session) {
return;
}
return;
}
- session->request_locate (selection->markers.front()->position(), session->transport_rolling());
+ _session->request_locate (selection->markers.front()->position(), _session->transport_rolling());
} else {
/* move selected markers to playhead */
cnt = 1;
} else {
if (was_floating) {
- cnt = (nframes64_t) floor (prefix * session->frame_rate ());
+ cnt = (nframes64_t) floor (prefix * _session->frame_rate ());
} else {
cnt = (nframes64_t) prefix;
}
cnt = 1;
} else {
if (was_floating) {
- cnt = (nframes64_t) floor (prefix * session->frame_rate ());
+ cnt = (nframes64_t) floor (prefix * _session->frame_rate ());
} else {
cnt = (nframes64_t) floor (prefix);
}
}
if (was_floating) {
- frame = (nframes64_t) floor (prefix * session->frame_rate());
+ frame = (nframes64_t) floor (prefix * _session->frame_rate());
} else {
frame = (nframes64_t) floor (prefix);
}
- session->request_locate (frame);
+ _session->request_locate (frame);
}
void
cnt = (nframes64_t) floor (pages * one_page);
} else {
if (was_floating) {
- cnt = (nframes64_t) floor (prefix * session->frame_rate());
+ cnt = (nframes64_t) floor (prefix * _session->frame_rate());
} else {
cnt = (nframes64_t) floor (prefix * one_page);
}
cnt = (nframes64_t) floor (pages * one_page);
} else {
if (was_floating) {
- cnt = (nframes64_t) floor (prefix * session->frame_rate());
+ cnt = (nframes64_t) floor (prefix * _session->frame_rate());
} else {
cnt = (nframes64_t) floor (prefix * one_page);
}
void
Editor::temporal_zoom (gdouble fpu)
{
- if (!session) return;
+ if (!_session) return;
nframes64_t current_page = current_page_frames();
nframes64_t current_leftmost = leftmost_frame;
}
- // leftmost_after_zoom = min (leftmost_after_zoom, session->current_end_frame());
+ // leftmost_after_zoom = min (leftmost_after_zoom, _session->current_end_frame());
reposition_and_zoom (leftmost_after_zoom, nfpu);
}
{
ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_session)
- if (session) {
- temporal_zoom_by_frame (session->current_start_frame(), session->current_end_frame(), "zoom to session");
+ if (_session) {
+ temporal_zoom_by_frame (_session->current_start_frame(), _session->current_end_frame(), "zoom to _session");
}
}
void
Editor::temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & /*op*/)
{
- if (!session) return;
+ if (!_session) return;
if ((start == 0 && end == 0) || end < start) {
return;
void
Editor::temporal_zoom_to_frame (bool coarser, nframes64_t frame)
{
- if (!session) {
+ if (!_session) {
return;
}
double range_before = frame - leftmost_frame;
new_leftmost = 0;
}
// begin_reversible_command (_("zoom to frame"));
-// session->add_undo (sigc::bind (sigc::mem_fun(*this, &Editor::reposition_and_zoom), leftmost_frame, frames_per_unit));
-// session->add_redo (sigc::bind (sigc::mem_fun(*this, &Editor::reposition_and_zoom), new_leftmost, new_fpu));
+// _session->add_undo (sigc::bind (sigc::mem_fun(*this, &Editor::reposition_and_zoom), leftmost_frame, frames_per_unit));
+// _session->add_redo (sigc::bind (sigc::mem_fun(*this, &Editor::reposition_and_zoom), new_leftmost, new_fpu));
// commit_reversible_command ();
reposition_and_zoom (new_leftmost, new_fpu);
return;
}
- if (session == 0 || clicked_axisview == 0) {
+ if (_session == 0 || clicked_axisview == 0) {
return;
}
nframes64_t start = selection->time[clicked_selection].start;
nframes64_t end = selection->time[clicked_selection].end;
- session->locations()->next_available_name(rangename,"selection");
+ _session->locations()->next_available_name(rangename,"selection");
Location *location = new Location (start, end, rangename, Location::IsRangeMarker);
- session->begin_reversible_command (_("add marker"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->add (location, true);
- XMLNode &after = session->locations()->get_state();
- session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ _session->begin_reversible_command (_("add marker"));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->add (location, true);
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
}
void
select_new_marker = true;
- session->locations()->next_available_name(markername,"mark");
+ _session->locations()->next_available_name(markername,"mark");
if (!choose_new_marker_name(markername)) {
return;
}
Location *location = new Location (where, where, markername, Location::IsMark);
- session->begin_reversible_command (_("add marker"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->add (location, true);
- XMLNode &after = session->locations()->get_state();
- session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ _session->begin_reversible_command (_("add marker"));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->add (location, true);
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
}
void
Editor::add_location_from_playhead_cursor ()
{
- add_location_mark (session->audible_frame());
+ add_location_mark (_session->audible_frame());
}
void
return;
}
- session->begin_reversible_command (rs.size () > 1 ? _("add markers") : _("add marker"));
- XMLNode &before = session->locations()->get_state();
+ _session->begin_reversible_command (rs.size () > 1 ? _("add markers") : _("add marker"));
+ XMLNode &before = _session->locations()->get_state();
cerr << "Add locations\n";
Location *location = new Location (region->position(), region->last_frame(), region->name(), Location::IsRangeMarker);
- session->locations()->add (location, true);
+ _session->locations()->add (location, true);
}
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
}
void
return;
}
- session->begin_reversible_command (_("add marker"));
- XMLNode &before = session->locations()->get_state();
+ _session->begin_reversible_command (_("add marker"));
+ XMLNode &before = _session->locations()->get_state();
string markername;
if (rs.size() > 1) { // more than one region selected
- session->locations()->next_available_name(markername, "regions");
+ _session->locations()->next_available_name(markername, "regions");
} else {
RegionView* rv = *(rs.begin());
boost::shared_ptr<Region> region = rv->region();
// single range spanning all selected
Location *location = new Location (rs.start(), rs.end_frame(), markername, Location::IsRangeMarker);
- session->locations()->add (location, true);
+ _session->locations()->add (location, true);
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
}
void
void
Editor::jump_forward_to_mark ()
{
- if (!session) {
+ if (!_session) {
return;
}
- Location *location = session->locations()->first_location_after (playhead_cursor->current_frame);
+ Location *location = _session->locations()->first_location_after (playhead_cursor->current_frame);
if (location) {
- session->request_locate (location->start(), session->transport_rolling());
+ _session->request_locate (location->start(), _session->transport_rolling());
} else {
- session->request_locate (session->current_end_frame());
+ _session->request_locate (_session->current_end_frame());
}
}
void
Editor::jump_backward_to_mark ()
{
- if (!session) {
+ if (!_session) {
return;
}
- Location *location = session->locations()->first_location_before (playhead_cursor->current_frame);
+ Location *location = _session->locations()->first_location_before (playhead_cursor->current_frame);
if (location) {
- session->request_locate (location->start(), session->transport_rolling());
+ _session->request_locate (location->start(), _session->transport_rolling());
} else {
- session->goto_start ();
+ _session->goto_start ();
}
}
string markername;
if (get_prefix (prefix, was_floating)) {
- pos = session->audible_frame ();
+ pos = _session->audible_frame ();
} else {
if (was_floating) {
- pos = (nframes64_t) floor (prefix * session->frame_rate ());
+ pos = (nframes64_t) floor (prefix * _session->frame_rate ());
} else {
pos = (nframes64_t) floor (prefix);
}
}
- session->locations()->next_available_name(markername,"mark");
+ _session->locations()->next_available_name(markername,"mark");
if (!choose_new_marker_name(markername)) {
return;
}
- session->locations()->add (new Location (pos, 0, markername, Location::IsMark), true);
+ _session->locations()->add (new Location (pos, 0, markername, Location::IsMark), true);
}
void
Editor::clear_markers ()
{
- if (session) {
- session->begin_reversible_command (_("clear markers"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->clear_markers ();
- XMLNode &after = session->locations()->get_state();
- session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ if (_session) {
+ _session->begin_reversible_command (_("clear markers"));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->clear_markers ();
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
}
}
void
Editor::clear_ranges ()
{
- if (session) {
- session->begin_reversible_command (_("clear ranges"));
- XMLNode &before = session->locations()->get_state();
+ if (_session) {
+ _session->begin_reversible_command (_("clear ranges"));
+ XMLNode &before = _session->locations()->get_state();
- Location * looploc = session->locations()->auto_loop_location();
- Location * punchloc = session->locations()->auto_punch_location();
+ Location * looploc = _session->locations()->auto_loop_location();
+ Location * punchloc = _session->locations()->auto_punch_location();
- session->locations()->clear_ranges ();
+ _session->locations()->clear_ranges ();
// re-add these
- if (looploc) session->locations()->add (looploc);
- if (punchloc) session->locations()->add (punchloc);
+ if (looploc) _session->locations()->add (looploc);
+ if (punchloc) _session->locations()->add (punchloc);
- XMLNode &after = session->locations()->get_state();
- session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
}
}
void
Editor::clear_locations ()
{
- session->begin_reversible_command (_("clear locations"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->clear ();
- XMLNode &after = session->locations()->get_state();
- session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
- session->locations()->clear ();
+ _session->begin_reversible_command (_("clear locations"));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->clear ();
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
+ _session->locations()->clear ();
}
void
begin_reversible_command (_("insert dragged region"));
XMLNode &before = playlist->get_state();
playlist->add_region (RegionFactory::create (region), where, 1.0);
- session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
commit_reversible_command ();
}
begin_reversible_command (_("insert region"));
XMLNode &before = playlist->get_state();
playlist->add_region ((RegionFactory::create (region)), get_preferred_edit_position(), times);
- session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
commit_reversible_command ();
}
void
Editor::transition_to_rolling (bool fwd)
{
- if (!session) {
+ if (!_session) {
return;
}
- if (session->config.get_external_sync()) {
- switch (session->config.get_sync_source()) {
+ if (_session->config.get_external_sync()) {
+ switch (_session->config.get_sync_source()) {
case JACK:
break;
default:
}
}
- if (session->is_auditioning()) {
- session->cancel_audition ();
+ if (_session->is_auditioning()) {
+ _session->cancel_audition ();
return;
}
- session->request_transport_speed (fwd ? 1.0f : -1.0f);
+ _session->request_transport_speed (fwd ? 1.0f : -1.0f);
}
void
Editor::play_from_start ()
{
- session->request_locate (session->current_start_frame(), true);
+ _session->request_locate (_session->current_start_frame(), true);
}
void
Editor::play_from_edit_point ()
{
- session->request_locate (get_preferred_edit_position(), true);
+ _session->request_locate (get_preferred_edit_position(), true);
}
void
start_frame = get_preferred_edit_position (true);
- if (session->transport_rolling()) {
- session->request_locate (start_frame, false);
+ if (_session->transport_rolling()) {
+ _session->request_locate (start_frame, false);
return;
}
/* don't reset the return frame if its already set */
- if ((return_frame = session->requested_return_frame()) < 0) {
- return_frame = session->audible_frame();
+ if ((return_frame = _session->requested_return_frame()) < 0) {
+ return_frame = _session->audible_frame();
}
if (start_frame >= 0) {
- session->request_roll_at_and_return (start_frame, return_frame);
+ _session->request_roll_at_and_return (start_frame, return_frame);
}
}
return;
}
- session->request_play_range (&selection->time, true);
+ _session->request_play_range (&selection->time, true);
}
void
// enable looping, reposition and start rolling
- session->request_play_loop (true);
- session->request_locate (tll->start(), false);
- session->request_transport_speed (1.0f);
+ _session->request_play_loop (true);
+ _session->request_locate (tll->start(), false);
+ _session->request_transport_speed (1.0f);
}
}
}
return;
}
- session->request_bounded_roll (location.start(), location.end());
+ _session->request_bounded_roll (location.start(), location.end());
}
void
tll->set (location.start(), location.end());
// enable looping, reposition and start rolling
- session->request_play_loop (true);
- session->request_locate (tll->start(), true);
+ _session->request_play_loop (true);
+ _session->request_locate (tll->start(), true);
}
}
void
Editor::audition_playlist_region_via_route (boost::shared_ptr<Region> region, Route& route)
{
- if (session->is_auditioning()) {
- session->cancel_audition ();
+ if (_session->is_auditioning()) {
+ _session->cancel_audition ();
}
// note: some potential for creativity here, because region doesn't
route.set_solo (true, this);
- session->request_bounded_roll (region->position(), region->position() + region->length());
+ _session->request_bounded_roll (region->position(), region->position() + region->length());
/* XXX how to unset the solo state ? */
}
nframes64_t start, end;
if (get_edit_op_range (start, end)) {
- session->request_bounded_roll (start, end);
+ _session->request_bounded_roll (start, end);
}
}
}
}
- session->request_bounded_roll (start, end);
+ _session->request_bounded_roll (start, end);
}
void
Editor::audition_playlist_region_standalone (boost::shared_ptr<Region> region)
{
- session->audition_region (region);
+ _session->audition_region (region);
}
void
}
internal_start = start - current->position();
- session->region_name (new_name, current->name(), true);
+ _session->region_name (new_name, current->name(), true);
boost::shared_ptr<Region> region (RegionFactory::create (current,
internal_start, selection_cnt, new_name));
}
}
internal_start = start - current->position();
- session->region_name (new_name, current->name(), true);
+ _session->region_name (new_name, current->name(), true);
new_regions.push_back (RegionFactory::create (current,
internal_start, end - start + 1, new_name));
vector< boost::shared_ptr<Region> > v;
for (list<RegionView*>::iterator x = rs.begin(); x != rs.end(); ++x) {
- (*x)->region()->separate_by_channel (*session, v);
+ (*x)->region()->separate_by_channel (*_session, v);
}
}
in_command = true;
}
- session->add_command(new MementoCommand<Playlist>(
+ _session->add_command(new MementoCommand<Playlist>(
*playlist, before, &playlist->get_state()));
}
}
void
Editor::separate_region_from_punch ()
{
- Location* loc = session->locations()->auto_punch_location();
+ Location* loc = _session->locations()->auto_punch_location();
if (loc) {
separate_regions_using_location (*loc);
}
void
Editor::separate_region_from_loop ()
{
- Location* loc = session->locations()->auto_loop_location();
+ Location* loc = _session->locations()->auto_loop_location();
if (loc) {
separate_regions_using_location (*loc);
}
XMLNode &before = (*i)->get_state();
region->trim_to (the_start, cnt, this);
XMLNode &after = (*i)->get_state();
- session->add_command (new MementoCommand<Playlist>(*(*i), &before, &after));
+ _session->add_command (new MementoCommand<Playlist>(*(*i), &before, &after));
}
commit_reversible_command ();
get_regions_for_action (rs);
- if (!session || rs.empty()) {
+ if (!_session || rs.empty()) {
return;
}
- end = session->current_end_frame ();
+ end = _session->current_end_frame ();
begin_reversible_command (_("region fill"));
XMLNode &before = pl->get_state();
pl->add_region (RegionFactory::create (region), region->last_frame(), times);
- session->add_command (new MementoCommand<Playlist>(*pl, &before, &pl->get_state()));
+ _session->add_command (new MementoCommand<Playlist>(*pl, &before, &pl->get_state()));
}
commit_reversible_command ();
XMLNode &before = playlist->get_state();
playlist->add_region (RegionFactory::create (region), start, times);
- session->add_command (new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
}
commit_reversible_command ();
XMLNode &before = region->playlist()->get_state();
region->set_sync_position (where);
XMLNode &after = region->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
}
if (in_command) {
XMLNode &before = (*i)->region()->playlist()->get_state();
(*i)->region()->clear_sync_position ();
XMLNode &after = (*i)->region()->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(*((*i)->region()->playlist()), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*((*i)->region()->playlist()), &before, &after));
}
commit_reversible_command ();
}
XMLNode &before = (*i)->region()->get_state();
(*i)->region()->move_to_natural_position (this);
XMLNode &after = (*i)->region()->get_state();
- session->add_command (new MementoCommand<Region>(*((*i)->region().get()), &before, &after));
+ _session->add_command (new MementoCommand<Region>(*((*i)->region().get()), &before, &after));
}
commit_reversible_command ();
}
XMLNode &before = r->playlist()->get_state();
r->set_position (pos, this);
XMLNode &after = r->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
/* move rest by the same amount */
}
XMLNode &after = region->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
}
}
XMLNode &after = region->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
}
void
(*i)->region()->trim_end (where, this);
}
XMLNode &after = pl->get_state();
- session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
}
}
void
Editor::trim_region_to_loop ()
{
- Location* loc = session->locations()->auto_loop_location();
+ Location* loc = _session->locations()->auto_loop_location();
if (!loc) {
return;
}
void
Editor::trim_region_to_punch ()
{
- Location* loc = session->locations()->auto_punch_location();
+ Location* loc = _session->locations()->auto_punch_location();
if (!loc) {
return;
}
XMLNode &before = rv->region()->playlist()->get_state();
rv->region()->trim_to (start, (end - start), this);
XMLNode &after = rv->region()->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(
+ _session->add_command(new MementoCommand<Playlist>(
*(rv->region()->playlist()), &before, &after));
}
}
XMLNode &before = rv->region()->playlist()->get_state();
- rv->region()->trim_end( session_frame_to_track_frame(where, speed), this);
+ rv->region()->trim_end (session_frame_to_track_frame(where, speed), this);
XMLNode &after = rv->region()->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(
+ _session->add_command(new MementoCommand<Playlist>(
*(rv->region()->playlist()), &before, &after));
}
}
XMLNode &before = rv->region()->playlist()->get_state();
- rv->region()->trim_front ( session_frame_to_track_frame(where, speed), this);
+ rv->region()->trim_front (session_frame_to_track_frame(where, speed), this);
XMLNode &after = rv->region()->playlist()->get_state();
- session->add_command(new MementoCommand<Playlist>(
+ _session->add_command(new MementoCommand<Playlist>(
*(rv->region()->playlist()), &before, &after));
}
}
XMLNode &after = playlist->get_state();
- session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
}
commit_reversible_command ();
}
XMLNode &after = playlist->get_state();
- session->add_command (new MementoCommand<Playlist> (*playlist, &before, &after));
+ _session->add_command (new MementoCommand<Playlist> (*playlist, &before, &after));
}
commit_reversible_command ();
bool ignored;
Location* loc = find_location_from_marker (entered_marker, ignored);
- if (session && loc) {
+ if (_session && loc) {
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::really_remove_marker), loc));
}
{
for (PointSelection::iterator i = selection->points.begin(); i != selection->points.end(); ++i) {
- AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>(&(*i).track);
+ AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>((*i).track);
if (atv) {
atv->cut_copy_clear_objects (selection->points, op);
XMLNode &before = playlist->get_state();
playlist->remove_region (clicked_regionview->region());
XMLNode &after = playlist->get_state();
- session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
commit_reversible_command ();
}
RegionSelection rs;
get_regions_for_action (rs);
- if (!session) {
+ if (!_session) {
return;
}
for (pl = playlists.begin(); pl != playlists.end(); ++pl) {
(*pl).playlist->thaw ();
- session->add_command(new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
+ _session->add_command(new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
}
commit_reversible_command ();
assert (z != pmap.end());
if (!(*z).pl) {
- npl = PlaylistFactory::create (pl->data_type(), *session, "cutlist", true);
+ npl = PlaylistFactory::create (pl->data_type(), *_session, "cutlist", true);
npl->freeze();
(*z).pl = npl;
} else {
for (set<PlaylistState, lt_playlist>::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
(*pl).playlist->thaw ();
- session->add_command (new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
+ _session->add_command (new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
}
}
playlist = (*i)->region()->playlist();
XMLNode &before = playlist->get_state();
playlist->duplicate (r, end_frame + (r->first_frame() - start_frame) + 1, times);
- session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
c.disconnect ();
XMLNode &before = playlist->get_state();
playlist->duplicate (*ri, selection->time[clicked_selection].end, times);
XMLNode &after = playlist->get_state();
- session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
++ri;
if (ri == new_regions.end()) {
for (PointSelection::iterator i = selection->points.begin(); i != selection->points.end(); ++i) {
- AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>(&(*i).track);
+ AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>((*i).track);
if (atv) {
atv->reset_objects (selection->points);
XMLNode &before = playlist->get_state();
playlist->clear ();
XMLNode &after = playlist->get_state();
- session->add_command (new MementoCommand<Playlist>(*playlist.get(), &before, &after));
+ _session->add_command (new MementoCommand<Playlist>(*playlist.get(), &before, &after));
commit_reversible_command ();
}
XMLNode &before = playlist->get_state();
playlist->nudge_after (start, distance, forwards);
XMLNode &after = playlist->get_state();
- session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
}
commit_reversible_command ();
vector<string> choices;
string prompt;
- if (!session) {
+ if (!_session) {
return;
}
Gtkmm2ext::Choice prompter (prompt, choices);
if (prompter.run () == 1) {
- session->remove_last_capture ();
+ _session->remove_last_capture ();
}
} else {
- session->remove_last_capture();
+ _session->remove_last_capture();
}
}
void
Editor::normalize_region ()
{
- if (!session) {
+ if (!_session) {
return;
}
continue;
XMLNode &before = arv->region()->get_state();
arv->audio_region()->normalize_to (spin.get_value());
- session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
+ _session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
}
commit_reversible_command ();
void
Editor::reset_region_scale_amplitude ()
{
- if (!session) {
+ if (!_session) {
return;
}
continue;
XMLNode &before = arv->region()->get_state();
arv->audio_region()->set_scale_amplitude (1.0f);
- session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
+ _session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
}
commit_reversible_command ();
void
Editor::adjust_region_scale_amplitude (bool up)
{
- if (!session) {
+ if (!_session) {
return;
}
}
arv->audio_region()->set_scale_amplitude (fraction);
- session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
+ _session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
}
commit_reversible_command ();
void
Editor::reverse_region ()
{
- if (!session) {
+ if (!_session) {
return;
}
- Reverse rev (*session);
+ Reverse rev (*_session);
apply_filter (rev, _("reverse regions"));
}
void
Editor::strip_region_silence ()
{
- if (!session) {
+ if (!_session) {
return;
}
int const r = d.run ();
if (r == Gtk::RESPONSE_OK) {
- StripSilence s (*session, d.threshold (), d.minimum_length (), d.fade_length ());
+ StripSilence s (*_session, d.threshold (), d.minimum_length (), d.fade_length ());
apply_filter (s, _("strip silence"));
}
}
cmd = apply_midi_note_edit_op_to_region (op, *mrv);
if (cmd) {
(*cmd)();
- session->add_command (cmd);
+ _session->add_command (cmd);
}
}
void
Editor::quantize_region ()
{
- if (!session) {
+ if (!_session) {
return;
}
qd->hide ();
if (r == Gtk::RESPONSE_OK) {
- Quantize quant (*session, Plain,
+ Quantize quant (*_session, Plain,
qd->snap_start(), qd->snap_end(),
qd->start_grid_size(), qd->end_grid_size(),
qd->strength(), qd->swing(), qd->threshold());
}
XMLNode &after = playlist->get_state();
- session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
} else {
goto out;
}
{
RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
- if (!session || rs.empty()) {
+ if (!_session || rs.empty()) {
return;
}
- session->begin_reversible_command (_("reset region gain"));
+ _session->begin_reversible_command (_("reset region gain"));
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
XMLNode& before (alist->get_state());
arv->audio_region()->set_default_envelope ();
- session->add_command (new MementoCommand<AutomationList>(*arv->audio_region()->envelope().get(), &before, &alist->get_state()));
+ _session->add_command (new MementoCommand<AutomationList>(*arv->audio_region()->envelope().get(), &before, &alist->get_state()));
}
}
- session->commit_reversible_command ();
+ _session->commit_reversible_command ();
}
void
{
RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
- if (!session || rs.empty()) {
+ if (!_session || rs.empty()) {
return;
}
- session->begin_reversible_command (_("region gain envelope visible"));
+ _session->begin_reversible_command (_("region gain envelope visible"));
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
XMLNode &before = arv->region()->get_state ();
arv->set_envelope_visible (!arv->envelope_visible());
XMLNode &after = arv->region()->get_state ();
- session->add_command (new MementoCommand<Region> (*(arv->region().get()), &before, &after));
+ _session->add_command (new MementoCommand<Region> (*(arv->region().get()), &before, &after));
}
}
- session->commit_reversible_command ();
+ _session->commit_reversible_command ();
}
void
{
RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
- if (!session || rs.empty()) {
+ if (!_session || rs.empty()) {
return;
}
- session->begin_reversible_command (_("region gain envelope active"));
+ _session->begin_reversible_command (_("region gain envelope active"));
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
XMLNode &before = arv->region()->get_state ();
arv->audio_region()->set_envelope_active (!arv->audio_region()->envelope_active());
XMLNode &after = arv->region()->get_state ();
- session->add_command (new MementoCommand<Region> (*(arv->region().get()), &before, &after));
+ _session->add_command (new MementoCommand<Region> (*(arv->region().get()), &before, &after));
}
}
- session->commit_reversible_command ();
+ _session->commit_reversible_command ();
}
void
{
RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
- if (!session || rs.empty()) {
+ if (!_session || rs.empty()) {
return;
}
- session->begin_reversible_command (_("region lock"));
+ _session->begin_reversible_command (_("region lock"));
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
XMLNode &before = (*i)->region()->get_state ();
(*i)->region()->set_locked (!(*i)->region()->locked());
XMLNode &after = (*i)->region()->get_state ();
- session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
+ _session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
}
- session->commit_reversible_command ();
+ _session->commit_reversible_command ();
}
void
{
RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
- if (!session || rs.empty()) {
+ if (!_session || rs.empty()) {
return;
}
- session->begin_reversible_command (_("region lock style"));
+ _session->begin_reversible_command (_("region lock style"));
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
XMLNode &before = (*i)->region()->get_state ();
(*i)->region()->set_position_lock_style (ps);
XMLNode &after = (*i)->region()->get_state ();
- session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
+ _session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
}
- session->commit_reversible_command ();
+ _session->commit_reversible_command ();
}
{
RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
- if (!session || rs.empty()) {
+ if (!_session || rs.empty()) {
return;
}
- session->begin_reversible_command (_("region mute"));
+ _session->begin_reversible_command (_("region mute"));
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
XMLNode &before = (*i)->region()->get_state ();
(*i)->region()->set_muted (!(*i)->region()->muted());
XMLNode &after = (*i)->region()->get_state ();
- session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
+ _session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
}
- session->commit_reversible_command ();
+ _session->commit_reversible_command ();
}
void
{
RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
- if (!session || rs.empty()) {
+ if (!_session || rs.empty()) {
return;
}
- session->begin_reversible_command (_("region opacity"));
+ _session->begin_reversible_command (_("region opacity"));
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
XMLNode &before = (*i)->region()->get_state ();
(*i)->region()->set_opaque (!(*i)->region()->opaque());
XMLNode &after = (*i)->region()->get_state ();
- session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
+ _session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
}
- session->commit_reversible_command ();
+ _session->commit_reversible_command ();
}
void
}
XMLNode &after = alist->get_state();
- session->add_command(new MementoCommand<AutomationList>(*alist, &before, &after));
+ _session->add_command(new MementoCommand<AutomationList>(*alist, &before, &after));
}
commit_reversible_command ();
region->set_fade_out_active (!yn);
}
XMLNode &after = region->get_state();
- session->add_command(new MementoCommand<AudioRegion>(*region.get(), &before, &after));
+ _session->add_command(new MementoCommand<AudioRegion>(*region.get(), &before, &after));
}
commit_reversible_command ();
tmp->audio_region()->set_fade_in_shape (shape);
XMLNode &after = alist->get_state();
- session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
+ _session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
}
commit_reversible_command ();
tmp->audio_region()->set_fade_out_shape (shape);
XMLNode &after = alist->get_state();
- session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
+ _session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
}
commit_reversible_command ();
ar->set_fade_in_active (yn);
XMLNode &after = ar->get_state();
- session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
+ _session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
}
commit_reversible_command ();
ar->set_fade_out_active (yn);
XMLNode &after = ar->get_state();
- session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
+ _session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
}
commit_reversible_command ();
void
Editor::update_region_fade_visibility ()
{
- bool _fade_visibility = session->config.get_show_region_fades ();
+ bool _fade_visibility = _session->config.get_show_region_fades ();
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);
void
Editor::update_xfade_visibility ()
{
- _xfade_visibility = session->config.get_xfades_visible ();
+ _xfade_visibility = _session->config.get_xfades_visible ();
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);
Editor::set_playhead_cursor ()
{
if (entered_marker) {
- session->request_locate (entered_marker->position(), session->transport_rolling());
+ _session->request_locate (entered_marker->position(), _session->transport_rolling());
} else {
nframes64_t where;
bool ignored;
snap_to (where);
- if (session) {
- session->request_locate (where, session->transport_rolling());
+ if (_session) {
+ _session->request_locate (where, _session->transport_rolling());
}
}
}
void
Editor::set_loop_from_selection (bool play)
{
- if (session == 0 || selection->time.empty()) {
+ if (_session == 0 || selection->time.empty()) {
return;
}
set_loop_range (start, end, _("set loop range from selection"));
if (play) {
- session->request_play_loop (true);
- session->request_locate (start, true);
+ _session->request_play_loop (true);
+ _session->request_locate (start, true);
}
}
void
Editor::set_loop_from_edit_range (bool play)
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
set_loop_range (start, end, _("set loop range from edit range"));
if (play) {
- session->request_play_loop (true);
- session->request_locate (start, true);
+ _session->request_play_loop (true);
+ _session->request_locate (start, true);
}
}
set_loop_range (start, end, _("set loop range from region"));
if (play) {
- session->request_play_loop (true);
- session->request_locate (start, true);
+ _session->request_play_loop (true);
+ _session->request_locate (start, true);
}
}
void
Editor::set_punch_from_selection ()
{
- if (session == 0 || selection->time.empty()) {
+ if (_session == 0 || selection->time.empty()) {
return;
}
void
Editor::set_punch_from_edit_range ()
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
void
Editor::use_region_as_bar ()
{
- if (!session) {
+ if (!_session) {
return;
}
{
nframes64_t length = end - start;
- const Meter& m (session->tempo_map().meter_at (start));
+ const Meter& m (_session->tempo_map().meter_at (start));
/* length = 1 bar */
/* beats per minute = */
- double beats_per_minute = (session->frame_rate() * 60.0) / frames_per_beat;
+ double beats_per_minute = (_session->frame_rate() * 60.0) / frames_per_beat;
/* now decide whether to:
*/
- const TempoSection& t (session->tempo_map().tempo_section_at (start));
+ const TempoSection& t (_session->tempo_map().tempo_section_at (start));
bool do_global = false;
- if ((session->tempo_map().n_tempos() == 1) && (session->tempo_map().n_meters() == 1)) {
+ if ((_session->tempo_map().n_tempos() == 1) && (_session->tempo_map().n_meters() == 1)) {
/* only 1 tempo & 1 meter: ask if the user wants to set the tempo
at the start, or create a new marker
}
begin_reversible_command (_("set tempo from region"));
- XMLNode& before (session->tempo_map().get_state());
+ XMLNode& before (_session->tempo_map().get_state());
if (do_global) {
- session->tempo_map().change_initial_tempo (beats_per_minute, t.note_type());
+ _session->tempo_map().change_initial_tempo (beats_per_minute, t.note_type());
} else if (t.frame() == start) {
- session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type());
+ _session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type());
} else {
- session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), start);
+ _session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), start);
}
- XMLNode& after (session->tempo_map().get_state());
+ XMLNode& after (_session->tempo_map().get_state());
- session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
+ _session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
commit_reversible_command ();
}
{
AnalysisFeatureList positions;
- if (!session) {
+ if (!_session) {
return;
}
return;
}
- session->begin_reversible_command (_("split regions"));
+ _session->begin_reversible_command (_("split regions"));
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ) {
i = tmp;
}
- session->commit_reversible_command ();
+ _session->commit_reversible_command ();
}
string new_name;
- if (session->region_name (new_name, r->name())) {
+ if (_session->region_name (new_name, r->name())) {
break;
}
XMLNode& after (pl->get_state());
- session->add_command (new MementoCommand<Playlist>(*pl, &before, &after));
+ _session->add_command (new MementoCommand<Playlist>(*pl, &before, &after));
}
void
{
AnalysisFeatureList positions;
- if (!session) {
+ if (!_session) {
return;
}
- nframes64_t pos = session->audible_frame ();
+ nframes64_t pos = _session->audible_frame ();
if (!selection->tracks.empty()) {
}
}
- TransientDetector::cleanup_transients (positions, session->frame_rate(), 3.0);
+ TransientDetector::cleanup_transients (positions, _session->frame_rate(), 3.0);
if (forward) {
AnalysisFeatureList::iterator x;
}
if (x != positions.end ()) {
- session->request_locate (*x);
+ _session->request_locate (*x);
}
} else {
}
if (x != positions.rend ()) {
- session->request_locate (*x);
+ _session->request_locate (*x);
}
}
}
void
Editor::playhead_forward_to_grid ()
{
- if (!session) return;
+ if (!_session) return;
nframes64_t pos = playhead_cursor->current_frame;
if (pos < max_frames - 1) {
pos += 2;
snap_to_internal (pos, 1, false);
- session->request_locate (pos);
+ _session->request_locate (pos);
}
}
void
Editor::playhead_backward_to_grid ()
{
- if (!session) return;
+ if (!_session) return;
nframes64_t pos = playhead_cursor->current_frame;
if (pos > 2) {
pos -= 2;
snap_to_internal (pos, -1, false);
- session->request_locate (pos);
+ _session->request_locate (pos);
}
}
}
for (vector<boost::shared_ptr<Route> >::iterator x = routes.begin(); x != routes.end(); ++x) {
- session->remove_route (*x);
+ _session->remove_route (*x);
}
}
table.attach (time_label, 0, 1, 0, 1, FILL | EXPAND);
AudioClock clock ("insertTimeClock", true, X_("InsertTimeClock"), true, false, true, true);
clock.set (0);
- clock.set_session (session);
+ clock.set_session (_session);
clock.set_bbt_reference (pos);
table.attach (clock, 1, 2, 0, 1);
XMLNode &after = pl->get_state();
- session->add_command (new MementoCommand<Playlist> (*pl, &before, &after));
+ _session->add_command (new MementoCommand<Playlist> (*pl, &before, &after));
commit = true;
}
/* markers */
if (markers_too) {
bool moved = false;
- XMLNode& before (session->locations()->get_state());
- Locations::LocationList copy (session->locations()->list());
+ XMLNode& before (_session->locations()->get_state());
+ Locations::LocationList copy (_session->locations()->list());
for (Locations::LocationList::iterator i = copy.begin(); i != copy.end(); ++i) {
}
if (moved) {
- XMLNode& after (session->locations()->get_state());
- session->add_command (new MementoCommand<Locations>(*session->locations(), &before, &after));
+ XMLNode& after (_session->locations()->get_state());
+ _session->add_command (new MementoCommand<Locations>(*_session->locations(), &before, &after));
}
}
if (tempo_too) {
- session->tempo_map().insert_time (pos, frames);
+ _session->tempo_map().insert_time (pos, frames);
}
if (commit) {
}
void
-EditorRegions::connect_to_session (ARDOUR::Session* s)
+EditorRegions::set_session (ARDOUR::Session* s)
{
- EditorComponent::connect_to_session (s);
+ EditorComponent::set_session (s);
- _session_connections.push_back (_session->RegionsAdded.connect (sigc::mem_fun(*this, &EditorRegions::handle_new_regions)));
- _session_connections.push_back (_session->RegionRemoved.connect (sigc::mem_fun(*this, &EditorRegions::handle_region_removed)));
- _session_connections.push_back (_session->RegionHiddenChange.connect (sigc::mem_fun(*this, &EditorRegions::region_hidden)));
+ if (_session) {
+ _session_connections.add_connection (_session->RegionsAdded.connect (boost::bind (&EditorRegions::handle_new_regions, this, _1)));
+ _session_connections.add_connection (_session->RegionRemoved.connect (boost::bind (&EditorRegions::handle_region_removed, this, _1)));
+ _session_connections.add_connection (_session->RegionHiddenChange.connect (boost::bind (&EditorRegions::region_hidden, this, _1)));
+ }
redisplay ();
}
public:
EditorRegions (Editor *);
- void connect_to_session (ARDOUR::Session *);
+ void set_session (ARDOUR::Session *);
Gtk::Widget& widget () {
return _scroller;
row[_columns.routegroup] = 0;
}
- _session->foreach_route_group (sigc::mem_fun (*this, &EditorRouteGroups::add));
+ if (_session) {
+ _session->foreach_route_group (sigc::mem_fun (*this, &EditorRouteGroups::add));
+ }
}
void
}
void
-EditorRouteGroups::connect_to_session (Session* s)
+EditorRouteGroups::set_session (Session* s)
{
- EditorComponent::connect_to_session (s);
+ EditorComponent::set_session (s);
- _session_connections.push_back (_session->route_group_added.connect (sigc::mem_fun (*this, &EditorRouteGroups::add)));
- _session_connections.push_back (_session->route_group_removed.connect (sigc::mem_fun (*this, &EditorRouteGroups::groups_changed)));
+ if (_session) {
+ _session_connections.add_connection (_session->route_group_added.connect (boost::bind (&EditorRouteGroups::add, this, _1)));
+ _session_connections.add_connection (_session->route_group_removed.connect (boost::bind (&EditorRouteGroups::groups_changed, this)));
+ }
groups_changed ();
}
public:
EditorRouteGroups (Editor *);
- void connect_to_session (ARDOUR::Session *);
+ void set_session (ARDOUR::Session *);
Gtk::Widget& widget () {
return *_display_packer;
_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 (sigc::mem_fun (*this, &EditorRoutes::sync_order_keys));
+ scoped_connect (Route::SyncOrderKeys, (sigc::mem_fun (*this, &EditorRoutes::sync_order_keys)));
}
void
-EditorRoutes::connect_to_session (Session* s)
+EditorRoutes::set_session (Session* s)
{
- EditorComponent::connect_to_session (s);
+ EditorComponent::set_session (s);
initial_display ();
- _session->SoloChanged.connect (sigc::mem_fun (*this, &EditorRoutes::solo_changed_so_update_mute));
+ if (_session) {
+ scoped_connect (_session->SoloChanged, (sigc::mem_fun (*this, &EditorRoutes::solo_changed_so_update_mute)));
+ }
}
void
void
EditorRoutes::redisplay ()
{
+ if (_no_redisplay || !_session) {
+ return;
+ }
+
TreeModel::Children rows = _model->children();
TreeModel::Children::iterator i;
uint32_t position;
int n;
- if (_no_redisplay) {
- return;
- }
-
for (n = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
TimeAxisView *tv = (*i)[_columns.tv];
boost::shared_ptr<Route> route = (*i)[_columns.route];
_ignore_reorder = false;
boost::weak_ptr<Route> wr ((*x)->route());
- (*x)->route()->gui_changed.connect (sigc::mem_fun (*this, &EditorRoutes::handle_gui_changes));
- (*x)->route()->NameChanged.connect (sigc::bind (sigc::mem_fun (*this, &EditorRoutes::route_name_changed), wr));
- (*x)->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &EditorRoutes::route_removed), *x));
+
+ scoped_connect ((*x)->route()->gui_changed, boost::bind (&EditorRoutes::handle_gui_changes, this, _1, _2));
+ scoped_connect ((*x)->route()->NameChanged, boost::bind (&EditorRoutes::route_name_changed, this, wr));
+ scoped_connect ((*x)->GoingAway, boost::bind (&EditorRoutes::route_removed, this, *x));
if ((*x)->is_track()) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> ((*x)->route());
- t->diskstream()->RecordEnableChanged.connect (sigc::mem_fun (*this, &EditorRoutes::update_rec_display));
+ scoped_connect (t->diskstream()->RecordEnableChanged, boost::bind (&EditorRoutes::update_rec_display, this));
}
- (*x)->route()->mute_changed.connect (sigc::mem_fun (*this, &EditorRoutes::update_mute_display));
- (*x)->route()->solo_changed.connect (sigc::mem_fun (*this, &EditorRoutes::update_solo_display));
- (*x)->route()->solo_isolated_changed.connect (sigc::mem_fun (*this, &EditorRoutes::update_solo_isolate_display));
+ scoped_connect ((*x)->route()->mute_changed, boost::bind (&EditorRoutes::update_mute_display, this));
+ scoped_connect ((*x)->route()->solo_changed, boost::bind (&EditorRoutes::update_solo_display, this));
+ scoped_connect ((*x)->route()->solo_isolated_changed, boost::bind (&EditorRoutes::update_solo_isolate_display, this));
}
update_rec_display ();
void
EditorRoutes::initial_display ()
{
+ suspend_redisplay ();
+ _model->clear ();
+
+ if (!_session) {
+ resume_redisplay ();
+ return;
+ }
+
boost::shared_ptr<RouteList> routes = _session->get_routes();
RouteList r (*routes);
EditorOrderRouteSorter sorter;
r.sort (sorter);
-
- suspend_redisplay ();
-
- _model->clear ();
_editor->handle_new_route (r);
/* don't show master bus in a new session */
}
void
-EditorRoutes::update_mute_display (void* /*src*/)
+EditorRoutes::update_mute_display ()
{
TreeModel::Children rows = _model->children();
TreeModel::Children::iterator i;
for (i = rows.begin(); i != rows.end(); ++i) {
boost::shared_ptr<Route> route = (*i)[_columns.route];
- (*i)[_columns.mute_state] = RouteUI::mute_visual_state (*_session, route) > 0 ? 1 : 0;
+ (*i)[_columns.mute_state] = RouteUI::mute_visual_state (_session, route) > 0 ? 1 : 0;
}
}
void
-EditorRoutes::update_solo_display (void* /*src*/)
+EditorRoutes::update_solo_display ()
{
TreeModel::Children rows = _model->children();
TreeModel::Children::iterator i;
}
void
-EditorRoutes::update_solo_isolate_display (void* /*src*/)
+EditorRoutes::update_solo_isolate_display ()
{
TreeModel::Children rows = _model->children();
TreeModel::Children::iterator i;
EditorRoutes::solo_changed_so_update_mute ()
{
ENSURE_GUI_THREAD (*this, &EditorRoutes::solo_changed_so_update_mute)
-
- update_mute_display (this);
+ update_mute_display ();
}
void
*/
-class EditorRoutes : public EditorComponent
+#ifndef __ardour_gtk_editor_route_h__
+#define __ardour_gtk_editor_route_h__
+
+#include "pbd/scoped_connections.h"
+#include "editor_component.h"
+
+class EditorRoutes : public EditorComponent, public PBD::ScopedConnectionList
{
public:
EditorRoutes (Editor *);
- void connect_to_session (ARDOUR::Session *);
+ void set_session (ARDOUR::Session *);
Gtk::Widget& widget () {
return _scroller;
void route_removed (TimeAxisView *);
void handle_gui_changes (std::string const &, void *);
void update_rec_display ();
- void update_mute_display (void* /*src*/);
- void update_solo_display (void* /*src*/);
- void update_solo_isolate_display (void* /*src*/);
+ void update_mute_display ();
+ void update_solo_display ();
+ void update_solo_isolate_display ();
void set_all_tracks_visibility (bool);
void set_all_audio_visibility (int, bool);
void show_all_routes ();
Gtk::Menu* _menu;
};
+
+#endif /* __ardour_gtk_editor_route_h__ */
gint
Editor::ruler_button_press (GdkEventButton* ev)
{
- if (session == 0) {
+ if (_session == 0) {
return FALSE;
}
if (ev->button == 1) {
// Since we will locate the playhead on button release, cancel any running
// auditions.
- if (session->is_auditioning()) {
- session->cancel_audition ();
+ if (_session->is_auditioning()) {
+ _session->cancel_audition ();
}
/* playhead cursor */
gint
Editor::ruler_button_release (GdkEventButton* ev)
{
- if (session == 0) {
+ if (_session == 0) {
return FALSE;
}
gint
Editor::ruler_mouse_motion (GdkEventMotion* ev)
{
- if (session == 0) {
+ if (_session == 0) {
return FALSE;
}
node->add_property (X_("transportmarker"), ruler_loop_punch_action->get_active() ? "yes": "no");
node->add_property (X_("cdmarker"), ruler_cd_marker_action->get_active() ? "yes": "no");
- session->add_extra_xml (*node);
- session->set_dirty ();
+ _session->add_extra_xml (*node);
+ _session->set_dirty ();
}
void
Editor::restore_ruler_visibility ()
{
XMLProperty* prop;
- XMLNode * node = session->extra_xml (X_("RulerVisibility"));
+ XMLNode * node = _session->extra_xml (X_("RulerVisibility"));
no_ruler_shown_update = true;
}
} else {
- // this session doesn't yet know about the cdmarker ruler
+ // this _session doesn't yet know about the cdmarker ruler
// as a benefit to the user who doesn't know the feature exists, show the ruler if
// any cd marks exist
ruler_cd_marker_action->set_active (false);
- const Locations::LocationList & locs = session->locations()->list();
+ const Locations::LocationList & locs = _session->locations()->list();
for (Locations::LocationList::const_iterator i = locs.begin(); i != locs.end(); ++i) {
if ((*i)->is_cd_marker()) {
ruler_cd_marker_action->set_active (true);
{
ENSURE_GUI_THREAD (*this, &Editor::update_just_timecode)
- if (session == 0) {
+ if (_session == 0) {
return;
}
if (ruler_timecode_action->get_active()) {
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_timecode_ruler), leftmost_frame, rightmost_frame,
- leftmost_frame, session->current_end_frame());
+ leftmost_frame, _session->current_end_frame());
}
}
void
Editor::compute_fixed_ruler_scale ()
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
{
nframes64_t rightmost_frame;
- if (session == 0) {
+ if (_session == 0) {
return;
}
if (ruler_timecode_action->get_active()) {
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_timecode_ruler), leftmost_frame, rightmost_frame,
- leftmost_frame, session->current_end_frame());
+ leftmost_frame, _session->current_end_frame());
}
if (ruler_samples_action->get_active()) {
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_frames_ruler), leftmost_frame, rightmost_frame,
- leftmost_frame, session->current_end_frame());
+ leftmost_frame, _session->current_end_frame());
}
if (ruler_minsec_action->get_active()) {
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_minsec_ruler), leftmost_frame, rightmost_frame,
- leftmost_frame, session->current_end_frame());
+ leftmost_frame, _session->current_end_frame());
}
}
void
Editor::update_tempo_based_rulers ()
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
if (ruler_bbt_action->get_active()) {
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_bbt_ruler), leftmost_frame, leftmost_frame+current_page_frames(),
- leftmost_frame, session->current_end_frame());
+ leftmost_frame, _session->current_end_frame());
}
}
nframes64_t spacer;
nframes64_t fr;
- if (session == 0) {
+ if (_session == 0) {
return;
}
- fr = session->frame_rate();
+ fr = _session->frame_rate();
if (lower > (spacer = (nframes64_t)(128 * Editor::get_current_zoom ()))) {
lower = lower - spacer;
upper = upper + spacer;
range = (nframes64_t) floor (upper - lower);
- if (range < (2 * session->frames_per_timecode_frame())) { /* 0 - 2 frames */
+ if (range < (2 * _session->frames_per_timecode_frame())) { /* 0 - 2 frames */
timecode_ruler_scale = timecode_show_bits;
timecode_mark_modulo = 20;
- timecode_nmarks = 2 + (2 * session->config.get_subframes_per_frame());
+ timecode_nmarks = 2 + (2 * _session->config.get_subframes_per_frame());
} else if (range <= (fr / 4)) { /* 2 frames - 0.250 second */
timecode_ruler_scale = timecode_show_frames;
timecode_mark_modulo = 1;
- timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
+ timecode_nmarks = 2 + (range / (nframes64_t)_session->frames_per_timecode_frame());
} else if (range <= (fr / 2)) { /* 0.25-0.5 second */
timecode_ruler_scale = timecode_show_frames;
timecode_mark_modulo = 2;
- timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
+ timecode_nmarks = 2 + (range / (nframes64_t)_session->frames_per_timecode_frame());
} else if (range <= fr) { /* 0.5-1 second */
timecode_ruler_scale = timecode_show_frames;
timecode_mark_modulo = 5;
- timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
+ timecode_nmarks = 2 + (range / (nframes64_t)_session->frames_per_timecode_frame());
} else if (range <= 2 * fr) { /* 1-2 seconds */
timecode_ruler_scale = timecode_show_frames;
timecode_mark_modulo = 10;
- timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
+ timecode_nmarks = 2 + (range / (nframes64_t)_session->frames_per_timecode_frame());
} else if (range <= 8 * fr) { /* 2-8 seconds */
timecode_ruler_scale = timecode_show_seconds;
timecode_mark_modulo = 1;
gchar buf[16];
gint n;
- if (session == 0) {
+ if (_session == 0) {
return 0;
}
case timecode_show_bits:
// Find timecode time of this sample (pos) with subframe accuracy
- session->sample_to_timecode(pos, timecode, true /* use_offset */, true /* use_subframes */ );
+ _session->sample_to_timecode(pos, timecode, true /* use_offset */, true /* use_subframes */ );
for (n = 0; n < timecode_nmarks; n++) {
- session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */ );
+ _session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */ );
if ((timecode.subframes % timecode_mark_modulo) == 0) {
if (timecode.subframes == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
(*marks)[n].position = pos;
// Increment subframes by one
- Timecode::increment_subframes( timecode, session->config.get_subframes_per_frame() );
+ Timecode::increment_subframes( timecode, _session->config.get_subframes_per_frame() );
}
break;
case timecode_show_seconds:
// Find timecode time of this sample (pos)
- session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
// Go to next whole second down
Timecode::seconds_floor( timecode );
for (n = 0; n < timecode_nmarks; n++) {
- session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
if ((timecode.seconds % timecode_mark_modulo) == 0) {
if (timecode.seconds == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
}
(*marks)[n].label = g_strdup (buf);
- Timecode::increment_seconds( timecode, session->config.get_subframes_per_frame() );
+ Timecode::increment_seconds( timecode, _session->config.get_subframes_per_frame() );
}
break;
case timecode_show_minutes:
// Find timecode time of this sample (pos)
- session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
// Go to next whole minute down
Timecode::minutes_floor( timecode );
for (n = 0; n < timecode_nmarks; n++) {
- session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
if ((timecode.minutes % timecode_mark_modulo) == 0) {
if (timecode.minutes == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
}
(*marks)[n].label = g_strdup (buf);
(*marks)[n].position = pos;
- Timecode::increment_minutes( timecode, session->config.get_subframes_per_frame() );
+ Timecode::increment_minutes( timecode, _session->config.get_subframes_per_frame() );
}
break;
case timecode_show_hours:
// Find timecode time of this sample (pos)
- session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
// Go to next whole hour down
Timecode::hours_floor( timecode );
for (n = 0; n < timecode_nmarks; n++) {
- session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
if ((timecode.hours % timecode_mark_modulo) == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
(*marks)[n].label = g_strdup (buf);
(*marks)[n].position = pos;
- Timecode::increment_hours( timecode, session->config.get_subframes_per_frame() );
+ Timecode::increment_hours( timecode, _session->config.get_subframes_per_frame() );
}
break;
case timecode_show_frames:
// Find timecode time of this sample (pos)
- session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
+ _session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
// Go to next whole frame down
Timecode::frames_floor( timecode );
for (n = 0; n < timecode_nmarks; n++) {
- session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
+ _session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
if ((timecode.frames % timecode_mark_modulo) == 0) {
if (timecode.frames == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
}
(*marks)[n].label = g_strdup (buf);
- Timecode::increment( timecode, session->config.get_subframes_per_frame() );
+ Timecode::increment( timecode, _session->config.get_subframes_per_frame() );
}
break;
void
Editor::compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper)
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
TempoMap::BBTPointList::iterator i;
BBT_Time lower_beat, upper_beat; // the beats at each end of the ruler
- session->bbt_time((jack_nframes_t) lower, lower_beat);
- session->bbt_time((jack_nframes_t) upper, upper_beat);
+ _session->bbt_time((jack_nframes_t) lower, lower_beat);
+ _session->bbt_time((jack_nframes_t) upper, upper_beat);
uint32_t beats = 0;
bbt_accent_modulo = 1;
gint
Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
{
- if (session == 0) {
+ if (_session == 0) {
return 0;
}
next_beat.beats = 1;
}
- next_beat_pos = session->tempo_map().frame_time(next_beat);
+ next_beat_pos = _session->tempo_map().frame_time(next_beat);
- frame_skip = (nframes64_t) floor (frame_skip_error = (session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
+ frame_skip = (nframes64_t) floor (frame_skip_error = (_session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
frame_skip_error -= frame_skip;
skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision);
next_beat.beats = 1;
}
- next_beat_pos = session->tempo_map().frame_time(next_beat);
+ next_beat_pos = _session->tempo_map().frame_time(next_beat);
- frame_skip = (nframes64_t) floor (frame_skip_error = (session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
+ frame_skip = (nframes64_t) floor (frame_skip_error = (_session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
frame_skip_error -= frame_skip;
skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision);
next_beat.beats = 1;
}
- next_beat_pos = session->tempo_map().frame_time(next_beat);
+ next_beat_pos = _session->tempo_map().frame_time(next_beat);
- frame_skip = (nframes64_t) floor (frame_skip_error = (session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
+ frame_skip = (nframes64_t) floor (frame_skip_error = (_session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
frame_skip_error -= frame_skip;
skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision);
gint nmarks;
gint n;
- if (session == 0) {
+ if (_session == 0) {
return 0;
}
mark_interval = (iupper - ilower) / 5;
- if (mark_interval > session->frame_rate()) {
- mark_interval -= mark_interval % session->frame_rate();
+ if (mark_interval > _session->frame_rate()) {
+ mark_interval -= mark_interval % _session->frame_rate();
} else {
- mark_interval = session->frame_rate() / (session->frame_rate() / mark_interval ) ;
+ mark_interval = _session->frame_rate() / (_session->frame_rate() / mark_interval ) ;
}
nmarks = 5;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
nframes64_t fr;
nframes64_t spacer;
- if (session == 0) {
+ if (_session == 0) {
return;
}
- fr = session->frame_rate();
+ fr = _session->frame_rate();
/* to prevent 'flashing' */
if (lower > (spacer = (nframes64_t)(128 * Editor::get_current_zoom ()))) {
gchar buf[16];
gint n;
- if (session == 0) {
+ if (_session == 0) {
return 0;
}
switch (minsec_ruler_scale) {
case minsec_show_seconds:
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
- sample_to_clock_parts (pos, session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+ sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
if (secs % minsec_mark_modulo == 0) {
if (secs == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
break;
case minsec_show_minutes:
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
- sample_to_clock_parts (pos, session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+ sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
if (mins % minsec_mark_modulo == 0) {
if (mins == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
break;
case minsec_show_hours:
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
- sample_to_clock_parts (pos, session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+ sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
if (hrs % minsec_mark_modulo == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%02ld:%02ld:%02ld.%03ld", hrs, mins, secs, millisecs);
break;
case minsec_show_frames:
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
- sample_to_clock_parts (pos, session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+ sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
if (millisecs % minsec_mark_modulo == 0) {
if (secs == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
{
Location* location;
- if ((location = session->locations()->auto_punch_location()) == 0) {
+ if ((location = _session->locations()->auto_punch_location()) == 0) {
return;
}
{
Location* location;
- if ((location = session->locations()->auto_loop_location()) == 0) {
+ if ((location = _session->locations()->auto_loop_location()) == 0) {
return;
}
set_selection_from_range (*location);
void
Editor::select_all_selectables_using_punch()
{
- Location* location = session->locations()->auto_punch_location();
+ Location* location = _session->locations()->auto_punch_location();
list<Selectable *> touched;
if (location == 0 || (location->end() - location->start() <= 1)) {
void
Editor::select_all_selectables_using_loop()
{
- Location* location = session->locations()->auto_loop_location();
+ Location* location = _session->locations()->auto_loop_location();
list<Selectable *> touched;
if (location == 0 || (location->end() - location->start() <= 1)) {
if (after) {
begin_reversible_command (_("select all after cursor"));
start = cursor->current_frame ;
- end = session->current_end_frame();
+ end = _session->current_end_frame();
} else {
if (cursor->current_frame > 0) {
begin_reversible_command (_("select all before cursor"));
if (after) {
begin_reversible_command (_("select all after edit"));
start = get_preferred_edit_position();
- end = session->current_end_frame();
+ end = _session->current_end_frame();
} else {
if ((end = get_preferred_edit_position()) > 1) {
begin_reversible_command (_("select all before edit"));
}
start = selection->markers.front()->position();
- end = session->audible_frame();
+ end = _session->audible_frame();
} else {
if (selection->markers.empty()) {
/* use mouse + playhead */
start = m;
- end = session->audible_frame();
+ end = _session->audible_frame();
} else {
/* use playhead + selected marker */
- start = session->audible_frame();
+ start = _session->audible_frame();
end = selection->markers.front()->position();
}
break;
/* use mouse + selected marker */
if (selection->markers.empty()) {
start = m;
- end = session->audible_frame();
+ end = _session->audible_frame();
} else {
start = selection->markers.front()->position();
end = m;
}
void
-EditorSnapshots::connect_to_session (Session* s)
+EditorSnapshots::set_session (Session* s)
{
- EditorComponent::connect_to_session (s);
+ EditorComponent::set_session (s);
redisplay ();
}
public:
EditorSnapshots (Editor *);
- void connect_to_session (ARDOUR::Session *);
+ void set_session (ARDOUR::Session *);
Gtk::Widget& widget () {
return _scroller;
* @param s Session.
*/
void
-EditorSummary::connect_to_session (Session* s)
+EditorSummary::set_session (Session* s)
{
- EditorComponent::connect_to_session (s);
+ EditorComponent::set_session (s);
Region::RegionPropertyChanged.connect (sigc::hide (sigc::mem_fun (*this, &EditorSummary::set_dirty)));
- _session_connections.push_back (_session->RegionRemoved.connect (sigc::hide (sigc::mem_fun (*this, &EditorSummary::set_dirty))));
- _session_connections.push_back (_session->StartTimeChanged.connect (sigc::mem_fun (*this, &EditorSummary::set_dirty)));
- _session_connections.push_back (_session->EndTimeChanged.connect (sigc::mem_fun (*this, &EditorSummary::set_dirty)));
+ if (_session) {
+ _session_connections.add_connection (_session->RegionRemoved.connect (boost::bind (&EditorSummary::set_dirty, this)));
+ _session_connections.add_connection (_session->StartTimeChanged.connect (boost::bind (&EditorSummary::set_dirty, this)));
+ _session_connections.add_connection (_session->EndTimeChanged.connect (boost::bind (&EditorSummary::set_dirty, this)));
+ }
+
_editor->playhead_cursor->PositionChanged.connect (sigc::mem_fun (*this, &EditorSummary::playhead_position_changed));
set_dirty ();
public:
EditorSummary (Editor *);
- void connect_to_session (ARDOUR::Session *);
+ void set_session (ARDOUR::Session *);
void set_overlays_dirty ();
private:
void
Editor::tempo_map_changed (Change ignored)
{
- if (!session) {
+ if (!_session) {
return;
}
tempo_lines->tempo_map_changed();
compute_current_bbt_points(leftmost_frame, leftmost_frame + current_page_frames());
- session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
+ _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
redraw_measures ();
}
void
Editor::redisplay_tempo (bool immediate_redraw)
{
- if (!session) {
+ if (!_session) {
return;
}
void
Editor::compute_current_bbt_points (nframes_t leftmost, nframes_t rightmost)
{
- if (!session) {
+ if (!_session) {
return;
}
BBT_Time previous_beat, next_beat; // the beats previous to the leftmost frame and after the rightmost frame
- session->bbt_time(leftmost, previous_beat);
- session->bbt_time(rightmost, next_beat);
+ _session->bbt_time(leftmost, previous_beat);
+ _session->bbt_time(rightmost, next_beat);
if (previous_beat.beats > 1) {
previous_beat.beats -= 1;
}
previous_beat.ticks = 0;
- if (session->tempo_map().meter_at(rightmost).beats_per_bar () > next_beat.beats + 1) {
+ if (_session->tempo_map().meter_at(rightmost).beats_per_bar () > next_beat.beats + 1) {
next_beat.beats += 1;
} else {
next_beat.bars += 1;
delete current_bbt_points;
current_bbt_points = 0;
- current_bbt_points = session->tempo_map().get_points (session->tempo_map().frame_time (previous_beat), session->tempo_map().frame_time (next_beat) + 1);
+ current_bbt_points = _session->tempo_map().get_points (_session->tempo_map().frame_time (previous_beat), _session->tempo_map().frame_time (next_beat) + 1);
}
void
void
Editor::draw_measures ()
{
- if (session == 0 || _show_measures == false ||
+ if (_session == 0 || _show_measures == false ||
!current_bbt_points || current_bbt_points->empty()) {
return;
}
void
Editor::mouse_add_new_tempo_event (nframes64_t frame)
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
- TempoMap& map(session->tempo_map());
+ TempoMap& map(_session->tempo_map());
TempoDialog tempo_dialog (map, frame, _("add"));
tempo_dialog.set_position (Gtk::WIN_POS_MOUSE);
XMLNode &before = map.get_state();
map.add_tempo (Tempo (bpm,nt), requested);
XMLNode &after = map.get_state();
- session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
+ _session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
commit_reversible_command ();
//map.dump (cerr);
void
Editor::mouse_add_new_meter_event (nframes64_t frame)
{
- if (session == 0) {
+ if (_session == 0) {
return;
}
- TempoMap& map(session->tempo_map());
+ TempoMap& map(_session->tempo_map());
MeterDialog meter_dialog (map, frame, _("add"));
meter_dialog.set_position (Gtk::WIN_POS_MOUSE);
begin_reversible_command (_("add meter mark"));
XMLNode &before = map.get_state();
map.add_meter (Meter (bpb, note_type), requested);
- session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state()));
+ _session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state()));
commit_reversible_command ();
//map.dump (cerr);
double note_type = meter_dialog.get_note_type ();
begin_reversible_command (_("replace tempo mark"));
- XMLNode &before = session->tempo_map().get_state();
- session->tempo_map().replace_meter (*section, Meter (bpb, note_type));
- XMLNode &after = session->tempo_map().get_state();
- session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
+ XMLNode &before = _session->tempo_map().get_state();
+ _session->tempo_map().replace_meter (*section, Meter (bpb, note_type));
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
commit_reversible_command ();
}
bpm = max (0.01, bpm);
cerr << "Editing tempo section to be at " << when << endl;
- session->tempo_map().dump (cerr);
+ _session->tempo_map().dump (cerr);
begin_reversible_command (_("replace tempo mark"));
- XMLNode &before = session->tempo_map().get_state();
- session->tempo_map().replace_tempo (*section, Tempo (bpm,nt));
- session->tempo_map().dump (cerr);
- session->tempo_map().move_tempo (*section, when);
- session->tempo_map().dump (cerr);
- XMLNode &after = session->tempo_map().get_state();
- session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
+ XMLNode &before = _session->tempo_map().get_state();
+ _session->tempo_map().replace_tempo (*section, Tempo (bpm,nt));
+ _session->tempo_map().dump (cerr);
+ _session->tempo_map().move_tempo (*section, when);
+ _session->tempo_map().dump (cerr);
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
commit_reversible_command ();
}
Editor::real_remove_tempo_marker (TempoSection *section)
{
begin_reversible_command (_("remove tempo mark"));
- XMLNode &before = session->tempo_map().get_state();
- session->tempo_map().remove_tempo (*section);
- XMLNode &after = session->tempo_map().get_state();
- session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
+ XMLNode &before = _session->tempo_map().get_state();
+ _session->tempo_map().remove_tempo (*section);
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
commit_reversible_command ();
return FALSE;
Editor::real_remove_meter_marker (MeterSection *section)
{
begin_reversible_command (_("remove tempo mark"));
- XMLNode &before = session->tempo_map().get_state();
- session->tempo_map().remove_meter (*section);
- XMLNode &after = session->tempo_map().get_state();
- session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
+ XMLNode &before = _session->tempo_map().get_state();
+ _session->tempo_map().remove_meter (*section);
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
commit_reversible_command ();
return FALSE;
ARDOUR::TimeFXRequest request;
request.time_fraction = fraction;
- MidiStretch stretch(*session, request);
+ MidiStretch stretch(*_session, request);
begin_reversible_command ("midi stretch");
stretch.run(regions.front()->region());
XMLNode &before = playlist->get_state();
playlist->replace_region (regions.front()->region(), stretch.results[0],
regions.front()->region()->position());
XMLNode &after = playlist->get_state();
- session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
commit_reversible_command ();
}
Filter* fx;
if (dialog.pitching) {
- fx = new Pitch (*session, dialog.request);
+ fx = new Pitch (*_session, dialog.request);
} else {
#ifdef USE_RUBBERBAND
- fx = new RBStretch (*session, dialog.request);
+ fx = new RBStretch (*_session, dialog.request);
#else
- fx = new STStretch (*session, dialog.request);
+ fx = new STStretch (*_session, dialog.request);
#endif
}
new_region = fx->results.front();
if (!in_command) {
- session->begin_reversible_command (dialog.pitching ? _("pitch shift") : _("time stretch"));
+ _session->begin_reversible_command (dialog.pitching ? _("pitch shift") : _("time stretch"));
in_command = true;
}
XMLNode &before = playlist->get_state();
playlist->replace_region (region, new_region, region->position());
XMLNode &after = playlist->get_state();
- session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
}
i = tmp;
}
if (in_command) {
- session->commit_reversible_command ();
+ _session->commit_reversible_command ();
}
dialog.status = 0;
PortExportChannelSelector::fill_route_list ()
{
channel_view.clear_routes ();
- RouteList routes = *session->get_routes();
+ RouteList routes = *_session->get_routes();
/* Add master bus and then everything else */
- ARDOUR::IO* master = session->master_out()->output().get();
+ ARDOUR::IO* master = _session->master_out()->output().get();
channel_view.add_route (master);
for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
update_config ();
}
-RegionExportChannelSelector::RegionExportChannelSelector (ARDOUR::Session * session,
+RegionExportChannelSelector::RegionExportChannelSelector (ARDOUR::Session * _session,
ProfileManagerPtr manager,
ARDOUR::AudioRegion const & region,
ARDOUR::AudioTrack & track) :
- ExportChannelSelector (session, manager),
+ ExportChannelSelector (_session, manager),
region (region),
track (track),
region_chans (region.n_channels()),
state->config->clear_channels ();
if (raw_button.get_active ()) {
- factory.reset (new RegionExportChannelFactory (session, region, track, RegionExportChannelFactory::Raw));
+ factory.reset (new RegionExportChannelFactory (_session, region, track, RegionExportChannelFactory::Raw));
} else if (fades_button.get_active ()) {
- factory.reset (new RegionExportChannelFactory (session, region, track, RegionExportChannelFactory::Fades));
+ factory.reset (new RegionExportChannelFactory (_session, region, track, RegionExportChannelFactory::Fades));
} else if (processed_button.get_active ()) {
- factory.reset (new RegionExportChannelFactory(session, region, track, RegionExportChannelFactory::Processed));
+ factory.reset (new RegionExportChannelFactory(_session, region, track, RegionExportChannelFactory::Processed));
} else {
CriticalSelectionChanged ();
return;
class XMLNode;
-class ExportChannelSelector : public Gtk::HBox
+class ExportChannelSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{
protected:
typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
- ARDOUR::Session * session;
ProfileManagerPtr manager;
public:
ExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
- : session (session)
- , manager (manager)
+ : SessionHandlePtr (session)
+ , manager (manager)
{}
virtual ~ExportChannelSelector () {}
void
ExportDialog::set_session (ARDOUR::Session* s)
{
- session = s;
+ SessionHandlePtr::set_session (s);
+
+ if (!_session) {
+ return;
+ }
/* Init handler and profile manager */
- handler = session->get_export_handler ();
- status = session->get_export_status ();
- profile_manager.reset (new ExportProfileManager (*session));
+ handler = _session->get_export_handler ();
+ status = _session->get_export_status ();
+ profile_manager.reset (new ExportProfileManager (*_session));
/* Possibly init stuff in derived classes */
init ();
- /* Rest of session related initialization */
+ /* Rest of _session related initialization */
preset_selector->set_manager (profile_manager);
- file_notebook->set_session_and_manager (session, profile_manager);
+ file_notebook->set_session_and_manager (_session, profile_manager);
/* Hand on selection range to profile manager */
ExportDialog::init_components ()
{
preset_selector.reset (new ExportPresetSelector ());
- timespan_selector.reset (new ExportTimespanSelectorMultiple (session, profile_manager));
- channel_selector.reset (new PortExportChannelSelector (session, profile_manager));
+ timespan_selector.reset (new ExportTimespanSelectorMultiple (_session, profile_manager));
+ channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
file_notebook.reset (new ExportFileNotebook ());
}
ExportRangeDialog::init_components ()
{
preset_selector.reset (new ExportPresetSelector ());
- timespan_selector.reset (new ExportTimespanSelectorSingle (session, profile_manager, range_id));
- channel_selector.reset (new PortExportChannelSelector (session, profile_manager));
+ timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, range_id));
+ channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
file_notebook.reset (new ExportFileNotebook ());
}
ExportSelectionDialog::init_components ()
{
preset_selector.reset (new ExportPresetSelector ());
- timespan_selector.reset (new ExportTimespanSelectorSingle (session, profile_manager, X_("selection")));
- channel_selector.reset (new PortExportChannelSelector (session, profile_manager));
+ timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, X_("selection")));
+ channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
file_notebook.reset (new ExportFileNotebook ());
}
Glib::ustring loc_id = profile_manager->set_single_range (region.position(), region.position() + region.length(), region.name());
preset_selector.reset (new ExportPresetSelector ());
- timespan_selector.reset (new ExportTimespanSelectorSingle (session, profile_manager, loc_id));
- channel_selector.reset (new RegionExportChannelSelector (session, profile_manager, region, track));
+ timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, loc_id));
+ channel_selector.reset (new RegionExportChannelSelector (_session, profile_manager, region, track));
file_notebook.reset (new ExportFileNotebook ());
}
void
ExportFileNotebook::set_session_and_manager (ARDOUR::Session * s, boost::shared_ptr<ARDOUR::ExportProfileManager> manager)
{
- session = s;
+ SessionHandlePtr::set_session (s);
profile_manager = manager;
sync_with_manager ();
void
ExportFileNotebook::add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state)
{
- FilePage * page = Gtk::manage (new FilePage (session, profile_manager, this, page_counter, format_state, filename_state));
+ FilePage * page = Gtk::manage (new FilePage (_session, profile_manager, this, page_counter, format_state, filename_state));
page->CriticalSelectionChanged.connect (CriticalSelectionChanged.make_slot());
insert_page (*page, page->get_tab_widget(), get_n_pages() - 1);
#include <gtkmm.h>
#include "ardour/export_profile_manager.h"
+#include "ardour/session_handle.h"
#include "export_format_selector.h"
#include "export_filename_selector.h"
-namespace ARDOUR {
- class Session;
-}
-
-
-class ExportFileNotebook : public Gtk::Notebook
+class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr
{
public:
class FilePage;
ManagerPtr profile_manager;
- ARDOUR::Session * session;
void add_new_file_page ();
void add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state);
using namespace ARDOUR;
ExportFilenameSelector::ExportFilenameSelector () :
- session (0),
-
- include_label (_("Include in Filename(s):"), Gtk::ALIGN_LEFT),
-
- label_label (_("Label:"), Gtk::ALIGN_LEFT),
- session_checkbox (_("Session Name")),
- revision_checkbox (_("Revision:")),
-
- path_label (_("Folder:"), Gtk::ALIGN_LEFT),
- browse_button (_("Browse"))
+ include_label (_("Include in Filename(s):"), Gtk::ALIGN_LEFT),
+
+ label_label (_("Label:"), Gtk::ALIGN_LEFT),
+ session_checkbox (_("Session Name")),
+ revision_checkbox (_("Revision:")),
+
+ path_label (_("Folder:"), Gtk::ALIGN_LEFT),
+ browse_button (_("Browse"))
{
pack_start (include_label, false, false, 6);
pack_start (include_hbox, false, false, 0);
void
ExportFilenameSelector::set_state (ARDOUR::ExportProfileManager::FilenameStatePtr state_, ARDOUR::Session * session_)
{
- session = session_;
+ SessionHandlePtr::set_session (session_);
filename = state_->filename;
#include "ardour/export_profile_manager.h"
#include "ardour/export_filename.h"
-
-namespace ARDOUR {
- class Session;
-}
+#include "ardour/session_handle.h"
///
-class ExportFilenameSelector : public Gtk::VBox {
+class ExportFilenameSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
+{
public:
typedef boost::shared_ptr<ARDOUR::ExportFilename> FilenamePtr;
void open_browse_dialog ();
- ARDOUR::Session * session;
boost::shared_ptr<ARDOUR::ExportFilename> filename;
Glib::RefPtr<Gtk::SizeGroup> label_sizegroup;
void
ExportFormatDialog::set_session (ARDOUR::Session* s)
{
- session = s;
- if (!session) {
- return;
- }
-
+ SessionHandlePtr::set_session (s);
silence_start_clock.set_session (s);
silence_end_clock.set_session (s);
+ if (!_session) {
+ return;
+ }
+
update_clock (silence_start_clock, silence_start);
update_clock (silence_end_clock, silence_end);
if (sample_rate_view.get_selection()->count_selected_rows() == 0) {
Gtk::ListStore::Children::iterator it;
for (it = sample_rate_list->children().begin(); it != sample_rate_list->children().end(); ++it) {
- if ((nframes_t) (*it)->get_value (sample_rate_cols.ptr)->rate == session->nominal_frame_rate()) {
+ if ((nframes_t) (*it)->get_value (sample_rate_cols.ptr)->rate == _session->nominal_frame_rate()) {
sample_rate_view.get_selection()->select (it);
break;
}
if (select) {
ExportFormatManager::SampleRatePtr ptr = rate.lock();
- if (ptr && session) {
- src_quality_combo.set_sensitive ((uint32_t) ptr->rate != session->frame_rate());
+ if (ptr && _session) {
+ src_quality_combo.set_sensitive ((uint32_t) ptr->rate != _session->frame_rate());
}
}
}
ExportFormatDialog::update_clock (AudioClock & clock, ARDOUR::AnyTime const & time)
{
// TODO position
- clock.set (session->convert_to_frames_at (0, time), true);
+ clock.set (_session->convert_to_frames_at (0, time), true);
AudioClock::Mode mode(AudioClock::Timecode);
void
ExportFormatDialog::update_time (AnyTime & time, AudioClock const & clock)
{
- if (!session) {
+ if (!_session) {
return;
}
switch (clock.mode()) {
case AudioClock::Timecode:
time.type = AnyTime::Timecode;
- session->timecode_time (frames, time.timecode);
+ _session->timecode_time (frames, time.timecode);
break;
case AudioClock::BBT:
time.type = AnyTime::BBT;
- session->bbt_time (frames, time.bbt);
+ _session->bbt_time (frames, time.bbt);
break;
case AudioClock::MinSec:
time.type = AnyTime::Seconds;
- time.seconds = (double) frames / session->frame_rate();
+ time.seconds = (double) frames / _session->frame_rate();
break;
case AudioClock::Frames:
time.type = AnyTime::Frames;
void
ExportFormatSelector::set_state (ARDOUR::ExportProfileManager::FormatStatePtr const state_, ARDOUR::Session * session_)
{
- session = session_;
+ SessionHandlePtr::set_session (session_);
+
state = state_;
update_format_list ();
ExportFormatSelector::open_edit_dialog (bool new_dialog)
{
ExportFormatDialog dialog (state->format, new_dialog);
- dialog.set_session (session);
+ dialog.set_session (_session);
Gtk::ResponseType response = (Gtk::ResponseType) dialog.run();
if (response == Gtk::RESPONSE_APPLY) {
update_format_description ();
#include <sigc++/signal.h>
#include <boost/shared_ptr.hpp>
+#include "ardour/session_handle.h"
+
namespace ARDOUR {
- class Session;
class ExportFormatSpecification;
class ExportProfileManager;
}
///
-class ExportFormatSelector : public Gtk::HBox {
+class ExportFormatSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
+{
private:
void update_format_description ();
ARDOUR::ExportProfileManager::FormatStatePtr state;
- ARDOUR::Session * session;
/*** GUI componenets ***/
using namespace PBD;
ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager) :
- session (session),
- manager (manager),
- time_format_label (_("Show Times as:"), Gtk::ALIGN_LEFT)
+ manager (manager),
+ time_format_label (_("Show Times as:"), Gtk::ALIGN_LEFT)
{
+ set_session (session);
option_hbox.pack_start (time_format_label, false, false, 0);
option_hbox.pack_start (time_format_combo, false, false, 6);
void
ExportTimespanSelector::add_range_to_selection (ARDOUR::Location const * loc)
{
- TimespanPtr span = session->get_export_handler()->add_timespan();
+ TimespanPtr span = _session->get_export_handler()->add_timespan();
Glib::ustring id;
if (loc == state->session_range.get()) {
Glib::ustring
ExportTimespanSelector::bbt_str (nframes_t frames) const
{
- if (!session) {
+ if (!_session) {
return "Error!";
}
std::ostringstream oss;
BBT_Time time;
- session->bbt_time (frames, time);
+ _session->bbt_time (frames, time);
oss << std::setfill('0') << std::right <<
std::setw(3) <<
Glib::ustring
ExportTimespanSelector::timecode_str (nframes_t frames) const
{
- if (!session) {
+ if (!_session) {
return "Error!";
}
std::ostringstream oss;
Timecode::Time time;
- session->timecode_time (frames, time);
+ _session->timecode_time (frames, time);
oss << std::setfill('0') << std::right <<
std::setw(2) <<
Glib::ustring
ExportTimespanSelector::ms_str (nframes_t frames) const
{
- if (!session) {
+ if (!_session) {
return "Error!";
}
int sec_promilles;
left = frames;
- hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
- left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
- mins = (int) floor (left / (session->frame_rate() * 60.0f));
- left -= (nframes_t) floor (mins * session->frame_rate() * 60.0f);
- secs = (int) floor (left / (float) session->frame_rate());
- left -= (nframes_t) floor (secs * session->frame_rate());
- sec_promilles = (int) (left * 1000 / (float) session->frame_rate() + 0.5);
+ hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f));
+ left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f);
+ mins = (int) floor (left / (_session->frame_rate() * 60.0f));
+ left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f);
+ secs = (int) floor (left / (float) _session->frame_rate());
+ left -= (nframes_t) floor (secs * _session->frame_rate());
+ sec_promilles = (int) (left * 1000 / (float) _session->frame_rate() + 0.5);
oss << std::setfill('0') << std::right <<
std::setw(2) <<
/*** ExportTimespanSelectorSingle ***/
ExportTimespanSelectorSingle::ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, Glib::ustring range_id) :
- ExportTimespanSelector (session, manager),
- range_id (range_id)
+ ExportTimespanSelector (session, manager),
+ range_id (range_id)
{
range_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_NEVER);
range_view.append_column_editable ("", range_cols.name);
#include <boost/shared_ptr.hpp>
#include "ardour/types.h"
+#include "ardour/session_handle.h"
#include "ardour/export_profile_manager.h"
namespace ARDOUR {
class Location;
class ExportTimespan;
class ExportHandler;
- class Session;
}
using ARDOUR::CDMarkerFormat;
/// Timespan Selector base
-class ExportTimespanSelector : public Gtk::VBox {
+class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
+{
protected:
typedef std::list<ARDOUR::Location *> LocationList;
typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
protected:
- ARDOUR::Session * session;
ProfileManagerPtr manager;
TimespanStatePtr state;
}
}
-GainMeterBase::GainMeterBase (Session& s,
+GainMeterBase::GainMeterBase (Session* s,
const Glib::RefPtr<Gdk::Pixbuf>& pix,
bool horizontal,
int fader_length)
- : _session (s)
- // 0.781787 is the value needed for gain to be set to 0.
- , gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1)
+ : gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1) // 0.781787 is the value needed for gain to be set to 0.
, gain_automation_style_button ("")
, gain_automation_state_button ("")
, dpi_changed (false)
{
using namespace Menu_Helpers;
+ set_session (s);
+
ignore_toggle = false;
meter_menu = 0;
next_release_selects = false;
boost::shared_ptr<Amp> amp)
{
connections.clear ();
+ model_connections.drop_connections ();
if (!pm && !amp) {
level_meter->set_meter (0);
connections.push_back (gain_automation_state_button.signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeterBase::gain_automation_state_button_event), false));
boost::shared_ptr<AutomationControl> gc = amp->gain_control();
-
- connections.push_back (gc->alist()->automation_state_changed.connect (sigc::mem_fun(*this, &GainMeter::gain_automation_state_changed)));
- connections.push_back (gc->alist()->automation_style_changed.connect (sigc::mem_fun(*this, &GainMeter::gain_automation_style_changed)));
-
+
+ model_connections.add_connection (gc->alist()->automation_state_changed.connect (boost::bind (&GainMeter::gain_automation_state_changed, this)));
+ model_connections.add_connection (gc->alist()->automation_style_changed.connect (boost::bind (&GainMeter::gain_automation_style_changed, this)));
+
gain_automation_state_changed ();
}
-
- connections.push_back (amp->gain_control()->Changed.connect (sigc::mem_fun (*this, &GainMeterBase::gain_changed)));
+
+ model_connections.add_connection (amp->gain_control()->Changed.connect (boost::bind (&GainMeterBase::gain_changed, this)));
gain_changed ();
show_gain ();
/* Primary+Tertiary-click applies change to all routes */
- _session.foreach_route (this, &GainMeterBase::set_meter_point, next_meter_point (_route->meter_point()));
+ _session->foreach_route (this, &GainMeterBase::set_meter_point, next_meter_point (_route->meter_point()));
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
style_changed = true;
}
-GainMeter::GainMeter (Session& s, int fader_length)
+GainMeter::GainMeter (Session* s, int fader_length)
: GainMeterBase (s, slider, false, fader_length)
{
gain_display_box.set_homogeneous (true);
#include <gtkmm/drawingarea.h>
#include <gdkmm/colormap.h>
+#include "pbd/scoped_connections.h"
+
#include "ardour/types.h"
+#include "ardour/session_handle.h"
-#include <gtkmm2ext/click_box.h>
-#include <gtkmm2ext/focus_entry.h>
-#include <gtkmm2ext/slider_controller.h>
+#include "gtkmm2ext/click_box.h"
+#include "gtkmm2ext/focus_entry.h"
+#include "gtkmm2ext/slider_controller.h"
#include "enums.h"
#include "level_meter.h"
class Menu;
}
-class GainMeterBase : virtual public sigc::trackable
+class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
{
public:
- GainMeterBase (ARDOUR::Session&, const Glib::RefPtr<Gdk::Pixbuf>& pix,
+ GainMeterBase (ARDOUR::Session*, const Glib::RefPtr<Gdk::Pixbuf>& pix,
bool horizontal, int);
virtual ~GainMeterBase ();
boost::shared_ptr<ARDOUR::Route> _route;
boost::shared_ptr<ARDOUR::PeakMeter> _meter;
boost::shared_ptr<ARDOUR::Amp> _amp;
- ARDOUR::Session& _session;
std::vector<sigc::connection> connections;
+ PBD::ScopedConnectionList model_connections;
bool ignore_toggle;
bool next_release_selects;
class GainMeter : public GainMeterBase, public Gtk::VBox
{
public:
- GainMeter (ARDOUR::Session&, int);
+ GainMeter (ARDOUR::Session*, int);
~GainMeter () {}
virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route,
using namespace ArdourCanvas;
using namespace ARDOUR;
+boost::signals2::signal<void(GhostRegion*)> GhostRegion::GoingAway;
+
GhostRegion::GhostRegion (ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_pos)
: trackview (tv)
, source_trackview (source_tv)
#define __ardour_gtk_ghost_region_h__
#include <vector>
-#include <sigc++/signal.h>
#include <libgnomecanvasmm.h>
+#include <boost/signals2.hpp>
#include "canvas.h"
namespace Gnome {
class MidiStreamView;
class TimeAxisView;
-class GhostRegion : public sigc::trackable
+class GhostRegion
{
public:
GhostRegion(ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
guint source_track_color(unsigned char alpha = 0xff);
bool is_automation_ghost();
- sigc::signal<void,GhostRegion*> GoingAway;
-
TimeAxisView& trackview;
TimeAxisView& source_trackview;
ArdourCanvas::Group* group;
ArdourCanvas::SimpleRect* base_rect;
+
+ static boost::signals2::signal<void(GhostRegion*)> GoingAway;
};
class AudioGhostRegion : public GhostRegion {
}
void
-GroupTabs::connect_to_session (Session* s)
+GroupTabs::set_session (Session* s)
{
- EditorComponent::connect_to_session (s);
+ EditorComponent::set_session (s);
- _session_connections.push_back (_session->RouteGroupChanged.connect (sigc::mem_fun (*this, &GroupTabs::set_dirty)));
+ if (_session) {
+ _session_connections.add_connection (_session->RouteGroupChanged.connect (boost::bind (&GroupTabs::set_dirty, this)));
+ }
}
public:
GroupTabs (Editor *);
- void connect_to_session (ARDOUR::Session *);
+ void set_session (ARDOUR::Session *);
protected:
void
ImageFrameSocketHandler::handle_session_name_request(const char* msg)
{
- ARDOUR::Session* currentSession = thePublicEditor.current_session() ;
+ ARDOUR::Session* currentSession = thePublicEditor.session() ;
if(currentSession == 0)
{
* @param sess the current session
* @param canvas the parent canvas item
*/
-ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas)
+ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas)
: AxisView(sess),
VisualTimeAxis(track_id, ed, sess, canvas)
{
*/
ImageFrameTimeAxis::~ImageFrameTimeAxis ()
{
- GoingAway() ; /* EMIT_SIGNAL */
+ GoingAway ; /* EMIT_SIGNAL */
// Destroy all the marker views we may have associaited with this TimeAxis
for(MarkerTimeAxisList::iterator iter = marker_time_axis_list.begin(); iter != marker_time_axis_list.end(); ++iter)
else
{
marker_time_axis_list.push_back(marker_track) ;
- marker_track->GoingAway.connect(sigc::bind(sigc::mem_fun(*this, &ImageFrameTimeAxis::remove_time_axis_view), marker_track, (void*)this));
+ scoped_connect (marker_track->GoingAway, boost::bind (&ImageFrameTimeAxis::remove_time_axis_view, this, marker_track, (void*)this));
MarkerTimeAxisAdded(marker_track, src) ; /* EMIT_SIGNAL */
ret = true ;
* @param sess the current session
* @param canvas the parent canvas item
*/
- ImageFrameTimeAxis(const std::string & track_id, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas) ;
+ ImageFrameTimeAxis(const std::string & track_id, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) ;
/**
* Destructor
iter = next ;
}
- GoingAway() ; /* EMIT_SIGNAL */
+ GoingAway ; /* EMIT_SIGNAL */
}
imageframe_views.push_front(ifv) ;
- ifv->GoingAway.connect(sigc::bind(sigc::mem_fun(*this,&ImageFrameTimeAxisGroup::remove_imageframe_item), (void*)this)) ;
+ scoped_connect (ifv->GoingAway, boost::bind (&ImageFrameTimeAxisGroup::remove_imageframe_item, this, (void*)this));
ImageFrameAdded(ifv, src) ; /* EMIT_SIGNAL */
}
imageframe_groups.push_front(iftag) ;
- iftag->GoingAway.connect(sigc::bind(sigc::mem_fun(*this,&ImageFrameTimeAxisView::remove_imageframe_group), iftag, (void*)this)) ;
+ scoped_connect (iftag->GoingAway, boost::bind (&ImageFrameTimeAxisView::remove_imageframe_group, this, iftag, (void*)this)) ;
ImageFrameGroupAdded(iftag, src) ; /* EMIT_SIGNAL */
}
{
if(selected_imageframe_group && selected_imageframe_view)
{
- selected_imageframe_view->set_duration((nframes_t) (sec * _trackview.editor.current_session()->frame_rate()), this) ;
+ selected_imageframe_view->set_duration((nframes_t) (sec * _trackview.editor.session()->frame_rate()), this) ;
}
}
{
marker_view_list.push_back(item) ;
- item->GoingAway.connect(sigc::bind(sigc::mem_fun(*this, &ImageFrameView::remove_marker_view_item), (void*)this));
+ scoped_connect (item->GoingAway, boost::bind (&ImageFrameView::remove_marker_view_item, this, (void*)this));
MarkerViewAdded(item, src) ; /* EMIT_SIGNAL */
}
void accept ();
void plugin_going_away ();
- sigc::connection going_away_connection;
+ boost::signals2::scoped_connection going_away_connection;
bool wm_delete (GdkEventAny*);
};
//sigc::signal<void,RouteGroup*> LevelMeter::ResetGroupPeakDisplays;
-LevelMeter::LevelMeter (Session& s)
- : _session (s)
- , _meter (0)
+LevelMeter::LevelMeter (Session* s)
+ : _meter (0)
, meter_length (0)
{
+ set_session (s);
set_spacing (1);
Config->ParameterChanged.connect (sigc::mem_fun (*this, &LevelMeter::parameter_changed));
UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &LevelMeter::on_theme_changed));
{
_configuration_connection.disconnect();
_meter = meter;
+
if (_meter) {
- _configuration_connection = _meter->ConfigurationChanged.connect(
- sigc::mem_fun(*this, &LevelMeter::configuration_changed));
+ _configuration_connection = _meter->ConfigurationChanged.connect(boost::bind (&LevelMeter::configuration_changed, this, _1, _2));
}
}
#include <gtkmm/drawingarea.h>
#include "ardour/types.h"
+#include "ardour/session_handle.h"
#include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/focus_entry.h>
class Menu;
}
-class LevelMeter : public Gtk::HBox
+class LevelMeter : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{
public:
- LevelMeter (ARDOUR::Session&);
+ LevelMeter (ARDOUR::Session*);
~LevelMeter ();
virtual void set_meter (ARDOUR::PeakMeter* meter);
void setup_meters (int len=0, int width=3);
private:
- ARDOUR::Session& _session;
ARDOUR::PeakMeter* _meter;
Width _width;
std::vector<MeterInfo> meters;
float max_peak;
- sigc::connection _configuration_connection;
+ boost::signals2::scoped_connection _configuration_connection;
void hide_all_meters ();
gint meter_button_release (GdkEventButton*, uint32_t);
using namespace Gtkmm2ext;
LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
- : location(0), session(0),
+ : SessionHandlePtr (0), /* explicitly set below */
+ location(0),
item_table (1, 6, false),
start_clock (X_("locationstart"), true, X_("LocationEditRowClock"), true, false),
end_clock (X_("locationend"), true, X_("LocationEditRowClock"), true, false),
LocationEditRow::~LocationEditRow()
{
if (location) {
- start_changed_connection.disconnect();
- end_changed_connection.disconnect();
- name_changed_connection.disconnect();
- changed_connection.disconnect();
- flags_changed_connection.disconnect();
+ connections.drop_connections ();
}
}
void
LocationEditRow::set_session (Session *sess)
{
- session = sess;
+ SessionHandlePtr::set_session (sess);
- if (!session) return;
+ if (!_session) {
+ return;
+ }
- start_clock.set_session (session);
- end_clock.set_session (session);
- length_clock.set_session (session);
+ start_clock.set_session (_session);
+ end_clock.set_session (_session);
+ length_clock.set_session (_session);
}
LocationEditRow::set_location (Location *loc)
{
if (location) {
- start_changed_connection.disconnect();
- end_changed_connection.disconnect();
- name_changed_connection.disconnect();
- changed_connection.disconnect();
- flags_changed_connection.disconnect();
+ connections.drop_connections ();
}
location = loc;
cd_check_button.set_active (location->is_cd_marker());
cd_check_button.show();
- if (location->start() == session->current_start_frame()) {
+ if (location->start() == _session->current_start_frame()) {
cd_check_button.set_sensitive (false);
} else {
cd_check_button.set_sensitive (true);
end_clock.set_sensitive (!location->locked());
length_clock.set_sensitive (!location->locked());
- start_changed_connection = location->start_changed.connect (sigc::mem_fun(*this, &LocationEditRow::start_changed));
- end_changed_connection = location->end_changed.connect (sigc::mem_fun(*this, &LocationEditRow::end_changed));
- name_changed_connection = location->name_changed.connect (sigc::mem_fun(*this, &LocationEditRow::name_changed));
- changed_connection = location->changed.connect (sigc::mem_fun(*this, &LocationEditRow::location_changed));
- flags_changed_connection = location->FlagsChanged.connect (sigc::mem_fun(*this, &LocationEditRow::flags_changed));
+ connections.add_connection (location->start_changed.connect (boost::bind (&LocationEditRow::start_changed, this, _1)));
+ connections.add_connection (location->end_changed.connect (boost::bind (&LocationEditRow::end_changed, this, _1)));
+ connections.add_connection (location->name_changed.connect (boost::bind (&LocationEditRow::name_changed, this, _1)));
+ connections.add_connection (location->changed.connect (boost::bind (&LocationEditRow::location_changed, this, _1)));
+ connections.add_connection (location->FlagsChanged.connect (boost::bind (&LocationEditRow::flags_changed, this, _1, _2)));
}
void
//}
if (cd_check_button.get_active()) {
- if (location->start() <= session->current_start_frame()) {
+ if (location->start() <= _session->current_start_frame()) {
error << _("You cannot put a CD marker at the start of the session") << endmsg;
cd_check_button.set_active (false);
return;
start_clock.set (location->start());
- if (location->start() == session->current_start_frame()) {
+ if (location->start() == _session->current_start_frame()) {
cd_check_button.set_sensitive (false);
} else {
cd_check_button.set_sensitive (true);
LocationUI::LocationUI ()
- : session (0)
- , add_location_button (_("New Marker"))
+ : add_location_button (_("New Marker"))
, add_range_button (_("New Range"))
{
i_am_the_modifier = 0;
return FALSE;
}
- session->begin_reversible_command (_("remove marker"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->remove (loc);
- XMLNode &after = session->locations()->get_state();
- session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ _session->begin_reversible_command (_("remove marker"));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->remove (loc);
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
return FALSE;
}
if (location->is_mark()) {
mark_n++;
- erow = manage (new LocationEditRow(session, location, mark_n));
+ erow = manage (new LocationEditRow(_session, location, mark_n));
erow->remove_requested.connect (sigc::mem_fun(*this, &LocationUI::location_remove_requested));
erow->redraw_ranges.connect (sigc::mem_fun(*this, &LocationUI::location_redraw_ranges));
loc_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START));
}
}
else if (location->is_auto_punch()) {
- punch_edit_row.set_session (session);
+ punch_edit_row.set_session (_session);
punch_edit_row.set_location (location);
punch_edit_row.show_all();
}
else if (location->is_auto_loop()) {
- loop_edit_row.set_session (session);
+ loop_edit_row.set_session (_session);
loop_edit_row.set_location (location);
loop_edit_row.show_all();
}
else {
- erow = manage (new LocationEditRow(session, location));
+ erow = manage (new LocationEditRow(_session, location));
erow->remove_requested.connect (sigc::mem_fun(*this, &LocationUI::location_remove_requested));
range_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START));
}
{
string markername;
- if (session) {
- nframes_t where = session->audible_frame();
- session->locations()->next_available_name(markername,"mark");
+ if (_session) {
+ nframes_t where = _session->audible_frame();
+ _session->locations()->next_available_name(markername,"mark");
Location *location = new Location (where, where, markername, Location::IsMark);
if (Config->get_name_new_markers()) {
newest_location = location;
}
- session->begin_reversible_command (_("add marker"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->add (location, true);
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ _session->begin_reversible_command (_("add marker"));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->add (location, true);
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
}
}
{
string rangename;
- if (session) {
- nframes_t where = session->audible_frame();
- session->locations()->next_available_name(rangename,"unnamed");
+ if (_session) {
+ nframes_t where = _session->audible_frame();
+ _session->locations()->next_available_name(rangename,"unnamed");
Location *location = new Location (where, where, rangename, Location::IsRangeMarker);
- session->begin_reversible_command (_("add range marker"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->add (location, true);
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+ _session->begin_reversible_command (_("add range marker"));
+ XMLNode &before = _session->locations()->get_state();
+ _session->locations()->add (location, true);
+ XMLNode &after = _session->locations()->get_state();
+ _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+ _session->commit_reversible_command ();
}
}
-
-void
-LocationUI::refresh_location_list_s (Change ignored)
-{
- ENSURE_GUI_THREAD (*this, &LocationUI::refresh_location_list_s, ignored)
-
- refresh_location_list ();
-}
-
void
LocationUI::refresh_location_list ()
{
loc_children.clear();
range_children.clear();
- if (session) {
- session->locations()->apply (*this, &LocationUI::map_locations);
+ if (_session) {
+ _session->locations()->apply (*this, &LocationUI::map_locations);
}
}
void
LocationUI::set_session(ARDOUR::Session* s)
{
- session = s;
+ SessionHandlePtr::set_session (s);
- if (session) {
- session->locations()->changed.connect (sigc::mem_fun(*this, &LocationUI::refresh_location_list));
- session->locations()->StateChanged.connect (sigc::mem_fun(*this, &LocationUI::refresh_location_list_s));
- session->locations()->added.connect (sigc::mem_fun(*this, &LocationUI::location_added));
- session->locations()->removed.connect (sigc::mem_fun(*this, &LocationUI::location_removed));
- session->GoingAway.connect (sigc::mem_fun(*this, &LocationUI::session_gone));
+ if (_session) {
+ _session_connections.add_connection (_session->locations()->changed.connect (boost::bind (&LocationUI::refresh_location_list, this)));
+ _session_connections.add_connection (_session->locations()->StateChanged.connect (boost::bind (&LocationUI::refresh_location_list, this)));
+ _session_connections.add_connection (_session->locations()->added.connect (boost::bind (&LocationUI::location_added, this, _1)));
+ _session_connections.add_connection (_session->locations()->removed.connect (boost::bind (&LocationUI::location_removed, this, _1)));
}
+
refresh_location_list ();
}
void
-LocationUI::session_gone()
+LocationUI::session_going_away()
{
- ENSURE_GUI_THREAD (*this, &LocationUI::session_gone)
+ ENSURE_GUI_THREAD (*this, &LocationUI::session_going_away);
using namespace Box_Helpers;
BoxList & loc_children = location_rows.children();
punch_edit_row.set_session (0);
punch_edit_row.set_location (0);
+
+ SessionHandlePtr::session_going_away ();
}
/*------------------------*/
{
ArdourDialog::set_session (s);
_ui.set_session (s);
-
- s->GoingAway.connect (sigc::mem_fun (*this, &LocationUIWindow::session_gone));
}
void
-LocationUIWindow::session_gone ()
+LocationUIWindow::session_going_away ()
{
+ ArdourDialog::session_going_away ();
hide_all();
- ArdourDialog::session_gone ();
}
#include <gtkmm/paned.h>
#include <gtkmm/scrolledwindow.h>
+#include "pbd/scoped_connections.h"
+
#include "ardour/location.h"
+#include "ardour/session_handle.h"
#include "ardour_dialog.h"
#include "audio_clock.h"
namespace ARDOUR {
class LocationStack;
- class Session;
class Location;
}
-class LocationEditRow : public Gtk::HBox
+class LocationEditRow : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{
public:
LocationEditRow (ARDOUR::Session *sess=0, ARDOUR::Location *loc=0, int32_t num=-1);
};
ARDOUR::Location *location;
- ARDOUR::Session *session;
-
-
Gtk::Table item_table;
Gtk::CheckButton scms_check_button;
Gtk::CheckButton preemph_check_button;
-
guint32 i_am_the_modifier;
int number;
void location_changed (ARDOUR::Location *);
void flags_changed (ARDOUR::Location *, void *src);
- sigc::connection start_changed_connection;
- sigc::connection end_changed_connection;
- sigc::connection name_changed_connection;
- sigc::connection changed_connection;
- sigc::connection flags_changed_connection;
-
+ PBD::ScopedConnectionList connections;
};
-class LocationUI : public Gtk::HBox
+class LocationUI : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{
public:
LocationUI ();
~LocationUI ();
- virtual void set_session (ARDOUR::Session *);
+ void set_session (ARDOUR::Session *);
void add_new_location();
void add_new_range();
void refresh_location_list ();
- void refresh_location_list_s (ARDOUR::Change);
private:
- ARDOUR::Session* session;
ARDOUR::LocationStack* locations;
ARDOUR::Location *newest_location;
- void session_gone();
+ void session_going_away ();
Gtk::VBox location_vpacker;
protected:
LocationUI _ui;
bool on_delete_event (GdkEventAny*);
- void session_gone();
+ void session_going_away();
};
#endif // __ardour_location_ui_h__
* @param name the name/id of this time axis
* @param tav the associated track view that this MarkerTimeAxis is marking up
*/
-MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas& canvas, const string & name, TimeAxisView* tav)
+MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session* sess, Canvas& canvas, const string & name, TimeAxisView* tav)
: AxisView(sess),
VisualTimeAxis(name, ed, sess, canvas)
{
*/
MarkerTimeAxis::~MarkerTimeAxis()
{
- GoingAway() ; /* EMIT_SIGNAL */
+ GoingAway ; /* EMIT_SIGNAL */
// destroy the view helper
// this handles removing and destroying individual marker items
* @param name the name/id of this time axis
* @param tav the associated track view that this MarkerTimeAxis is marking up
*/
- MarkerTimeAxis(PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas, const std::string & name, TimeAxisView* tav) ;
+ MarkerTimeAxis(PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas, const std::string & name, TimeAxisView* tav) ;
/**
* Destructor
ifv->add_marker_view_item(mv, src) ;
marker_view_list.push_front(mv) ;
- mv->GoingAway.connect(sigc::bind (sigc::mem_fun(*this,&MarkerTimeAxisView::remove_marker_view), (void*)this)) ;
+ scoped_connect (mv->GoingAway, boost::bind (&MarkerTimeAxisView::remove_marker_view, this, (void*)this));
MarkerViewAdded(mv,src) ; /* EMIT_SIGNAL */
{
if(get_selected_time_axis_item() != 0)
{
- get_selected_time_axis_item()->set_duration((nframes_t) (sec * _trackview.editor.current_session()->frame_rate()), this) ;
+ get_selected_time_axis_item()->set_duration((nframes_t) (sec * _trackview.editor.session()->frame_rate()), this) ;
}
}
using namespace ARDOUR;
-MidiCutBuffer::MidiCutBuffer (Session& s)
- : AutomatableSequence<MidiModel::TimeType> (s, 0)
+MidiCutBuffer::MidiCutBuffer (Session* s)
+ : AutomatableSequence<MidiModel::TimeType> (*s, 0)
, _origin (0)
{
-
+
}
MidiCutBuffer::~MidiCutBuffer ()
public:
typedef ARDOUR::MidiModel::TimeType TimeType;
- MidiCutBuffer (ARDOUR::Session&);
+ MidiCutBuffer (ARDOUR::Session*);
~MidiCutBuffer();
TimeType origin() const { return _origin; }
using namespace Glib;
using namespace ARDOUR;
-MidiListEditor::MidiListEditor (Session& s, boost::shared_ptr<MidiRegion> r)
+MidiListEditor::MidiListEditor (Session* s, boost::shared_ptr<MidiRegion> r)
: ArdourDialog (r->name(), false, false)
- , session (s)
, region (r)
{
+ set_session (s);
+
model = ListStore::create (columns);
view.set_model (model);
view.set_model (Glib::RefPtr<Gtk::ListStore>(0));
model->clear ();
- MidiModel::Notes notes = region->midi_source(0)->model()->notes();
- TreeModel::Row row;
-
- for (MidiModel::Notes::iterator i = notes.begin(); i != notes.end(); ++i) {
- row = *(model->append());
- row[columns.channel] = (*i)->channel();
- row[columns.note_name] = _("Note");
- row[columns.note] = (*i)->note();
- row[columns.velocity] = (*i)->velocity();
-
- BBT_Time bbt;
- BBT_Time dur;
- stringstream ss;
-
- session.tempo_map().bbt_time (region->position(), bbt);
-
- dur.bars = 0;
- dur.beats = floor ((*i)->time());
- dur.ticks = 0;
-
- session.tempo_map().bbt_duration_at (region->position(), dur, 0);
-
- ss << bbt;
- row[columns.start] = ss.str();
- ss << dur;
- row[columns.length] = ss.str();
-
- session.tempo_map().bbt_time (region->position(), bbt);
- /* XXX get end point */
-
- ss << bbt;
- row[columns.end] = ss.str();
-
- row[columns._note] = (*i);
+ if (_session) {
+
+ MidiModel::Notes notes = region->midi_source(0)->model()->notes();
+ TreeModel::Row row;
+
+ for (MidiModel::Notes::iterator i = notes.begin(); i != notes.end(); ++i) {
+ row = *(model->append());
+ row[columns.channel] = (*i)->channel();
+ row[columns.note_name] = _("Note");
+ row[columns.note] = (*i)->note();
+ row[columns.velocity] = (*i)->velocity();
+
+ BBT_Time bbt;
+ BBT_Time dur;
+ stringstream ss;
+
+ _session->tempo_map().bbt_time (region->position(), bbt);
+
+ dur.bars = 0;
+ dur.beats = floor ((*i)->time());
+ dur.ticks = 0;
+
+ _session->tempo_map().bbt_duration_at (region->position(), dur, 0);
+
+ ss << bbt;
+ row[columns.start] = ss.str();
+ ss << dur;
+ row[columns.length] = ss.str();
+
+ _session->tempo_map().bbt_time (region->position(), bbt);
+ /* XXX get end point */
+
+ ss << bbt;
+ row[columns.end] = ss.str();
+
+ row[columns._note] = (*i);
+ }
}
view.set_model (model);
#include "evoral/types.hpp"
+#include "ardour/session_handle.h"
+
#include "ardour_dialog.h"
namespace ARDOUR {
public:
typedef Evoral::Note<Evoral::MusicalTime> NoteType;
- MidiListEditor(ARDOUR::Session&, boost::shared_ptr<ARDOUR::MidiRegion>);
+ MidiListEditor(ARDOUR::Session*, boost::shared_ptr<ARDOUR::MidiRegion>);
~MidiListEditor();
private:
Gtk::TreeModelColumn<boost::shared_ptr<NoteType> > _note;
};
- ARDOUR::Session& session;
MidiListModelColumns columns;
Glib::RefPtr<Gtk::ListStore> model;
Gtk::TreeView view;
MidiModel::DeltaCommand* cmd = _model->new_delta_command("add note");
cmd->add(new_note);
- _model->apply_command(trackview.session(), cmd);
+ _model->apply_command(*trackview.session(), cmd);
play_midi_note (new_note);
}
{
_model = model;
content_connection.disconnect ();
- content_connection = _model->ContentsChanged.connect(
- sigc::mem_fun(this, &MidiRegionView::redisplay_model));
+ content_connection = _model->ContentsChanged.connect (boost::bind (&MidiRegionView::redisplay_model, this));
+
clear_events ();
if (_enable_display) {
_marked_for_selection.insert((*i)->note());
}
- _model->apply_command(trackview.session(), _delta_command);
+ _model->apply_command(*trackview.session(), _delta_command);
_delta_command = 0;
midi_view()->midi_track()->diskstream()->playlist_modified();
return;
}
- _model->apply_command(trackview.session(), _diff_command);
+ _model->apply_command(*trackview.session(), _diff_command);
_diff_command = 0;
midi_view()->midi_track()->diskstream()->playlist_modified();
_marked_for_selection.insert((*i)->note());
}
- _model->apply_command_as_subcommand(trackview.session(), _delta_command);
+ _model->apply_command_as_subcommand(*trackview.session(), _delta_command);
_delta_command = 0;
midi_view()->midi_track()->diskstream()->playlist_modified();
_marked_for_selection.insert((*i)->note());
}
- _model->apply_command_as_subcommand(trackview.session(), _diff_command);
+ _model->apply_command_as_subcommand(*trackview.session(), _diff_command);
_diff_command = 0;
midi_view()->midi_track()->diskstream()->playlist_modified();
}
}
- ghost->GoingAway.connect (sigc::mem_fun(*this, &MidiRegionView::remove_ghost));
+ ghost->GoingAway.connect (boost::bind (&RegionView::remove_ghost, this, _1));
return ghost;
}
const double note_length_beats = (note->off_event().time() - note->on_event().time());
nframes_t note_length_ms = beats_to_frames(note_length_beats)
- * (1000 / (double)route_ui->session().nominal_frame_rate());
+ * (1000 / (double)route_ui->session()->nominal_frame_rate());
Glib::signal_timeout().connect(sigc::bind(sigc::mem_fun(this, &MidiRegionView::play_midi_note_off), note),
note_length_ms, G_PRIORITY_DEFAULT);
}
if (end_frame > region_end) {
- trackview.session().begin_reversible_command (_("paste"));
+ trackview.session()->begin_reversible_command (_("paste"));
XMLNode& before (_region->get_state());
_region->set_length (end_frame, this);
- trackview.session().add_command (new MementoCommand<Region>(*_region, &before, &_region->get_state()));
+ trackview.session()->add_command (new MementoCommand<Region>(*_region, &before, &_region->get_state()));
}
apply_delta ();
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
+
+#include <boost/signals2.hpp>
+
#include "ardour/midi_track.h"
#include "ardour/midi_region.h"
#include "ardour/midi_model.h"
std::vector<NoteResizeData *> _resize_data;
/* connection used to connect to model's ContentChanged signal */
- sigc::connection content_connection;
+ boost::signals2::scoped_connection 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 (sigc::bind (sigc::mem_fun (*this, &MidiStreamView::remove_region_view), region));
+ scoped_connect (region->GoingAway, boost::bind (&MidiStreamView::remove_region_view, this, region));
RegionViewAdded (region_view);
{
// cerr << _trackview.name() << " streamview SRB\n";
- if (_trackview.session().transport_rolling()) {
+ if (_trackview.session()->transport_rolling()) {
if (!rec_active &&
- _trackview.session().record_status() == Session::Recording &&
+ _trackview.session()->record_status() == Session::Recording &&
_trackview.get_diskstream()->record_enabled()) {
if (use_rec_regions && rec_regions.size() == rec_rects.size()) {
MidiRegion::SourceList sources;
- for (list<sigc::connection>::iterator prc = rec_data_ready_connections.begin();
- prc != rec_data_ready_connections.end(); ++prc) {
- (*prc).disconnect();
- }
- rec_data_ready_connections.clear();
+ rec_data_ready_connections.drop_connections ();
boost::shared_ptr<MidiDiskstream> mds = _trackview.midi_track()->midi_diskstream();
sources.push_back(mds->write_source());
- rec_data_ready_connections.push_back (mds->write_source()->ViewDataRangeReady.connect (sigc::bind (
- sigc::mem_fun (*this, &MidiStreamView::rec_data_range_ready),
- boost::weak_ptr<Source>(mds->write_source()))));
+ rec_data_ready_connections.add_connection (mds->write_source()->ViewDataRangeReady.connect
+ (boost::bind (&MidiStreamView::rec_data_range_ready, this,
+ _1, _2, boost::weak_ptr<Source>(mds->write_source()))));
// handle multi
assert(region);
region->block_property_changes ();
- region->set_position (_trackview.session().transport_frame(), this);
+ region->set_position (_trackview.session()->transport_frame(), this);
rec_regions.push_back (make_pair(region, (RegionView*)0));
// rec regions are destroyed in setup_rec_box
RecBoxInfo recbox;
recbox.rectangle = rec_rect;
- recbox.start = _trackview.session().transport_frame();
+ recbox.start = _trackview.session()->transport_frame();
recbox.length = 0;
rec_rects.push_back (recbox);
rec_active = true;
} else if (rec_active &&
- (_trackview.session().record_status() != Session::Recording ||
+ (_trackview.session()->record_status() != Session::Recording ||
!_trackview.get_diskstream()->record_enabled())) {
screen_update_connection.disconnect();
rec_active = false;
/* disconnect rapid update */
screen_update_connection.disconnect();
-
- for (list<sigc::connection>::iterator prc = rec_data_ready_connections.begin();
- prc != rec_data_ready_connections.end(); ++prc) {
- (*prc).disconnect();
- }
- rec_data_ready_connections.clear();
+ rec_data_ready_connections.drop_connections ();
rec_updating = false;
rec_active = false;
gdouble xend = _trackview.editor().frame_to_pixel (region->position() + region->length());
rect->property_x2() = xend;
- ARDOUR::BeatsFramesConverter tconv(_trackview.session().tempo_map(), region->position());
+ ARDOUR::BeatsFramesConverter tconv(_trackview.session()->tempo_map(), region->position());
const MidiModel::TimeType start_beats = tconv.from(start);
/* draw events */
static const uint32_t MIDI_CONTROLS_BOX_MIN_HEIGHT = 162;
static const uint32_t KEYBOARD_MIN_HEIGHT = 140;
-MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess,
+MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess,
boost::shared_ptr<Route> rt, Canvas& canvas)
: AxisView(sess) // virtually inherited
, RouteTimeAxisView(ed, sess, rt, canvas)
nframes64_t start = pos;
real_editor->snap_to (start, -1);
- const Meter& m = _session.tempo_map().meter_at(start);
- const Tempo& t = _session.tempo_map().tempo_at(start);
- double length = floor (m.frames_per_bar(t, _session.frame_rate()));
+ const Meter& m = _session->tempo_map().meter_at(start);
+ const Tempo& t = _session->tempo_map().tempo_at(start);
+ double length = floor (m.frames_per_bar(t, _session->frame_rate()));
const boost::shared_ptr<MidiDiskstream> diskstream =
boost::dynamic_pointer_cast<MidiDiskstream>(view()->trackview().track()->diskstream());
- boost::shared_ptr<Source> src = _session.create_midi_source_for_session (*diskstream.get());
+ boost::shared_ptr<Source> src = _session->create_midi_source_for_session (*diskstream.get());
boost::shared_ptr<Region> region = (RegionFactory::create (src, 0, (nframes_t) length,
PBD::basename_nosuffix(src->name())));
playlist()->add_region (region, start);
XMLNode &after = playlist()->get_state();
- _session.add_command (new MementoCommand<Playlist> (*playlist().get(), &before, &after));
+ _session->add_command (new MementoCommand<Playlist> (*playlist().get(), &before, &after));
real_editor->commit_reversible_command();
class MidiTimeAxisView : public RouteTimeAxisView
{
public:
- MidiTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
+ MidiTimeAxisView (PublicEditor&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
virtual ~MidiTimeAxisView ();
MidiStreamView* midi_view();
int MixerStrip::scrollbar_height = 0;
-MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer)
+MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
: AxisView(sess)
, RouteUI (sess)
,_mixer(mx)
, _mixer_owned (in_mixer)
- , processor_box (sess, sigc::mem_fun(*this, &MixerStrip::plugin_selector), mx.selection(), this, in_mixer)
+ , processor_box (sess, boost::bind (&MixerStrip::plugin_selector, this), mx.selection(), this, in_mixer)
, gpm (sess, 250)
, panners (sess)
, _mono_button (_("Mono"))
}
}
-MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
+MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt, bool in_mixer)
: AxisView(sess)
, RouteUI (sess)
,_mixer(mx)
_packed = false;
_embedded = false;
- _session.engine().Stopped.connect (sigc::mem_fun(*this, &MixerStrip::engine_stopped));
- _session.engine().Running.connect (sigc::mem_fun(*this, &MixerStrip::engine_running));
+ _session->engine().Stopped.connect (sigc::mem_fun(*this, &MixerStrip::engine_stopped));
+ _session->engine().Running.connect (sigc::mem_fun(*this, &MixerStrip::engine_running));
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);
MixerStrip::~MixerStrip ()
{
- GoingAway(); /* EMIT_SIGNAL */
+ drop_references ();
delete input_selector;
delete output_selector;
boost::shared_ptr<AudioTrack> at = audio_track();
- connections.push_back (at->FreezeChange.connect (sigc::mem_fun(*this, &MixerStrip::map_frozen)));
+ connections.add_connection (at->FreezeChange.connect (sigc::mem_fun(*this, &MixerStrip::map_frozen)));
button_table.attach (*rec_enable_button, 0, 2, 2, 3);
- rec_enable_button->set_sensitive (_session.writable());
+ rec_enable_button->set_sensitive (_session->writable());
rec_enable_button->show();
} else if (!is_track()) {
_("Click to Add/Edit Comments"):
_route->comment());
- connections.push_back (_route->meter_change.connect (
- sigc::mem_fun(*this, &MixerStrip::meter_changed)));
- connections.push_back (_route->input()->changed.connect (
- sigc::mem_fun(*this, &MixerStrip::input_changed)));
- connections.push_back (_route->output()->changed.connect (
- sigc::mem_fun(*this, &MixerStrip::output_changed)));
- connections.push_back (_route->route_group_changed.connect (
- sigc::mem_fun(*this, &MixerStrip::route_group_changed)));
+ connections.add_connection (_route->meter_change.connect (sigc::mem_fun(*this, &MixerStrip::meter_changed)));
+ connections.add_connection (_route->input()->changed.connect (sigc::mem_fun(*this, &MixerStrip::input_changed)));
+ connections.add_connection (_route->output()->changed.connect (sigc::mem_fun(*this, &MixerStrip::output_changed)));
+ connections.add_connection (_route->route_group_changed.connect (sigc::mem_fun(*this, &MixerStrip::route_group_changed)));
if (_route->panner()) {
- connections.push_back (_route->panner()->Changed.connect (
- sigc::mem_fun(*this, &MixerStrip::connect_to_pan)));
+ connections.add_connection (_route->panner()->Changed.connect (sigc::mem_fun(*this, &MixerStrip::connect_to_pan)));
}
if (is_audio_track()) {
- connections.push_back (audio_track()->DiskstreamChanged.connect (
- sigc::mem_fun(*this, &MixerStrip::diskstream_changed)));
+ connections.add_connection (audio_track()->DiskstreamChanged.connect (sigc::mem_fun(*this, &MixerStrip::diskstream_changed)));
}
- connections.push_back (_route->NameChanged.connect (
- sigc::mem_fun(*this, &RouteUI::name_changed)));
- connections.push_back (_route->comment_changed.connect (
- sigc::mem_fun(*this, &MixerStrip::comment_changed)));
- connections.push_back (_route->gui_changed.connect (
- sigc::mem_fun(*this, &MixerStrip::route_gui_changed)));
+ connections.add_connection (_route->NameChanged.connect (sigc::mem_fun(*this, &RouteUI::name_changed)));
+ connections.add_connection (_route->comment_changed.connect (sigc::mem_fun(*this, &MixerStrip::comment_changed)));
+ connections.add_connection (_route->gui_changed.connect (sigc::mem_fun(*this, &MixerStrip::route_gui_changed)));
set_stuff_from_route ();
MixerStrip::output_press (GdkEventButton *ev)
{
using namespace Menu_Helpers;
- if (!_session.engine().connected()) {
+ if (!_session->engine().connected()) {
MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
msg.run ();
return true;
ARDOUR::BundleList current = _route->output()->bundles_connected ();
- boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
+ boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
/* give user bundles first chance at being in the menu */
}
}
- boost::shared_ptr<ARDOUR::RouteList> routes = _session.get_routes ();
+ boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
maybe_add_bundle_to_output_menu ((*i)->input()->bundle(), current);
}
output = _route->output ();
}
- output_selector = new IOSelectorWindow (&_session, output);
+ output_selector = new IOSelectorWindow (_session, output);
}
if (output_selector->is_visible()) {
MixerStrip::edit_input_configuration ()
{
if (input_selector == 0) {
- input_selector = new IOSelectorWindow (&_session, _route->input());
+ input_selector = new IOSelectorWindow (_session, _route->input());
}
if (input_selector->is_visible()) {
input_menu.set_name ("ArdourContextMenu");
citems.clear();
- if (!_session.engine().connected()) {
+ if (!_session->engine().connected()) {
MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
msg.run ();
return true;
ARDOUR::BundleList current = _route->input()->bundles_connected ();
- boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
+ boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
/* give user bundles first chance at being in the menu */
}
}
- boost::shared_ptr<ARDOUR::RouteList> routes = _session.get_routes ();
+ boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
maybe_add_bundle_to_input_menu ((*i)->output()->bundle(), current);
}
uint32_t io_count;
uint32_t io_index;
Port *port;
- vector<string> connections;
+ vector<string> port_connections;
uint32_t total_connection_count = 0;
uint32_t io_connection_count = 0;
} else {
port = route->output()->nth (io_index);
}
-
- connections.clear ();
- port->get_connections(connections);
+
+ port_connections.clear ();
+ port->get_connections(port_connections);
io_connection_count = 0;
- if (!connections.empty()) {
- for (vector<string>::iterator i = connections.begin(); i != connections.end(); ++i) {
+ if (!port_connections.empty()) {
+ for (vector<string>::iterator i = port_connections.begin(); i != port_connections.end(); ++i) {
string& connection_name (*i);
if (io_connection_count == 0) {
class MixerStrip : public RouteUI, public Gtk::EventBox
{
public:
- MixerStrip (Mixer_UI&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, bool in_mixer = true);
- MixerStrip (Mixer_UI&, ARDOUR::Session&, bool in_mixer = true);
+ MixerStrip (Mixer_UI&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, bool in_mixer = true);
+ MixerStrip (Mixer_UI&, ARDOUR::Session*, bool in_mixer = true);
~MixerStrip ();
void set_width_enum (Width, void* owner);
std::string longest_label;
- sigc::connection newplug_connection;
-
gint mark_update_safe ();
guint32 mode_switch_in_progress;
void input_changed (ARDOUR::IOChange, void *);
void output_changed (ARDOUR::IOChange, void *);
- sigc::connection panstate_connection;
- sigc::connection panstyle_connection;
+ boost::signals2::scoped_connection panstate_connection;
+ boost::signals2::scoped_connection panstyle_connection;
void connect_to_pan ();
void update_diskstream_display ();
void revert_to_default_display ();
void drop_send ();
- sigc::connection send_gone_connection;
+ boost::signals2::scoped_connection send_gone_connection;
void reset_strip_style ();
Mixer_UI::Mixer_UI ()
: Window (Gtk::WINDOW_TOPLEVEL)
{
- session = 0;
_strip_width = Config->get_default_narrow_ms() ? Narrow : Wide;
track_menu = 0;
route_group_context_menu = 0;
return;
}
- strip = new MixerStrip (*this, *session, route);
+ strip = new MixerStrip (*this, _session, route);
strips.push_back (strip);
Config->get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide;
route->NameChanged.connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_name_changed), strip));
- strip->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::remove_strip), strip));
+ scoped_connect (strip->GoingAway, boost::bind (&Mixer_UI::remove_strip, this, strip));
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));
}
TreeModel::Children rows = track_model->children();
TreeModel::Children::iterator ri;
- if (src == N_("signal") || !session || (session->state_of_the_state() & (Session::Loading|Session::Deletion)) || rows.empty()) {
+ if (src == N_("signal") || !_session || (_session->state_of_the_state() & (Session::Loading|Session::Deletion)) || rows.empty()) {
return;
}
}
void
-Mixer_UI::connect_to_session (Session* sess)
+Mixer_UI::set_session (Session* sess)
{
- session = sess;
+ SessionHandlePtr::set_session (sess);
+
+ if (_plugin_selector) {
+ _plugin_selector->set_session (_session);
+ }
+
+ _group_tabs->set_session (sess);
+
+ if (!_session) {
+ return;
+ }
XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
set_state (*node);
- WindowTitle title(session->name());
+ WindowTitle title(_session->name());
title += _("Mixer");
title += Glib::get_application_name();
initial_track_display ();
- session->GoingAway.connect (sigc::mem_fun(*this, &Mixer_UI::disconnect_from_session));
- session->RouteAdded.connect (sigc::mem_fun(*this, &Mixer_UI::add_strip));
- session->route_group_added.connect (sigc::mem_fun(*this, &Mixer_UI::add_route_group));
- session->route_group_removed.connect (sigc::mem_fun(*this, &Mixer_UI::route_groups_changed));
- session->config.ParameterChanged.connect (sigc::mem_fun (*this, &Mixer_UI::parameter_changed));
+ _session_connections.add_connection (_session->RouteAdded.connect (boost::bind (&Mixer_UI::add_strip, this, _1)));
+ _session_connections.add_connection (_session->route_group_added.connect (boost::bind (&Mixer_UI::add_route_group, this, _1)));
+ _session_connections.add_connection (_session->route_group_removed.connect (boost::bind (&Mixer_UI::route_groups_changed, this)));
+ _session_connections.add_connection (_session->config.ParameterChanged.connect (boost::bind (&Mixer_UI::parameter_changed, this, _1)));
route_groups_changed ();
- if (_plugin_selector)
- _plugin_selector->set_session (session);
-
if (_visible) {
show_window();
}
- _group_tabs->connect_to_session (sess);
-
start_updating ();
}
void
-Mixer_UI::disconnect_from_session ()
+Mixer_UI::session_going_away ()
{
- ENSURE_GUI_THREAD (*this, &Mixer_UI::disconnect_from_session)
+ ENSURE_GUI_THREAD (*this, &Mixer_UI::session_going_away)
group_model->clear ();
_selection.clear ();
set_title (title.get_string());
stop_updating ();
+
+ SessionHandlePtr::session_going_away ();
}
void
void
Mixer_UI::fast_update_strips ()
{
- if (is_mapped () && session) {
+ if (is_mapped () && _session) {
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
(*i)->fast_update ();
}
Mixer_UI::track_list_reorder (const TreeModel::Path&, const TreeModel::iterator&, int* /*new_order*/)
{
strip_redisplay_does_not_sync_order_keys = true;
- session->set_remote_control_ids();
+ _session->set_remote_control_ids();
redisplay_track_list ();
strip_redisplay_does_not_sync_order_keys = false;
}
{
// never reset order keys because of a property change
strip_redisplay_does_not_reset_order_keys = true;
- session->set_remote_control_ids();
+ _session->set_remote_control_ids();
redisplay_track_list ();
strip_redisplay_does_not_reset_order_keys = false;
}
Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&)
{
/* this could require an order sync */
- session->set_remote_control_ids();
- redisplay_track_list ();
+ if (_session && !_session->deletion_in_progress()) {
+ _session->set_remote_control_ids();
+ redisplay_track_list ();
+ }
}
void
}
if (!strip_redisplay_does_not_reset_order_keys && !strip_redisplay_does_not_sync_order_keys) {
- session->sync_order_keys (N_("signal"));
+ _session->sync_order_keys (N_("signal"));
}
// Resigc::bind all of the midi controls automatically
void
Mixer_UI::initial_track_display ()
{
- boost::shared_ptr<RouteList> routes = session->get_routes();
+ boost::shared_ptr<RouteList> routes = _session->get_routes();
RouteList copy (*routes);
SignalOrderRouteSorter sorter;
void
Mixer_UI::activate_all_route_groups ()
{
- session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), true));
+ _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), true));
}
void
Mixer_UI::disable_all_route_groups ()
{
- session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), false));
+ _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), false));
}
void
row[group_columns.group] = 0;
}
- session->foreach_route_group (sigc::mem_fun (*this, &Mixer_UI::add_route_group));
+ _session->foreach_route_group (sigc::mem_fun (*this, &Mixer_UI::add_route_group));
}
void
Mixer_UI::new_route_group ()
{
- session->add_route_group (new RouteGroup (*session, "", RouteGroup::Active, (RouteGroup::Property) (RouteGroup::Gain |RouteGroup::Mute | RouteGroup::Solo)));
+ _session->add_route_group (new RouteGroup (*_session, "", RouteGroup::Active, (RouteGroup::Property) (RouteGroup::Gain |RouteGroup::Mute | RouteGroup::Solo)));
}
void
RouteGroup* rg = (*iter)[group_columns.group];
if (rg) {
- session->remove_route_group (*rg);
+ _session->remove_route_group (*rg);
}
}
}
Mixer_UI::parameter_changed (string const & p)
{
if (p == "show-group-tabs") {
- bool const s = session->config.get_show_group_tabs ();
+ bool const s = _session->config.get_show_group_tabs ();
if (s) {
_group_tabs->show ();
} else {
#include <gtkmm/treeview.h>
#include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
#include "ardour/ardour.h"
+#include "ardour/session_handle.h"
#include "route_processor_selection.h"
#include "enums.h"
namespace ARDOUR {
class Route;
class RouteGroup;
- class Session;
class AudioDiskstream;
};
class PluginSelector;
class MixerGroupTabs;
-class Mixer_UI : public Gtk::Window
+class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
{
public:
Mixer_UI ();
~Mixer_UI();
- void connect_to_session (ARDOUR::Session *);
+ void set_session (ARDOUR::Session *);
PluginSelector* plugin_selector();
RouteRedirectSelection& selection() { return _selection; }
private:
- ARDOUR::Session *session;
-
bool _visible;
Gtk::HBox global_hpacker;
gint start_updating ();
gint stop_updating ();
- void disconnect_from_session ();
+ void session_going_away ();
sigc::connection fast_screen_update_connection;
void fast_update_strips ();
const int PannerUI::pan_bar_height = 30;
-PannerUI::PannerUI (Session& s)
- : _session (s),
- _current_nouts (-1),
- _current_npans (-1),
- hAdjustment(0.0, 0.0, 0.0),
- vAdjustment(0.0, 0.0, 0.0),
- panning_viewport(hAdjustment, vAdjustment),
- panning_up_arrow (Gtk::ARROW_UP, Gtk::SHADOW_OUT),
- panning_down_arrow (Gtk::ARROW_DOWN, Gtk::SHADOW_OUT),
- panning_link_button (_("link")),
- pan_automation_style_button (""),
- pan_automation_state_button ("")
-{
+PannerUI::PannerUI (Session* s)
+ : _current_nouts (-1)
+ , _current_npans (-1)
+ , hAdjustment(0.0, 0.0, 0.0)
+ , vAdjustment(0.0, 0.0, 0.0)
+ , panning_viewport(hAdjustment, vAdjustment)
+ , panning_up_arrow (Gtk::ARROW_UP, Gtk::SHADOW_OUT)
+ , panning_down_arrow (Gtk::ARROW_DOWN, Gtk::SHADOW_OUT)
+ , panning_link_button (_("link"))
+ , pan_automation_style_button ("")
+ , pan_automation_state_button ("")
+{
+ set_session (s);
+
ignore_toggle = false;
pan_menu = 0;
pan_astate_menu = 0;
void
PannerUI::set_panner (boost::shared_ptr<Panner> p)
{
- connections.clear ();
+ connections.drop_connections ();
delete pan_astyle_menu;
pan_astyle_menu = 0;
return;
}
- connections.push_back (_panner->Changed.connect (sigc::mem_fun(*this, &PannerUI::panner_changed)));
- connections.push_back (_panner->LinkStateChanged.connect (sigc::mem_fun(*this, &PannerUI::update_pan_linkage)));
- connections.push_back (_panner->StateChanged.connect (sigc::mem_fun(*this, &PannerUI::update_pan_state)));
+ connections.add_connection (_panner->Changed.connect (sigc::mem_fun(*this, &PannerUI::panner_changed)));
+ connections.add_connection (_panner->LinkStateChanged.connect (sigc::mem_fun(*this, &PannerUI::update_pan_linkage)));
+ connections.add_connection (_panner->StateChanged.connect (sigc::mem_fun(*this, &PannerUI::update_pan_state)));
setup_pan ();
the panner objects have no access to the session,
so do this here. ick.
*/
- _session.set_dirty();
+ _session->set_dirty();
}
}
}
#include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/slider_controller.h>
+#include "ardour/session_handle.h"
+
#include "enums.h"
class Panner2d;
class Menuitem;
}
-class PannerUI : public Gtk::HBox
+class PannerUI : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{
public:
- PannerUI (ARDOUR::Session&);
+ PannerUI (ARDOUR::Session*);
~PannerUI ();
virtual void set_panner (boost::shared_ptr<ARDOUR::Panner>);
friend class MixerStrip;
boost::shared_ptr<ARDOUR::Panner> _panner;
- ARDOUR::Session& _session;
- std::vector<sigc::connection> connections;
+ PBD::ScopedConnectionList connections;
bool ignore_toggle;
bool in_pan_update;
model->clear ();
- session->playlists->foreach (this, &PlaylistSelector::add_playlist_to_map);
+ _session->playlists->foreach (this, &PlaylistSelector::add_playlist_to_map);
this_ds = rui->get_diskstream();
for (DSPL_Map::iterator x = dspl_map.begin(); x != dspl_map.end(); ++x) {
- boost::shared_ptr<Diskstream> ds = session->diskstream_by_id (x->first);
+ boost::shared_ptr<Diskstream> ds = _session->diskstream_by_id (x->first);
if (ds == 0) {
continue;
// Add unassigned (imported) playlists to the list
list<boost::shared_ptr<Playlist> > unassigned;
- session->playlists->unassigned (unassigned);
+ _session->playlists->unassigned (unassigned);
TreeModel::Row row;
TreeModel::Row* selected_row = 0;
x->second->push_back (pl);
}
-void
-PlaylistSelector::set_session (Session* s)
-{
- ENSURE_GUI_THREAD (*this, &PlaylistSelector::set_session, s)
-
- session = s;
-
- if (session) {
- session->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &PlaylistSelector::set_session), static_cast<Session*> (0)));
- }
-}
-
void
PlaylistSelector::close_button_click ()
{
#include <gtkmm2ext/selector.h>
#include "ardour_dialog.h"
+#include "ardour/session_handle.h"
namespace ARDOUR {
class Session;
PlaylistSelector ();
~PlaylistSelector ();
- void set_session (ARDOUR::Session*);
void show_for (RouteUI*);
protected:
private:
typedef std::map<PBD::ID,std::list<boost::shared_ptr<ARDOUR::Playlist> >*> DSPL_Map;
- ARDOUR::Session* session;
Gtk::ScrolledWindow scroller;
DSPL_Map dspl_map;
RouteUI* rui;
_plugin_menu = 0;
manager = mgr;
- session = 0;
in_row_change = false;
manager->PluginListChanged.connect (sigc::mem_fun (*this, &PluginSelector::build_plugin_menu));
btn_add_clicked();
}
-void
-PluginSelector::set_session (Session* s)
-{
- ENSURE_GUI_THREAD (*this, &PluginSelector::set_session, s)
-
- session = s;
-
- if (session) {
- session->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &PluginSelector::set_session), static_cast<Session*> (0)));
- }
-}
-
bool
PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& filterstr)
{
PluginPtr
PluginSelector::load_plugin (PluginInfoPtr pi)
{
- if (session == 0) {
+ if (_session == 0) {
return PluginPtr();
}
- return pi->load (*session);
+ return pi->load (*_session);
}
void
#include <gtkmm2ext/selector.h>
#include "ardour/plugin.h"
+#include "ardour/session_handle.h"
#include "plugin_interest.h"
namespace ARDOUR {
int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ?
- void set_session (ARDOUR::Session*);
void on_show ();
Gtk::Menu* plugin_menu ();
private:
PluginInterestedObject* interested_object;
- ARDOUR::Session* session;
Gtk::ScrolledWindow scroller; // Available plugins
Gtk::ScrolledWindow ascroller; // Added plugins
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 (sigc::mem_fun (*this, &PlugUIBase::plugin_going_away));
+
+ death_connection = insert->GoingAway.connect (sigc::mem_fun (*this, &PlugUIBase::plugin_going_away));
}
PlugUIBase::~PlugUIBase()
/* drop references to the plugin/insert */
insert.reset ();
plugin.reset ();
+ death_connection.disconnect ();
}
void
void toggle_plugin_analysis ();
void processor_active_changed (boost::weak_ptr<ARDOUR::Processor> p);
void plugin_going_away ();
+ boost::signals2::scoped_connection death_connection;
};
class GenericPluginUI : public PlugUIBase, public Gtk::VBox
private:
Glib::ustring _title;
PlugUIBase* _pluginui;
- sigc::connection death_connection;
+ boost::signals2::scoped_connection death_connection;
Gtk::Window* parent;
Gtk::VBox vbox;
bool non_gtk_gui;
#define __ardour_gtk_point_selection_h__
#include <list>
+#include <boost/noncopyable.hpp>
#include "automation_selectable.h"
}
+PortGroup::~PortGroup()
+{
+ for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
+ delete *i;
+ }
+ _bundles.clear ();
+}
+
/** Add a bundle to a group.
* @param b Bundle.
* @param allow_dups true to allow the group to contain more than one bundle with the same port, otherwise false.
add_bundle_internal (b, io, true, c, false);
}
+PortGroup::BundleRecord::BundleRecord (boost::shared_ptr<ARDOUR::Bundle> b, boost::shared_ptr<ARDOUR::IO> iop, Gdk::Color c, bool has_c)
+ : bundle (b)
+ , io (iop)
+ , colour (c)
+ , has_colour (has_c)
+{
+}
+
void
PortGroup::add_bundle_internal (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io, bool has_colour, Gdk::Color colour, bool allow_dups)
{
/* don't add this bundle if we already have one with the same ports */
BundleList::iterator i = _bundles.begin ();
- while (i != _bundles.end() && b->has_same_ports (i->bundle) == false) {
+ while (i != _bundles.end() && b->has_same_ports ((*i)->bundle) == false) {
++i;
}
}
}
- BundleRecord r;
- r.bundle = b;
- r.io = io;
- r.colour = colour;
- r.has_colour = has_colour;
- r.changed_connection = b->Changed.connect (sigc::mem_fun (*this, &PortGroup::bundle_changed));
-
- _bundles.push_back (r);
+ BundleRecord* br = new BundleRecord (b, io, colour, has_colour);
+ br->changed_connection = b->Changed.connect (boost::bind (&PortGroup::bundle_changed, this, _1));
+ _bundles.push_back (br);
Changed ();
}
assert (b.get());
BundleList::iterator i = _bundles.begin ();
- while (i != _bundles.end() && i->bundle != b) {
+ while (i != _bundles.end() && (*i)->bundle != b) {
++i;
}
return;
}
- i->changed_connection.disconnect ();
+ delete *i;
_bundles.erase (i);
Changed ();
PortGroup::clear ()
{
for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
- i->changed_connection.disconnect ();
+ delete *i;
}
_bundles.clear ();
PortGroup::has_port (std::string const& p) const
{
for (BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
- if (i->bundle->offers_port_alone (p)) {
+ if ((*i)->bundle->offers_port_alone (p)) {
return true;
}
}
PortGroup::only_bundle ()
{
assert (_bundles.size() == 1);
- return _bundles.front().bundle;
+ return _bundles.front()->bundle;
}
{
uint32_t n = 0;
for (BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
- n += i->bundle->nchannels ();
+ n += (*i)->bundle->nchannels ();
}
return n;
PortGroup::io_from_bundle (boost::shared_ptr<ARDOUR::Bundle> b) const
{
BundleList::const_iterator i = _bundles.begin ();
- while (i != _bundles.end() && i->bundle != b) {
+ while (i != _bundles.end() && (*i)->bundle != b) {
++i;
}
return boost::shared_ptr<IO> ();
}
- return i->io;
+ return (*i)->io;
}
}
+PortGroupList::~PortGroupList()
+{
+ /* XXX need to clean up bundles, but ownership shared with PortGroups */
+}
+
void
PortGroupList::set_type (DataType t)
{
route_bundles.push_back (io->bundle ());
- (*i)->foreach_processor (sigc::bind (sigc::mem_fun (*this, &PortGroupList::maybe_add_processor_to_list), &route_bundles, inputs, used_io));
+ (*i)->foreach_processor (boost::bind (&PortGroupList::maybe_add_processor_to_list, this, _1, &route_bundles, inputs, used_io));
/* Work out which group to put these bundles in */
boost::shared_ptr<PortGroup> g;
PortGroupList::clear ()
{
_groups.clear ();
-
- for (std::vector<sigc::connection>::iterator i = _bundle_changed_connections.begin(); i != _bundle_changed_connections.end(); ++i) {
- i->disconnect ();
- }
-
- _bundle_changed_connections.clear ();
-
+ _bundle_changed_connections.drop_connections ();
emit_changed ();
}
g->Changed.connect (sigc::mem_fun (*this, &PortGroupList::emit_changed));
- _bundle_changed_connections.push_back (
- g->BundleChanged.connect (sigc::mem_fun (*this, &PortGroupList::emit_bundle_changed))
- );
+ _bundle_changed_connections.add_connection (g->BundleChanged.connect (sigc::mem_fun (*this, &PortGroupList::emit_bundle_changed)));
emit_changed ();
}
#include <vector>
#include <string>
#include <set>
+#include <boost/shared_ptr.hpp>
+#include <boost/signals2.hpp>
+
#include <gtkmm/widget.h>
#include <gtkmm/checkbutton.h>
-#include <boost/shared_ptr.hpp>
+
#include "ardour/data_type.h"
#include "ardour/types.h"
{
public:
PortGroup (std::string const & n);
+ ~PortGroup ();
void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, bool allow_dups = false);
void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO> io);
sigc::signal<void> Changed;
/** An individual bundle on our list has changed in some way */
- sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
+ boost::signals2::signal<void(ARDOUR::Bundle::Change)> BundleChanged;
struct BundleRecord {
- boost::shared_ptr<ARDOUR::Bundle> bundle;
- /** IO whose ports are in the bundle, or 0. This is so that we can do things like adding
- ports to the IO from matrix editor menus. */
- boost::shared_ptr<ARDOUR::IO> io;
- Gdk::Color colour;
- bool has_colour;
- sigc::connection changed_connection;
+ boost::shared_ptr<ARDOUR::Bundle> bundle;
+ /** IO whose ports are in the bundle, or 0. This is so that we can do things like adding
+ ports to the IO from matrix editor menus. */
+ boost::shared_ptr<ARDOUR::IO> io;
+ Gdk::Color colour;
+ bool has_colour;
+ boost::signals2::scoped_connection changed_connection;
+
+ BundleRecord (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO>, Gdk::Color, bool has_colour);
};
- typedef std::list<BundleRecord> BundleList;
+ typedef std::list<BundleRecord*> BundleList;
BundleList const & bundles () const {
return _bundles;
{
public:
PortGroupList ();
+ ~PortGroupList();
typedef std::vector<boost::shared_ptr<PortGroup> > List;
bool empty () const;
/** The group list has changed in some way; a group has been added or removed, or the list cleared etc. */
- sigc::signal<void> Changed;
+ boost::signals2::signal<void()> Changed;
/** A bundle in one of our groups has changed */
- sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
+ boost::signals2::signal<void(ARDOUR::Bundle::Change)> BundleChanged;
private:
bool port_has_prefix (std::string const &, std::string const &) const;
ARDOUR::DataType _type;
mutable PortGroup::BundleList _bundles;
List _groups;
- std::vector<sigc::connection> _bundle_changed_connections;
+ PBD::ScopedConnectionList _bundle_changed_connections;
bool _signals_suspended;
bool _pending_change;
ARDOUR::Bundle::Change _pending_bundle_change;
* @param type Port type that we are handling.
*/
PortMatrix::PortMatrix (Window* parent, Session* session, DataType type)
- : Table (3, 3),
- _session (session),
- _parent (parent),
- _type (type),
- _menu (0),
- _arrangement (TOP_TO_RIGHT),
- _row_index (0),
- _column_index (1),
- _min_height_divisor (1),
- _show_only_bundles (false),
- _inhibit_toggle_show_only_bundles (false),
- _ignore_notebook_page_selected (false)
-{
+ : Table (3, 3)
+ , _parent (parent)
+ , _type (type)
+ , _menu (0)
+ , _arrangement (TOP_TO_RIGHT)
+ , _row_index (0)
+ , _column_index (1)
+ , _min_height_divisor (1)
+ , _show_only_bundles (false)
+ , _inhibit_toggle_show_only_bundles (false)
+ , _ignore_notebook_page_selected (false)
+{
+ set_session (session);
+
_body = new PortMatrixBody (this);
_body->DimensionsChanged.connect (sigc::mem_fun (*this, &PortMatrix::body_dimensions_changed));
/* 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 (sigc::hide (sigc::mem_fun (*this, &PortMatrix::routes_changed)));
+ _session_connections.add_connection (_session->RouteAdded.connect (boost::bind (&PortMatrix::routes_changed, this)));
/* and also bundles */
- _session->BundleAdded.connect (sigc::hide (sigc::mem_fun (*this, &PortMatrix::setup_global_ports)));
+ _session_connections.add_connection (_session->BundleAdded.connect (boost::bind (&PortMatrix::setup_global_ports, this)));
/* and also ports */
- _session->engine().PortRegisteredOrUnregistered.connect (sigc::mem_fun (*this, &PortMatrix::setup_global_ports));
-
- _session->GoingAway.connect (sigc::mem_fun (*this, &PortMatrix::session_going_away));
+ _session_connections.add_connection (_session->engine().PortRegisteredOrUnregistered.connect (boost::bind (&PortMatrix::setup_global_ports, this)));
reconnect_to_routes ();
void
PortMatrix::reconnect_to_routes ()
{
- for (vector<sigc::connection>::iterator i = _route_connections.begin(); i != _route_connections.end(); ++i) {
- i->disconnect ();
- }
- _route_connections.clear ();
+ _route_connections.drop_connections ();
boost::shared_ptr<RouteList> routes = _session->get_routes ();
for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
- _route_connections.push_back (
- (*i)->processors_changed.connect (sigc::mem_fun (*this, &PortMatrix::route_processors_changed))
- );
+ _route_connections.add_connection ((*i)->processors_changed.connect (sigc::mem_fun (*this, &PortMatrix::route_processors_changed)));
}
}
PortGroup::BundleList b = _ports[1].bundles ();
for (PortGroup::BundleList::iterator i = a.begin(); i != a.end(); ++i) {
- for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
for (PortGroup::BundleList::iterator k = b.begin(); k != b.end(); ++k) {
- for (uint32_t l = 0; l < k->bundle->nchannels(); ++l) {
+ for (uint32_t l = 0; l < (*k)->bundle->nchannels(); ++l) {
BundleChannel c[2] = {
- BundleChannel (i->bundle, j),
- BundleChannel (k->bundle, l)
+ BundleChannel ((*i)->bundle, j),
+ BundleChannel ((*k)->bundle, l)
};
if (get_state (c) == PortMatrixNode::ASSOCIATED) {
PortGroup::BundleList a = _ports[1-dim].bundles ();
for (PortGroup::BundleList::iterator i = a.begin(); i != a.end(); ++i) {
- for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
BundleChannel c[2];
c[dim] = BundleChannel (sb, channel);
- c[1-dim] = BundleChannel (i->bundle, j);
+ c[1-dim] = BundleChannel ((*i)->bundle, j);
if (get_state (c) == PortMatrixNode::ASSOCIATED) {
set_state (c, false);
#include <gtkmm/checkbutton.h>
#include <gtkmm/notebook.h>
#include <boost/shared_ptr.hpp>
+
#include "ardour/bundle.h"
#include "ardour/types.h"
+#include "ardour/session_handle.h"
+
#include "port_group.h"
#include "port_matrix_types.h"
#include "i18n.h"
class PortMatrixBody;
-class PortMatrix : public Gtk::Table
+class PortMatrix : public Gtk::Table, public ARDOUR::SessionHandlePtr
{
public:
PortMatrix (Gtk::Window*, ARDOUR::Session *, ARDOUR::DataType);
from left to right as you go from list 0 to list 1. Hence subclasses which deal with
inputs and outputs should put outputs in list 0 and inputs in list 1. */
PortGroupList _ports[2];
- ARDOUR::Session* _session;
private:
/// port type that we are working with
ARDOUR::DataType _type;
- std::vector<sigc::connection> _route_connections;
+ PBD::ScopedConnectionList _route_connections;
PortMatrixBody* _body;
Gtk::HScrollbar _hscroll;
{
/* Discard any old connections to bundles */
- for (list<sigc::connection>::iterator i = _bundle_connections.begin(); i != _bundle_connections.end(); ++i) {
- i->disconnect ();
- }
- _bundle_connections.clear ();
+ _bundle_connections.drop_connections ();
/* Connect to bundles so that we find out when their names change */
PortGroup::BundleList r = _matrix->visible_rows()->bundles ();
for (PortGroup::BundleList::iterator i = r.begin(); i != r.end(); ++i) {
- _bundle_connections.push_back (
- i->bundle->Changed.connect (sigc::hide (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_row_labels)))
- );
+ _bundle_connections.add_connection ((*i)->bundle->Changed.connect (boost::bind (&PortMatrixBody::rebuild_and_draw_row_labels, this)));
}
}
if (_matrix->visible_columns()) {
PortGroup::BundleList c = _matrix->visible_columns()->bundles ();
for (PortGroup::BundleList::iterator i = c.begin(); i != c.end(); ++i) {
- _bundle_connections.push_back (
- i->bundle->Changed.connect (sigc::hide (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_column_labels)))
- );
+ _bundle_connections.add_connection ((*i)->bundle->Changed.connect (boost::bind (&PortMatrixBody::rebuild_and_draw_column_labels, this)));
}
}
PortGroup::BundleList const b = _matrix->visible_ports(1 - dim)->bundles ();
for (PortGroup::BundleList::const_iterator i = b.begin(); i != b.end(); ++i) {
- for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
- bc[1 - dim] = ARDOUR::BundleChannel (i->bundle, j);
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+ bc[1 - dim] = ARDOUR::BundleChannel ((*i)->bundle, j);
if (_matrix->get_state (bc) == PortMatrixNode::ASSOCIATED) {
if (dim == _matrix->column_index()) {
_row_labels->add_channel_highlight (bc[1 - dim]);
std::list<PortMatrixNode> _mouseover;
bool _ignore_component_size_changed;
- std::list<sigc::connection> _bundle_connections;
+ PBD::ScopedConnectionList _bundle_connections;
};
#endif
for (PortGroup::BundleList::const_iterator j = c.begin (); j != c.end(); ++j) {
cairo_text_extents_t ext;
- cairo_text_extents (cr, j->bundle->name().c_str(), &ext);
+ cairo_text_extents (cr, (*j)->bundle->name().c_str(), &ext);
if (ext.width > _longest_bundle_name) {
_longest_bundle_name = ext.width;
}
- for (uint32_t k = 0; k < j->bundle->nchannels (); ++k) {
+ for (uint32_t k = 0; k < (*j)->bundle->nchannels (); ++k) {
cairo_text_extents (
cr,
- j->bundle->channel_name (k).c_str(),
+ (*j)->bundle->channel_name (k).c_str(),
&ext
);
PortGroup::BundleList const & bundles = _matrix->visible_columns()->bundles ();
for (PortGroup::BundleList::const_iterator i = bundles.begin (); i != bundles.end(); ++i) {
- Gdk::Color c = i->has_colour ? i->colour : get_a_bundle_colour (N);
- render_bundle_name (cr, background_colour (), c, x, 0, i->bundle);
+ Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N);
+ render_bundle_name (cr, background_colour (), c, x, 0, (*i)->bundle);
if (_matrix->show_only_bundles()) {
x += grid_spacing();
} else {
- x += i->bundle->nchannels () * grid_spacing();
+ x += (*i)->bundle->nchannels () * grid_spacing();
}
++N;
for (PortGroup::BundleList::const_iterator i = bundles.begin (); i != bundles.end(); ++i) {
- for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
- Gdk::Color c = i->has_colour ? i->colour : get_a_bundle_colour (N);
- render_channel_name (cr, background_colour (), c, x, 0, ARDOUR::BundleChannel (i->bundle, j));
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+ Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N);
+ render_channel_name (cr, background_colour (), c, x, 0, ARDOUR::BundleChannel ((*i)->bundle, j));
x += grid_spacing();
}
s = bundles.size();
} else {
for (PortGroup::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
- s += i->bundle->nchannels();
+ s += (*i)->bundle->nchannels();
}
}
for (PortGroup::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
- if (i->bundle == bc.bundle) {
+ if ((*i)->bundle == bc.bundle) {
/* found the bundle */
if (_matrix->show_only_bundles()) {
p += 1;
} else {
- p += i->bundle->nchannels ();
+ p += (*i)->bundle->nchannels ();
}
}
if (_matrix->show_only_bundles()) {
if (p < 1) {
- return ARDOUR::BundleChannel (j->bundle, -1);
+ return ARDOUR::BundleChannel ((*j)->bundle, -1);
} else {
p -= 1;
}
} else {
- uint32_t const s = j->bundle->nchannels ();
+ uint32_t const s = (*j)->bundle->nchannels ();
if (p < s) {
- return ARDOUR::BundleChannel (j->bundle, p);
+ return ARDOUR::BundleChannel ((*j)->bundle, p);
} else {
p -= s;
}
if (!_matrix->show_only_bundles()) {
cairo_set_line_width (cr, thin_grid_line_width());
- for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
x += grid_spacing ();
cairo_move_to (cr, x, 0);
cairo_line_to (cr, x, _height);
if (!_matrix->show_only_bundles()) {
cairo_set_line_width (cr, thin_grid_line_width());
- for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
y += grid_spacing ();
cairo_move_to (cr, 0, y);
cairo_line_to (cr, _width, y);
for (PortGroup::BundleList::const_iterator j = row_bundles.begin(); j != row_bundles.end(); ++j) {
PortMatrixNode::State s = get_association (PortMatrixNode (
- ARDOUR::BundleChannel (i->bundle, 0),
- ARDOUR::BundleChannel (j->bundle, 0)
+ ARDOUR::BundleChannel ((*i)->bundle, 0),
+ ARDOUR::BundleChannel ((*j)->bundle, 0)
));
switch (s) {
case PortMatrixNode::ASSOCIATED:
for (PortGroup::BundleList::const_iterator j = row_bundles.begin(); j != row_bundles.end(); ++j) {
x = bx;
- for (uint32_t k = 0; k < i->bundle->nchannels (); ++k) {
+ for (uint32_t k = 0; k < (*i)->bundle->nchannels (); ++k) {
y = by;
- for (uint32_t l = 0; l < j->bundle->nchannels (); ++l) {
+ for (uint32_t l = 0; l < (*j)->bundle->nchannels (); ++l) {
ARDOUR::BundleChannel c[2];
- c[_matrix->column_index()] = ARDOUR::BundleChannel (i->bundle, k);
- c[_matrix->row_index()] = ARDOUR::BundleChannel (j->bundle, l);
+ c[_matrix->column_index()] = ARDOUR::BundleChannel ((*i)->bundle, k);
+ c[_matrix->row_index()] = ARDOUR::BundleChannel ((*j)->bundle, l);
PortMatrixNode::State const s = _matrix->get_state (c);
x += grid_spacing();
}
- by += j->bundle->nchannels () * grid_spacing();
+ by += (*j)->bundle->nchannels () * grid_spacing();
}
- bx += i->bundle->nchannels () * grid_spacing();
+ bx += (*i)->bundle->nchannels () * grid_spacing();
}
}
}
PortGroup::BundleList const r = (*i)->bundles ();
for (PortGroup::BundleList::const_iterator j = r.begin(); j != r.end(); ++j) {
- for (uint32_t k = 0; k < j->bundle->nchannels(); ++k) {
+ for (uint32_t k = 0; k < (*j)->bundle->nchannels(); ++k) {
cairo_text_extents_t ext;
- cairo_text_extents (cr, j->bundle->channel_name(k).c_str(), &ext);
+ cairo_text_extents (cr, (*j)->bundle->channel_name(k).c_str(), &ext);
if (ext.width > _longest_port_name) {
_longest_port_name = ext.width;
}
}
cairo_text_extents_t ext;
- cairo_text_extents (cr, j->bundle->name().c_str(), &ext);
+ cairo_text_extents (cr, (*j)->bundle->name().c_str(), &ext);
if (ext.width > _longest_bundle_name) {
_longest_bundle_name = ext.width;
}
PortGroup::BundleList const & bundles = _matrix->visible_rows()->bundles ();
for (PortGroup::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
- render_bundle_name (cr, background_colour (), i->has_colour ? i->colour : get_a_bundle_colour (N), 0, y, i->bundle);
+ render_bundle_name (cr, background_colour (), (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N), 0, y, (*i)->bundle);
if (!_matrix->show_only_bundles()) {
- for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
- Gdk::Color c = i->has_colour ? i->colour : get_a_bundle_colour (M);
- render_channel_name (cr, background_colour (), c, 0, y, ARDOUR::BundleChannel (i->bundle, j));
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+ Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (M);
+ render_channel_name (cr, background_colour (), c, 0, y, ARDOUR::BundleChannel ((*i)->bundle, j));
y += grid_spacing();
++M;
}
_fader.set_fader_length (p);
}
-ProcessorBox::ProcessorBox (ARDOUR::Session& sess, sigc::slot<PluginSelector*> get_plugin_selector,
- RouteRedirectSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
- : _session(sess)
- , _parent_strip (parent)
+ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelector*()> get_plugin_selector,
+ RouteRedirectSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
+ : _parent_strip (parent)
, _owner_is_mixer (owner_is_mixer)
, ab_direction (true)
, _get_plugin_selector (get_plugin_selector)
, _placement(PreFader)
, _rr_selection(rsel)
{
+ set_session (sess);
+
_width = Wide;
processor_menu = 0;
send_action_menu = 0;
return;
}
- connections.clear ();
+ connections.drop_connections();
/* new route: any existing block on processor redisplay must be meaningless */
no_processor_redisplay = false;
_route = r;
- connections.push_back (_route->processors_changed.connect (sigc::mem_fun (*this, &ProcessorBox::route_processors_changed)));
- connections.push_back (_route->GoingAway.connect (
- sigc::mem_fun (*this, &ProcessorBox::route_going_away)));
- connections.push_back (_route->NameChanged.connect (
- sigc::mem_fun(*this, &ProcessorBox::route_name_changed)));
+ connections.add_connection (_route->processors_changed.connect (sigc::mem_fun (*this, &ProcessorBox::route_processors_changed)));
+ connections.add_connection (_route->GoingAway.connect (sigc::mem_fun (*this, &ProcessorBox::route_going_away)));
+ connections.add_connection (_route->NameChanged.connect (sigc::mem_fun(*this, &ProcessorBox::route_name_changed)));
redisplay_processors ();
}
Gtk::Menu*
ProcessorBox::build_possible_aux_menu ()
{
- boost::shared_ptr<RouteList> rl = _session.get_routes_with_internal_returns();
+ boost::shared_ptr<RouteList> rl = _session->get_routes_with_internal_returns();
if (rl->empty()) {
return 0;
if (processor && (Keyboard::is_edit_event (ev) || (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS))) {
- if (_session.engine().connected()) {
+ if (_session->engine().connected()) {
/* XXX giving an error message here is hard, because we may be in the midst of a button press */
edit_processor (processor);
}
{
for (SelectedPlugins::const_iterator p = plugins.begin(); p != plugins.end(); ++p) {
- boost::shared_ptr<Processor> processor (new PluginInsert (_session, *p));
+ boost::shared_ptr<Processor> processor (new PluginInsert (*_session, *p));
Route::ProcessorStreams err_streams;
void
ProcessorBox::choose_insert ()
{
- boost::shared_ptr<Processor> processor (new PortInsert (_session, _route->mute_master()));
+ boost::shared_ptr<Processor> processor (new PortInsert (*_session, _route->mute_master()));
_route->add_processor (processor, _placement);
}
void
ProcessorBox::choose_send ()
{
- boost::shared_ptr<Send> send (new Send (_session, _route->mute_master()));
+ boost::shared_ptr<Send> send (new Send (*_session, _route->mute_master()));
/* make an educated guess at the initial number of outputs for the send */
- ChanCount outs = (_session.master_out())
- ? _session.master_out()->n_outputs()
+ ChanCount outs = (_session->master_out())
+ ? _session->master_out()->n_outputs()
: _route->n_outputs();
/* XXX need processor lock on route */
is closed.
*/
- IOSelectorWindow *ios = new IOSelectorWindow (&_session, send->output(), true);
+ IOSelectorWindow *ios = new IOSelectorWindow (_session, send->output(), true);
ios->show_all ();
/* keep a reference to the send so it doesn't get deleted while
boost::shared_ptr<RouteList> rlist (new RouteList);
rlist->push_back (_route);
- _session.add_internal_sends (target, PreFader, rlist);
+ _session->add_internal_sends (target, PreFader, rlist);
}
void
case Gtk::RESPONSE_ACCEPT:
name_prompter.get_result (result);
if (result.length()) {
- if (_session.route_by_name (result)) {
+ if (_session->route_by_name (result)) {
ARDOUR_UI::instance()->popup_error (_("A track already exists with that name."));
return;
}
} else if (type->value() == "send") {
XMLNode n (**niter);
- Send::make_unique (n, _session);
- p.reset (new Send (_session, _route->mute_master(), n));
+ Send::make_unique (n, *_session);
+ p.reset (new Send (*_session, _route->mute_master(), n));
} else if (type->value() == "return") {
XMLNode n (**niter);
- Return::make_unique (n, _session);
- p.reset (new Return (_session, **niter));
+ Return::make_unique (n, *_session);
+ p.reset (new Return (*_session, **niter));
} else {
/* XXX its a bit limiting to assume that everything else
is a plugin.
*/
- p.reset (new PluginInsert (_session, **niter));
+ p.reset (new PluginInsert (*_session, **niter));
}
copies.push_back (p);
if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) {
- if (!_session.engine().connected()) {
+ if (!_session->engine().connected()) {
return;
}
} else if ((retrn = boost::dynamic_pointer_cast<Return> (processor)) != 0) {
- if (!_session.engine().connected()) {
+ if (!_session->engine().connected()) {
return;
}
} else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (processor)) != 0) {
- if (!_session.engine().connected()) {
+ if (!_session->engine().connected()) {
MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible"));
msg.run ();
return;
PortInsertWindow *io_selector;
if (port_insert->get_gui() == 0) {
- io_selector = new PortInsertWindow (&_session, port_insert);
+ io_selector = new PortInsertWindow (_session, port_insert);
port_insert->set_gui (io_selector);
} else {
#ifndef __ardour_gtk_processor_box__
#define __ardour_gtk_processor_box__
+#include <cmath>
#include <vector>
-#include <cmath>
+#include <boost/function.hpp>
+
#include <gtkmm/box.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/menu.h>
#include <gtkmm2ext/pixfader.h>
#include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
#include "ardour/types.h"
#include "ardour/ardour.h"
#include "ardour/port_insert.h"
#include "ardour/processor.h"
#include "ardour/route.h"
+#include "ardour/session_handle.h"
#include "pbd/fastlog.h"
static Glib::RefPtr<Gdk::Pixbuf> _slider;
};
-class ProcessorBox : public Gtk::HBox, public PluginInterestedObject
+class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARDOUR::SessionHandlePtr
{
public:
- ProcessorBox (ARDOUR::Session&, sigc::slot<PluginSelector*> get_plugin_selector,
- RouteRedirectSelection&, MixerStrip* parent, bool owner_is_mixer = false);
+ ProcessorBox (ARDOUR::Session*, boost::function<PluginSelector*()> get_plugin_selector,
+ RouteRedirectSelection&, MixerStrip* parent, bool owner_is_mixer = false);
~ProcessorBox ();
void set_route (boost::shared_ptr<ARDOUR::Route>);
private:
boost::shared_ptr<ARDOUR::Route> _route;
- ARDOUR::Session & _session;
MixerStrip* _parent_strip; // null if in RouteParamsUI
bool _owner_is_mixer;
bool ab_direction;
- std::vector<sigc::connection> connections;
+ PBD::ScopedConnectionList connections;
- sigc::slot<PluginSelector*> _get_plugin_selector;
+ boost::function<PluginSelector*()> _get_plugin_selector;
boost::shared_ptr<ARDOUR::Processor> _processor_being_created;
* of PublicEditor need not be recompiled if private methods or member variables
* change.
*/
-class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway {
+class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
public:
PublicEditor ();
virtual ~PublicEditor ();
/** Attach this editor to a Session.
* @param s Session to connect to.
*/
- virtual void connect_to_session (ARDOUR::Session* s) = 0;
+ virtual void set_session (ARDOUR::Session* s) = 0;
/** @return The Session that we are editing, or 0 */
- virtual ARDOUR::Session* current_session () const = 0;
+ virtual ARDOUR::Session* session () const = 0;
/** Set the snap type.
* @param t Snap type (defined in editing_syms.h)
#ifndef __gtk_ardour_region_edit_h__
#define __gtk_ardour_region_edit_h__
+#include "ardour/session_handle.h"
+
#include "ardour_dialog.h"
namespace ARDOUR { class Session; }
class RegionEditor : public ArdourDialog
{
public:
- RegionEditor(ARDOUR::Session& s)
- : ArdourDialog ("region editor")
- , _session(s)
- {}
+ RegionEditor(ARDOUR::Session* s)
+ : ArdourDialog ("region editor") {
+ set_session (s);
+ }
virtual ~RegionEditor () {}
-
- protected:
- ARDOUR::Session& _session;
};
#endif /* __gtk_ardour_region_edit_h__ */
*/
#include "evoral/Curve.hpp"
-#include "ardour/audioregion.h"
#include "pbd/memento_command.h"
+#include "ardour/audioregion.h"
+#include "ardour/session.h"
+
#include "region_gain_line.h"
#include "audio_region_view.h"
#include "utils.h"
#include "time_axis_view.h"
#include "editor.h"
-#include "ardour/session.h"
-
#include "i18n.h"
using namespace std;
using namespace ARDOUR;
using namespace PBD;
-AudioRegionGainLine::AudioRegionGainLine (const string & name, Session& s, AudioRegionView& r, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> l)
+AudioRegionGainLine::AudioRegionGainLine (const string & name, AudioRegionView& r, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> l)
: AutomationLine (name, r.get_time_axis_view(), parent, l)
- , session (s)
, rv (r)
{
// If this isn't true something is horribly wrong, and we'll get catastrophic gain values
{
AutomationLine::start_drag (cp, x, fraction);
if (!rv.audio_region()->envelope_active()) {
- trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), &rv.audio_region()->get_state(), 0));
+ trackview.session()->add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), &rv.audio_region()->get_state(), 0));
rv.audio_region()->set_envelope_active(false);
}
}
model_representation (cp, mr);
- trackview.editor().current_session()->begin_reversible_command (_("remove control point"));
+ trackview.editor().session()->begin_reversible_command (_("remove control point"));
XMLNode &before = alist->get_state();
if (!rv.audio_region()->envelope_active()) {
XMLNode ®ion_before = rv.audio_region()->get_state();
rv.audio_region()->set_envelope_active(true);
XMLNode ®ion_after = rv.audio_region()->get_state();
- trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), ®ion_before, ®ion_after));
+ trackview.session()->add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), ®ion_before, ®ion_after));
}
alist->erase (mr.start, mr.end);
- trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
- trackview.editor().current_session()->commit_reversible_command ();
- trackview.editor().current_session()->set_dirty ();
+ trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
+ trackview.editor().session()->commit_reversible_command ();
+ trackview.editor().session()->set_dirty ();
}
void
{
if (!rv.audio_region()->envelope_active()) {
rv.audio_region()->set_envelope_active(true);
- trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), 0, &rv.audio_region()->get_state()));
+ trackview.session()->add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), 0, &rv.audio_region()->get_state()));
}
AutomationLine::end_drag(cp);
#define __ardour_gtk_region_gain_line_h__
#include "ardour/ardour.h"
+
#include <libgnomecanvasmm.h>
#include "automation_line.h"
class AudioRegionGainLine : public AutomationLine
{
public:
- AudioRegionGainLine (const std::string & name, ARDOUR::Session&, AudioRegionView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>);
+ AudioRegionGainLine (const std::string & name, AudioRegionView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>);
void start_drag (ControlPoint*, nframes_t x, float fraction);
void end_drag (ControlPoint*);
void remove_point (ControlPoint&);
private:
- ARDOUR::Session& session;
AudioRegionView& rv;
};
*/
RegionSelection::RegionSelection ()
{
- RegionView::RegionViewGoingAway.connect (sigc::mem_fun(*this, &RegionSelection::remove_it));
+ death_connection = RegionView::RegionViewGoingAway.connect (boost::bind (&RegionSelection::remove_it, this, _1));
_current_start = 0;
_current_end = 0;
*/
RegionSelection::RegionSelection (const RegionSelection& other)
: std::list<RegionView*>()
- , sigc::trackable(other)
{
- RegionView::RegionViewGoingAway.connect (sigc::mem_fun(*this, &RegionSelection::remove_it));
+ death_connection = RegionView::RegionViewGoingAway.connect (boost::bind (&RegionSelection::remove_it, this, _1));
_current_start = other._current_start;
_current_end = other._current_end;
#include <set>
#include <list>
-#include <sigc++/signal.h>
+
+#include <boost/signals2.hpp>
+
#include "ardour/types.h"
class RegionView;
/** Class to represent list of selected regions.
*/
-class RegionSelection : public std::list<RegionView*>, public sigc::trackable
+class RegionSelection : public std::list<RegionView*>
{
public:
RegionSelection();
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;
};
#endif /* __ardour_gtk_region_selection_h__ */
static const int32_t sync_mark_width = 9;
-sigc::signal<void,RegionView*> RegionView::RegionViewGoingAway;
+boost::signals2::signal<void(RegionView*)> RegionView::RegionViewGoingAway;
RegionView::RegionView (ArdourCanvas::Group* parent,
TimeAxisView& tv,
void enable_display(bool yn) { _enable_display = yn; }
virtual void update_coverage_frames (LayerDisplay);
- static sigc::signal<void,RegionView*> RegionViewGoingAway;
+ static boost::signals2::signal<void(RegionView*)> RegionViewGoingAway;
protected:
bool in_destructor;
bool wait_for_data;
- sigc::connection data_ready_connection;
+ boost::signals2::scoped_connection data_ready_connection;
std::vector<GhostRegion*> ghosts;
using namespace ARDOUR;
using namespace PBD;
-ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session& se)
- : _return (r)
- , _session (se)
- , _gpm (se, 250)
+ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session* session)
+ :_return (r)
+ , _gpm (session, 250)
{
_gpm.set_controls (boost::shared_ptr<Route>(), r->meter(), r->amp());
_vbox.pack_start (_hbox, false, false, false);
- io = manage (new IOSelector (parent, &se, r->output()));
+ io = manage (new IOSelector (parent, session, r->output()));
pack_start (_vbox, false, false);
}
}
-ReturnUIWindow::ReturnUIWindow (boost::shared_ptr<Return> s, Session& ss)
- : ArdourDialog (string("Ardour: return ") + s->name())
+ReturnUIWindow::ReturnUIWindow (boost::shared_ptr<Return> r, ARDOUR::Session* s)
+ : ArdourDialog (string("Ardour: return ") + r->name())
{
- ui = new ReturnUI (this, s, ss);
+ ui = new ReturnUI (this, r, s);
hpacker.pack_start (*ui, true, true);
set_name ("ReturnUIWindow");
- going_away_connection = s->GoingAway.connect (sigc::mem_fun (*this, &ReturnUIWindow::return_going_away));
+ going_away_connection = r->GoingAway.connect (sigc::mem_fun (*this, &ReturnUIWindow::return_going_away));
signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window *> (this)));
}
ReturnUIWindow::return_going_away ()
{
ENSURE_GUI_THREAD (*this, &ReturnUIWindow::return_going_away)
+ going_away_connection.disconnect ();
delete_when_idle (this);
- going_away_connection.disconnect ();
}
namespace ARDOUR {
class Return;
- class Session;
class IOProcessor;
}
class IOSelector;
-class ReturnUI : public Gtk::HBox
+class ReturnUI : public Gtk::HBox
{
public:
- ReturnUI (Gtk::Window *,boost::shared_ptr<ARDOUR::Return>, ARDOUR::Session&);
+ ReturnUI (Gtk::Window *,boost::shared_ptr<ARDOUR::Return>, ARDOUR::Session*);
~ReturnUI();
void update ();
private:
boost::shared_ptr<ARDOUR::Return> _return;
- ARDOUR::Session& _session;
GainMeter _gpm;
Gtk::VBox _vbox;
Gtk::VBox _hbox;
class ReturnUIWindow : public ArdourDialog
{
public:
- ReturnUIWindow(boost::shared_ptr<ARDOUR::Return>, ARDOUR::Session&);
+ ReturnUIWindow(boost::shared_ptr<ARDOUR::Return>, ARDOUR::Session*);
~ReturnUIWindow();
ReturnUI* ui;
Gtk::HBox hpacker;
void return_going_away ();
- sigc::connection going_away_connection;
+ boost::signals2::scoped_connection going_away_connection;
};
#endif /* __ardour_gtk_return_ui_h__ */
void
RhythmFerret::run_analysis ()
{
- if (!session) {
+ if (!_session) {
return;
}
int
RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readable, nframes64_t offset, AnalysisFeatureList& results)
{
- TransientDetector t (session->frame_rate());
+ TransientDetector t (_session->frame_rate());
for (uint32_t i = 0; i < readable->n_channels(); ++i) {
}
if (!results.empty()) {
- TransientDetector::cleanup_transients (results, session->frame_rate(), trigger_gap_adjustment.get_value());
+ TransientDetector::cleanup_transients (results, _session->frame_rate(), trigger_gap_adjustment.get_value());
}
return 0;
RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, nframes64_t offset, AnalysisFeatureList& results)
{
try {
- OnsetDetector t (session->frame_rate());
+ OnsetDetector t (_session->frame_rate());
for (uint32_t i = 0; i < readable->n_channels(); ++i) {
}
if (!results.empty()) {
- OnsetDetector::cleanup_onsets (results, session->frame_rate(), trigger_gap_adjustment.get_value());
+ OnsetDetector::cleanup_onsets (results, _session->frame_rate(), trigger_gap_adjustment.get_value());
}
return 0;
void
RhythmFerret::do_action ()
{
- if (!session || current_results.empty()) {
+ if (!_session || current_results.empty()) {
return;
}
return;
}
- session->begin_reversible_command (_("split regions (rhythm ferret)"));
+ _session->begin_reversible_command (_("split regions (rhythm ferret)"));
for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ) {
i = tmp;
}
- session->commit_reversible_command ();
+ _session->commit_reversible_command ();
}
void
using namespace Gtk;
using namespace ARDOUR;
-RouteGroupMenu::RouteGroupMenu (Session& s, RouteGroup::Property p)
- : _session (s),
- _default_properties (p)
+RouteGroupMenu::RouteGroupMenu (Session* s, RouteGroup::Property p)
+ : SessionHandlePtr (s)
+ , _default_properties (p)
{
rebuild (0);
}
static_cast<RadioMenuItem*> (&items().back())->set_active ();
}
- _session.foreach_route_group (sigc::bind (sigc::mem_fun (*this, &RouteGroupMenu::add_item), curr, &group));
+ if (_session) {
+ _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &RouteGroupMenu::add_item), curr, &group));
+ }
}
void
void
RouteGroupMenu::new_group ()
{
- RouteGroup* g = new RouteGroup (_session, "", RouteGroup::Active, _default_properties);
+ if (!_session) {
+ return;
+ }
+
+ RouteGroup* g = new RouteGroup (*_session, "", RouteGroup::Active, _default_properties);
RouteGroupDialog d (g, Gtk::Stock::NEW);
int const r = d.do_run ();
if (r == Gtk::RESPONSE_OK) {
- _session.add_route_group (g);
+ _session->add_route_group (g);
set_group (g);
} else {
delete g;
*/
+#ifndef __ardour_gtk_route_group_menu_h__
+#define __ardour_gtk_route_group_menu_h__
+
#include "ardour/route_group.h"
+#include "ardour/session_handle.h"
-namespace ARDOUR {
- class Session;
-}
-class RouteGroupMenu : public Gtk::Menu
+class RouteGroupMenu : public Gtk::Menu, public ARDOUR::SessionHandlePtr
{
public:
- RouteGroupMenu (ARDOUR::Session &, ARDOUR::RouteGroup::Property);
+ RouteGroupMenu (ARDOUR::Session*, ARDOUR::RouteGroup::Property);
void rebuild (ARDOUR::RouteGroup *);
sigc::signal<void, ARDOUR::RouteGroup*> GroupSelected;
-private:
+ private:
void add_item (ARDOUR::RouteGroup *, ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*);
void new_group ();
void set_group (ARDOUR::RouteGroup *);
- ARDOUR::Session& _session;
ARDOUR::RouteGroup::Property _default_properties;
};
+
+#endif /* __ardour_gtk_route_group_menu_h__ */
//route_select_list.rows().back().select ();
- route->NameChanged.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::route_name_changed), route));
- route->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::route_removed), route));
+ scoped_connect (route->NameChanged, boost::bind (&RouteParams_UI::route_name_changed, this, boost::weak_ptr<Route>(route)));
+ scoped_connect (route->GoingAway, boost::bind (&RouteParams_UI::route_removed, this, boost::weak_ptr<Route>(route)));
}
}
void
-RouteParams_UI::route_name_changed (boost::shared_ptr<Route> route)
+RouteParams_UI::route_name_changed (boost::weak_ptr<Route> wr)
{
- ENSURE_GUI_THREAD (*this, &RouteParams_UI::route_name_changed, route)
+ boost::shared_ptr<Route> route (wr.lock());
+
+ if (!route) {
+ return;
+ }
+
+ ENSURE_GUI_THREAD (*this, &RouteParams_UI::route_name_changed, wr)
bool found = false ;
TreeModel::Children rows = route_display_model->children();
void
RouteParams_UI::setup_processor_boxes()
{
- if (session && _route) {
+ if (_session && _route) {
// just in case... shouldn't need this
cleanup_processor_boxes();
// construct new redirect boxes
- insert_box = new ProcessorBox(*session,
- sigc::mem_fun(*this, &RouteParams_UI::plugin_selector), _rr_selection, 0);
+ insert_box = new ProcessorBox (_session, boost::bind (&RouteParams_UI::plugin_selector, this), _rr_selection, 0);
insert_box->set_route (_route);
redir_hpane.pack1 (*insert_box);
latency_packer.remove (*latency_widget);
latency_packer.remove (latency_button_box);
latency_packer.remove (delay_label);
+ latency_connections.drop_connections ();
+ latency_click_connection.disconnect ();
+
delete latency_widget;
latency_widget = 0;
- latency_conn.disconnect ();
- delay_conn.disconnect ();
- latency_apply_conn.disconnect ();
+
}
}
void
RouteParams_UI::setup_latency_frame ()
{
- latency_widget = new LatencyGUI (*(_route->output()), session->frame_rate(), session->engine().frames_per_cycle());
+ latency_widget = new LatencyGUI (*(_route->output()), _session->frame_rate(), _session->engine().frames_per_cycle());
char buf[128];
snprintf (buf, sizeof (buf), _("Playback delay: %u samples"), _route->initial_delay());
latency_packer.pack_start (latency_button_box, false, false);
latency_packer.pack_start (delay_label);
- latency_apply_conn = latency_apply_button.signal_clicked().connect (sigc::mem_fun (*latency_widget, &LatencyGUI::finish));
- latency_conn = _route->signal_latency_changed.connect (sigc::mem_fun (*this, &RouteParams_UI::refresh_latency));
- delay_conn = _route->initial_delay_changed.connect (sigc::mem_fun (*this, &RouteParams_UI::refresh_latency));
+ latency_click_connection = latency_apply_button.signal_clicked().connect (sigc::mem_fun (*latency_widget, &LatencyGUI::finish));
+ latency_connections.add_connection (_route->signal_latency_changed.connect (sigc::mem_fun (*this, &RouteParams_UI::refresh_latency)));
+ latency_connections.add_connection ( _route->initial_delay_changed.connect (sigc::mem_fun (*this, &RouteParams_UI::refresh_latency)));
latency_frame.add (latency_packer);
latency_frame.show_all ();
cleanup_io_frames();
// input
- _input_iosel = new IOSelector (this, session, _route->input());
+ _input_iosel = new IOSelector (this, _session, _route->input());
_input_iosel->setup ();
input_frame.add (*_input_iosel);
input_frame.show_all();
// output
- _output_iosel = new IOSelector (this, session, _route->output());
+ _output_iosel = new IOSelector (this, _session, _route->output());
_output_iosel->setup ();
output_frame.add (*_output_iosel);
output_frame.show_all();
plugui->stop_updating (0);
}
- _plugin_conn.disconnect();
+ _processor_going_away_connection.disconnect ();
redir_hpane.remove(*_active_view);
delete _active_view;
_active_view = 0;
}
void
-RouteParams_UI::route_removed (boost::shared_ptr<Route> route)
+RouteParams_UI::route_removed (boost::weak_ptr<Route> wr)
{
- ENSURE_GUI_THREAD (*this, &RouteParams_UI::route_removed, route)
+ boost::shared_ptr<Route> route (wr.lock());
+
+ if (!route) {
+ return;
+ }
+
+ ENSURE_GUI_THREAD (*this, &RouteParams_UI::route_removed, wr)
TreeModel::Children rows = route_display_model->children();
TreeModel::Children::iterator ri;
RouteParams_UI::set_session (Session *sess)
{
ArdourDialog::set_session (sess);
-
+
route_display_model->clear();
+ _plugin_selector->set_session (_session);
- if (session) {
- boost::shared_ptr<RouteList> r = session->get_routes();
+ if (_session) {
+ boost::shared_ptr<RouteList> r = _session->get_routes();
add_routes (*r);
- session->GoingAway.connect (sigc::mem_fun(*this, &ArdourDialog::session_gone));
- session->RouteAdded.connect (sigc::mem_fun(*this, &RouteParams_UI::add_routes));
+ _session_connections.add_connection (_session->RouteAdded.connect (sigc::mem_fun(*this, &RouteParams_UI::add_routes)));
start_updating ();
} else {
stop_updating ();
}
-
- //route_select_list.thaw ();
-
- _plugin_selector->set_session (session);
}
void
-RouteParams_UI::session_gone ()
+RouteParams_UI::session_going_away ()
{
- ENSURE_GUI_THREAD (*this, &RouteParams_UI::session_gone)
+ ENSURE_GUI_THREAD (*this, &RouteParams_UI::session_going_away);
+
+ SessionHandlePtr::session_going_away ();
route_display_model->clear();
_route.reset ((Route*) 0);
_processor.reset ((Processor*) 0);
update_title();
-
- ArdourDialog::session_gone();
-
}
void
// remove event binding from previously selected
if (_route) {
- _route_conn.disconnect();
- _route_ds_conn.disconnect();
+ _route_processors_connection.disconnect ();
cleanup_processor_boxes();
cleanup_view();
cleanup_io_frames();
setup_processor_boxes();
setup_latency_frame ();
- // sigc::bind to redirects changed event for this route
- _route_conn = route->processors_changed.connect (sigc::mem_fun(*this, &RouteParams_UI::processors_changed));
-
+ _route_processors_connection = route->processors_changed.connect (boost::bind (&RouteParams_UI::processors_changed, this, _1));
+
track_input_label.set_text (_route->name());
update_title();
} else {
// no selection
if (_route) {
- _route_conn.disconnect();
+ _route_processors_connection.disconnect ();
// remove from view
cleanup_io_frames();
}
void
-RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert)
+RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> proc)
{
boost::shared_ptr<Send> send;
boost::shared_ptr<Return> retrn;
boost::shared_ptr<PluginInsert> plugin_insert;
boost::shared_ptr<PortInsert> port_insert;
- if ((send = boost::dynamic_pointer_cast<Send> (insert)) != 0) {
+ if ((send = boost::dynamic_pointer_cast<Send> (proc)) != 0) {
- SendUI *send_ui = new SendUI (this, send, *session);
+ SendUI *send_ui = new SendUI (this, send, _session);
cleanup_view();
- _plugin_conn = send->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::redirect_going_away),
- insert));
+ _processor_going_away_connection = send->GoingAway.connect (boost::bind (&RouteParams_UI::processor_going_away, this,
+ boost::weak_ptr<Processor>(proc)));
+
_active_view = send_ui;
redir_hpane.add2 (*_active_view);
redir_hpane.show_all();
- } else if ((retrn = boost::dynamic_pointer_cast<Return> (insert)) != 0) {
+ } else if ((retrn = boost::dynamic_pointer_cast<Return> (proc)) != 0) {
- ReturnUI *return_ui = new ReturnUI (this, retrn, *session);
+ ReturnUI *return_ui = new ReturnUI (this, retrn, _session);
cleanup_view();
- _plugin_conn = retrn->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::redirect_going_away),
- insert));
+ _processor_going_away_connection = retrn->GoingAway.connect (boost::bind (&RouteParams_UI::processor_going_away, this,
+ boost::weak_ptr<Processor>(proc)));
_active_view = return_ui;
redir_hpane.add2 (*_active_view);
redir_hpane.show_all();
- } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (insert)) != 0) {
+ } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (proc)) != 0) {
GenericPluginUI *plugin_ui = new GenericPluginUI (plugin_insert, true);
cleanup_view();
- _plugin_conn = plugin_insert->plugin()->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::plugin_going_away),
- PreFader));
+ _processor_going_away_connection = plugin_insert->plugin()->GoingAway.connect (boost::bind (&RouteParams_UI::plugin_going_away, this, PreFader));
plugin_ui->start_updating (0);
_active_view = plugin_ui;
redir_hpane.pack2 (*_active_view);
redir_hpane.show_all();
- } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (insert)) != 0) {
+ } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (proc)) != 0) {
- PortInsertUI *portinsert_ui = new PortInsertUI (this, session, port_insert);
+ PortInsertUI *portinsert_ui = new PortInsertUI (this, _session, port_insert);
cleanup_view();
- _plugin_conn = port_insert->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::redirect_going_away),
- insert));
+ _processor_going_away_connection = port_insert->GoingAway.connect (boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor> (proc)));
_active_view = portinsert_ui;
redir_hpane.pack2 (*_active_view);
portinsert_ui->redisplay();
redir_hpane.show_all();
}
- _processor = insert;
-
+ _processor = proc;
update_title();
}
}
void
-RouteParams_UI::redirect_going_away (boost::shared_ptr<ARDOUR::Processor> insert)
-
+RouteParams_UI::processor_going_away (boost::weak_ptr<ARDOUR::Processor> wproc)
{
- ENSURE_GUI_THREAD (*this, &RouteParams_UI::redirect_going_away, insert)
+ boost::shared_ptr<Processor> proc = (wproc.lock());
+
+ if (!proc) {
+ return;
+ }
+
+ ENSURE_GUI_THREAD (*this, &RouteParams_UI::processor_going_away, wproc)
printf ("redirect going away\n");
// delete the current view without calling finish
- if (insert == _processor) {
+ if (proc == _processor) {
cleanup_view (false);
_processor.reset ((Processor*) 0);
}
#include <gtkmm/treeview.h>
#include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
#include "ardour/ardour.h"
class PluginSelector;
-class RouteParams_UI : public ArdourDialog
+class RouteParams_UI : public ArdourDialog, public PBD::ScopedConnectionList
{
public:
RouteParams_UI ();
~RouteParams_UI();
- void set_session (ARDOUR::Session *);
- void session_gone ();
+ void set_session (ARDOUR::Session*);
+ void session_going_away ();
PluginSelector* plugin_selector() { return _plugin_selector; }
private:
Gtk::Button latency_apply_button;
LatencyGUI* latency_widget;
Gtk::Label delay_label;
- sigc::connection latency_conn;
- sigc::connection delay_conn;
- sigc::connection latency_apply_conn;
+
+ PBD::ScopedConnectionList latency_connections;
+ sigc::connection latency_click_connection;
void refresh_latency ();
RouteRedirectSelection _rr_selection;
boost::shared_ptr<ARDOUR::Route> _route;
- sigc::connection _route_conn;
- sigc::connection _route_ds_conn;
+ boost::signals2::scoped_connection _route_processors_connection;
boost::shared_ptr<ARDOUR::Processor> _processor;
- sigc::connection _plugin_conn;
+ boost::signals2::scoped_connection _processor_going_away_connection;
enum ConfigView {
void add_routes (ARDOUR::RouteList&);
- void route_name_changed (boost::shared_ptr<ARDOUR::Route> route);
- void route_removed (boost::shared_ptr<ARDOUR::Route> route);
+ void route_name_changed (boost::weak_ptr<ARDOUR::Route> route);
+ void route_removed (boost::weak_ptr<ARDOUR::Route> route);
void route_selected();
void redirect_selected (boost::shared_ptr<ARDOUR::Processor>);
void plugin_going_away (ARDOUR::Placement);
- void redirect_going_away (boost::shared_ptr<ARDOUR::Processor>);
+ void processor_going_away (boost::weak_ptr<ARDOUR::Processor>);
gint edit_input_configuration (GdkEventButton *ev);
gint edit_output_configuration (GdkEventButton *ev);
#include "ardour/route.h"
#include "route_processor_selection.h"
+#include "gui_thread.h"
#include "i18n.h"
{
if (find (routes.begin(), routes.end(), r) == routes.end()) {
routes.push_back (r);
+ r->GoingAway.connect (boost::bind (&RouteRedirectSelection::removed, this, boost::weak_ptr<Route>(r)));
+ RoutesChanged();
+ }
+}
- // XXX SHAREDPTR FIXME
- // void (RouteRedirectSelection::*pmf)(Route*) = &RouteRedirectSelection::remove;
- // r->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, pmf), r));
+void
+RouteRedirectSelection::removed (boost::weak_ptr<Route> wr)
+{
+ boost::shared_ptr<Route> r (wr.lock());
- RoutesChanged();
+ if (!r) {
+ return;
}
+
+ remove (r);
}
void
RouteRedirectSelection::remove (boost::shared_ptr<Route> r)
{
+ ENSURE_GUI_THREAD (*this, &RouteRedirectSelection::remove, r);
+
list<boost::shared_ptr<Route> >::iterator i;
if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) {
routes.erase (i);
#define __ardour_gtk_route_processor_selection_h__
#include <vector>
-#include <sigc++/signal.h>
+#include "pbd/scoped_connections.h"
#include "processor_selection.h"
#include "route_selection.h"
-class RouteRedirectSelection : public sigc::trackable
+class RouteRedirectSelection : public PBD::ScopedConnectionList, public sigc::trackable
{
public:
ProcessorSelection processors;
void clear_routes ();
bool selected (boost::shared_ptr<ARDOUR::Route>);
+
+ private:
+ void removed (boost::weak_ptr<ARDOUR::Route>);
+
};
bool operator==(const RouteRedirectSelection& a, const RouteRedirectSelection& b);
}
}
-RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
+RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, boost::shared_ptr<Route> rt, Canvas& canvas)
: AxisView(sess)
, RouteUI(rt, sess)
, TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas)
controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
- rec_enable_button->set_sensitive (_session.writable());
+ rec_enable_button->set_sensitive (_session->writable());
}
controls_hbox.pack_start(gm.get_level_meter(), false, false);
RouteTimeAxisView::~RouteTimeAxisView ()
{
- GoingAway (); /* EMIT_SIGNAL */
+ drop_references ();
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
delete *i;
name = resolve_new_group_playlist_name(name, playlists_before_op);
}
- while (_session.playlists->by_name(name)) {
- name = Playlist::bump_name (name, _session);
+ while (_session->playlists->by_name(name)) {
+ name = Playlist::bump_name (name, *_session);
}
// TODO: The prompter "new" button should be de-activated if the user
name = resolve_new_group_playlist_name(name,playlists_before_op);
}
- while (_session.playlists->by_name(name)) {
- name = Playlist::bump_name (name, _session);
+ while (_session->playlists->by_name(name)) {
+ name = Playlist::bump_name (name, *_session);
}
return;
}
- if (!_session.route_name_unique (x)) {
+ if (!_session->route_name_unique (x)) {
ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
name_entry.set_text (_route->name());
- } else if (_session.route_name_internal (x)) {
+ } else if (_session->route_name_internal (x)) {
ARDOUR_UI::instance()->popup_error (_("You cannot create a track with that name as it is reserved for Ardour"));
name_entry.set_text (_route->name());
} else {
case Cut:
if ((what_we_got = playlist->cut (time)) != 0) {
_editor.get_cut_buffer().add (what_we_got);
- _session.add_command( new MementoCommand<Playlist>(*playlist.get(), &before, &playlist->get_state()));
+ _session->add_command( new MementoCommand<Playlist>(*playlist.get(), &before, &playlist->get_state()));
ret = true;
}
break;
case Clear:
if ((what_we_got = playlist->cut (time)) != 0) {
- _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
what_we_got->release ();
ret = true;
}
XMLNode &before = playlist->get_state();
playlist->paste (*p, pos, times);
- _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
return true;
}
boost::shared_ptr<Diskstream> ds = get_diskstream();
RadioMenuItem::Group playlist_group;
- _session.playlists->get (playlists);
+ _session->playlists->get (playlists);
for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
continue;
}
- boost::shared_ptr<Playlist> ipl = session().playlists->by_name(playlist_name);
+ boost::shared_ptr<Playlist> ipl = session()->playlists->by_name(playlist_name);
if (!ipl) {
// No playlist for this track for this take yet, make it
track->diskstream()->use_new_playlist();
class RouteTimeAxisView : public RouteUI, public TimeAxisView
{
public:
- RouteTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
+ RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
virtual ~RouteTimeAxisView ();
void show_selection (TimeSelection&);
#include "ardour/dB.h"
#include "pbd/memento_command.h"
#include "pbd/stacktrace.h"
-#include "pbd/shiva.h"
#include "pbd/controllable.h"
#include "pbd/enumwriter.h"
using namespace ARDOUR;
using namespace PBD;
-RouteUI::RouteUI (ARDOUR::Session& sess)
+RouteUI::RouteUI (ARDOUR::Session* sess)
: AxisView(sess)
{
init ();
}
-RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session& sess)
+RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session* sess)
: AxisView(sess)
{
init ();
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 (sigc::mem_fun(*this, &RouteUI::solo_changed_so_update_mute));
- _session.TransportStateChange.connect (sigc::mem_fun (*this, &RouteUI::check_rec_enable_sensitivity));
+ _session_connections.add_connection (_session->SoloChanged.connect (sigc::mem_fun(*this, &RouteUI::solo_changed_so_update_mute)));
+ _session_connections.add_connection (_session->TransportStateChange.connect (sigc::mem_fun (*this, &RouteUI::check_rec_enable_sensitivity)));
Config->ParameterChanged.connect (sigc::mem_fun (*this, &RouteUI::parameter_changed));
}
void
RouteUI::reset ()
{
- //Remove route connections associated with us.
- for (vector<sigc::connection>::iterator it = connections.begin(); it!=connections.end(); ++it) {
- (*it).disconnect();
- }
-
- connections.clear ();
+ route_going_away_connection.disconnect();
+ connections.drop_connections ();
delete solo_menu;
solo_menu = 0;
denormal_menu_item = 0;
}
+void
+RouteUI::self_delete ()
+{
+ route_going_away_connection.disconnect ();
+ connections.drop_connections ();
+ delete_when_idle (this);
+}
+
void
RouteUI::set_route (boost::shared_ptr<Route> rp)
{
set_color (unique_random_color());
}
- /* no, there is no memory leak here. This object cleans itself (and other stuff)
- up when the route is destroyed.
- */
-
if (self_destruct) {
- new PairedShiva<Route,RouteUI> (*_route, *this);
+ route_going_away_connection = rp->GoingAway.connect (boost::bind (&RouteUI::self_delete, this));
}
mute_button->set_controllable (_route->mute_control());
solo_button->set_controllable (_route->solo_control());
- connections.push_back (_route->active_changed.connect (sigc::mem_fun (*this, &RouteUI::route_active_changed)));
- connections.push_back (_route->mute_changed.connect (sigc::mem_fun(*this, &RouteUI::mute_changed)));
- connections.push_back (_route->solo_changed.connect (sigc::mem_fun(*this, &RouteUI::solo_changed)));
- connections.push_back (_route->listen_changed.connect (sigc::mem_fun(*this, &RouteUI::listen_changed)));
- connections.push_back (_route->solo_isolated_changed.connect (sigc::mem_fun(*this, &RouteUI::solo_changed)));
+ connections.add_connection (_route->active_changed.connect (sigc::mem_fun (*this, &RouteUI::route_active_changed)));
+ connections.add_connection (_route->mute_changed.connect (sigc::mem_fun(*this, &RouteUI::mute_changed)));
+ connections.add_connection (_route->solo_changed.connect (sigc::mem_fun(*this, &RouteUI::solo_changed)));
+ connections.add_connection (_route->listen_changed.connect (sigc::mem_fun(*this, &RouteUI::listen_changed)));
+ connections.add_connection (_route->solo_isolated_changed.connect (sigc::mem_fun(*this, &RouteUI::solo_changed)));
- if (_session.writable() && is_track()) {
+ if (_session->writable() && is_track()) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
- connections.push_back (t->diskstream()->RecordEnableChanged.connect (sigc::mem_fun (*this, &RouteUI::route_rec_enable_changed)));
- connections.push_back (_session.RecordStateChanged.connect (sigc::mem_fun (*this, &RouteUI::session_rec_enable_changed)));
+ connections.add_connection (t->diskstream()->RecordEnableChanged.connect (sigc::mem_fun (*this, &RouteUI::route_rec_enable_changed)));
+ connections.add_connection (_session->RecordStateChanged.connect (sigc::mem_fun (*this, &RouteUI::session_rec_enable_changed)));
rec_enable_button->show();
rec_enable_button->set_controllable (t->rec_enable_control());
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
if (_mute_release) {
- _mute_release->routes = _session.get_routes ();
+ _mute_release->routes = _session->get_routes ();
}
- _session.set_mute (_session.get_routes(), !_route->muted());
+ _session->set_mute (_session->get_routes(), !_route->muted());
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
if (ev->button == 1 && _route->route_group()) {
if (_mute_release) {
- _mute_release->routes = _session.get_routes ();
+ _mute_release->routes = _session->get_routes ();
}
- _session.set_mute (_session.get_routes(), !_route->muted(), Session::rt_cleanup, true);
+ _session->set_mute (_session->get_routes(), !_route->muted(), Session::rt_cleanup, true);
}
} else {
_mute_release->routes = rl;
}
- _session.set_mute (rl, !_route->muted());
+ _session->set_mute (rl, !_route->muted());
}
}
{
if (!ignore_toggle) {
if (_mute_release){
- _session.set_mute (_mute_release->routes, _mute_release->active, Session::rt_cleanup, true);
+ _session->set_mute (_mute_release->routes, _mute_release->active, Session::rt_cleanup, true);
delete _mute_release;
_mute_release = 0;
}
/* Primary-Tertiary-click applies change to all routes */
if (_solo_release) {
- _solo_release->routes = _session.get_routes ();
+ _solo_release->routes = _session->get_routes ();
}
if (Config->get_solo_control_is_listen_control()) {
- _session.set_listen (_session.get_routes(), !_route->listening(), Session::rt_cleanup, true);
+ _session->set_listen (_session->get_routes(), !_route->listening(), Session::rt_cleanup, true);
} else {
- _session.set_solo (_session.get_routes(), !_route->soloed(), Session::rt_cleanup, true);
+ _session->set_solo (_session->get_routes(), !_route->soloed(), Session::rt_cleanup, true);
}
} else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
if (_solo_release) {
_solo_release->exclusive = true;
- boost::shared_ptr<RouteList> routes = _session.get_routes();
+ boost::shared_ptr<RouteList> routes = _session->get_routes();
for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
if ((*i)->soloed ()) {
if (Config->get_solo_control_is_listen_control()) {
/* ??? we need a just_one_listen() method */
} else {
- _session.set_just_one_solo (_route, true);
+ _session->set_just_one_solo (_route, true);
}
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
}
if (Config->get_solo_control_is_listen_control()) {
- _session.set_listen (_route->route_group()->route_list(), !_route->listening(), Session::rt_cleanup, true);
+ _session->set_listen (_route->route_group()->route_list(), !_route->listening(), Session::rt_cleanup, true);
} else {
- _session.set_solo (_route->route_group()->route_list(), !_route->soloed(), Session::rt_cleanup, true);
+ _session->set_solo (_route->route_group()->route_list(), !_route->soloed(), Session::rt_cleanup, true);
}
}
}
if (Config->get_solo_control_is_listen_control()) {
- _session.set_listen (rl, !_route->listening());
+ _session->set_listen (rl, !_route->listening());
} else {
- _session.set_solo (rl, !_route->soloed());
+ _session->set_solo (rl, !_route->soloed());
}
}
}
if (_solo_release->exclusive) {
} else {
- _session.set_solo (_solo_release->routes, _solo_release->active, Session::rt_cleanup, true);
+ _session->set_solo (_solo_release->routes, _solo_release->active, Session::rt_cleanup, true);
}
delete _solo_release;
return true;
}
- if (!_session.engine().connected()) {
+ if (!_session->engine().connected()) {
MessageDialog msg (_("Not connected to JACK - cannot engage record"));
msg.run ();
return true;
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
- _session.set_record_enable (_session.get_routes(), !rec_enable_button->get_active());
+ _session->set_record_enable (_session->get_routes(), !rec_enable_button->get_active());
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
NOTE: Primary-button2 is MIDI learn.
*/
if (ev->button == 1 && _route->route_group()) {
- _session.set_record_enable (_route->route_group()->route_list(), !rec_enable_button->get_active(), Session::rt_cleanup, true);
+ _session->set_record_enable (_route->route_group()->route_list(), !rec_enable_button->get_active(), Session::rt_cleanup, true);
}
} else if (Keyboard::is_context_menu_event (ev)) {
boost::shared_ptr<RouteList> rl (new RouteList);
rl->push_back (route());
- _session.set_record_enable (rl, !rec_enable_button->get_active());
+ _session->set_record_enable (rl, !rec_enable_button->get_active());
}
}
void
RouteUI::create_sends (Placement p)
{
- _session.globally_add_internal_sends (_route, p);
+ _session->globally_add_internal_sends (_route, p);
}
void
}
}
- _session.add_internal_sends (_route, p, rlist);
+ _session->add_internal_sends (_route, p, rlist);
}
void
RouteUI::set_sends_gain_from_track ()
{
- _session.globally_set_send_gains_from_track (_route);
+ _session->globally_set_send_gains_from_track (_route);
}
void
RouteUI::set_sends_gain_to_zero ()
{
- _session.globally_set_send_gains_to_zero (_route);
+ _session->globally_set_send_gains_to_zero (_route);
}
void
RouteUI::set_sends_gain_to_unity ()
{
- _session.globally_set_send_gains_to_unity (_route);
+ _session->globally_set_send_gains_to_unity (_route);
}
bool
}
int
-RouteUI::mute_visual_state (Session& s, boost::shared_ptr<Route> r)
+RouteUI::mute_visual_state (Session* s, boost::shared_ptr<Route> r)
{
if (r->is_master() || r->is_control()) {
return 0;
if (r->muted ()) {
/* full mute */
return 2;
- } else if (s.soloing() && !r->soloed() && !r->solo_isolated()) {
+ } else if (s->soloing() && !r->soloed() && !r->solo_isolated()) {
/* mute-because-not-soloed */
return 1;
} else {
if (model) {
- switch (_session.record_status ()) {
+ switch (_session->record_status ()) {
case Session::Recording:
rec_enable_button->set_visual_state (1);
break;
gint
RouteUI::idle_remove_this_route (RouteUI *rui)
{
- rui->_session.remove_route (rui->_route);
+ rui->_session->remove_route (rui->_route);
return false;
}
void
RouteUI::adjust_latency ()
{
- LatencyDialog dialog (_route->name() + _(" latency"), *(_route->output()), _session.frame_rate(), _session.engine().frames_per_cycle());
+ LatencyDialog dialog (_route->name() + _(" latency"), *(_route->output()), _session->frame_rate(), _session->engine().frames_per_cycle());
}
void
void
RouteUI::check_rec_enable_sensitivity ()
{
- if (_session.transport_rolling() && rec_enable_button->get_active() && Config->get_disable_disarm_during_roll()) {
+ if (_session->transport_rolling() && rec_enable_button->get_active() && Config->get_disable_disarm_during_roll()) {
rec_enable_button->set_sensitive (false);
} else {
rec_enable_button->set_sensitive (true);
{
ArdourDialog dialog (_("Remote Control ID"));
- uint32_t const limit = _session.ntracks() + _session.nbusses () + 4;
+ uint32_t const limit = _session->ntracks() + _session->nbusses () + 4;
HBox* hbox = manage (new HBox);
hbox->set_spacing (6);
#include <list>
#include "pbd/xml++.h"
+#include "pbd/scoped_connections.h"
+
#include "ardour/ardour.h"
#include "ardour/mute_master.h"
#include "ardour/session_event.h"
class RouteUI : public virtual AxisView
{
public:
- RouteUI(ARDOUR::Session&);
- RouteUI(boost::shared_ptr<ARDOUR::Route>, ARDOUR::Session&);
+ RouteUI(ARDOUR::Session*);
+ RouteUI(boost::shared_ptr<ARDOUR::Route>, ARDOUR::Session*);
virtual ~RouteUI();
static int solo_visual_state (boost::shared_ptr<ARDOUR::Route>);
static int solo_visual_state_with_isolate (boost::shared_ptr<ARDOUR::Route>);
static int solo_isolate_visual_state (boost::shared_ptr<ARDOUR::Route>);
- static int mute_visual_state (ARDOUR::Session &, boost::shared_ptr<ARDOUR::Route>);
+ static int mute_visual_state (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>);
protected:
- std::vector<sigc::connection> connections;
+ PBD::ScopedConnectionList connections;
+ boost::signals2::scoped_connection route_going_away_connection;
bool self_destruct;
void init ();
void reset ();
void queue_route_group_op (ARDOUR::RouteGroup::Property prop, void (ARDOUR::Session::*session_method)(boost::shared_ptr<ARDOUR::RouteList>, bool), bool yn);
+ void self_delete ();
private:
void check_rec_enable_sensitivity ();
SoloMuteRelease* _solo_release;
SoloMuteRelease* _mute_release;
+
};
#endif /* __ardour_route_ui__ */
}
};
+#if 0
Selection&
Selection::operator= (const Selection& other)
{
}
return *this;
}
+#endif
bool
operator== (const Selection& a, const Selection& b)
if ((i = find (tracks.begin(), tracks.end(), track)) == tracks.end()) {
void (Selection::*pmf)(TimeAxisView*) = &Selection::remove;
- track->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, pmf), track));
+ track->GoingAway.connect (boost::bind (pmf, this, track));
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 (sigc::bind (sigc::mem_fun (*this, pmf), (*i)));
+ scoped_connect ((*i)->GoingAway, boost::bind (pmf, this, (*i)));
}
if (!added.empty()) {
void (Selection::*pmf)(Marker*) = &Selection::remove;
- m->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, pmf), m));
+ scoped_connect (m->GoingAway, boost::bind (pmf, this, m));
markers.push_back (m);
MarkersChanged();
#include <sigc++/signal.h>
+#include "pbd/scoped_connections.h"
+
#include "time_selection.h"
#include "region_selection.h"
#include "track_selection.h"
/** The Selection class holds lists of selected items (tracks, regions, etc. etc.). */
-class Selection : public sigc::trackable
+class Selection : public sigc::trackable, public PBD::ScopedConnectionList
{
public:
enum SelectionType {
clear();
}
- Selection& operator= (const Selection& other);
+ // Selection& operator= (const Selection& other);
sigc::signal<void> RegionsChanged;
sigc::signal<void> TracksChanged;
template<class A> void foreach_region (void (ARDOUR::Region::*method)(A), A arg);
private:
+ Selection (const Selection& other) {}
PublicEditor const * editor;
uint32_t next_time_id;
-
+
void add (std::vector<AutomationSelectable*>&);
};
using namespace ARDOUR;
using namespace PBD;
-SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se)
+SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session)
: _send (s)
- , _session (se)
- , _gpm (se, 250)
- , _panners (se)
+ , _gpm (session, 250)
+ , _panners (session)
{
_panners.set_panner (s->panner());
_gpm.set_controls (boost::shared_ptr<Route>(), s->meter(), s->amp());
_vbox.pack_start (_hbox, false, false, false);
_vbox.pack_start (_panners, false, false);
- io = manage (new IOSelector (parent, &se, s->output()));
+ io = manage (new IOSelector (parent, session, s->output()));
pack_start (_vbox, false, false);
}
}
-SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss)
+SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session* session)
: ArdourDialog (string("Ardour: send ") + s->name())
{
- ui = new SendUI (this, s, ss);
+ ui = new SendUI (this, s, session);
hpacker.pack_start (*ui, true, true);
set_name ("SendUIWindow");
- going_away_connection = s->GoingAway.connect (
- sigc::mem_fun (*this, &SendUIWindow::send_going_away));
+ going_away_connection = s->GoingAway.connect (sigc::mem_fun (*this, &SendUIWindow::send_going_away));
signal_delete_event().connect (sigc::bind (
sigc::ptr_fun (just_hide_it),
SendUIWindow::send_going_away ()
{
ENSURE_GUI_THREAD (*this, &SendUIWindow::send_going_away)
- delete_when_idle (this);
going_away_connection.disconnect ();
+ delete_when_idle (this);
}
namespace ARDOUR {
class Send;
- class Session;
class IOProcessor;
}
class SendUI : public Gtk::HBox
{
public:
- SendUI (Gtk::Window *, boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session&);
+ SendUI (Gtk::Window *, boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session*);
~SendUI();
void update ();
private:
boost::shared_ptr<ARDOUR::Send> _send;
- ARDOUR::Session& _session;
GainMeter _gpm;
PannerUI _panners;
Gtk::VBox _vbox;
class SendUIWindow : public ArdourDialog
{
public:
- SendUIWindow(boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session&);
+ SendUIWindow(boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session*);
~SendUIWindow();
SendUI* ui;
Gtk::HBox hpacker;
void send_going_away ();
- sigc::connection going_away_connection;
+ boost::signals2::scoped_connection going_away_connection;
};
#endif /* __ardour_gtk_send_ui_h__ */
using namespace std;
using namespace ARDOUR;
-SessionImportDialog::SessionImportDialog (ARDOUR::Session & target) :
+SessionImportDialog::SessionImportDialog (ARDOUR::Session* target) :
ArdourDialog (_("Import from session")),
- target (target),
file_browse_button (_("Browse"))
{
+ set_session (target);
+
// File entry
file_entry.set_name ("ImportFileNameEntry");
file_entry.set_text ("/");
void
SessionImportDialog::load_session (const string& filename)
{
- tree.read (filename);
- boost::shared_ptr<AudioRegionImportHandler> region_handler (new AudioRegionImportHandler (tree, target));
- boost::shared_ptr<AudioPlaylistImportHandler> pl_handler (new AudioPlaylistImportHandler (tree, target, *region_handler));
-
- handlers.push_back (boost::static_pointer_cast<ElementImportHandler> (region_handler));
- handlers.push_back (boost::static_pointer_cast<ElementImportHandler> (pl_handler));
- handlers.push_back (HandlerPtr(new UnusedAudioPlaylistImportHandler (tree, target, *region_handler)));
- handlers.push_back (HandlerPtr(new AudioTrackImportHandler (tree, target, *pl_handler)));
- handlers.push_back (HandlerPtr(new LocationImportHandler (tree, target)));
- handlers.push_back (HandlerPtr(new TempoMapImportHandler (tree, target)));
-
- fill_list();
-
- if (ElementImportHandler::dirty()) {
- // Warn user
- string txt = _("Some elements had errors in them. Please see the log for details");
- Gtk::MessageDialog msg (txt, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true);
- msg.run();
+ if (_session) {
+ tree.read (filename);
+ boost::shared_ptr<AudioRegionImportHandler> region_handler (new AudioRegionImportHandler (tree, *_session));
+ boost::shared_ptr<AudioPlaylistImportHandler> pl_handler (new AudioPlaylistImportHandler (tree, *_session, *region_handler));
+
+ handlers.push_back (boost::static_pointer_cast<ElementImportHandler> (region_handler));
+ handlers.push_back (boost::static_pointer_cast<ElementImportHandler> (pl_handler));
+ handlers.push_back (HandlerPtr(new UnusedAudioPlaylistImportHandler (tree, *_session, *region_handler)));
+ handlers.push_back (HandlerPtr(new AudioTrackImportHandler (tree, *_session, *pl_handler)));
+ handlers.push_back (HandlerPtr(new LocationImportHandler (tree, *_session)));
+ handlers.push_back (HandlerPtr(new TempoMapImportHandler (tree, *_session)));
+
+ fill_list();
+
+ if (ElementImportHandler::dirty()) {
+ // Warn user
+ string txt = _("Some elements had errors in them. Please see the log for details");
+ Gtk::MessageDialog msg (txt, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true);
+ msg.run();
+ }
}
}
typedef std::list<ElementPtr> ElementList;
public:
- SessionImportDialog (ARDOUR::Session & target);
+ SessionImportDialog (ARDOUR::Session* target);
virtual Gtk::FileChooserAction browse_action() const { return Gtk::FILE_CHOOSER_ACTION_OPEN; }
// Data
HandlerList handlers;
XMLTree tree;
- ARDOUR::Session ⌖
// GUI
Gtk::Frame file_frame;
SessionMetadataSet::SessionMetadataSet (ustring const & name) :
name (name)
{
- session = 0;
}
void
void
SessionMetadataSetEditable::set_session (ARDOUR::Session * s)
{
- session = s;
+ SessionHandlePtr::set_session (s);
- ARDOUR::SessionMetadata const & data = session->metadata();
+ if (!_session) {
+ return;
+ }
+
+ ARDOUR::SessionMetadata const & data = _session->metadata();
table.resize (list.size(), 2);
uint32_t row = 0;
void
SessionMetadataSetEditable::save_data ()
{
- ARDOUR::SessionMetadata & data = session->metadata();
+ ARDOUR::SessionMetadata & data = _session->metadata();
for (DataList::const_iterator it = list.begin(); it != list.end(); ++it) {
(*it)->save_data(data);
}
tree_view.append_column (*viewcol);
select_all_check.signal_toggled().connect (sigc::mem_fun(*this, &SessionMetadataSetImportable::select_all));
-
- session = 0;
}
Gtk::Widget &
void
SessionMetadataSetImportable::load_extra_data (ARDOUR::SessionMetadata const & data)
{
- if (!session) {
+ if (!_session) {
std::cerr << "Programming error: no session set for SessionMetaDataSetImportable (in load_data)!" << std::endl;
return;
}
- ARDOUR::SessionMetadata & session_data = session->metadata();
+ ARDOUR::SessionMetadata & session_data = _session->metadata();
MetadataPtr session_field;
MetadataPtr import_field;
void
SessionMetadataSetImportable::save_data ()
{
- if (!session) {
+ if (!_session) {
std::cerr << "Programming error: no session set for SessionMetaDataSetImportable (in import_data)!" << std::endl;
return;
}
- ARDOUR::SessionMetadata & session_data = session->metadata();
+ ARDOUR::SessionMetadata & session_data = _session->metadata();
Gtk::TreeModel::Children fields = tree->children();
Gtk::TreeModel::Children::iterator it;
void
SessionMetadataDialog<DataSet>::init_data ()
{
- if (!session) {
+ if (!_session) {
std::cerr << "Programming error: no session set for SessionMetaDataDialog (in init_data)!" << std::endl;
return;
}
init_people_data ();
for (DataSetList::iterator it = data_list.begin(); it != data_list.end(); ++it) {
- (*it)->set_session (session);
+ (*it)->set_session (_session);
notebook.append_page ((*it)->get_widget(), (*it)->get_tab_widget());
}
void
SessionMetadataImporter::run ()
{
- if (!session) {
+ if (!_session) {
std::cerr << "Programming error: no session set for SessionMetaDataImporter (in run)!" << std::endl;
return;
}
};
/// Interface for MetadataFields
-class SessionMetadataSet {
+class SessionMetadataSet : public ARDOUR::SessionHandlePtr {
public:
SessionMetadataSet (Glib::ustring const & name);
virtual ~SessionMetadataSet () {};
void add_data_field (MetadataPtr field);
- /// Sets session, into which the data is eventually saved
- virtual void set_session (ARDOUR::Session * s) { session = s; }
/// allows loading extra data into data sets (for importing etc.)
virtual void load_extra_data (ARDOUR::SessionMetadata const & /*data*/) { }
/// Saves data to session
typedef std::list<MetadataPtr> DataList;
DataList list;
Glib::ustring name;
- ARDOUR::Session *session;
};
/// Contains MetadataFields for editing
}
SoundFileBox::SoundFileBox (bool persistent)
- : _session(0),
- table (6, 2),
+ : table (6, 2),
length_clock ("sfboxLengthClock", !persistent, "EditCursorClock", false, false, true, false),
timecode_clock ("sfboxTimecodeClock", !persistent, "EditCursorClock", false, false, false, false),
main_box (false, 6),
void
SoundFileBox::set_session(Session* s)
{
- _session = s;
+ SessionHandlePtr::set_session (s);
+
+ length_clock.set_session (s);
+ timecode_clock.set_session (s);
if (!_session) {
play_btn.set_sensitive (false);
stop_btn.set_sensitive (false);
}
-
-
- length_clock.set_session (s);
- timecode_clock.set_session (s);
}
bool
{
ArdourDialog::set_session (s);
preview.set_session (s);
- if (s) {
+
+ if (_session) {
add_gain_meter ();
} else {
remove_gain_meter ();
{
delete gm;
- gm = new GainMeter (*session, 250);
+ gm = new GainMeter (_session, 250);
- boost::shared_ptr<Route> r = session->the_auditioner ();
+ boost::shared_ptr<Route> r = _session->the_auditioner ();
gm->set_controls (r, r->shared_peak_meter(), r->amp());
void
SoundFileBrowser::meter ()
{
- if (is_mapped () && session && gm) {
+ if (is_mapped () && _session && gm) {
gm->update_meters ();
}
}
bool same_size;
bool src_needed;
bool selection_includes_multichannel;
- bool selection_can_be_embedded_with_links = check_link_status (*session, paths);
+ bool selection_can_be_embedded_with_links = check_link_status (_session, paths);
ImportMode mode;
if (check_info (paths, same_size, src_needed, selection_includes_multichannel)) {
}
}
- if ((nframes_t) info.samplerate != session->frame_rate()) {
+ if ((nframes_t) info.samplerate != _session->frame_rate()) {
src_needed = true;
}
bool
-SoundFileOmega::check_link_status (const Session& s, const vector<ustring>& paths)
+SoundFileOmega::check_link_status (const Session* s, const vector<ustring>& paths)
{
- sys::path path = s.session_directory().sound_path() / "linktest";
+ sys::path path = s->session_directory().sound_path() / "linktest";
string tmpdir = path.to_string();
bool ret = false;
ArdourDialog::on_hide();
stop_metering ();
- if (session) {
- session->cancel_audition();
+ if (_session) {
+ _session->cancel_audition();
}
}
SoundFileOmega::on_hide ()
{
ArdourDialog::on_hide();
- if (session) {
- session->cancel_audition();
+ if (_session) {
+ _session->cancel_audition();
}
}
#include <gtkmm/textview.h>
#include "ardour/audiofilesource.h"
+#include "ardour/session_handle.h"
#include "ardour_dialog.h"
#include "editing.h"
class GainMeter;
-class SoundFileBox : public Gtk::VBox
+class SoundFileBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
SoundFileBox (bool persistent);
bool autoplay () const;
protected:
- ARDOUR::Session* _session;
Glib::ustring path;
ARDOUR::SoundFileInfo sf_info;
bool check_info (const std::vector<Glib::ustring>& paths,
bool& same_size, bool& src_needed, bool& multichannel);
- static bool check_link_status (const ARDOUR::Session&, const std::vector<Glib::ustring>& paths);
+ static bool check_link_status (const ARDOUR::Session*, const std::vector<Glib::ustring>& paths);
void file_selection_changed ();
bool reset_options ();
canvas_rect, &_trackview));
if (_trackview.is_track()) {
- _trackview.track()->DiskstreamChanged.connect (
- sigc::mem_fun (*this, &StreamView::diskstream_changed));
- _trackview.session().TransportStateChange.connect (
- sigc::mem_fun (*this, &StreamView::transport_changed));
- _trackview.session().TransportLooped.connect (
- sigc::mem_fun (*this, &StreamView::transport_looped));
- _trackview.get_diskstream()->RecordEnableChanged.connect (
- sigc::mem_fun (*this, &StreamView::rec_enable_changed));
- _trackview.session().RecordStateChanged.connect (
- sigc::mem_fun (*this, &StreamView::sess_rec_enable_changed));
+ scoped_connect (_trackview.track()->DiskstreamChanged, boost::bind (&StreamView::diskstream_changed, this));
+ scoped_connect (_trackview.get_diskstream()->RecordEnableChanged, boost::bind (&StreamView::rec_enable_changed, this));
+
+ scoped_connect (_trackview.session()->TransportStateChange, boost::bind (&StreamView::transport_changed, this));
+ scoped_connect (_trackview.session()->TransportLooped, boost::bind (&StreamView::transport_looped, this));
+ scoped_connect (_trackview.session()->RecordStateChanged, boost::bind (&StreamView::sess_rec_enable_changed, this));
}
ColorsChanged.connect (sigc::mem_fun (*this, &StreamView::color_handler));
StreamView::~StreamView ()
{
+ cerr << "Streamview " << _trackview.name() << " deleted\n";
+
undisplay_diskstream ();
delete canvas_rect;
if (((*i)->region()) == r) {
RegionView* rv = *i;
region_views.erase (i);
+ cerr << "Deleting RV for " << r->name() << " @ " << r << endl;
delete rv;
break;
}
{
playlist_change_connection.disconnect();
playlist_changed (ds);
- playlist_change_connection = ds->PlaylistChanged.connect (
- sigc::bind (sigc::mem_fun (*this, &StreamView::playlist_changed_weak),
- boost::weak_ptr<Diskstream> (ds)));
+ playlist_change_connection = ds->PlaylistChanged.connect (boost::bind (&StreamView::playlist_changed_weak, this, boost::weak_ptr<Diskstream> (ds)));
}
void
/* disconnect from old playlist */
- for (vector<sigc::connection>::iterator i = playlist_connections.begin();
- i != playlist_connections.end(); ++i) {
- (*i).disconnect();
- }
-
- playlist_connections.clear();
+ playlist_connections.drop_connections ();
undisplay_diskstream ();
/* update layers count and the y positions and heights of our regions */
/* catch changes */
- playlist_connections.push_back (ds->playlist()->Modified.connect (sigc::bind (
- sigc::mem_fun (*this, &StreamView::playlist_modified_weak), ds)));
-
- playlist_connections.push_back (ds->playlist()->RegionAdded.connect (
- sigc::mem_fun (*this, &StreamView::add_region_view_weak)));
-
- playlist_connections.push_back (ds->playlist()->RegionRemoved.connect (
- sigc::mem_fun (*this, &StreamView::remove_region_view)));
+ playlist_connections.add_connection (ds->playlist()->Modified.connect (boost::bind (&StreamView::playlist_modified_weak, this, ds)));
+ playlist_connections.add_connection (ds->playlist()->RegionAdded.connect (boost::bind (&StreamView::add_region_view_weak, this, _1)));
+ playlist_connections.add_connection (ds->playlist()->RegionRemoved.connect (boost::bind (&StreamView::remove_region_view, this, _1)));
}
void
#include <list>
#include <cmath>
+#include "pbd/scoped_connections.h"
+
#include "ardour/location.h"
#include "enums.h"
#include "simplerect.h"
class CrossfadeView;
class Selection;
-class StreamView : public sigc::trackable
+class StreamView : public sigc::trackable, public PBD::ScopedConnectionList
{
public:
virtual ~StreamView ();
Gdk::Color region_color; ///< Contained region color
uint32_t stream_base_color; ///< Background color
- std::vector<sigc::connection> playlist_connections;
- sigc::connection playlist_change_connection;
+ PBD::ScopedConnectionList playlist_connections;
+ boost::signals2::scoped_connection playlist_change_connection;
ARDOUR::layer_t _layers;
LayerDisplay _layer_display;
double height;
- std::list<sigc::connection> rec_data_ready_connections;
- nframes_t last_rec_data_frame;
+ PBD::ScopedConnectionList rec_data_ready_connections;
+ nframes_t last_rec_data_frame;
private:
void update_coverage_frames ();
int n = 0;
for (std::list<Wave>::iterator i = _waves.begin(); i != _waves.end(); ++i) {
- if (i->region->audio_source(0)->peaks_ready (sigc::mem_fun (*this, &StripSilenceDialog::peaks_ready), _peaks_ready_connection)) {
+ if (i->region->audio_source(0)->peaks_ready (boost::bind (&StripSilenceDialog::peaks_ready, this), _peaks_ready_connection)) {
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;
- sigc::connection _peaks_ready_connection;
+ boost::signals2::scoped_connection _peaks_ready_connection;
};
bool TimeAxisView::need_size_info = true;
int const TimeAxisView::_max_order = 512;
-TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/)
+TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/)
: AxisView (sess),
controls_table (2, 8),
_y_position (0),
if(gr) {
ghosts.push_back(gr);
- gr->GoingAway.connect (sigc::mem_fun(*this, &TimeAxisView::erase_ghost));
+ scoped_connect (gr->GoingAway, boost::bind (&TimeAxisView::erase_ghost, this, _1));
}
}
#include <gtkmm2ext/focus_entry.h>
#include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
#include "ardour/types.h"
#include "ardour/region.h"
static uint32_t hSmaller;
static uint32_t hSmall;
- TimeAxisView(ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* parent, ArdourCanvas::Canvas& canvas);
+ TimeAxisView(ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* parent, ArdourCanvas::Canvas& canvas);
virtual ~TimeAxisView ();
XMLNode& get_state ();
#include <libgnomecanvasmm/pixbuf.h>
+#include "pbd/scoped_connections.h"
+
#include "selectable.h"
#include "simplerect.h"
#include "canvas.h"
* A base class for 'items' that may appear upon a TimeAxisView
*
*/
-class TimeAxisViewItem : public Selectable
+class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
{
public:
virtual ~TimeAxisViewItem() ;
* @param sess the current session
* @param canvas the parent canvas object
*/
-VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Session& sess, Canvas& canvas)
+VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Session* sess, Canvas& canvas)
: AxisView(sess),
TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas),
visual_button (_("v")),
* @param sess the current session
* @param canvas the parent canvas object
*/
- VisualTimeAxis(const std::string & name, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas) ;
+ VisualTimeAxis(const std::string & name, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) ;
//---------------------------------------------------------------------------------------//
#include <limits.h>
#include <signal.h>
+#include <boost/signals2.hpp>
+
#include "pbd/error.h"
#include "pbd/failed_constructor.h"
#include "pbd/locale_guard.h"
class AudioEngine;
static const nframes_t max_frames = JACK_MAX_FRAMES;
- extern sigc::signal<void,std::string> BootMessage;
+ extern boost::signals2::signal<void(std::string)> BootMessage;
int init (bool with_vst, bool try_optimization);
void init_post_engine ();
#ifndef __ardour_audio_diskstream_h__
#define __ardour_audio_diskstream_h__
-#include <sigc++/signal.h>
#include <cmath>
#include <string>
#include <exception>
#include <string>
-#include <sigc++/signal.h>
#include <glibmm/thread.h>
#include "pbd/rcu.h"
+#include "pbd/scoped_connections.h"
#include "ardour/ardour.h"
#include <jack/jack.h>
#include <jack/transport.h>
-#include "ardour/types.h"
+
#include "ardour/data_type.h"
+#include "ardour/session_handle.h"
+#include "ardour/types.h"
namespace ARDOUR {
class Port;
class Session;
-class AudioEngine : public sigc::trackable
+class AudioEngine : public SessionHandlePtr
{
public:
typedef std::set<Port*> Ports;
}
void set_session (Session *);
- void remove_session ();
+ void remove_session (); // not a replacement for SessionHandle::session_going_away()
class PortRegistrationFailure : public std::exception {
public:
_ the regular process() call to session->process() is not made.
*/
- sigc::signal<int,nframes_t> Freewheel;
+ boost::signals2::signal<int(nframes_t)> Freewheel;
- sigc::signal<void> Xrun;
+ boost::signals2::signal<void()> Xrun;
/* this signal is if JACK notifies us of a graph order event */
- sigc::signal<void> GraphReordered;
+ boost::signals2::signal<void()> GraphReordered;
/* this signal is emitted if the sample rate changes */
- sigc::signal<void,nframes_t> SampleRateChanged;
+ boost::signals2::signal<void(nframes_t)> SampleRateChanged;
/* this signal is sent if JACK ever disconnects us */
- sigc::signal<void> Halted;
+ boost::signals2::signal<void()> Halted;
/* these two are emitted when the engine itself is
started and stopped
*/
- sigc::signal<void> Running;
- sigc::signal<void> Stopped;
+ boost::signals2::signal<void()> Running;
+ boost::signals2::signal<void()> Stopped;
/* this signal is emitted if a JACK port is registered or unregistered */
- sigc::signal<void> PortRegisteredOrUnregistered;
+ boost::signals2::signal<void()> PortRegisteredOrUnregistered;
std::string make_port_name_relative (std::string);
std::string make_port_name_non_relative (std::string);
private:
static AudioEngine* _instance;
- ARDOUR::Session* session;
jack_client_t* volatile _jack; /* could be reset to null by SIGPIPE or another thread */
std::string jack_client_name;
Glib::Mutex _process_lock;
bool _freewheeling;
bool _freewheel_pending;
bool _freewheel_thread_registered;
- sigc::slot<int,nframes_t> freewheel_action;
+ boost::function<int(nframes_t)> freewheel_action;
bool reconnect_on_halt;
int _usecs_per_cycle;
static void set_bwf_serial_number (int);
static void set_header_position_offset (nframes_t offset );
- static sigc::signal<void> HeaderPositionOffsetChanged;
+ static boost::signals2::signal<void()> HeaderPositionOffsetChanged;
protected:
/** Constructor to be called for existing external-to-session files */
int set_state (const XMLNode&, int version);
- sigc::signal<void,boost::shared_ptr<Crossfade> > NewCrossfade;
-
- void foreach_crossfade (sigc::slot<void, boost::shared_ptr<Crossfade> >);
+ boost::signals2::signal<void(boost::shared_ptr<Crossfade>)> NewCrossfade;
+
+ void foreach_crossfade (boost::function<void (boost::shared_ptr<Crossfade>)>);
void crossfades_at (nframes_t frame, Crossfades&);
bool destroy_region (boost::shared_ptr<Region>);
#include <glibmm/thread.h>
#include <glibmm/ustring.h>
-
-#include <sigc++/signal.h>
+#include <boost/function.hpp>
#include "ardour/source.h"
#include "ardour/ardour.h"
sframes_t start, nframes_t cnt, double samples_per_visual_peak) const;
int build_peaks ();
- bool peaks_ready (sigc::slot<void>, sigc::connection&) const;
+ bool peaks_ready (boost::function<void()> callWhenReady, boost::signals2::connection& connection_established_if_not_ready) const;
- mutable sigc::signal<void> PeaksReady;
- mutable sigc::signal<void,nframes_t,nframes_t> PeakRangeReady;
+ mutable boost::signals2::signal<void()> PeaksReady;
+ mutable boost::signals2::signal<void(nframes_t,nframes_t)> PeakRangeReady;
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
#include <list>
#include <cmath>
-#include <sigc++/signal.h>
#include <glibmm/thread.h>
#include "pbd/undo.h"
void set_automation_state (AutoState);
AutoState automation_state() const { return _state; }
- sigc::signal<void> automation_state_changed;
+ boost::signals2::signal<void()> automation_state_changed;
void set_automation_style (AutoStyle m);
AutoStyle automation_style() const { return _style; }
- sigc::signal<void> automation_style_changed;
+ boost::signals2::signal<void()> automation_style_changed;
bool automation_playback() const {
return (_state & Play) || ((_state & Touch) && !_touching);
return (_state & Write) || ((_state & Touch) && _touching);
}
- sigc::signal<void> StateChanged;
+ boost::signals2::signal<void()> StateChanged;
- static sigc::signal<void, AutomationList*> AutomationListCreated;
- mutable sigc::signal<void> Dirty;
+ static boost::signals2::signal<void(AutomationList*)> AutomationListCreated;
+ mutable boost::signals2::signal<void()> Dirty;
void start_touch ();
void stop_touch ();
#include <string>
#include <vector>
#include <glibmm/thread.h>
-#include <sigc++/signal.h>
#include <boost/shared_ptr.hpp>
+
+#include "pbd/scoped_connections.h"
+
#include "ardour/data_type.h"
namespace ARDOUR {
* `Channel' is a rather overloaded term but I can't think of a better
* one right now.
*/
-class Bundle : public sigc::trackable
+class Bundle : public PBD::ScopedConnectionList
{
public:
DirectionChanged = 0x10 ///< the direction (whether ports are inputs or outputs) has changed
};
- sigc::signal<void, Change> Changed;
+ boost::signals2::signal<void(Change)> Changed;
protected:
#define __ardour_butler_h__
#include <glibmm/thread.h>
+
#include "ardour/types.h"
+#include "ardour/session_handle.h"
namespace ARDOUR {
-class Session;
-
-class Butler {
-public:
- Butler(Session* session);
+class Butler : public SessionHandleRef
+{
+ public:
+ Butler (Session& session);
~Butler();
-
+
int start_thread();
void terminate_thread();
void schedule_transport_work();
};
};
- Session* session;
pthread_t thread;
Glib::Mutex request_lock;
Glib::Cond paused;
#ifndef __ardour_configuration_h__
#define __ardour_configuration_h__
+
#include <boost/function.hpp>
+#include <boost/signals2.hpp>
#include "pbd/stateful.h"
#include "ardour/configuration_variable.h"
virtual XMLNode & get_variables () = 0;
virtual void set_variables (XMLNode const &) = 0;
- sigc::signal<void, std::string> ParameterChanged;
+ boost::signals2::signal<void(std::string)> ParameterChanged;
};
} // namespace ARDOUR
#include <string>
#include <list>
-#include <sigc++/sigc++.h>
#include <glibmm/thread.h>
#include "pbd/stateful.h"
+#include "ardour/session_handle.h"
namespace ARDOUR {
~ControlProtocolInfo() { if (state) { delete state; } }
};
- class ControlProtocolManager : public sigc::trackable, public PBD::Stateful
+class ControlProtocolManager : public PBD::Stateful, public ARDOUR::SessionHandlePtr
{
public:
~ControlProtocolManager ();
static ControlProtocolManager& instance();
- void set_session (Session&);
+ void set_session (Session*);
void discover_control_protocols ();
- void foreach_known_protocol (sigc::slot<void,const ControlProtocolInfo*>);
+ void foreach_known_protocol (boost::function<void(const ControlProtocolInfo*)>);
void load_mandatory_protocols ();
ControlProtocol* instantiate (ControlProtocolInfo&);
ControlProtocolManager ();
static ControlProtocolManager* _instance;
- Session* _session;
Glib::Mutex protocols_lock;
std::list<ControlProtocol*> control_protocols;
- void drop_session ();
+ void session_going_away ();
int control_protocol_discover (std::string path);
ControlProtocolDescriptor* get_descriptor (std::string path);
#include <algorithm>
#include <boost/shared_ptr.hpp>
-#include <sigc++/signal.h>
#include "pbd/undo.h"
#include "pbd/statefuldestructible.h"
nframes_t overlap_length() const;
- sigc::signal<void,boost::shared_ptr<Region> > Invalidated;
- sigc::signal<void,Change> StateChanged;
+ boost::signals2::signal<void(boost::shared_ptr<Region>)> Invalidated;
+ boost::signals2::signal<void(Change)> StateChanged;
bool covers (nframes_t frame) const {
return _position <= frame && frame < _position + _length;
#define __ardour_delivery_h__
#include <string>
+
#include "ardour/types.h"
#include "ardour/chan_count.h"
#include "ardour/io_processor.h"
class MuteMaster;
class Panner;
-class Delivery : public IOProcessor {
+class Delivery : public IOProcessor
+{
public:
enum Role {
/* main outputs - delivers out-of-place to port buffers, and cannot be removed */
BufferSet& output_buffers() { return *_output_buffers; }
- sigc::signal<void> MuteChange;
+ boost::signals2::signal<void()> MuteChange;
- static sigc::signal<void,nframes_t> CycleStart;
+ static boost::signals2::signal<void(nframes_t)> CycleStart;
XMLNode& state (bool full);
int set_state (const XMLNode&, int version);
boost::shared_ptr<Panner> _panner;
static bool panners_legal;
- static sigc::signal<int> PannersLegal;
+ static boost::signals2::signal<int()> PannersLegal;
int panners_became_legal ();
- sigc::connection panner_legal_c;
+ boost::signals2::scoped_connection panner_legal_c;
void output_changed (IOChange, void*);
gain_t target_gain ();
#include <cmath>
#include <time.h>
-#include <sigc++/signal.h>
-
#include <boost/utility.hpp>
#include "evoral/types.hpp"
void move_processor_automation (boost::weak_ptr<Processor>,
std::list< Evoral::RangeMove<nframes_t> > const &);
- sigc::signal<void> RecordEnableChanged;
- sigc::signal<void> SpeedChanged;
- sigc::signal<void> ReverseChanged;
- sigc::signal<void> PlaylistChanged;
- sigc::signal<void> AlignmentStyleChanged;
- sigc::signal<void,Location *> LoopSet;
+ boost::signals2::signal<void()> RecordEnableChanged;
+ boost::signals2::signal<void()> SpeedChanged;
+ boost::signals2::signal<void()> ReverseChanged;
+ boost::signals2::signal<void()> PlaylistChanged;
+ boost::signals2::signal<void()> AlignmentStyleChanged;
+ boost::signals2::signal<void(Location *)> LoopSet;
- static sigc::signal<void> DiskOverrun;
- static sigc::signal<void> DiskUnderrun;
+ static boost::signals2::signal<void()> DiskOverrun;
+ static boost::signals2::signal<void()> DiskUnderrun;
protected:
friend class Session;
nframes_t scrub_buffer_size;
nframes_t scrub_offset;
- sigc::connection ports_created_c;
- sigc::connection plmod_connection;
- sigc::connection plgone_connection;
- sigc::connection plregion_connection;
- sigc::connection ic_connection;
+ PBD::ScopedConnectionList playlist_connections;
+
+ boost::signals2::scoped_connection ic_connection;
Flag _flags;
#include <string>
#include <utility>
-#include <sigc++/signal.h>
-
+#include <boost/signals2.hpp>
#include "ardour/types.h"
class XMLTree;
bool broken () { return _broken; }
/// Signal that requests for anew name
- static sigc::signal <std::pair<bool, std::string>, std::string, std::string> Rename;
+ static boost::signals2::signal <std::pair<bool, std::string> (std::string, std::string)> Rename;
/// Signal for ok/cancel prompting
- static sigc::signal <bool, std::string> Prompt;
+ static boost::signals2::signal <bool(std::string)> Prompt;
protected:
#include <vector>
#include <string>
-#include <sigc++/signal.h>
#include <sndfile.h>
#include <samplerate.h>
typedef std::pair<Port *, uint32_t> PortChannelPair;
typedef std::map<uint32_t, std::vector<PortChannelPair> > ExportPortMap;
- struct ExportSpecification : public SF_INFO, public sigc::trackable {
+ struct ExportSpecification : public SF_INFO, public PBD::ScopedConnectionList {
ExportSpecification();
~ExportSpecification ();
SRC_STATE* src_state;
nframes_t pos;
- sigc::connection freewheel_connection;
+ boost::signals2::scoped_connection freewheel_connection;
/* shared between UI thread and audio thread */
#ifndef __ardour_export_channel_h__
#define __ardour_export_channel_h__
-#include "ardour/audioregion.h"
-#include "ardour/buffer_set.h"
-
#include <set>
+#include <boost/signals2.hpp>
#include <boost/shared_ptr.hpp>
-#include <sigc++/signal.h>
+
+#include "ardour/audioregion.h"
+#include "ardour/buffer_set.h"
namespace ARDOUR {
};
/// Handles RegionExportChannels and does actual reading from region
-class RegionExportChannelFactory : public sigc::trackable
+class RegionExportChannelFactory
{
public:
enum Type {
private:
- int new_cycle_started () { buffers_up_to_date = false; return 0; }
+ int new_cycle_started (nframes_t) { buffers_up_to_date = false; return 0; }
void update_buffers (nframes_t frames);
AudioRegion const & region;
Sample * mixdown_buffer;
Sample * gain_buffer;
+
+ boost::signals2::scoped_connection export_connection;
};
/// Export channel that reads from region channel
#include <list>
#include <glibmm/ustring.h>
-#include <sigc++/signal.h>
#include "ardour/export_channel.h"
#include "ardour/export_status.h"
/// Writes all files for this channel config @return true if a new thread was spawned
bool write_files (boost::shared_ptr<ExportProcessor> new_processor);
- sigc::signal<void> FilesWritten;
+ boost::signals2::signal<void()> FilesWritten;
// Tells the handler the necessary information for it to handle tempfiles
void register_with_timespan (TimespanPtr timespan);
: _selected (false), _compatible (true) { }
~SelectableCompatible () {}
- sigc::signal<void, bool> SelectChanged;
- sigc::signal<void, bool> CompatibleChanged;
+ boost::signals2::signal<void(bool)> SelectChanged;
+ boost::signals2::signal<void(bool)> CompatibleChanged;
bool selected () const { return _selected; }
bool compatible () const { return _compatible; }
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
-#include <sigc++/signal.h>
-#include <sigc++/trackable.h>
+
+#include "pbd/scoped_connections.h"
#include "ardour/export_formats.h"
class ExportFormatSpecification;
class AnyTime;
-class ExportFormatManager : public sigc::trackable
+class ExportFormatManager : public PBD::ScopedConnectionList
{
public:
/* Signals */
- sigc::signal<void, bool> CompleteChanged;
+ boost::signals2::signal<void(bool)> CompleteChanged;
/* Access to lists */
#ifndef __ardour_export_formats_h__
#define __ardour_export_formats_h__
-#include "ardour/export_format_base.h"
-#include "ardour/export_format_compatibility.h"
-
#include <list>
#include <boost/weak_ptr.hpp>
+
#include "pbd/failed_constructor.h"
+#include "pbd/scoped_connections.h"
+
+#include "ardour/export_format_base.h"
+#include "ardour/export_format_compatibility.h"
namespace ARDOUR
{
};
/// Class to be inherited by export formats that have a selectable sample format
-class HasSampleFormat {
+class HasSampleFormat : public PBD::ScopedConnectionList {
public:
class SampleFormatState : public ExportFormatBase::SelectableCompatible {
/* Proxies for signals from sample formats and dither types */
- sigc::signal<void, bool, WeakSampleFormatPtr> SampleFormatSelectChanged;
- sigc::signal<void, bool, WeakSampleFormatPtr> SampleFormatCompatibleChanged;
+ boost::signals2::signal<void(bool, WeakSampleFormatPtr)> SampleFormatSelectChanged;
+ boost::signals2::signal<void(bool, WeakSampleFormatPtr)> SampleFormatCompatibleChanged;
- sigc::signal<void, bool, WeakDitherTypePtr> DitherTypeSelectChanged;
- sigc::signal<void, bool, WeakDitherTypePtr> DitherTypeCompatibleChanged;
+ boost::signals2::signal<void(bool, WeakDitherTypePtr)> DitherTypeSelectChanged;
+ boost::signals2::signal<void(bool, WeakDitherTypePtr)> DitherTypeCompatibleChanged;
static std::string get_sample_format_name (ExportFormatBase::SampleFormat format);
Session & session;
};
-class ExportHandler : public ExportElementFactory, public sigc::trackable
+class ExportHandler : public ExportElementFactory
{
private:
bool realtime;
- sigc::connection files_written_connection;
+ boost::signals2::scoped_connection files_written_connection;
+ boost::signals2::scoped_connection export_read_finished_connection;
std::list<Glib::ustring> files_written;
+ void add_file (const Glib::ustring&);
/* CD Marker stuff */
TimespanPtr current_timespan;
ConfigMap::iterator current_map_it;
TimespanBounds timespan_bounds;
- sigc::connection channel_config_connection;
+ boost::signals2::scoped_connection channel_config_connection;
};
bool selected () const { return _selected; }
void select (bool value);
- sigc::signal<void, bool> SelectChanged;
+ boost::signals2::signal<void(bool)> SelectChanged;
protected:
void split_node (GraphNode * node, float position);
void remove_node (GraphNode * node);
- sigc::signal<void> GraphChanged;
+ boost::signals2::signal<void()> GraphChanged;
private:
void write_files ();
- static sigc::signal<void, Glib::ustring> WritingFile;
+ static boost::signals2::signal<void(const Glib::ustring&)> WritingFile;
private:
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
-#include <sigc++/signal.h>
#include <glibmm/ustring.h>
#include "pbd/uuid.h"
void remove_format_profile (FormatPtr format);
FormatPtr get_new_format (FormatPtr original);
- sigc::signal<void> FormatListChanged;
+ boost::signals2::signal<void()> FormatListChanged;
private:
#define __ardour_export_status_h__
#include <list>
+#include <boost/signals2.hpp>
#include <stdint.h>
-#include <sigc++/signal.h>
namespace ARDOUR
{
export_Write
};
-struct ExportStatus : public sigc::trackable {
+struct ExportStatus {
ExportStatus ();
void init ();
volatile bool stop;
volatile bool running;
- sigc::signal<void> Aborting;
+ boost::signals2::signal<void()> Aborting;
void abort (bool error_occurred = false);
bool aborted () const { return _aborted; }
bool errors () const { return _errors; }
- sigc::signal<void> Finished;
+ boost::signals2::signal<void()> Finished;
void finish ();
bool finished () const { return _finished; }
class ExportChannel;
class ExportTempFile;
-class ExportTimespan : public sigc::trackable
+class ExportTimespan
{
private:
typedef boost::shared_ptr<ExportTempFile> TempFilePtr;
/// Reads data from each channel and writes to tempfile
int process (nframes_t frames);
- sigc::connection process_connection;
+ boost::signals2::scoped_connection process_connection;
void set_range (nframes_t start, nframes_t end);
nframes_t get_length () const { return end_frame - start_frame; }
#include <vector>
#include <stdint.h>
-#include <sigc++/signal.h>
#include "ardour/types.h"
#ifndef __ardour_internal_return_h__
#define __ardour_internal_return_h__
-#include <sigc++/signal.h>
#include "ardour/ardour.h"
#include "ardour/return.h"
BufferSet* get_buffers();
void release_buffers();
- static sigc::signal<void,nframes_t> CycleStart;
+ static boost::signals2::signal<void(nframes_t)> CycleStart;
private:
BufferSet buffers;
BufferSet* target;
boost::shared_ptr<Route> _send_to;
PBD::ID _send_to_id;
- sigc::connection connect_c;
+ boost::signals2::scoped_connection connect_c;
void send_to_going_away ();
void send_to_name_changed ();
#include <string>
#include <vector>
#include <cmath>
-#include <sigc++/signal.h>
#include <jack/jack.h>
#include <glibmm/thread.h>
const ChanCount& n_ports () const { return _ports.count(); }
- sigc::signal<void,IOChange,void*> changed;
+ boost::signals2::signal<void(IOChange,void*)> changed;
virtual XMLNode& state (bool full);
XMLNode& get_state (void);
static int disable_ports (void);
static int enable_ports (void);
- static sigc::signal<void,ChanCount> PortCountChanged; // emitted when the number of ports changes
+ static boost::signals2::signal<void(ChanCount)> PortCountChanged; // emitted when the number of ports changes
static std::string name_from_state (const XMLNode&);
static void set_name_in_state (XMLNode&, const std::string&);
/* we have to defer/order port connection. this is how we do it.
*/
- static sigc::signal<int> ConnectingLegal;
+ static boost::signals2::signal<int()> ConnectingLegal;
static bool connecting_legal;
XMLNode *pending_state_node;
bool _active;
private:
-
int connecting_became_legal ();
- sigc::connection connection_legal_c;
+ boost::signals2::scoped_connection connection_legal_c;
boost::shared_ptr<Bundle> _bundle; ///< a bundle representing our ports
struct UserBundleInfo {
- UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b);
-
- boost::shared_ptr<UserBundle> bundle;
- sigc::connection changed;
+ UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b);
+ boost::shared_ptr<UserBundle> bundle;
+ boost::signals2::scoped_connection changed;
};
-
- std::vector<UserBundleInfo> _bundles_connected; ///< user bundles connected to our ports
+
+ std::vector<UserBundleInfo*> _bundles_connected; ///< user bundles connected to our ports
static int parse_io_string (const std::string&, std::vector<std::string>& chns);
static int parse_gain_string (const std::string&, std::vector<std::string>& chns);
int ensure_ports (ChanCount, bool clear, bool lockit, void *src);
void check_bundles_connected ();
- void check_bundles (std::vector<UserBundleInfo>&, const PortSet&);
+ void check_bundles (std::vector<UserBundleInfo*>&, const PortSet&);
void bundle_changed (Bundle::Change);
#include <string>
#include <boost/shared_ptr.hpp>
-#include <sigc++/signal.h>
#include <glibmm/thread.h>
virtual bool feeds (boost::shared_ptr<Route> other) const;
- sigc::signal<void,IOProcessor*,bool> AutomationPlaybackChanged;
- sigc::signal<void,IOProcessor*,uint32_t> AutomationChanged;
+ boost::signals2::signal<void(IOProcessor*,bool)> AutomationPlaybackChanged;
+ boost::signals2::signal<void(IOProcessor*,uint32_t)> AutomationChanged;
XMLNode& state (bool full_state);
int set_state (const XMLNode&, int version);
#ifndef __ardour_jack_port_h__
#define __ardour_jack_port_h__
-#include <sigc++/signal.h>
#include "pbd/failed_constructor.h"
#include "ardour/port.h"
#include <jack/jack.h>
#include <string>
#include <dlfcn.h>
-#include <sigc++/signal.h>
#include "pbd/stateful.h"
#include <map>
#include <sys/types.h>
-#include <sigc++/signal.h>
#include <glibmm/thread.h>
bool is_range_marker() const { return _flags & IsRangeMarker; }
bool matches (Flags f) const { return _flags & f; }
- sigc::signal<void,Location*> name_changed;
- sigc::signal<void,Location*> end_changed;
- sigc::signal<void,Location*> start_changed;
+ boost::signals2::signal<void(Location*)> name_changed;
+ boost::signals2::signal<void(Location*)> end_changed;
+ boost::signals2::signal<void(Location*)> start_changed;
- sigc::signal<void,Location*,void*> FlagsChanged;
+ boost::signals2::signal<void(Location*,void*)> FlagsChanged;
/* this is sent only when both start&end change at the same time */
- sigc::signal<void,Location*> changed;
+ boost::signals2::signal<void(Location*)> changed;
/* CD Track / CD-Text info */
void find_all_between (nframes64_t start, nframes64_t, LocationList&, Location::Flags);
- sigc::signal<void,Location*> current_changed;
- sigc::signal<void> changed;
- sigc::signal<void,Location*> added;
- sigc::signal<void,Location*> removed;
- sigc::signal<void,Change> StateChanged;
+ boost::signals2::signal<void(Location*)> current_changed;
+ boost::signals2::signal<void()> changed;
+ boost::signals2::signal<void(Location*)> added;
+ boost::signals2::signal<void(Location*)> removed;
+ boost::signals2::signal<void(Change)> StateChanged;
template<class T> void apply (T& obj, void (T::*method)(LocationList&)) {
Glib::Mutex::Lock lm (lock);
#include <string>
#include <dlfcn.h>
-#include <sigc++/signal.h>
#include "pbd/stateful.h"
#define __ardour_meter_h__
#include <vector>
-#include <sigc++/slot.h>
#include "ardour/types.h"
#include "ardour/processor.h"
#include "pbd/fastlog.h"
class Metering {
public:
static void update_meters ();
- static sigc::signal<void> Meter;
+ static boost::signals2::signal<void()> Meter;
- static sigc::connection connect (sigc::slot<void> the_slot);
- static void disconnect (sigc::connection& c);
+ static boost::signals2::connection connect (boost::function<void()>);
+ static void disconnect (boost::signals2::connection& c);
private:
/* this object is not meant to be instantiated */
#ifndef __ardour_midi_diskstream_h__
#define __ardour_midi_diskstream_h__
-#include <sigc++/signal.h>
#include <cmath>
#include <cassert>
XMLNode& get_state();
int set_state(const XMLNode&) { return 0; }
- sigc::signal<void> ContentsChanged;
+ boost::signals2::signal<void()> ContentsChanged;
const MidiSource* midi_source() const { return _midi_source; }
void set_midi_source(MidiSource* source) { _midi_source = source; }
#define MIDI_PATCH_MANAGER_H_
#include "midi++/midnam_patch.h"
+#include "pbd/scoped_connections.h"
+#include "ardour/session_handle.h"
namespace ARDOUR {
class Session;
namespace Name
{
-class MidiPatchManager
+class MidiPatchManager : public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
{
/// Singleton
private:
return *_manager;
}
- void set_session (ARDOUR::Session&);
+ void set_session (ARDOUR::Session*);
boost::shared_ptr<MIDINameDocument> document_by_model(std::string model_name)
{ return _documents[model_name]; }
}
}
-
boost::shared_ptr<Patch> find_patch(
std::string model,
std::string custom_device_mode,
const MasterDeviceNames::Models& all_models() const { return _all_models; }
private:
- void drop_session();
+ void session_going_away();
void refresh();
- ARDOUR::Session* _session;
MidiNameDocuments _documents;
MIDINameDocument::MasterDeviceNamesList _master_devices_by_model;
MasterDeviceNames::Models _all_models;
} // namespace Name
} // namespace MIDI
+
#endif /* MIDI_PATCH_MANAGER_H_ */
#include <string>
#include <time.h>
-#include <sigc++/signal.h>
#include <glibmm/thread.h>
#include "pbd/stateful.h"
#include "pbd/xml++.h"
uint32_t read_data_count() const { return _read_data_count; }
uint32_t write_data_count() const { return _write_data_count; }
- static sigc::signal<void,MidiSource*> MidiSourceCreated;
+ static boost::signals2::signal<void(MidiSource*)> MidiSourceCreated;
// Signal a range of recorded data is available for reading from model()
- mutable sigc::signal<void,sframes_t,nframes_t> ViewDataRangeReady;
+ mutable boost::signals2::signal<void(sframes_t,nframes_t)> ViewDataRangeReady;
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
#define __libardour_midi_ui_h__
#include <list>
+#include <boost/signals2.hpp>
#include "pbd/abstract_ui.h"
namespace MIDI {
typedef std::list<GSource*> PortSources;
PortSources port_sources;
ARDOUR::Session& _session;
-
+ boost::signals2::scoped_connection rebind_connection;
+
bool midi_input_handler (Glib::IOCondition, MIDI::Port*);
void reset_ports ();
void clear_ports ();
void set_value (float); /* note: float is used as a bitfield of MutePoints */
float get_value () const;
- sigc::signal<void> MutePointChanged;
+ boost::signals2::signal<void()> MutePointChanged;
XMLNode& get_state();
int set_state(const XMLNode&, int version);
int set_state (const XMLNode&, int version);
- static sigc::signal<void,NamedSelection*> NamedSelectionCreated;
+ static boost::signals2::signal<void(NamedSelection*)> NamedSelectionCreated;
};
}/* namespace ARDOUR */
#include <vector>
#include <string>
#include <iostream>
-#include <sigc++/signal.h>
#include "pbd/stateful.h"
#include "pbd/controllable.h"
class BufferSet;
class AudioBuffer;
-class StreamPanner : public sigc::trackable, public PBD::Stateful
+class StreamPanner : public PBD::Stateful
{
public:
StreamPanner (Panner& p, Evoral::Parameter param);
boost::shared_ptr<AutomationControl> pan_control() { return _control; }
- sigc::signal<void> Changed; /* for position */
- sigc::signal<void> StateChanged; /* for mute */
+ boost::signals2::signal<void()> Changed; /* for position */
+ boost::signals2::signal<void()> StateChanged; /* for mute */
int set_state (const XMLNode&, int version);
virtual XMLNode& state (bool full_state) = 0;
StreamPanner &streampanner( uint32_t n ) const { assert( n < _streampanners.size() ); return *_streampanners[n]; }
uint32_t npanners() const { return _streampanners.size(); }
- sigc::signal<void> Changed;
- sigc::signal<void> LinkStateChanged;
- sigc::signal<void> StateChanged; /* for bypass */
+ boost::signals2::signal<void()> Changed;
+ boost::signals2::signal<void()> LinkStateChanged;
+ boost::signals2::signal<void()> StateChanged; /* for bypass */
/* only StreamPanner should call these */
#include <glib.h>
-#include <sigc++/signal.h>
#include "pbd/undo.h"
#include "pbd/stateful.h"
class Session;
class Region;
-class Playlist : public SessionObject,
- public boost::noncopyable,
- public boost::enable_shared_from_this<Playlist> {
+class Playlist : public SessionObject
+ , public boost::noncopyable
+ , public boost::enable_shared_from_this<Playlist> {
public:
typedef std::list<boost::shared_ptr<Region> > RegionList;
nframes64_t find_next_transient (nframes64_t position, int dir);
- void foreach_region (sigc::slot<void, boost::shared_ptr<Region> >);
+ void foreach_region (boost::function<void (boost::shared_ptr<Region>)>);
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
XMLNode& get_template ();
- sigc::signal<void,bool> InUse;
- sigc::signal<void> Modified;
- sigc::signal<void, boost::weak_ptr<Region> > RegionAdded;
- sigc::signal<void, boost::weak_ptr<Region> > RegionRemoved;
- sigc::signal<void> NameChanged;
- sigc::signal<void> LengthChanged;
- sigc::signal<void, std::list< Evoral::RangeMove<nframes_t> > const &> RangesMoved;
+ boost::signals2::signal<void(bool)> InUse;
+ boost::signals2::signal<void()> Modified;
+ boost::signals2::signal<void(boost::weak_ptr<Region>)> RegionAdded;
+ boost::signals2::signal<void(boost::weak_ptr<Region>)> RegionRemoved;
+ boost::signals2::signal<void()> NameChanged;
+ boost::signals2::signal<void()> LengthChanged;
+ boost::signals2::signal<void(std::list< Evoral::RangeMove<nframes_t> > const &)> RangesMoved;
static std::string bump_name (std::string old_name, Session&);
RegionList regions; /* the current list of regions in the playlist */
std::set<boost::shared_ptr<Region> > all_regions; /* all regions ever added to this playlist */
- std::list<sigc::connection> region_state_changed_connections;
+ PBD::ScopedConnectionList region_state_changed_connections;
DataType _type;
mutable gint block_notifications;
mutable gint ignore_state_changes;
class PlaylistFactory {
public:
- static sigc::signal<void,boost::shared_ptr<Playlist>, bool> PlaylistCreated;
+ static boost::signals2::signal<void(boost::shared_ptr<Playlist>, bool)> PlaylistCreated;
static boost::shared_ptr<Playlist> create (Session&, const XMLNode&, bool hidden = false, bool unused = false);
static boost::shared_ptr<Playlist> create (DataType type, Session&, std::string name, bool hidden = false);
#define __ardour_plugin_h__
#include <boost/shared_ptr.hpp>
-#include <sigc++/signal.h>
#include <glibmm/ustring.h>
#include "pbd/statefuldestructible.h"
virtual bool has_editor() const = 0;
- sigc::signal<void,uint32_t,float> ParameterChanged;
+ boost::signals2::signal<void(uint32_t,float)> ParameterChanged;
/* NOTE: this block of virtual methods looks like the interface
to a Processor, but Plugin does not inherit from Processor.
#include <boost/weak_ptr.hpp>
-#include <sigc++/signal.h>
#include "ardour/ardour.h"
#include "ardour/types.h"
#include "ardour/processor.h"
void collect_signal_for_analysis(nframes_t nframes);
- sigc::signal<void, BufferSet*, BufferSet*> AnalysisDataGathered;
+ boost::signals2::signal<void(BufferSet*, BufferSet*)> AnalysisDataGathered;
private:
/* disallow copy construction */
PluginStatusType get_status (const PluginInfoPtr&);
/** plugins were added to or removed from one of the PluginInfoLists */
- sigc::signal<void> PluginListChanged;
+ boost::signals2::signal<void()> PluginListChanged;
private:
struct PluginStatus {
#include <vector>
#include <jack/jack.h>
#include <boost/utility.hpp>
-#include <sigc++/trackable.h>
+#include <boost/signals2.hpp>
+
#include "ardour/data_type.h"
#include "ardour/types.h"
class AudioEngine;
class Buffer;
-class Port : public sigc::trackable, public boost::noncopyable
+class Port : public boost::noncopyable
{
public:
enum Flags {
static void set_engine (AudioEngine *);
- sigc::signal<void, bool> MonitorInputChanged;
+ boost::signals2::signal<void(bool)> MonitorInputChanged;
protected:
#include <string>
#include <exception>
-#include <sigc++/signal.h>
#include "ardour/ardour.h"
#include "ardour/io_processor.h"
#include "ardour/types.h"
#include "pbd/statefuldestructible.h"
-#include <sigc++/signal.h>
#include "ardour/ardour.h"
#include "ardour/automatable_controls.h"
void *get_gui () const { return _gui; }
void set_gui (void *p) { _gui = p; }
- static sigc::signal<void,Processor*> ProcessorCreated;
+ static boost::signals2::signal<void(Processor*)> ProcessorCreated;
- sigc::signal<void> ActiveChanged;
- sigc::signal<void,ChanCount,ChanCount> ConfigurationChanged;
+ boost::signals2::signal<void()> ActiveChanged;
+ boost::signals2::signal<void(ChanCount,ChanCount)> ConfigurationChanged;
protected:
int _pending_active;
#include <boost/utility.hpp>
#include "pbd/undo.h"
+#include "pbd/scoped_connections.h"
#include "ardour/ardour.h"
#include "ardour/data_type.h"
static Change LayerChanged;
static Change HiddenChanged;
- sigc::signal<void,Change> StateChanged;
- static sigc::signal<void,boost::shared_ptr<ARDOUR::Region> > RegionPropertyChanged;
+ boost::signals2::signal<void(Change)> StateChanged;
+ static boost::signals2::signal<void(boost::shared_ptr<ARDOUR::Region>)> RegionPropertyChanged;
void unlock_property_changes () { _flags = Flag (_flags & ~DoNotSendPropertyChanges); }
void block_property_changes () { _flags = Flag (_flags | DoNotSendPropertyChanges); }
boost::shared_ptr<ARDOUR::Playlist> playlist() const { return _playlist.lock(); }
virtual void set_playlist (boost::weak_ptr<ARDOUR::Playlist>);
- void source_deleted (boost::shared_ptr<Source>);
+ void source_deleted (boost::weak_ptr<Source>);
boost::shared_ptr<Source> source (uint32_t n=0) const { return _sources[ (n < _sources.size()) ? n : 0 ]; }
uint32_t n_channels() const { return _sources.size(); }
itself, to permit dynamic_cast<> to be used to
infer the type of Region.
*/
- static sigc::signal<void,boost::shared_ptr<Region> > CheckNewRegion;
+ static boost::signals2::signal<void(boost::shared_ptr<Region>)> CheckNewRegion;
static boost::shared_ptr<Region> create (boost::shared_ptr<const Region>);
#ifndef __ardour_return_h__
#define __ardour_return_h__
-#include <sigc++/signal.h>
#include <string>
void flush_processors ();
- void foreach_processor (sigc::slot<void, boost::weak_ptr<Processor> > method) {
+ void foreach_processor (boost::function<void(boost::weak_ptr<Processor>)> method) {
Glib::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
method (boost::weak_ptr<Processor> (*i));
void set_user_latency (nframes_t);
nframes_t initial_delay() const { return _initial_delay; }
- sigc::signal<void> active_changed;
- sigc::signal<void> phase_invert_changed;
- sigc::signal<void> denormal_protection_changed;
- sigc::signal<void,void*> listen_changed;
- sigc::signal<void,void*> solo_changed;
- sigc::signal<void,void*> solo_safe_changed;
- sigc::signal<void,void*> solo_isolated_changed;
- sigc::signal<void,void*> comment_changed;
- sigc::signal<void,void*> mute_changed;
- sigc::signal<void> mute_points_changed;
+ boost::signals2::signal<void()> active_changed;
+ boost::signals2::signal<void()> phase_invert_changed;
+ boost::signals2::signal<void()> denormal_protection_changed;
+ boost::signals2::signal<void(void*)> listen_changed;
+ boost::signals2::signal<void(void*)> solo_changed;
+ boost::signals2::signal<void(void*)> solo_safe_changed;
+ boost::signals2::signal<void(void*)> solo_isolated_changed;
+ boost::signals2::signal<void(void*)> comment_changed;
+ boost::signals2::signal<void(void*)> mute_changed;
+ boost::signals2::signal<void()> mute_points_changed;
/** the processors have changed; the parameter indicates what changed */
- sigc::signal<void, RouteProcessorChange> processors_changed;
- sigc::signal<void,void*> record_enable_changed;
+ boost::signals2::signal<void(RouteProcessorChange)> processors_changed;
+ boost::signals2::signal<void(void*)> record_enable_changed;
/** the metering point has changed */
- sigc::signal<void,void*> meter_change;
- sigc::signal<void> signal_latency_changed;
- sigc::signal<void> initial_delay_changed;
+ boost::signals2::signal<void(void*)> meter_change;
+ boost::signals2::signal<void()> signal_latency_changed;
+ boost::signals2::signal<void()> initial_delay_changed;
/* gui's call this for their own purposes. */
- sigc::signal<void,std::string,void*> gui_changed;
+ boost::signals2::signal<void(std::string,void*)> gui_changed;
/* stateful */
int save_as_template (const std::string& path, const std::string& name);
- sigc::signal<void,void*> SelectedChanged;
+ boost::signals2::signal<void(void*)> SelectedChanged;
int listen_via (boost::shared_ptr<Route>, Placement p, bool active, bool aux);
void drop_listen (boost::shared_ptr<Route>);
void set_remote_control_id (uint32_t id);
uint32_t remote_control_id () const;
- sigc::signal<void> RemoteControlIDChanged;
+ boost::signals2::signal<void()> RemoteControlIDChanged;
void sync_order_keys (std::string const &);
- static sigc::signal<void, std::string const &> SyncOrderKeys;
+ static boost::signals2::signal<void(std::string const &)> SyncOrderKeys;
protected:
friend class Session;
void silence (nframes_t nframes);
- sigc::connection input_signal_connection;
-
ChanCount processor_max_streams;
uint32_t _remote_control_id;
boost::shared_ptr<Amp> _amp;
boost::shared_ptr<PeakMeter> _meter;
- sigc::connection _meter_connection;
private:
void init ();
#include <set>
#include <string>
#include <stdint.h>
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
#include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
+
#include "ardour/types.h"
namespace ARDOUR {
class AudioTrack;
class Session;
-class RouteGroup : public PBD::Stateful, public sigc::trackable {
+class RouteGroup : public PBD::Stateful, public PBD::ScopedConnectionList {
public:
enum Flag {
Relative = 0x1,
boost::shared_ptr<RouteList> route_list() { return routes; }
- sigc::signal<void> changed;
- sigc::signal<void,void*> FlagsChanged;
+ boost::signals2::signal<void()> changed;
+ boost::signals2::signal<void(void*)> FlagsChanged;
XMLNode& get_state ();
#ifndef __libardour_route_group_member_h__
#define __libardour_route_group_member_h__
-#include <sigc++/signal.h>
namespace ARDOUR {
RouteGroup* route_group () const { return _route_group; }
- sigc::signal<void> route_group_changed;
+ boost::signals2::signal<void()> route_group_changed;
protected:
RouteGroup* _route_group;
#ifndef __ardour_send_h__
#define __ardour_send_h__
-#include <sigc++/signal.h>
#include <string>
#include "pbd/stateful.h"
#include "pbd/error.h"
#include "pbd/rcu.h"
#include "pbd/statefuldestructible.h"
+#include "pbd/scoped_connections.h"
#include "pbd/undo.h"
#include "midi++/mmc.h"
#include "midi++/types.h"
-#include "pbd/destructible.h"
-#include "pbd/stateful.h"
-
#include "ardour/ardour.h"
#include "ardour/click.h"
#include "ardour/chan_count.h"
extern void setup_enum_writer ();
-class Session : public PBD::StatefulDestructible, public SessionEventManager, public boost::noncopyable
+class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager, public boost::noncopyable
{
public:
enum RecordState {
void set_deletion_in_progress ();
void clear_deletion_in_progress ();
bool deletion_in_progress() const { return _state_of_the_state & Deletion; }
- sigc::signal<void> DirtyChanged;
+ boost::signals2::signal<void()> DirtyChanged;
const SessionDirectory& session_directory () const { return *(_session_dir.get()); }
- static sigc::signal<void> AutoBindingOn;
- static sigc::signal<void> AutoBindingOff;
+ static boost::signals2::signal<void()> AutoBindingOn;
+ static boost::signals2::signal<void()> AutoBindingOff;
- static sigc::signal<void,std::string> Dialog;
+ static boost::signals2::signal<void(std::string)> Dialog;
std::string sound_dir (bool with_path = true) const;
std::string peak_dir () const;
/* Proxy signal for region hidden changes */
- sigc::signal<void,boost::shared_ptr<Region> > RegionHiddenChange;
+ boost::signals2::signal<void(boost::shared_ptr<Region>)> RegionHiddenChange;
/* Emitted when all i/o connections are complete */
- sigc::signal<void> IOConnectionsComplete;
+ boost::signals2::signal<void()> IOConnectionsComplete;
/* Record status signals */
- sigc::signal<void> RecordStateChanged;
+ boost::signals2::signal<void()> RecordStateChanged;
/* Transport mechanism signals */
- sigc::signal<void> TransportStateChange; /* generic */
- sigc::signal<void,nframes64_t> PositionChanged; /* sent after any non-sequential motion */
- sigc::signal<void> DurationChanged;
- sigc::signal<void,nframes64_t> Xrun;
- sigc::signal<void> TransportLooped;
+ boost::signals2::signal<void()> TransportStateChange; /* generic */
+ boost::signals2::signal<void(nframes64_t)> PositionChanged; /* sent after any non-sequential motion */
+ boost::signals2::signal<void()> DurationChanged;
+ boost::signals2::signal<void(nframes64_t)> Xrun;
+ boost::signals2::signal<void()> TransportLooped;
/** emitted when a locate has occurred */
- sigc::signal<void> Located;
+ boost::signals2::signal<void()> Located;
- sigc::signal<void,RouteList&> RouteAdded;
- sigc::signal<void> RouteGroupChanged;
+ boost::signals2::signal<void(RouteList&)> RouteAdded;
+ boost::signals2::signal<void()> RouteGroupChanged;
void queue_event (SessionEvent*);
Locations *locations() { return &_locations; }
- sigc::signal<void,Location*> auto_loop_location_changed;
- sigc::signal<void,Location*> auto_punch_location_changed;
- sigc::signal<void> locations_modified;
+ boost::signals2::signal<void(Location*)> auto_loop_location_changed;
+ boost::signals2::signal<void(Location*)> auto_punch_location_changed;
+ boost::signals2::signal<void()> locations_modified;
void set_auto_punch_location (Location *);
void set_auto_loop_location (Location *);
static int rename_template (std::string old_name, std::string new_name);
static int delete_template (std::string name);
- sigc::signal<void,std::string> StateSaved;
- sigc::signal<void> StateReady;
+ boost::signals2::signal<void(std::string)> StateSaved;
+ boost::signals2::signal<void()> StateReady;
std::vector<std::string*>* possible_states() const;
static std::vector<std::string*>* possible_states (std::string path);
RouteGroup *route_group_by_name (std::string);
- sigc::signal<void,RouteGroup*> route_group_added;
- sigc::signal<void> route_group_removed;
+ boost::signals2::signal<void(RouteGroup*)> route_group_added;
+ boost::signals2::signal<void()> route_group_removed;
- void foreach_route_group (sigc::slot<void,RouteGroup*> sl) {
+ void foreach_route_group (boost::function<void(RouteGroup*)> f) {
for (std::list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); i++) {
- sl (*i);
+ f (*i);
}
}
nframes_t convert_to_frames_at (nframes_t position, AnyTime const &);
- static sigc::signal<void> StartTimeChanged;
- static sigc::signal<void> EndTimeChanged;
- static sigc::signal<void> TimecodeOffsetChanged;
+ static boost::signals2::signal<void()> StartTimeChanged;
+ static boost::signals2::signal<void()> EndTimeChanged;
+ static boost::signals2::signal<void()> TimecodeOffsetChanged;
std::vector<SyncSource> get_available_sync_options() const;
void request_sync_source (Slave*);
TempoMap& tempo_map() { return *_tempo_map; }
/// signals the current transport position in frames, bbt and timecode time (in that order)
- sigc::signal<void, const nframes_t&, const BBT_Time&, const Timecode::Time&> tick;
+ boost::signals2::signal<void(const nframes_t&, const BBT_Time&, const Timecode::Time&)> tick;
/* region info */
void add_regions (std::vector<boost::shared_ptr<Region> >&);
- sigc::signal<void,boost::weak_ptr<Region> > RegionAdded;
- sigc::signal<void,std::vector<boost::weak_ptr<Region> >& > RegionsAdded;
- sigc::signal<void,boost::weak_ptr<Region> > RegionRemoved;
+ boost::signals2::signal<void(boost::weak_ptr<Region>)> RegionAdded;
+ boost::signals2::signal<void(std::vector<boost::weak_ptr<Region> >&)> RegionsAdded;
+ boost::signals2::signal<void(boost::weak_ptr<Region>)> RegionRemoved;
int region_name (std::string& result, std::string base = std::string(""), bool newlevel = false);
std::string new_region_name (std::string);
int start_audio_export (nframes_t position, bool realtime);
- sigc::signal<int, nframes_t> ProcessExport;
- sigc::signal<void> ExportReadFinished;
- static sigc::signal<void, std::string, std::string> Exported;
+ boost::signals2::signal<int(nframes_t)> ProcessExport;
+ boost::signals2::signal<void()> ExportReadFinished;
+ static boost::signals2::signal<void(std::string, std::string)> Exported;
void add_source (boost::shared_ptr<Source>);
void remove_source (boost::weak_ptr<Source>);
0 for "yes, delete this playlist",
1 for "no, don't delete this playlist".
*/
- sigc::signal<int,boost::shared_ptr<Playlist> > AskAboutPlaylistDeletion;
+ boost::signals2::signal<void(boost::shared_ptr<Playlist>)> AskAboutPlaylistDeletion;
/** handlers should return 0 for "ignore the rate mismatch",
!0 for "do not use this session"
*/
- static sigc::signal<int,nframes_t, nframes_t> AskAboutSampleRateMismatch;
+ static boost::signals2::signal<int(nframes_t, nframes_t)> AskAboutSampleRateMismatch;
/** handlers should return !0 for use pending state, 0 for ignore it.
*/
- static sigc::signal<int> AskAboutPendingState;
+ static boost::signals2::signal<int()> AskAboutPendingState;
boost::shared_ptr<AudioFileSource> create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive);
void remove_named_selection (NamedSelection *);
template<class T> void foreach_named_selection (T& obj, void (T::*func)(NamedSelection&));
- sigc::signal<void> NamedSelectionAdded;
- sigc::signal<void> NamedSelectionRemoved;
+ boost::signals2::signal<void()> NamedSelectionAdded;
+ boost::signals2::signal<void()> NamedSelectionRemoved;
/* Curves and AutomationLists (TODO when they go away) */
void add_automation_list(AutomationList*);
void cancel_audition ();
bool is_auditioning () const;
- sigc::signal<void,bool> AuditionActive;
+ boost::signals2::signal<void(bool)> AuditionActive;
/* flattening stuff */
void set_listen (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
void set_record_enable (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
- sigc::signal<void,bool> SoloActive;
- sigc::signal<void> SoloChanged;
+ boost::signals2::signal<void(bool)> SoloActive;
+ boost::signals2::signal<void()> SoloChanged;
/* control/master out */
void remove_bundle (boost::shared_ptr<Bundle>);
boost::shared_ptr<Bundle> bundle_by_name (std::string) const;
- sigc::signal<void,boost::shared_ptr<Bundle> > BundleAdded;
- sigc::signal<void,boost::shared_ptr<Bundle> > BundleRemoved;
+ boost::signals2::signal<void(boost::shared_ptr<Bundle>)> BundleAdded;
+ boost::signals2::signal<void(boost::shared_ptr<Bundle>)> BundleRemoved;
/* MIDI control */
MIDI::Port *midi_port() const { return _midi_port; }
MIDI::Port *midi_clock_port() const { return _midi_clock_port; }
- sigc::signal<void> MTC_PortChanged;
- sigc::signal<void> MMC_PortChanged;
- sigc::signal<void> MIDI_PortChanged;
- sigc::signal<void> MIDIClock_PortChanged;
+ boost::signals2::signal<void()> MTC_PortChanged;
+ boost::signals2::signal<void()> MMC_PortChanged;
+ boost::signals2::signal<void()> MIDI_PortChanged;
+ boost::signals2::signal<void()> MIDIClock_PortChanged;
void set_trace_midi_input (bool, MIDI::Port* port = 0);
void set_trace_midi_output (bool, MIDI::Port* port = 0);
void stop_scrub ();
void set_scrub_speed (float);
nframes_t scrub_buffer_size() const;
- sigc::signal<void> ScrubReady;
+ boost::signals2::signal<void()> ScrubReady;
/* History (for editors, mixers, UIs etc.) */
_current_trans.top()->add_command (cmd);
}
- std::map<PBD::ID, PBD::StatefulThingWithGoingAway*> registry;
+ std::map<PBD::ID,PBD::StatefulDestructible*> registry;
// these commands are implemented in libs/ardour/session_command.cc
Command* memento_command_factory(XMLNode* n);
- void register_with_memento_command_factory(PBD::ID, PBD::StatefulThingWithGoingAway*);
+ void register_with_memento_command_factory(PBD::ID, PBD::StatefulDestructible*);
/* clicking */
void* ptr,
float opt);
- static sigc::signal<void> SendFeedback;
+ static boost::signals2::signal<void()> SendFeedback;
/* Controllables */
int stop_audio_export ();
void finalize_audio_export ();
- sigc::connection export_freewheel_connection;
+ boost::signals2::scoped_connection export_freewheel_connection;
void prepare_diskstreams ();
void commit_diskstreams (nframes_t, bool& session_requires_butler);
void locations_added (Location*);
void handle_locations_changed (Locations::LocationList&);
- sigc::connection auto_punch_start_changed_connection;
- sigc::connection auto_punch_end_changed_connection;
- sigc::connection auto_punch_changed_connection;
+ PBD::ScopedConnectionList punch_connections;
void auto_punch_start_changed (Location *);
void auto_punch_end_changed (Location *);
void auto_punch_changed (Location *);
- sigc::connection auto_loop_start_changed_connection;
- sigc::connection auto_loop_end_changed_connection;
- sigc::connection auto_loop_changed_connection;
+ PBD::ScopedConnectionList loop_connections;
void auto_loop_changed (Location *);
void first_stage_init (std::string path, std::string snapshot_name);
struct timeval last_mmc_step;
double step_speed;
- typedef sigc::slot<bool> MidiTimeoutCallback;
+ typedef boost::function<bool()> MidiTimeoutCallback;
typedef std::list<MidiTimeoutCallback> MidiTimeoutList;
MidiTimeoutList midi_timeouts;
#include <list>
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
-#include <sigc++/signal.h>
#include "pbd/pool.h"
#include "pbd/ringbuffer.h"
--- /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 __libardour_session_handle_h__
+#define __libardour_session_handle_h__
+
+#include "pbd/scoped_connections.h"
+
+namespace ARDOUR {
+ class Session;
+
+class SessionHandleRef : public PBD::ScopedConnectionList
+{
+ public:
+ SessionHandleRef (ARDOUR::Session& s);
+ virtual ~SessionHandleRef () {}
+
+ protected:
+ ARDOUR::Session& _session;
+ virtual void session_going_away ();
+};
+
+class SessionHandlePtr
+{
+ public:
+ SessionHandlePtr (ARDOUR::Session* s);
+ SessionHandlePtr () : _session (0) {}
+ virtual ~SessionHandlePtr () {}
+
+ virtual void set_session (ARDOUR::Session *);
+
+ protected:
+ ARDOUR::Session* _session;
+ PBD::ScopedConnectionList _session_connections;
+
+ virtual void session_going_away ();
+};
+
+} /* namespace */
+
+#endif /* __libardour_session_handle_h__ */
#include <string>
#include "pbd/statefuldestructible.h"
+#include "pbd/scoped_connections.h"
+
+#include "ardour/session_handle.h"
namespace ARDOUR {
class Session;
-/** An object associated with a Session.
- *
- * This is a few common things factored out of IO which weren't IO specific
- * (to fix the problem with e.g. PluginInsert being an IO which it shouldn't be).
+/** A named object associated with a Session. Objects derived from this class are
+ expected to be destroyed before the session calls drop_references().
*/
-class SessionObject : public PBD::StatefulDestructible
+
+class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible
{
-public:
- SessionObject(Session& session, const std::string& name)
- : _session(session)
+ public:
+ SessionObject (Session& session, const std::string& name)
+ : SessionHandleRef (session)
, _name(name)
{}
-
+
Session& session() const { return _session; }
const std::string& name() const { return _name; }
return true;
}
- sigc::signal<void> NameChanged;
+ boost::signals2::signal<void()> NameChanged;
-protected:
- Session& _session;
+ protected:
std::string _name;
};
#include <string>
#include <glibmm/thread.h>
#include <boost/shared_ptr.hpp>
-#include <sigc++/trackable.h>
+#include <boost/function.hpp>
+
+#include "pbd/scoped_connections.h"
class XMLNode;
class Source;
class Session;
-class SessionPlaylists : public sigc::trackable
+class SessionPlaylists : public PBD::ScopedConnectionList
{
public:
~SessionPlaylists ();
void find_equivalent_playlist_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >& result);
void update_after_tempo_map_change ();
void add_state (XMLNode *, bool);
- bool maybe_delete_unused (sigc::signal<int, boost::shared_ptr<Playlist> >);
+ bool maybe_delete_unused (boost::function<int(boost::shared_ptr<Playlist>)>);
int load (Session &, const XMLNode&);
int load_unused (Session &, const XMLNode&);
boost::shared_ptr<Playlist> XMLPlaylistFactory (Session &, const XMLNode&);
#include <vector>
#include <glibmm/thread.h>
+#include <boost/signals2.hpp>
#include <jack/jack.h>
-#include <sigc++/signal.h>
+#include "pbd/scoped_connections.h"
+
#include "ardour/types.h"
#include "midi++/parser.h"
#include "midi++/types.h"
}
};
-class MTC_Slave : public Slave, public sigc::trackable {
+class MTC_Slave : public Slave {
public:
MTC_Slave (Session&, MIDI::Port&);
~MTC_Slave ();
private:
Session& session;
MIDI::Port* port;
- std::vector<sigc::connection> connections;
+ PBD::ScopedConnectionList* port_connections;
bool can_notify_on_unknown_rate;
PIChaser* pic;
void process_apparent_speed (double);
};
-class MIDIClock_Slave : public Slave, public sigc::trackable {
+class MIDIClock_Slave : public Slave {
public:
MIDIClock_Slave (Session&, MIDI::Port&, int ppqn = 24);
private:
ISlaveSessionProxy* session;
MIDI::Port* port;
- std::vector<sigc::connection> connections;
+ PBD::ScopedConnectionList* port_connections;
/// pulses per quarter note for one MIDI clock frame (default 24)
int ppqn;
#include <set>
#include <boost/utility.hpp>
-#include <sigc++/signal.h>
#include "pbd/statefuldestructible.h"
#include "ardour/ardour.h"
virtual bool set_destructive (bool /*yn*/) { return false; }
virtual bool length_mutable() const { return false; }
- static sigc::signal<void,Source*> SourceCreated;
- sigc::signal<void,boost::shared_ptr<Source> > Switched;
+ static boost::signals2::signal<void(Source*)> SourceCreated;
+ boost::signals2::signal<void(boost::shared_ptr<Source>)> Switched;
bool has_been_analysed() const;
virtual bool can_be_analysed() const { return false; }
virtual void set_been_analysed (bool yn);
virtual bool check_for_analysis_data_on_disk();
- sigc::signal<void> AnalysisChanged;
+ boost::signals2::signal<void()> AnalysisChanged;
AnalysisFeatureList transients;
std::string get_transients_path() const;
#include <string>
#include <stdint.h>
-#include <sigc++/sigc++.h>
#include <boost/shared_ptr.hpp>
#include "ardour/source.h"
public:
static void init ();
- static sigc::signal<void,boost::shared_ptr<Source> > SourceCreated;
+ static boost::signals2::signal<void(boost::shared_ptr<Source>)> SourceCreated;
static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false);
static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node,
#include "pbd/stateful.h"
#include "pbd/statefuldestructible.h"
-#include <sigc++/signal.h>
#include "ardour/ardour.h"
nframes_t frame_rate () const { return _frame_rate; }
- sigc::signal<void,ARDOUR::Change> StateChanged;
+ boost::signals2::signal<void(ARDOUR::Change)> StateChanged;
private:
static Tempo _default_tempo;
$Id$
*/
-#include <sigc++/sigc++.h>
-#include "ardour/types.h"
#include "midi++/jack.h"
+#include "pbd/scoped_connections.h"
+
+#include "ardour/types.h"
+#include "ardour/session_handle.h"
+
#ifndef TICKER_H_
#define TICKER_H_
class Session;
-class Ticker : public sigc::trackable
+class Ticker : public SessionHandlePtr
{
public:
- Ticker() : _session(0) {};
- virtual ~Ticker() {};
+ Ticker() {};
+ virtual ~Ticker() {}
virtual void tick(
const nframes_t& transport_frames,
const BBT_Time& transport_bbt,
const Timecode::Time& transport_timecode) = 0;
- virtual void set_session(Session& s);
- virtual void going_away() { _session = 0; }
-
-protected:
- Session* _session;
+ void set_session (Session* s);
};
class MidiClockTicker : public Ticker
const BBT_Time& transport_bbt,
const Timecode::Time& transport_timecode);
- void set_session(Session& s);
- void going_away() { _midi_port = 0; Ticker::going_away(); }
+ void set_session (Session* s);
+ void session_going_away();
/// slot for the signal session::MIDIClock_PortChanged
void update_midi_clock_port();
TrackMode mode () const { return _mode; }
virtual int set_mode (TrackMode /*m*/) { return false; }
virtual bool can_use_mode (TrackMode /*m*/, bool& /*bounce_required*/) { return false; }
- sigc::signal<void> TrackModeChanged;
+ boost::signals2::signal<void()> TrackModeChanged;
virtual int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
bool state_changing, bool can_record, bool rec_monitors_input);
bool record_enabled() const;
void set_record_enable (bool yn, void *src);
- sigc::signal<void> DiskstreamChanged;
- sigc::signal<void> FreezeChange;
+ boost::signals2::signal<void()> DiskstreamChanged;
+ boost::signals2::signal<void()> FreezeChange;
protected:
Track (Session& sess, const XMLNode& node, DataType default_type = DataType::AUDIO);
FreezeRecord _freeze_record;
XMLNode* pending_state;
- sigc::connection recenable_connection;
+ boost::signals2::scoped_connection recenable_connection;
bool _destructive;
boost::shared_ptr<RecEnableControllable> _rec_enable_control;
#include <string>
#include <dlfcn.h>
-#include <sigc++/signal.h>
#include "pbd/stateful.h"
#include <jack/types.h>
#include "ardour/plugin.h"
{
DEBUG_TRACE (DEBUG::Destruction, string_compose ("Audio Diskstream %1 destructor\n", _name));
- notify_callbacks ();
-
{
RCUWriter<ChannelList> writer (channels);
boost::shared_ptr<ChannelList> c = writer.get_copy();
continue; /* XXX is this OK? */
}
- region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Diskstream::remove_region_from_last_capture), boost::weak_ptr<Region>(region)));
+ scoped_connect (region->GoingAway, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
_last_capture_regions.push_back (region);
#include <cstdlib>
-#include <sigc++/bind.h>
#include "ardour/types.h"
#include "ardour/configuration.h"
AudioPlaylist::~AudioPlaylist ()
{
- GoingAway (); /* EMIT SIGNAL */
+ drop_references ();
/* drop connections to signals */
- notify_callbacks ();
-
_crossfades.clear ();
}
} else {
_crossfades.push_back (xfade);
- xfade->Invalidated.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
- xfade->StateChanged.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_changed));
+ scoped_connect (xfade->Invalidated, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
+ scoped_connect (xfade->StateChanged, 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 (sigc::mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
- xfade->StateChanged.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_changed));
+ scoped_connect (xfade->Invalidated, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
+ scoped_connect (xfade->StateChanged, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
NewCrossfade(xfade);
}
}
void
-AudioPlaylist::foreach_crossfade (sigc::slot<void, boost::shared_ptr<Crossfade> > s)
+AudioPlaylist::foreach_crossfade (boost::function<void (boost::shared_ptr<Crossfade>)> s)
{
RegionLock rl (this, false);
for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
{
// Rename
while (session.playlists->by_name (name) || !handler.check_name (name)) {
- std::pair<bool, string> rename_pair = Rename (_("A playlist with this name already exists, please rename it."), name);
+ std::pair<bool, string> rename_pair = *Rename (_("A playlist with this name already exists, please rename it."), name);
if (!rename_pair.first) {
return false;
}
*/
-#include <sigc++/retype.h>
-#include <sigc++/retype_return.h>
-#include <sigc++/bind.h>
#include "pbd/error.h"
#include "pbd/enumwriter.h"
if (audio_diskstream()->deprecated_io_node) {
if (!IO::connecting_legal) {
- IO::ConnectingLegal.connect (sigc::mem_fun (*this, &AudioTrack::deprecated_use_diskstream_connections));
+ scoped_connect (IO::ConnectingLegal, 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 (sigc::mem_fun (*this, &AudioTrack::set_state_part_two));
+ scoped_connect (_session.StateReady, boost::bind (&AudioTrack::set_state_part_two, this));
} else {
set_state_part_two ();
}
/* Rename */
while (session.route_by_name (name) || !track_handler.check_name (name)) {
- std::pair<bool, string> rename_pair = Rename (_("A playlist with this name already exists, please rename it."), name);
+ std::pair<bool, string> rename_pair = *Rename (_("A playlist with this name already exists, please rename it."), name);
if (!rename_pair.first) {
return false;
}
{
_instance = this; /* singleton */
- session = 0;
session_remove_pending = false;
_running = false;
_has_run = false;
nframes_t blocksize = jack_get_buffer_size (_priv_jack);
- if (session) {
+ if (_session) {
BootMessage (_("Connect session to engine"));
- session->set_block_size (blocksize);
- session->set_frame_rate (jack_get_sample_rate (_priv_jack));
+ _session->set_block_size (blocksize);
+ _session->set_frame_rate (jack_get_sample_rate (_priv_jack));
/* page in as much of the session process code as we
can before we really start running.
*/
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
}
_processed_frames = 0;
jack_set_freewheel_callback (_priv_jack, _freewheel_callback, this);
jack_set_port_registration_callback (_priv_jack, _registration_callback, this);
- if (session && session->config.get_jack_time_master()) {
+ if (_session && _session->config.get_jack_time_master()) {
jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this);
}
AudioEngine::jack_timebase_callback (jack_transport_state_t state, nframes_t nframes,
jack_position_t* pos, int new_position)
{
- if (_jack && session && session->synced_to_jack()) {
- session->jack_timebase_callback (state, nframes, pos, new_position);
+ if (_jack && _session && _session->synced_to_jack()) {
+ _session->jack_timebase_callback (state, nframes, pos, new_position);
}
}
int
AudioEngine::jack_sync_callback (jack_transport_state_t state, jack_position_t* pos)
{
- if (_jack && session) {
- return session->jack_sync_callback (state, pos);
+ if (_jack && _session) {
+ return _session->jack_sync_callback (state, pos);
}
return true;
next_processed_frames = _processed_frames + nframes;
}
- if (!tm.locked() || session == 0) {
+ if (!tm.locked() || _session == 0) {
/* return having done nothing */
_processed_frames = next_processed_frames;
return 0;
if (session_remove_pending) {
/* perform the actual session removal */
- session = 0;
+ _session = 0;
session_remove_pending = false;
session_removed.signal();
_processed_frames = next_processed_frames;
}
if (_freewheeling) {
- /* emit the Freewheel signal and stop freewheeling in the event of trouble */
- if (Freewheel (nframes)) {
+ /* emit the Freewheel signal and stop freewheeling in the event of trouble
+ * the indirection is to pick up the return value of the signal.
+ */
+ if (*Freewheel (nframes)) {
jack_set_freewheel (_priv_jack, false);
}
} else {
- if (session) {
- session->process (nframes);
+ if (_session) {
+ _session->process (nframes);
}
}
last_monitor_check = next_processed_frames;
}
- if (session->silent()) {
+ if (_session->silent()) {
boost::shared_ptr<Ports> p = ports.reader();
monitor_check_interval = nframes / 10;
last_monitor_check = 0;
- if (session) {
- session->set_frame_rate (nframes);
+ if (_session) {
+ _session->set_frame_rate (nframes);
}
SampleRateChanged (nframes); /* EMIT SIGNAL */
(*i)->reset();
}
- if (session) {
- session->set_block_size (_buffer_size);
+ if (_session) {
+ _session->set_block_size (_buffer_size);
}
return 0;
{
if (m_meter_thread == 0) {
g_atomic_int_set (&m_meter_exit, 0);
- m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread),
+ m_meter_thread = Glib::Thread::create (boost::bind (&AudioEngine::meter_thread, this),
500000, true, true, Glib::THREAD_PRIORITY_NORMAL);
}
}
{
Glib::Mutex::Lock pl (_process_lock);
- if (!session) {
-
- session = s;
+ SessionHandlePtr::set_session (s);
+ if (_session) {
+
nframes_t blocksize = jack_get_buffer_size (_jack);
-
+
/* page in as much of the session process code as we
can before we really start running.
*/
-
+
boost::shared_ptr<Ports> p = ports.reader();
-
+
for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
(*i)->cycle_start (blocksize);
}
-
- s->process (blocksize);
- s->process (blocksize);
- s->process (blocksize);
- s->process (blocksize);
- s->process (blocksize);
- s->process (blocksize);
- s->process (blocksize);
- s->process (blocksize);
-
+
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+ _session->process (blocksize);
+
for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
(*i)->cycle_end (blocksize);
}
if (_running) {
- if (session) {
+ if (_session) {
session_remove_pending = true;
session_removed.wait(_process_lock);
}
} else {
- session = 0;
+ SessionHandlePtr::set_session (0);
}
remove_all_ports ();
AudioEngine::reset_timebase ()
{
GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
- if (session) {
- if (session->config.get_jack_time_master()) {
+ if (_session) {
+ if (_session->config.get_jack_time_master()) {
return jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this);
} else {
return jack_release_timebase (_jack);
GET_PRIVATE_JACK_POINTER_RET (_jack,-1);
- if (session) {
- session->reset_jack_connection (_priv_jack);
+ if (_session) {
+ _session->reset_jack_connection (_priv_jack);
nframes_t blocksize = jack_get_buffer_size (_priv_jack);
- session->set_block_size (blocksize);
- session->set_frame_rate (jack_get_sample_rate (_priv_jack));
+ _session->set_block_size (blocksize);
+ _session->set_frame_rate (jack_get_sample_rate (_priv_jack));
_raw_buffer_sizes[DataType::AUDIO] = blocksize * sizeof(float);
cout << "FIXME: Assuming maximum MIDI buffer size " << blocksize * 4 << "bytes" << endl;
jack_set_sync_callback (_priv_jack, _jack_sync_callback, this);
jack_set_freewheel_callback (_priv_jack, _freewheel_callback, this);
- if (session && session->config.get_jack_time_master()) {
+ if (_session && _session->config.get_jack_time_master()) {
jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this);
}
ustring AudioFileSource::peak_dir = "";
-sigc::signal<void> AudioFileSource::HeaderPositionOffsetChanged;
+boost::signals2::signal<void()> AudioFileSource::HeaderPositionOffsetChanged;
uint64_t AudioFileSource::header_position_offset = 0;
/* XXX maybe this too */
#include <set>
-#include <sigc++/bind.h>
-#include <sigc++/class_slot.h>
#include <glibmm/thread.h>
{
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
if (afs) {
- afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed));
+ scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this));
}
init ();
{
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
if (afs) {
- afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed));
+ scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this));
}
init ();
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> ((*i));
if (afs) {
- afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed));
+ scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this));
}
}
{
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
if (afs) {
- afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed));
+ scoped_connect (afs->HeaderPositionOffsetChanged, 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 (sigc::mem_fun (*this, &AudioRegion::invalidate_transients));
+ scoped_connect ((*i)->AnalysisChanged, 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 (sigc::mem_fun (*this, &AudioRegion::source_offset_changed));
+ scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this));
}
}
}
void
AudioRegion::listen_to_my_curves ()
{
- _envelope->StateChanged.connect (sigc::mem_fun (*this, &AudioRegion::envelope_changed));
- _fade_in->StateChanged.connect (sigc::mem_fun (*this, &AudioRegion::fade_in_changed));
- _fade_out->StateChanged.connect (sigc::mem_fun (*this, &AudioRegion::fade_out_changed));
+ scoped_connect (_envelope->StateChanged, boost::bind (&AudioRegion::envelope_changed, this));
+ scoped_connect (_fade_in->StateChanged, boost::bind (&AudioRegion::fade_in_changed, this));
+ scoped_connect (_fade_out->StateChanged, boost::bind (&AudioRegion::fade_out_changed, this));
}
void
***********************************************************************/
bool
-AudioSource::peaks_ready (sigc::slot<void> the_slot, sigc::connection& conn) const
+AudioSource::peaks_ready (boost::function<void()> doThisWhenReady, boost::signals2::connection& connect_here_if_not) const
{
bool ret;
Glib::Mutex::Lock lm (_peaks_ready_lock);
*/
if (!(ret = _peaks_built)) {
- conn = PeaksReady.connect (the_slot);
+ connect_here_if_not = PeaksReady.connect (doThisWhenReady);
}
return ret;
_main_outs->allow_pan_reset ();
_main_outs->reset_panner ();
- _output->changed.connect (sigc::mem_fun (*this, &Auditioner::output_changed));
+ scoped_connect (_output->changed, boost::bind (&Auditioner::output_changed, this, _1, _2));
the_region.reset ((AudioRegion*) 0);
g_atomic_int_set (&_active, 0);
#include <cmath>
#include <sstream>
#include <algorithm>
-#include <sigc++/bind.h>
#include "ardour/automation_list.h"
#include "ardour/event_type_map.h"
#include "evoral/Curve.hpp"
using namespace ARDOUR;
using namespace PBD;
-sigc::signal<void,AutomationList *> AutomationList::AutomationListCreated;
+boost::signals2::signal<void(AutomationList *)> AutomationList::AutomationListCreated;
#if 0
static void dumpit (const AutomationList& al, string prefix = "")
AutomationList::~AutomationList()
{
- GoingAway ();
+ drop_references ();
}
boost::shared_ptr<Evoral::ControlList>
namespace ARDOUR {
-Butler::Butler(Session* s)
- : session(s)
+Butler::Butler(Session& s)
+ : SessionHandleRef (s)
, thread(0)
, audio_dstream_buffer_size(0)
, midi_dstream_buffer_size(0)
int
Butler::start_thread()
{
- const float rate = (float)session->frame_rate();
+ const float rate = (float)_session.frame_rate();
/* size is in Samples, not bytes */
audio_dstream_buffer_size = (uint32_t) floor (Config->get_audio_track_buffer_seconds() * rate);
}
if (transport_work_requested()) {
- session->butler_transport_work ();
+ _session.butler_transport_work ();
}
disk_work_outstanding = false;
begin = get_microseconds();
- boost::shared_ptr<Session::DiskstreamList> dsl = session->diskstream_list().reader ();
+ boost::shared_ptr<Session::DiskstreamList> dsl = _session.diskstream_list().reader ();
// for (i = dsl->begin(); i != dsl->end(); ++i) {
// cerr << "BEFORE " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl;
}
}
- if (err && session->actively_recording()) {
+ if (err && _session.actively_recording()) {
/* stop the transport and try to catch as much possible
captured state as we can.
*/
- session->request_stop ();
+ _session.request_stop ();
}
if (i != dsl->end()) {
if (compute_io) {
// there are no apparent users for this calculation?
end = get_microseconds();
- if(end-begin > 0) {
- _write_data_rate = (float) bytes / (float) (end - begin);
+ if (end - begin > 0) {
+ _write_data_rate = (float) bytes / (float) (end - begin);
} else {
- _write_data_rate = 0; // Well, infinity would be better
+ _write_data_rate = 0; // Well, infinity would be better
}
}
if (!disk_work_outstanding) {
- session->refresh_disk_space ();
+ _session.refresh_disk_space ();
}
const string ControlProtocolManager::state_node_name = X_("ControlProtocols");
ControlProtocolManager::ControlProtocolManager ()
- : _session (0)
{
}
}
void
-ControlProtocolManager::set_session (Session& s)
+ControlProtocolManager::set_session (Session* s)
{
- _session = &s;
- _session->GoingAway.connect (sigc::mem_fun (*this, &ControlProtocolManager::drop_session));
+ SessionHandlePtr::set_session (s);
- for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
- if ((*i)->requested || (*i)->mandatory) {
- instantiate (**i);
- (*i)->requested = false;
+ if (_session) {
+ Glib::Mutex::Lock lm (protocols_lock);
- if ((*i)->protocol && (*i)->state) {
- (*i)->protocol->set_state (*(*i)->state, Stateful::loading_state_version);
+ for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
+ if ((*i)->requested || (*i)->mandatory) {
+ instantiate (**i);
+ (*i)->requested = false;
+
+ if ((*i)->protocol && (*i)->state) {
+ (*i)->protocol->set_state (*(*i)->state, Stateful::loading_state_version);
+ }
}
}
}
}
void
-ControlProtocolManager::drop_session ()
+ControlProtocolManager::session_going_away()
{
- _session = 0;
+ SessionHandlePtr::session_going_away ();
{
Glib::Mutex::Lock lm (protocols_lock);
+
for (list<ControlProtocol*>::iterator p = control_protocols.begin(); p != control_protocols.end(); ++p) {
delete *p;
}
+
control_protocols.clear ();
for (list<ControlProtocolInfo*>::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) {
+ // mark existing protocols as requested
// otherwise the ControlProtocol instances are not recreated in set_session
if ((*p)->protocol) {
(*p)->requested = true;
}
void
-ControlProtocolManager::foreach_known_protocol (sigc::slot<void,const ControlProtocolInfo*> method)
+ControlProtocolManager::foreach_known_protocol (boost::function<void(const ControlProtocolInfo*)> method)
{
for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
method (*i);
CoreAudioSource::~CoreAudioSource ()
{
- GoingAway (); /* EMIT SIGNAL */
+ drop_references ();
}
int
*/
-#include <sigc++/bind.h>
#include "pbd/stacktrace.h"
Crossfade::~Crossfade ()
{
- notify_callbacks ();
}
void
using namespace PBD;
using namespace ARDOUR;
-sigc::signal<void,nframes_t> Delivery::CycleStart;
-sigc::signal<int> Delivery::PannersLegal;
-bool Delivery::panners_legal = false;
+boost::signals2::signal<void(nframes_t)> Delivery::CycleStart;
+boost::signals2::signal<int()> Delivery::PannersLegal;
+bool Delivery::panners_legal = false;
/* deliver to an existing IO object */
_display_to_user = false;
if (_output) {
- _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed));
+ scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2));
}
- CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start));
+ scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1));
}
/* deliver to a new IO object */
_display_to_user = false;
if (_output) {
- _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed));
+ scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2));
}
- CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start));
+ scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1));
}
/* deliver to a new IO object, reconstruct from XML */
}
if (_output) {
- _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed));
+ scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2));
}
- CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start));
+ scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1));
}
/* deliver to an existing IO object, reconstruct from XML */
}
if (_output) {
- _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed));
+ scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2));
}
- CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start));
+ scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1));
}
std::string
}
} else {
panner_legal_c.disconnect ();
- panner_legal_c = PannersLegal.connect (sigc::mem_fun (*this, &Delivery::panners_became_legal));
+ panner_legal_c = PannersLegal.connect (boost::bind (&Delivery::panners_became_legal, this));
}
}
Delivery::reset_panners ()
{
panners_legal = true;
- return PannersLegal ();
+ return *PannersLegal ();
}
#include <sys/stat.h>
#include <sys/mman.h>
-#include <sigc++/bind.h>
#include "pbd/error.h"
#include "pbd/basename.h"
*/
ARDOUR::nframes_t Diskstream::disk_io_chunk_frames = 1024 * 256;
-sigc::signal<void> Diskstream::DiskOverrun;
-sigc::signal<void> Diskstream::DiskUnderrun;
+boost::signals2::signal<void()> Diskstream::DiskOverrun;
+boost::signals2::signal<void()> Diskstream::DiskUnderrun;
Diskstream::Diskstream (Session &sess, const string &name, Flag flag)
: SessionObject(sess, name)
_io = _route->input();
ic_connection.disconnect();
- ic_connection = _io->changed.connect (sigc::mem_fun (*this, &Diskstream::handle_input_change));
+ ic_connection = _io->changed.connect (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 (sigc::mem_fun (*this, &Diskstream::route_going_away));
+ scoped_connect (_route->GoingAway, boost::bind (&Diskstream::route_going_away, this));
}
void
return 0;
}
- plmod_connection.disconnect ();
- plgone_connection.disconnect ();
- plregion_connection.disconnect ();
+ playlist_connections.drop_connections ();
if (_playlist) {
_playlist->release();
reset_write_sources (false);
}
- plmod_connection = _playlist->Modified.connect (sigc::mem_fun (*this, &Diskstream::playlist_modified));
- plgone_connection = _playlist->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Diskstream::playlist_deleted), boost::weak_ptr<Playlist>(_playlist)));
- plregion_connection = _playlist->RangesMoved.connect (sigc::mem_fun (*this, &Diskstream::playlist_ranges_moved));
+ playlist_connections.add_connection (_playlist->Modified.connect (boost::bind (&Diskstream::playlist_modified, this)));
+ playlist_connections.add_connection (_playlist->GoingAway.connect (boost::bind (&Diskstream::playlist_deleted, this, boost::weak_ptr<Playlist>(_playlist))));
+ playlist_connections.add_connection (_playlist->RangesMoved.connect (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
}
/* move processor automation */
- _route->foreach_processor (sigc::bind (sigc::mem_fun (*this, &Diskstream::move_processor_automation), movements_frames));
+ _route->foreach_processor (boost::bind (&Diskstream::move_processor_automation, this, _1, movements_frames));
}
void
-Diskstream::move_processor_automation (boost::weak_ptr<Processor> p,
- list< Evoral::RangeMove<nframes_t> > const & movements_frames)
+Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, list< Evoral::RangeMove<nframes_t> > const & movements_frames)
{
boost::shared_ptr<Processor> processor (p.lock ());
if (!processor) {
using namespace PBD;
using namespace ARDOUR;
-sigc::signal <std::pair<bool, string>, string, string> ElementImporter::Rename;
-sigc::signal <bool, string> ElementImporter::Prompt;
+boost::signals2::signal <std::pair<bool, string> (string, string)> ElementImporter::Rename;
+boost::signals2::signal <bool (string)> ElementImporter::Prompt;
ElementImporter::ElementImporter (XMLTree const & source, ARDOUR::Session & session) :
source (source),
throw ExportFailed ("Unhandled type in ExportChannelFactory constructor");
}
- session->ProcessExport.connect (sigc::hide (sigc::mem_fun (*this, &RegionExportChannelFactory::new_cycle_started)));
+ export_connection = session->ProcessExport.connect (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 (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_compatibility_selection), WeakCompatPtr (ptr)));
+ scoped_connect (ptr->SelectChanged, boost::bind (&ExportFormatManager::change_compatibility_selection, this, _1, WeakCompatPtr (ptr)));
}
void
ExportFormatManager::add_quality (QualityPtr ptr)
{
- ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_quality_selection), WeakQualityPtr (ptr)));
+ scoped_connect (ptr->SelectChanged, 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 (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_format_selection), WeakFormatPtr (ptr)));
+ scoped_connect (ptr->SelectChanged, 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 (sigc::mem_fun (*this, &ExportFormatManager::change_sample_format_selection));
- hsf->DitherTypeSelectChanged.connect (sigc::mem_fun (*this, &ExportFormatManager::change_dither_type_selection));
+ scoped_connect (hsf->SampleFormatSelectChanged, boost::bind (&ExportFormatManager::change_sample_format_selection, this, _1, _2));
+ scoped_connect (hsf->DitherTypeSelectChanged, boost::bind (&ExportFormatManager::change_dither_type_selection, this, _1, _2));
}
}
void
ExportFormatManager::add_sample_rate (SampleRatePtr ptr)
{
- ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_sample_rate_selection), WeakSampleRatePtr (ptr)));
+ scoped_connect (ptr->SelectChanged, 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 (sigc::bind (SampleFormatSelectChanged.make_slot(), WeakSampleFormatPtr (ptr)));
- ptr->SelectChanged.connect (sigc::mem_fun (*this, &HasSampleFormat::update_sample_format_selection));
- ptr->CompatibleChanged.connect (sigc::bind (SampleFormatCompatibleChanged.make_slot(), WeakSampleFormatPtr (ptr)));
+ scoped_connect (ptr->SelectChanged, boost::bind (&HasSampleFormat::update_sample_format_selection, this, _1));
+ // BOOST SIGNALS how to connect one signal to another
+ // scoped_connect (ptr->SelectChanged, boost::bind (SampleFormatSelectChanged, _1, WeakSampleFormatPtr (ptr));
+ // scoped_connect (ptr->CompatibleChanged, boost::bind (SampleFormatCompatibleChanged, _1, WeakSampleFormatPtr (ptr));
}
void
{
DitherTypePtr ptr (new DitherTypeState (type, name));
dither_type_states.push_back (ptr);
- ptr->SelectChanged.connect (sigc::bind (DitherTypeSelectChanged.make_slot(), WeakDitherTypePtr (ptr)));
- ptr->SelectChanged.connect (sigc::mem_fun (*this, &HasSampleFormat::update_dither_type_selection));
- ptr->CompatibleChanged.connect (sigc::bind (DitherTypeCompatibleChanged.make_slot(), WeakDitherTypePtr (ptr)));
+ scoped_connect (ptr->SelectChanged, boost::bind (&HasSampleFormat::update_dither_type_selection, this, _1));
+ // BOOST SIGNALS how to connect one signal to another
+ // scoped_connect (ptr->SelectChanged, boost::bind (DitherTypeSelectChanged, _1, WeakDitherTypePtr (ptr));
+ // scoped_connect (ptr->CompatibleChanged, boost::bind (DitherTypeCompatibleChanged, _1, WeakDitherTypePtr (ptr));
}
HasSampleFormat::SampleFormatPtr
/*** ExportHandler ***/
-ExportHandler::ExportHandler (Session & session) :
- ExportElementFactory (session),
- session (session),
- export_status (session.get_export_status ()),
- realtime (false)
+ExportHandler::ExportHandler (Session & session)
+ : ExportElementFactory (session)
+ , session (session)
+ , export_status (session.get_export_status ())
+ , realtime (false)
{
processor.reset (new ExportProcessor (session));
- files_written_connection = ExportProcessor::WritingFile.connect (sigc::mem_fun (files_written, &std::list<Glib::ustring>::push_back));
+ files_written_connection = ExportProcessor::WritingFile.connect (boost::bind (&ExportHandler::add_file, this, _1));
}
ExportHandler::~ExportHandler ()
files_written_connection.disconnect();
}
+void
+ExportHandler::add_file (const Glib::ustring& str)
+{
+ files_written.push_back (str);
+}
+
bool
ExportHandler::add_export_config (TimespanPtr timespan, ChannelConfigPtr channel_config, FormatPtr format, FilenamePtr filename)
{
realtime = rt;
- session.ExportReadFinished.connect (sigc::mem_fun (*this, &ExportHandler::finish_timespan));
+ export_read_finished_connection = session.ExportReadFinished.connect (boost::bind (&ExportHandler::finish_timespan, this));
start_timespan ();
}
/* connect stuff and start export */
- current_timespan->process_connection = session.ProcessExport.connect (sigc::mem_fun (*current_timespan, &ExportTimespan::process));
+ current_timespan->process_connection = session.ProcessExport.connect (boost::bind (&ExportTimespan::process, current_timespan, _1));
session.start_audio_export (current_timespan->get_start(), realtime);
}
ExportHandler::timespan_thread_finished ()
{
channel_config_connection.disconnect();
+ export_read_finished_connection.disconnect ();
if (current_map_it != timespan_bounds.second) {
cc = current_map_it->second.channel_config;
}
- channel_config_connection = cc->FilesWritten.connect (sigc::mem_fun (*this, &ExportHandler::timespan_thread_finished));
+ channel_config_connection = cc->FilesWritten.connect (boost::bind (&ExportHandler::timespan_thread_finished, this));
++current_map_it;
} else { /* All files are written from current timespan, reset timespan and start new */
namespace ARDOUR
{
-sigc::signal<void, Glib::ustring> ExportProcessor::WritingFile;
+boost::signals2::signal<void (const Glib::ustring&)> ExportProcessor::WritingFile;
ExportProcessor::ExportProcessor (Session & session) :
session (session),
mix_buffers_with_gain_t ARDOUR::mix_buffers_with_gain = 0;
mix_buffers_no_gain_t ARDOUR::mix_buffers_no_gain = 0;
-sigc::signal<void,std::string> ARDOUR::BootMessage;
+boost::signals2::signal<void(std::string)> ARDOUR::BootMessage;
void ARDOUR::setup_enum_writer ();
using namespace std;
using namespace ARDOUR;
-sigc::signal<void,nframes_t> InternalReturn::CycleStart;
+boost::signals2::signal<void(nframes_t)> InternalReturn::CycleStart;
InternalReturn::InternalReturn (Session& s)
: Return (s, true)
, user_count (0)
{
- CycleStart.connect (sigc::mem_fun (*this, &InternalReturn::cycle_start));
+ scoped_connect (CycleStart, boost::bind (&InternalReturn::cycle_start, this, _1));
}
InternalReturn::InternalReturn (Session& s, const XMLNode& node)
: Return (s, node, true)
, user_count (0)
{
- CycleStart.connect (sigc::mem_fun (*this, &InternalReturn::cycle_start));
+ scoped_connect (CycleStart, boost::bind (&InternalReturn::cycle_start, this, _1));
}
void
set_name (sendto->name());
- _send_to->GoingAway.connect (sigc::mem_fun (*this, &InternalSend::send_to_going_away));
- _send_to->NameChanged.connect (sigc::mem_fun (*this, &InternalSend::send_to_name_changed));
+ scoped_connect (_send_to->GoingAway, boost::bind (&InternalSend::send_to_going_away, this));
+ scoped_connect (_send_to->NameChanged, boost::bind (&InternalSend::send_to_name_changed, this));
}
InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
*/
if (!IO::connecting_legal) {
- connect_c = IO::ConnectingLegal.connect (sigc::mem_fun (*this, &InternalSend::connect_when_legal));
+ connect_c = IO::ConnectingLegal.connect (boost::bind (&InternalSend::connect_when_legal, this));
} else {
connect_when_legal ();
}
#include <locale.h>
#include <errno.h>
-#include <sigc++/bind.h>
#include <glibmm.h>
#include <glibmm/thread.h>
const string IO::state_node_name = "IO";
bool IO::connecting_legal = false;
-sigc::signal<int> IO::ConnectingLegal;
-sigc::signal<void,ChanCount> IO::PortCountChanged;
+boost::signals2::signal<int()> IO::ConnectingLegal;
+boost::signals2::signal<void(ChanCount)> IO::PortCountChanged;
/** @param default_type The type of port that will be created by ensure_io
* and friends if no type is explicitly requested (to avoid breakage).
}
void
-IO::check_bundles (std::vector<UserBundleInfo>& list, const PortSet& ports)
+IO::check_bundles (std::vector<UserBundleInfo*>& list, const PortSet& ports)
{
- std::vector<UserBundleInfo> new_list;
+ std::vector<UserBundleInfo*> new_list;
- for (std::vector<UserBundleInfo>::iterator i = list.begin(); i != list.end(); ++i) {
+ for (std::vector<UserBundleInfo*>::iterator i = list.begin(); i != list.end(); ++i) {
- uint32_t const N = i->bundle->nchannels ();
+ uint32_t const N = (*i)->bundle->nchannels ();
if (_ports.num_ports (default_type()) < N) {
continue;
for (uint32_t j = 0; j < N; ++j) {
/* Every port on bundle channel j must be connected to our input j */
- Bundle::PortList const pl = i->bundle->channel_ports (j);
+ Bundle::PortList const pl = (*i)->bundle->channel_ports (j);
for (uint32_t k = 0; k < pl.size(); ++k) {
if (ports.port(j)->connected_to (pl[k]) == false) {
ok = false;
if (ok) {
new_list.push_back (*i);
} else {
- i->changed.disconnect ();
+ delete *i;
}
}
node->add_property ("direction", enum_2_string (_direction));
node->add_property ("default-type", _default_type.to_string());
- for (std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) {
+ for (std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) {
XMLNode* n = new XMLNode ("Bundle");
- n->add_property ("name", i->bundle->name ());
+ n->add_property ("name", (*i)->bundle->name ());
node->add_child_nocopy (*n);
}
pending_state_node = new XMLNode (node);
pending_state_node_version = version;
pending_state_node_in = false;
- connection_legal_c = ConnectingLegal.connect (sigc::mem_fun (*this, &IO::connecting_became_legal));
+ connection_legal_c = ConnectingLegal.connect (boost::bind (&IO::connecting_became_legal, this));
}
pending_state_node = new XMLNode (node);
pending_state_node_version = version;
pending_state_node_in = in;
- connection_legal_c = ConnectingLegal.connect (sigc::mem_fun (*this, &IO::connecting_became_legal));
+ connection_legal_c = ConnectingLegal.connect (boost::bind (&IO::connecting_became_legal, this));
}
return 0;
if (ub) {
/* See if we already know about this one */
- std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin();
- while (i != _bundles_connected.end() && i->bundle != ub) {
+ std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin();
+ while (i != _bundles_connected.end() && (*i)->bundle != ub) {
++i;
}
if (i == _bundles_connected.end()) {
/* We don't, so make a note */
- _bundles_connected.push_back (UserBundleInfo (this, ub));
+ _bundles_connected.push_back (new UserBundleInfo (this, ub));
}
}
}
boost::shared_ptr<UserBundle> ub = boost::dynamic_pointer_cast<UserBundle> (c);
if (ub) {
- std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin();
- while (i != _bundles_connected.end() && i->bundle != ub) {
+ std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin();
+ while (i != _bundles_connected.end() && (*i)->bundle != ub) {
++i;
}
if (i != _bundles_connected.end()) {
+ delete *i;
_bundles_connected.erase (i);
}
}
IO::enable_connecting ()
{
connecting_legal = true;
- return ConnectingLegal ();
+ return *ConnectingLegal ();
}
void
BundleList bundles;
/* User bundles */
- for (std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) {
- bundles.push_back (i->bundle);
+ for (std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) {
+ bundles.push_back ((*i)->bundle);
}
/* Session bundles */
IO::UserBundleInfo::UserBundleInfo (IO* io, boost::shared_ptr<UserBundle> b)
{
bundle = b;
- changed = b->Changed.connect (
- sigc::mem_fun (*io, &IO::bundle_changed)
- );
+ changed = b->Changed.connect (boost::bind (&IO::bundle_changed, io, _1));
}
std::string
#include <unistd.h>
#include <sstream>
-#include <sigc++/bind.h>
#include "pbd/xml++.h"
#include "pbd/enumwriter.h"
IOProcessor::~IOProcessor ()
{
- notify_callbacks ();
}
void
deactivate ();
cleanup ();
- GoingAway (); /* EMIT SIGNAL */
+ drop_references ();
/* XXX who should close a plugin? */
#include <ctime>
#include <list>
-#include <sigc++/bind.h>
#include "pbd/stl_delete.h"
#include "pbd/xml++.h"
std::pair<bool, string> rename_pair;
if (location->is_auto_punch()) {
- rename_pair = Rename (_("The location is the Punch range. It will be imported as a normal range.\nYou may rename the imported location:"), name);
+ rename_pair = *Rename (_("The location is the Punch range. It will be imported as a normal range.\nYou may rename the imported location:"), name);
if (!rename_pair.first) {
return false;
}
}
if (location->is_auto_loop()) {
- rename_pair = Rename (_("The location is a Loop range. It will be imported as a normal range.\nYou may rename the imported location:"), name);
+ rename_pair = *Rename (_("The location is a Loop range. It will be imported as a normal range.\nYou may rename the imported location:"), name);
if (!rename_pair.first) { return false; }
location->set_auto_loop (false, this);
Locations::LocationList const & locations(session.locations()->list());
for (Locations::LocationList::const_iterator it = locations.begin(); it != locations.end(); ++it) {
if (!((*it)->name().compare (location->name())) || !handler.check_name (location->name())) {
- rename_pair = Rename (_("A location with that name already exists.\nYou may rename the imported location:"), name);
+ rename_pair = *Rename (_("A location with that name already exists.\nYou may rename the imported location:"), name);
if (!rename_pair.first) { return false; }
name = rename_pair.second;
}
deactivate ();
cleanup ();
- GoingAway (); /* EMIT SIGNAL */
+ drop_references ();
slv2_instance_free(_instance);
slv2_value_free(_name);
using namespace ARDOUR;
-sigc::signal<void> Metering::Meter;
+boost::signals2::signal<void()> Metering::Meter;
Glib::StaticMutex Metering::m_meter_signal_lock;
-sigc::connection
-Metering::connect (sigc::slot<void> the_slot)
+boost::signals2::connection
+Metering::connect (boost::function<void()> f)
{
// SignalProcessor::Meter is emitted from another thread so the
// Meter signal must be protected.
Glib::Mutex::Lock guard (m_meter_signal_lock);
- return Meter.connect (the_slot);
+ return Meter.connect (f);
}
void
-Metering::disconnect (sigc::connection& c)
+Metering::disconnect (boost::signals2::connection& c)
{
Glib::Mutex::Lock guard (m_meter_signal_lock);
c.disconnect ();
using namespace PBD;
MIDIClock_Slave::MIDIClock_Slave (Session& s, MIDI::Port& p, int ppqn)
- : ppqn (ppqn)
+ : port_connections (0)
+ , ppqn (ppqn)
, bandwidth (30.0 / 60.0) // 1 BpM = 1 / 60 Hz
{
session = (ISlaveSessionProxy *) new SlaveSessionProxy(s);
MIDIClock_Slave::MIDIClock_Slave (ISlaveSessionProxy* session_proxy, int ppqn)
: session(session_proxy)
+ , port_connections (0)
, ppqn (ppqn)
, bandwidth (30.0 / 60.0) // 1 BpM = 1 / 60 Hz
{
MIDIClock_Slave::~MIDIClock_Slave()
{
- delete session;
+ delete session;
+ delete port_connections;
}
void
MIDIClock_Slave::rebind (MIDI::Port& p)
{
- for (vector<sigc::connection>::iterator i = connections.begin(); i != connections.end(); ++i) {
- (*i).disconnect ();
- }
-
+ delete port_connections;
+ port_connections = new ScopedConnectionList;
+
port = &p;
- #ifdef DEBUG_MIDI_CLOCK
- std::cerr << "MIDIClock_Slave: connecting to port " << port->name() << std::endl;
- #endif
+#ifdef DEBUG_MIDI_CLOCK
+ std::cerr << "MIDIClock_Slave: connecting to port " << port->name() << std::endl;
+#endif
- connections.push_back (port->input()->timing.connect (sigc::mem_fun (*this, &MIDIClock_Slave::update_midi_clock)));
- connections.push_back (port->input()->start.connect (sigc::mem_fun (*this, &MIDIClock_Slave::start)));
- connections.push_back (port->input()->contineu.connect (sigc::mem_fun (*this, &MIDIClock_Slave::contineu)));
- connections.push_back (port->input()->stop.connect (sigc::mem_fun (*this, &MIDIClock_Slave::stop)));
- connections.push_back (port->input()->position.connect (sigc::mem_fun (*this, &MIDIClock_Slave::position)));
+ port_connections->add_connection (port->input()->timing.connect (boost::bind (&MIDIClock_Slave::update_midi_clock, this, _1, _2)));
+ port_connections->add_connection (port->input()->start.connect (boost::bind (&MIDIClock_Slave::start, this, _1, _2)));
+ port_connections->add_connection (port->input()->contineu.connect (boost::bind (&MIDIClock_Slave::contineu, this, _1, _2)));
+ port_connections->add_connection (port->input()->stop.connect (boost::bind (&MIDIClock_Slave::stop, this, _1, _2)));
+ port_connections->add_connection (port->input()->position.connect (boost::bind (&MIDIClock_Slave::position, this, _1, _2, 3)));
}
void
continue; /* XXX is this OK? */
}
- region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Diskstream::remove_region_from_last_capture), boost::weak_ptr<Region>(region)));
+ scoped_connect (region->GoingAway, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
_last_capture_regions.push_back (region);
if (added_notes) {
XMLNodeList notes = added_notes->children();
transform(notes.begin(), notes.end(), back_inserter(_added_notes),
- sigc::mem_fun(*this, &DeltaCommand::unmarshal_note));
+ boost::bind (&DeltaCommand::unmarshal_note, this, _1));
}
_removed_notes.clear();
if (removed_notes) {
XMLNodeList notes = removed_notes->children();
transform(notes.begin(), notes.end(), back_inserter(_removed_notes),
- sigc::mem_fun(*this, &DeltaCommand::unmarshal_note));
+ boost::bind (&DeltaCommand::unmarshal_note, this, _1));
}
return 0;
delta_command->add_property("midi-source", _model->midi_source()->id().to_s());
XMLNode* added_notes = delta_command->add_child(ADDED_NOTES_ELEMENT);
- for_each(_added_notes.begin(), _added_notes.end(), sigc::compose(
- sigc::mem_fun(*added_notes, &XMLNode::add_child_nocopy),
- sigc::mem_fun(*this, &DeltaCommand::marshal_note)));
+ for_each(_added_notes.begin(), _added_notes.end(),
+ boost::bind(
+ boost::bind (&XMLNode::add_child_nocopy, *added_notes, _1),
+ boost::bind (&DeltaCommand::marshal_note, this, _1)));
XMLNode* removed_notes = delta_command->add_child(REMOVED_NOTES_ELEMENT);
- for_each(_removed_notes.begin(), _removed_notes.end(), sigc::compose(
- sigc::mem_fun(*removed_notes, &XMLNode::add_child_nocopy),
- sigc::mem_fun(*this, &DeltaCommand::marshal_note)));
+ for_each(_removed_notes.begin(), _removed_notes.end(),
+ boost::bind (
+ boost::bind (&XMLNode::add_child_nocopy, *removed_notes, _1),
+ boost::bind (&DeltaCommand::marshal_note, this, _1)));
return *delta_command;
}
if (changed_notes) {
XMLNodeList notes = changed_notes->children();
-
transform (notes.begin(), notes.end(), back_inserter(_changes),
- sigc::mem_fun(*this, &DiffCommand::unmarshal_change));
+ boost::bind (&DiffCommand::unmarshal_change, this, _1));
+
}
return 0;
diff_command->add_property("midi-source", _model->midi_source()->id().to_s());
XMLNode* changes = diff_command->add_child(DIFF_NOTES_ELEMENT);
- for_each(_changes.begin(), _changes.end(), sigc::compose(
- sigc::mem_fun(*changes, &XMLNode::add_child_nocopy),
- sigc::mem_fun(*this, &DiffCommand::marshal_change)));
+ for_each(_changes.begin(), _changes.end(),
+ boost::bind (
+ boost::bind (&XMLNode::add_child_nocopy, *changes, _1),
+ boost::bind (&DiffCommand::marshal_change, this, _1)));
return *diff_command;
}
$Id$
*/
-#include <sigc++/sigc++.h>
#include <boost/shared_ptr.hpp>
#include "pbd/compose.h"
MidiPatchManager* MidiPatchManager::_manager = 0;
void
-MidiPatchManager::set_session (Session& s)
+MidiPatchManager::set_session (Session* s)
{
- _session = &s;
- _session->GoingAway.connect (sigc::mem_fun (*this, &MidiPatchManager::drop_session));
-
+ SessionHandlePtr::set_session (s);
refresh();
}
_master_devices_by_model.clear();
_all_models.clear();
+ if (!_session) {
+ return;
+ }
+
path path_to_patches = _session->session_directory().midi_patch_path();
if (!exists(path_to_patches)) {
}
void
-MidiPatchManager::drop_session ()
+MidiPatchManager::session_going_away ()
{
- _session = 0;
- _documents.clear();
- _master_devices_by_model.clear();
- _all_models.clear();
+ SessionHandlePtr::session_going_away ();
+ refresh ();
}
#include <iostream>
#include <stdlib.h>
-#include <sigc++/bind.h>
#include "evoral/EventList.hpp"
MidiPlaylist::~MidiPlaylist ()
{
- GoingAway (); /* EMIT SIGNAL */
+ drop_references ();
/* drop connections to signals */
-
- notify_callbacks ();
}
template<typename Time>
#include <set>
-#include <sigc++/bind.h>
-#include <sigc++/class_slot.h>
#include <glibmm/thread.h>
: 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(sigc::mem_fun(this, &MidiRegion::switch_source));
+ scoped_connect (midi_source(0)->Switched, 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(sigc::mem_fun(this, &MidiRegion::switch_source));
+ scoped_connect (midi_source(0)->Switched, 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(sigc::mem_fun(this, &MidiRegion::switch_source));
+ scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1));
}
: Region (other, offset, length, name, layer, flags)
{
assert(_name.find("/") == string::npos);
- midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source));
+ scoped_connect (midi_source(0)->Switched, 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(sigc::mem_fun(this, &MidiRegion::switch_source));
+ scoped_connect (midi_source(0)->Switched, 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(sigc::mem_fun(this, &MidiRegion::switch_source));
+ scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1));
assert(_name.find("/") == string::npos);
assert(_type == DataType::MIDI);
}
throw failed_constructor();
}
- midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source));
+ scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1));
assert(_name.find("/") == string::npos);
assert(_type == DataType::MIDI);
}
using namespace ARDOUR;
using namespace PBD;
-sigc::signal<void,MidiSource *> MidiSource::MidiSourceCreated;
+boost::signals2::signal<void(MidiSource*)> MidiSource::MidiSourceCreated;
MidiSource::MidiSource (Session& s, string name, Source::Flag flags)
: Source(s, DataType::MIDI, name, flags)
newsrc->flush_midi();
- Switched.emit(newsrc);
+ Switched (newsrc); /* EMIT SIGNAL */
}
}
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "pbd/error.h"
-#include <sigc++/retype.h>
-#include <sigc++/retype_return.h>
-#include <sigc++/bind.h>
#include "pbd/enumwriter.h"
#include "midi++/events.h"
pending_state = const_cast<XMLNode*> (&node);
if (_session.state_of_the_state() & Session::Loading) {
- _session.StateReady.connect (sigc::mem_fun (*this, &MidiTrack::set_state_part_two));
+ scoped_connect (_session.StateReady, boost::bind (&MidiTrack::set_state_part_two, this));
} else {
set_state_part_two ();
}
*/
#include <cstdlib>
+#include <sigc++/signal.h>
+
#include "pbd/pthread_utils.h"
#include "midi++/manager.h"
: AbstractUI<MidiUIRequest> (_("midiui"))
, _session (s)
{
- MIDI::Manager::instance()->PortsChanged.connect (sigc::mem_fun (*this, &MidiControlUI::change_midi_ports));
+ rebind_connection = MIDI::Manager::instance()->PortsChanged.connect (boost::bind (&MidiControlUI::change_midi_ports, this));
}
MidiControlUI::~MidiControlUI ()
if ((fd = (*i)->selectable ()) >= 0) {
Glib::RefPtr<IOSource> psrc = IOSource::create (fd, IO_IN|IO_HUP|IO_ERR);
- psrc->connect (sigc::bind (sigc::mem_fun (*this, &MidiControlUI::midi_input_handler), (*i)));
+ psrc->connect (sigc::bind (sigc::mem_fun (this, &MidiControlUI::midi_input_handler), *i));
psrc->attach (_main_loop->get_context());
// glibmm hack: for now, store only the GSource*
MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p)
: session (s)
+ , port_connections (0)
{
can_notify_on_unknown_rate = true;
did_reset_tc_format = false;
MTC_Slave::~MTC_Slave()
{
+ delete port_connections;
+
if (did_reset_tc_format) {
session.config.set_timecode_format (saved_tc_format);
}
+
delete pic;
delete [] speed_accumulator;
}
void
MTC_Slave::rebind (MIDI::Port& p)
{
- for (vector<sigc::connection>::iterator i = connections.begin(); i != connections.end(); ++i) {
- (*i).disconnect ();
- }
-
+ delete port_connections;
+ port_connections = new ScopedConnectionList;
+
port = &p;
-
- connections.push_back (port->input()->mtc_time.connect (sigc::mem_fun (*this, &MTC_Slave::update_mtc_time)));
- connections.push_back (port->input()->mtc_qtr.connect (sigc::mem_fun (*this, &MTC_Slave::update_mtc_qtr)));
- connections.push_back (port->input()->mtc_status.connect (sigc::mem_fun (*this, &MTC_Slave::update_mtc_status)));
+
+ port_connections->add_connection (port->input()->mtc_time.connect ( boost::bind (&MTC_Slave::update_mtc_time, this, _1, _2, _3)));
+ port_connections->add_connection (port->input()->mtc_qtr.connect (boost::bind (&MTC_Slave::update_mtc_qtr, this, _1, _2, _3)));
+ port_connections->add_connection (port->input()->mtc_status.connect (boost::bind (&MTC_Slave::update_mtc_status, this, _1)));
}
void
using namespace ARDOUR;
using namespace PBD;
-sigc::signal<void,NamedSelection*> NamedSelection::NamedSelectionCreated;
+boost::signals2::signal<void(NamedSelection*)> NamedSelection::NamedSelectionCreated;
typedef std::list<boost::shared_ptr<Playlist> > PlaylistList;
{
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
(*i)->release ();
- (*i)->GoingAway ();
+ (*i)->drop_references ();
}
}
#include <string>
#include <climits>
-#include <sigc++/bind.h>
#include "pbd/failed_constructor.h"
#include "pbd/stl_delete.h"
}
Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, bool hide)
- : SessionObject(other->_session, namestr), _type(other->_type), _orig_diskstream_id(other->_orig_diskstream_id)
+ : SessionObject(other->_session, namestr)
+ , _type(other->_type)
+ , _orig_diskstream_id(other->_orig_diskstream_id)
{
init (hide);
}
Playlist::Playlist (boost::shared_ptr<const Playlist> other, nframes_t start, nframes_t cnt, string str, bool hide)
- : SessionObject(other->_session, str), _type(other->_type), _orig_diskstream_id(other->_orig_diskstream_id)
+ : SessionObject(other->_session, str)
+ , _type(other->_type)
+ , _orig_diskstream_id(other->_orig_diskstream_id)
{
RegionLock rlock2 (const_cast<Playlist*> (other.get()));
freeze_length = 0;
_explicit_relayering = false;
- Modified.connect (sigc::mem_fun (*this, &Playlist::mark_session_dirty));
+ scoped_connect (Modified, boost::bind (&Playlist::mark_session_dirty, this));
}
Playlist::~Playlist ()
{
DEBUG_TRACE (DEBUG::Destruction, string_compose ("Playlist %1 destructor\n", _name));
+
{
RegionLock rl (this);
}
}
- region_state_changed_connections.push_back (
- region->StateChanged.connect (sigc::bind (sigc::mem_fun (this, &Playlist::region_changed_proxy),
- boost::weak_ptr<Region> (region)))
- );
+ region_state_changed_connections.add_connection
+ (region->StateChanged.connect (boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region))));
return true;
}
return;
}
-
/* this makes a virtual call to the right kind of playlist ... */
region_changed (what_changed, region);
{
RegionLock rl (this);
- for (
- std::list<sigc::connection>::iterator i = region_state_changed_connections.begin ();
- i != region_state_changed_connections.end ();
- ++i
- ) {
- i->disconnect ();
- }
+ region_state_changed_connections.drop_connections ();
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
pending_removes.insert (*i);
}
void
-Playlist::foreach_region (sigc::slot<void, boost::shared_ptr<Region> > s)
+Playlist::foreach_region (boost::function<void(boost::shared_ptr<Region>)> s)
{
RegionLock rl (this, false);
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
using namespace ARDOUR;
using namespace PBD;
-sigc::signal<void,boost::shared_ptr<Playlist>, bool> PlaylistFactory::PlaylistCreated;
+boost::signals2::signal<void(boost::shared_ptr<Playlist>, bool)> PlaylistFactory::PlaylistCreated;
boost::shared_ptr<Playlist>
PlaylistFactory::create (Session& s, const XMLNode& node, bool hidden, bool unused)
#include <string>
-#include <sigc++/bind.h>
#include "pbd/failed_constructor.h"
#include "pbd/xml++.h"
PluginInsert::~PluginInsert ()
{
- GoingAway (); /* EMIT SIGNAL */
+ drop_references ();
}
void
#include <string>
-#include <sigc++/bind.h>
#include "pbd/failed_constructor.h"
#include "pbd/xml++.h"
PortInsert::~PortInsert ()
{
- GoingAway ();
+ drop_references ();
}
void
#include <string>
-#include <sigc++/bind.h>
#include "pbd/failed_constructor.h"
#include "pbd/enumwriter.h"
using namespace ARDOUR;
using namespace PBD;
-sigc::signal<void,Processor*> Processor::ProcessorCreated;
+boost::signals2::signal<void(Processor*)> Processor::ProcessorCreated;
// Always saved as Processor, but may be IOProcessor or Send in legacy sessions
const string Processor::state_node_name = "Processor";
_configured_output = out;
_configured = true;
- ConfigurationChanged.emit (in, out);
+ ConfigurationChanged (in, out); /* EMIT SIGNAL */
return true;
}
#include <algorithm>
#include <sstream>
-#include <sigc++/bind.h>
-#include <sigc++/class_slot.h>
#include <glibmm/thread.h>
#include "pbd/xml++.h"
Change Region::LayerChanged = ARDOUR::new_change ();
Change Region::HiddenChanged = ARDOUR::new_change ();
-sigc::signal<void,boost::shared_ptr<ARDOUR::Region> > Region::RegionPropertyChanged;
+boost::signals2::signal<void(boost::shared_ptr<ARDOUR::Region>)> Region::RegionPropertyChanged;
/* derived-from-derived constructor (no sources in constructor) */
Region::Region (Session& s, nframes_t start, nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags)
_sources.push_back (src);
_master_sources.push_back (src);
- src->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Region::source_deleted), src));
+ scoped_connect (src->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(src)));
assert(_sources.size() > 0);
_positional_lock_style = AudioTime;
Region::~Region ()
{
DEBUG_TRACE (DEBUG::Destruction, string_compose ("Region %1 destructor @ %2\n", _name, this));
- notify_callbacks ();
drop_references ();
}
}
void
-Region::source_deleted (boost::shared_ptr<Source>)
+Region::source_deleted (boost::weak_ptr<Source>)
{
_sources.clear ();
+ cerr << "Send drop ref signal from region " << ' ' << this << endl;
drop_references ();
}
for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) {
_sources.push_back (*i);
- (*i)->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Region::source_deleted), *i));
+ scoped_connect ((*i)->GoingAway, 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 (sigc::bind (sigc::mem_fun (*this, &Region::source_deleted), *i));
+ scoped_connect ((*i)->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
}
}
}
using namespace ARDOUR;
using namespace PBD;
-sigc::signal<void,boost::shared_ptr<Region> > RegionFactory::CheckNewRegion;
+boost::signals2::signal<void(boost::shared_ptr<Region>)> RegionFactory::CheckNewRegion;
boost::shared_ptr<Region>
RegionFactory::create (boost::shared_ptr<Region> region, nframes_t start,
Return::~Return ()
{
- GoingAway ();
+ drop_references ();
}
XMLNode&
#include <cassert>
#include <algorithm>
-#include <sigc++/bind.h>
#include "pbd/xml++.h"
#include "pbd/enumwriter.h"
#include "pbd/memento_command.h"
using namespace PBD;
uint32_t Route::order_key_cnt = 0;
-sigc::signal<void, string const &> Route::SyncOrderKeys;
+boost::signals2::signal<void(string const&)> Route::SyncOrderKeys;
Route::Route (Session& sess, string name, Flag flg, DataType default_type)
: SessionObject (sess, name)
/* now that we have _meter, its safe to connect to this */
- _meter_connection = Metering::connect (sigc::mem_fun (*this, &Route::meter));
+ scoped_connect (Metering::Meter, (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 */
- _meter_connection = Metering::connect (sigc::mem_fun (*this, &Route::meter));
+ scoped_connect (Metering::Meter, (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 (sigc::mem_fun (this, &Route::input_change_handler));
- _output->changed.connect (sigc::mem_fun (this, &Route::output_change_handler));
+ scoped_connect (_input->changed, boost::bind (&Route::input_change_handler, this, _1, _2));
+ scoped_connect (_output->changed, boost::bind (&Route::output_change_handler, this, _1, _2));
/* add amp processor */
Route::~Route ()
{
DEBUG_TRACE (DEBUG::Destruction, string_compose ("route %1 destructor\n", _name));
- Metering::disconnect (_meter_connection);
/* don't use clear_processors here, as it depends on the session which may
be half-destroyed by now */
// XXX: do we want to emit the signal here ? change call order.
processor->activate ();
}
- processor->ActiveChanged.connect (sigc::bind (sigc::mem_fun (_session, &Session::update_latency_compensation), false, false));
+ scoped_connect (processor->ActiveChanged, boost::bind (&Session::update_latency_compensation, &_session, false, false));
_output->set_user_latency (0);
}
return -1;
}
- (*i)->ActiveChanged.connect (sigc::bind (sigc::mem_fun (_session, &Session::update_latency_compensation), false, false));
+ scoped_connect ((*i)->ActiveChanged, boost::bind (&Session::update_latency_compensation, &_session, false, false));
}
_output->set_user_latency (0);
#include <algorithm>
-#include <sigc++/bind.h>
#include "pbd/error.h"
#include "pbd/enumwriter.h"
routes->push_back (r);
r->join_route_group (this);
- r->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &RouteGroup::remove_when_going_away), boost::weak_ptr<Route> (r)));
+ scoped_connect (r->GoingAway, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
_session.set_dirty ();
changed (); /* EMIT SIGNAL */
Send::~Send ()
{
- GoingAway ();
+ drop_references ();
}
void
#include <unistd.h>
#include <limits.h>
-#include <sigc++/bind.h>
-#include <sigc++/retype.h>
#include <glibmm/thread.h>
#include <glibmm/miscutils.h>
bool Session::_disable_all_loaded_plugins = false;
-sigc::signal<void,std::string> Session::Dialog;
-sigc::signal<int> Session::AskAboutPendingState;
-sigc::signal<int,nframes_t,nframes_t> Session::AskAboutSampleRateMismatch;
-sigc::signal<void> Session::SendFeedback;
+boost::signals2::signal<void(std::string)> Session::Dialog;
+boost::signals2::signal<int()> Session::AskAboutPendingState;
+boost::signals2::signal<int(nframes_t,nframes_t)> Session::AskAboutSampleRateMismatch;
+boost::signals2::signal<void()> Session::SendFeedback;
-sigc::signal<void> Session::TimecodeOffsetChanged;
-sigc::signal<void> Session::StartTimeChanged;
-sigc::signal<void> Session::EndTimeChanged;
-sigc::signal<void> Session::AutoBindingOn;
-sigc::signal<void> Session::AutoBindingOff;
-sigc::signal<void, std::string, std::string> Session::Exported;
+boost::signals2::signal<void()> Session::TimecodeOffsetChanged;
+boost::signals2::signal<void()> Session::StartTimeChanged;
+boost::signals2::signal<void()> Session::EndTimeChanged;
+boost::signals2::signal<void()> Session::AutoBindingOn;
+boost::signals2::signal<void()> Session::AutoBindingOff;
+boost::signals2::signal<void(std::string, std::string)> Session::Exported;
static void clean_up_session_event (SessionEvent* ev) { delete ev; }
const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event);
_midi_clock_port (default_midi_clock_port),
_session_dir (new SessionDirectory(fullpath)),
state_tree (0),
- _butler (new Butler (this)),
+ _butler (new Butler (*this)),
_post_transport_work (0),
_send_timecode_update (false),
diskstreams (new DiskstreamList),
_state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
- Config->ParameterChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::config_changed), false));
- config.ParameterChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::config_changed), true));
+ scoped_connect (Config->ParameterChanged, boost::bind (&Session::config_changed, this, _1, false));
+ scoped_connect (config.ParameterChanged, boost::bind (&Session::config_changed, this, _1, true));
if (was_dirty) {
DirtyChanged (); /* EMIT SIGNAL */
_midi_clock_port (default_midi_clock_port),
_session_dir ( new SessionDirectory(fullpath)),
state_tree (0),
- _butler (new Butler (this)),
+ _butler (new Butler (*this)),
_post_transport_work (0),
_send_timecode_update (false),
diskstreams (new DiskstreamList),
if (master_out_channels) {
ChanCount count(DataType::AUDIO, master_out_channels);
- shared_ptr<Route> r (new Route (*this, _("master"), Route::MasterOut, DataType::AUDIO));
+ Route* rt = new Route (*this, _("master"), Route::MasterOut, DataType::AUDIO);
+ boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name());
+ shared_ptr<Route> r (rt);
r->input()->ensure_io (count, false, this);
r->output()->ensure_io (count, false, this);
r->set_remote_control_id (control_id);
if (control_out_channels) {
ChanCount count(DataType::AUDIO, control_out_channels);
- shared_ptr<Route> r (new Route (*this, _("monitor"), Route::ControlOut, DataType::AUDIO));
+ Route* rt = new Route (*this, _("monitor"), Route::ControlOut, DataType::AUDIO);
+ boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name());
+ shared_ptr<Route> r (rt);
r->input()->ensure_io (count, false, this);
r->output()->ensure_io (count, false, this);
r->set_remote_control_id (control_id++);
_state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
- Config->ParameterChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::config_changed), false));
+ scoped_connect (Config->ParameterChanged, boost::bind (&Session::config_changed, this, _1, false));
}
Session::~Session ()
_engine.remove_session ();
- GoingAway (); /* EMIT SIGNAL */
-
- /* do this */
-
- notify_callbacks ();
-
/* clear history so that no references to objects are held any more */
_history.clear ();
AudioDiskstream::free_working_buffers();
- Route::SyncOrderKeys.clear();
+ // BOOST::SIGNALS: Route::SyncOrderKeys.clear();
DEBUG_TRACE (DEBUG::Destruction, "delete named selections\n");
for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ) {
tmp = i;
++tmp;
+
+ boost::shared_ptr<Region> keep (i->second);
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for region %1 (%2); pre-ref = %3\n", i->second->name(), i->second.get(), i->second.use_count()));
i->second->drop_references ();
/* not strictly necessary, but doing it here allows the shared_ptr debugging to work */
playlists.reset ();
+ /* tell everyone who is still standing that we're about to die */
+
+ drop_references ();
+
boost_debug_list_ptrs ();
DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n");
/* every time we reconnect, recompute worst case output latencies */
- _engine.Running.connect (sigc::mem_fun (*this, &Session::set_worst_io_latencies));
+ scoped_connect (_engine.Running, 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 (sigc::mem_fun (this, &Session::playlist_length_changed));
+ scoped_connect (playlist->LengthChanged, boost::bind (&Session::playlist_length_changed, this));
}
/* see comment in playlist_length_changed () */
Location* existing;
if ((existing = _locations.auto_punch_location()) != 0 && existing != location) {
- auto_punch_start_changed_connection.disconnect();
- auto_punch_end_changed_connection.disconnect();
- auto_punch_changed_connection.disconnect();
+ punch_connections.drop_connections();
existing->set_auto_punch (false, this);
remove_event (existing->start(), SessionEvent::PunchIn);
clear_events (SessionEvent::PunchOut);
return;
}
- auto_punch_start_changed_connection.disconnect();
- auto_punch_end_changed_connection.disconnect();
- auto_punch_changed_connection.disconnect();
+ punch_connections.drop_connections ();
- auto_punch_start_changed_connection = location->start_changed.connect (sigc::mem_fun (this, &Session::auto_punch_start_changed));
- auto_punch_end_changed_connection = location->end_changed.connect (sigc::mem_fun (this, &Session::auto_punch_end_changed));
- auto_punch_changed_connection = location->changed.connect (sigc::mem_fun (this, &Session::auto_punch_changed));
+ punch_connections.add_connection (location->start_changed.connect (boost::bind (&Session::auto_punch_start_changed, this, _1)));
+ punch_connections.add_connection (location->end_changed.connect (boost::bind (&Session::auto_punch_end_changed, this, _1)));
+ punch_connections.add_connection (location->changed.connect (boost::bind (&Session::auto_punch_changed, this, _1)));
location->set_auto_punch (true, this);
-
auto_punch_changed (location);
auto_punch_location_changed (location);
Location* existing;
if ((existing = _locations.auto_loop_location()) != 0 && existing != location) {
- auto_loop_start_changed_connection.disconnect();
- auto_loop_end_changed_connection.disconnect();
- auto_loop_changed_connection.disconnect();
+ loop_connections.drop_connections ();
existing->set_auto_loop (false, this);
remove_event (existing->end(), SessionEvent::AutoLoop);
auto_loop_location_changed (0);
last_loopend = location->end();
- auto_loop_start_changed_connection.disconnect();
- auto_loop_end_changed_connection.disconnect();
- auto_loop_changed_connection.disconnect();
+ loop_connections.drop_connections ();
- auto_loop_start_changed_connection = location->start_changed.connect (
- sigc::mem_fun (this, &Session::auto_loop_changed));
- auto_loop_end_changed_connection = location->end_changed.connect (
- sigc::mem_fun (this, &Session::auto_loop_changed));
- auto_loop_changed_connection = location->changed.connect (
- sigc::mem_fun (this, &Session::auto_loop_changed));
+ loop_connections.add_connection (location->start_changed.connect (boost::bind (&Session::auto_loop_changed, this, _1)));
+ loop_connections.add_connection (location->end_changed.connect (boost::bind (&Session::auto_loop_changed, this, _1)));
+ loop_connections.add_connection (location->changed.connect (boost::bind (&Session::auto_loop_changed, this, _1)));
location->set_auto_loop (true, this);
route_group->add (track);
}
- track->DiskstreamChanged.connect (sigc::mem_fun (this, &Session::resort_routes));
+ scoped_connect (track->DiskstreamChanged, boost::bind (&Session::resort_routes, this));
//track->set_remote_control_id (control_id);
new_routes.push_back (track);
try {
AudioTrack* at = new AudioTrack (*this, track_name, Route::Flag (0), mode);
- // boost_debug_shared_ptr_mark_interesting (at, typeid (at).name());
+ boost_debug_shared_ptr_mark_interesting (at, typeid (at).name());
track = boost::shared_ptr<AudioTrack>(at);
if (track->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
track->audio_diskstream()->non_realtime_input_change();
- track->DiskstreamChanged.connect (sigc::mem_fun (this, &Session::resort_routes));
+ scoped_connect (track->DiskstreamChanged, boost::bind (&Session::resort_routes, this));
track->set_remote_control_id (control_id);
++control_id;
} while (bus_id < (UINT_MAX-1));
try {
- shared_ptr<Route> bus (new Route (*this, bus_name, Route::Flag(0), DataType::AUDIO));
+ Route* rt = new Route (*this, bus_name, Route::Flag(0), DataType::AUDIO);
+ boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name());
+ shared_ptr<Route> bus (rt);
if (bus->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"),
boost::weak_ptr<Route> wpr (*x);
- (*x)->listen_changed.connect (sigc::bind (sigc::mem_fun (*this, &Session::route_listen_changed), wpr));
- (*x)->solo_changed.connect (sigc::bind (sigc::mem_fun (*this, &Session::route_solo_changed), wpr));
- (*x)->mute_changed.connect (sigc::mem_fun (*this, &Session::route_mute_changed));
- (*x)->output()->changed.connect (sigc::mem_fun (*this, &Session::set_worst_io_latencies_x));
- (*x)->processors_changed.connect (sigc::mem_fun (*this, &Session::route_processors_changed));
- (*x)->route_group_changed.connect (sigc::mem_fun (*this, &Session::route_group_changed));
+ scoped_connect ((*x)->listen_changed, boost::bind (&Session::route_listen_changed, this, _1, wpr));
+ scoped_connect ((*x)->solo_changed, boost::bind (&Session::route_solo_changed, this, _1, wpr));
+ scoped_connect ((*x)->mute_changed, boost::bind (&Session::route_mute_changed, this, _1));
+ scoped_connect ((*x)->output()->changed, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2));
+ scoped_connect ((*x)->processors_changed, boost::bind (&Session::route_processors_changed, this, _1));
+ scoped_connect ((*x)->route_group_changed, 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 (sigc::bind (sigc::mem_fun (*this, &Session::diskstream_playlist_changed), boost::weak_ptr<Diskstream> (dstream)));
+ scoped_connect (dstream->PlaylistChanged, 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 (sigc::mem_fun (*this, &Session::update_have_rec_enabled_diskstream));
+ scoped_connect (dstream->RecordEnableChanged, boost::bind (&Session::update_have_rec_enabled_diskstream, this));
dstream->prepare ();
}
}
- region->StateChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::region_changed), boost::weak_ptr<Region>(region)));
- region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Session::remove_region), boost::weak_ptr<Region>(region)));
+ scoped_connect (region->StateChanged, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
+ scoped_connect (region->GoingAway, boost::bind (&Session::remove_region, this, boost::weak_ptr<Region>(region)));
update_region_name_map (region);
}
}
if (result.second) {
- source->GoingAway.connect (sigc::bind (sigc::mem_fun (this, &Session::remove_source), boost::weak_ptr<Source> (source)));
+ scoped_connect (source->GoingAway, boost::bind (&Session::remove_source, this, boost::weak_ptr<Source> (source)));
set_dirty();
}
bool existing = playlists->add (playlist);
if (!existing) {
- playlist->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Session::remove_playlist), boost::weak_ptr<Playlist>(playlist)));
+ scoped_connect (playlist->GoingAway, boost::bind (&Session::remove_playlist, this, boost::weak_ptr<Playlist>(playlist)));
}
if (unused) {
TapeFileMatcher tape_file_matcher;
remove_if (audio_filenames.begin(), audio_filenames.end(),
- sigc::mem_fun (tape_file_matcher, &TapeFileMatcher::matches));
-
+ boost::bind (&TapeFileMatcher::matches, &tape_file_matcher, _1));
+
for (vector<string>::iterator i = audio_filenames.begin(); i != audio_filenames.end(); ++i) {
sys::path audio_file_path (_session_dir->sound_path());
void
Session::add_processor (Processor* processor)
{
- processor->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Session::remove_processor), processor));
+ scoped_connect (processor->GoingAway, boost::bind (&Session::remove_processor, this, processor));
set_dirty();
}
#include "i18n.h"
-void Session::register_with_memento_command_factory(PBD::ID id, PBD::StatefulThingWithGoingAway *ptr)
+void Session::register_with_memento_command_factory(PBD::ID id, PBD::StatefulDestructible *ptr)
{
registry[id] = ptr;
}
if (i != automation_lists.end()) {
return new MementoCommand<AutomationList>(*i->second, before, after);
}
- } else if (registry.count(id)) { // For Editor and AutomationLine which are off-limits here
- return new MementoCommand<PBD::StatefulThingWithGoingAway>(*registry[id], before, after);
+ } else if (registry.count(id)) { // For Editor and AutomationLine which are off-limits herea
+ return new MementoCommand<PBD::StatefulDestructible>(*registry[id], before, after);
}
/* we failed */
*/
-#include <sigc++/bind.h>
#include "pbd/error.h"
#include <glibmm/thread.h>
_exporting = true;
export_status->running = true;
- export_status->Aborting.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::stop_audio_export)));
- export_status->Finished.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::finalize_audio_export)));
+ scoped_connect (export_status->Aborting, boost::bind (&Session::stop_audio_export, this));
+ scoped_connect (export_status->Finished, boost::bind (&Session::finalize_audio_export, this));
return 0;
}
last_process_function = process_function;
process_function = &Session::process_export;
} else {
- export_freewheel_connection = _engine.Freewheel.connect (sigc::mem_fun (*this, &Session::process_export_fw));
+ export_freewheel_connection = _engine.Freewheel.connect (boost::bind (&Session::process_export_fw, this, _1));
return _engine.freewheel (true);
}
process_without_events (nframes);
- /* handle export */
+ /* handle export - XXX what about error handling? */
ProcessExport (nframes);
/* Clean up */
- ProcessExport.clear();
- ExportReadFinished.clear();
+ /* BOOST SIGNAL are these necessary?
+ ProcessExport.clear();
+ ExportReadFinished.clear();
+ */
+
export_freewheel_connection.disconnect();
export_handler.reset();
export_status.reset();
--- /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.
+
+*/
+
+#include "pbd/error.h"
+
+#include "ardour/session.h"
+#include "ardour/session_handle.h"
+
+#include "i18n.h"
+
+using namespace std;
+using namespace ARDOUR;
+using namespace PBD;
+
+SessionHandlePtr::SessionHandlePtr (Session* s)
+ : _session (s)
+{
+ if (_session) {
+ _session_connections.add_connection (_session->GoingAway.connect (boost::bind (&SessionHandlePtr::session_going_away, this)));
+ }
+}
+
+void
+SessionHandlePtr::set_session (Session* s)
+{
+ _session_connections.drop_connections ();
+
+ if (_session) {
+ _session = 0;
+ }
+
+ if (s) {
+ _session = s;
+ _session_connections.add_connection (_session->GoingAway.connect (boost::bind (&SessionHandlePtr::session_going_away, this)));
+ }
+}
+
+void
+SessionHandlePtr::session_going_away ()
+{
+ set_session (0);
+}
+
+/*-------------------------*/
+
+
+SessionHandleRef::SessionHandleRef (Session& s)
+ : _session (s)
+{
+ scoped_connect (_session.GoingAway, boost::bind (&SessionHandleRef::session_going_away, this));
+}
+
+void
+SessionHandleRef::session_going_away ()
+{
+ error << string_compose (_("programming error: %1"), "SessionHandleRef exists across sesssion deletion!") << endmsg;
+}
mmc->set_send_device_id (old_send_device_id);
}
- mmc->Play.connect
- (sigc::mem_fun (*this, &Session::mmc_deferred_play));
- mmc->DeferredPlay.connect
- (sigc::mem_fun (*this, &Session::mmc_deferred_play));
- mmc->Stop.connect
- (sigc::mem_fun (*this, &Session::mmc_stop));
- mmc->FastForward.connect
- (sigc::mem_fun (*this, &Session::mmc_fast_forward));
- mmc->Rewind.connect
- (sigc::mem_fun (*this, &Session::mmc_rewind));
- mmc->Pause.connect
- (sigc::mem_fun (*this, &Session::mmc_pause));
- mmc->RecordPause.connect
- (sigc::mem_fun (*this, &Session::mmc_record_pause));
- mmc->RecordStrobe.connect
- (sigc::mem_fun (*this, &Session::mmc_record_strobe));
- mmc->RecordExit.connect
- (sigc::mem_fun (*this, &Session::mmc_record_exit));
- mmc->Locate.connect
- (sigc::mem_fun (*this, &Session::mmc_locate));
- mmc->Step.connect
- (sigc::mem_fun (*this, &Session::mmc_step));
- mmc->Shuttle.connect
- (sigc::mem_fun (*this, &Session::mmc_shuttle));
- mmc->TrackRecordStatusChange.connect
- (sigc::mem_fun (*this, &Session::mmc_record_enable));
+ scoped_connect (mmc->Play, boost::bind (&Session::mmc_deferred_play, this, _1));
+ scoped_connect (mmc->DeferredPlay, boost::bind (&Session::mmc_deferred_play, this, _1));
+ scoped_connect (mmc->Stop, boost::bind (&Session::mmc_stop, this, _1));
+ scoped_connect (mmc->FastForward, boost::bind (&Session::mmc_fast_forward, this, _1));
+ scoped_connect (mmc->Rewind, boost::bind (&Session::mmc_rewind, this, _1));
+ scoped_connect (mmc->Pause, boost::bind (&Session::mmc_pause, this, _1));
+ scoped_connect (mmc->RecordPause, boost::bind (&Session::mmc_record_pause, this, _1));
+ scoped_connect (mmc->RecordStrobe, boost::bind (&Session::mmc_record_strobe, this, _1));
+ scoped_connect (mmc->RecordExit, boost::bind (&Session::mmc_record_exit, this, _1));
+ scoped_connect (mmc->Locate, boost::bind (&Session::mmc_locate, this, _1, _2));
+ scoped_connect (mmc->Step, boost::bind (&Session::mmc_step, this, _1, _2));
+ scoped_connect (mmc->Shuttle, boost::bind (&Session::mmc_shuttle, this, _1, _2, _3));
+ scoped_connect (mmc->TrackRecordStatusChange, boost::bind (&Session::mmc_record_enable, this, _1, _2, _3));
/* also handle MIDI SPP because its so common */
- _mmc_port->input()->start.connect (sigc::mem_fun (*this, &Session::spp_start));
- _mmc_port->input()->contineu.connect (sigc::mem_fun (*this, &Session::spp_continue));
- _mmc_port->input()->stop.connect (sigc::mem_fun (*this, &Session::spp_stop));
+ scoped_connect (_mmc_port->input()->start, boost::bind (&Session::spp_start, this, _1, _2));
+ scoped_connect (_mmc_port->input()->contineu, boost::bind (&Session::spp_continue, this, _1, _2));
+ scoped_connect (_mmc_port->input()->stop, boost::bind (&Session::spp_stop, this, _1, _2));
Config->set_mmc_port_name (port_tag);
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
#include "pbd/xml++.h"
#include "pbd/compose.h"
if (!existing) {
playlists.insert (playlists.begin(), playlist);
- playlist->InUse.connect (sigc::bind (sigc::mem_fun (*this, &SessionPlaylists::track), boost::weak_ptr<Playlist>(playlist)));
+ scoped_connect (playlist->InUse, boost::bind (&SessionPlaylists::track, this, _1, boost::weak_ptr<Playlist>(playlist)));
}
return existing;
/** @return true for `stop cleanup', otherwise false */
bool
-SessionPlaylists::maybe_delete_unused (sigc::signal<int, boost::shared_ptr<Playlist> > ask)
+SessionPlaylists::maybe_delete_unused (boost::function<int(boost::shared_ptr<Playlist>)> ask)
{
vector<boost::shared_ptr<Playlist> > playlists_tbd;
#include <string>
#include <cerrno>
-#include <sigc++/bind.h>
#include <cstdio> /* snprintf(3) ... grrr */
#include <cmath>
_base_frame_rate = _current_frame_rate;
_tempo_map = new TempoMap (_current_frame_rate);
- _tempo_map->StateChanged.connect (sigc::mem_fun (*this, &Session::tempo_map_changed));
+ scoped_connect (_tempo_map->StateChanged, boost::bind (&Session::tempo_map_changed, this, _1));
_non_soloed_outs_muted = false;
delta_accumulator_cnt = 0;
_slave_state = Stopped;
- _engine.GraphReordered.connect (sigc::mem_fun (*this, &Session::graph_reordered));
+ scoped_connect (_engine.GraphReordered, boost::bind (&Session::graph_reordered, this));
/* These are all static "per-class" signals */
- RegionFactory::CheckNewRegion.connect (sigc::mem_fun (*this, &Session::add_region));
- SourceFactory::SourceCreated.connect (sigc::mem_fun (*this, &Session::add_source));
- PlaylistFactory::PlaylistCreated.connect (sigc::mem_fun (*this, &Session::add_playlist));
- Processor::ProcessorCreated.connect (sigc::mem_fun (*this, &Session::add_processor));
- NamedSelection::NamedSelectionCreated.connect (sigc::mem_fun (*this, &Session::add_named_selection));
- AutomationList::AutomationListCreated.connect (sigc::mem_fun (*this, &Session::add_automation_list));
+ scoped_connect (RegionFactory::CheckNewRegion, boost::bind (&Session::add_region, this, _1));
+ scoped_connect (SourceFactory::SourceCreated, boost::bind (&Session::add_source, this, _1));
+ scoped_connect (PlaylistFactory::PlaylistCreated, boost::bind (&Session::add_playlist, this, _1, _2));
+ scoped_connect (Processor::ProcessorCreated, boost::bind (&Session::add_processor, this, _1));
+ scoped_connect (NamedSelection::NamedSelectionCreated, boost::bind (&Session::add_named_selection, this, _1));
+ scoped_connect (AutomationList::AutomationListCreated, boost::bind (&Session::add_automation_list, this, _1));
- Controllable::Destroyed.connect (sigc::mem_fun (*this, &Session::remove_controllable));
+ // BOOST SIGNALS
+ // scoped_connect (Controllable::Destroyed, boost::bind (&Session::remove_controllable, this, _1));
- IO::PortCountChanged.connect (sigc::mem_fun (*this, &Session::ensure_buffers));
+ scoped_connect (IO::PortCountChanged, 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 (sigc::mem_fun (this, &Session::locations_changed));
- _locations.added.connect (sigc::mem_fun (this, &Session::locations_added));
+ scoped_connect (_locations.changed, boost::bind (&Session::locations_changed, this));
+ scoped_connect (_locations.added, boost::bind (&Session::locations_added, this, _1));
setup_click_sounds (0);
setup_midi_control ();
/* Pay attention ... */
- _engine.Halted.connect (sigc::mem_fun (*this, &Session::engine_halted));
- _engine.Xrun.connect (sigc::mem_fun (*this, &Session::xrun_recovery));
+ scoped_connect (_engine.Halted, boost::bind (&Session::engine_halted, this));
+ scoped_connect (_engine.Xrun, boost::bind (&Session::xrun_recovery, this));
try {
when_engine_running();
deliver_mmc (MIDI::MachineControl::cmdMmcReset, 0);
deliver_mmc (MIDI::MachineControl::cmdLocate, 0);
- MidiClockTicker::instance().set_session(*this);
- MIDI::Name::MidiPatchManager::instance().set_session(*this);
+ MidiClockTicker::instance().set_session (this);
+ MIDI::Name::MidiPatchManager::instance().set_session (this);
/* initial program change will be delivered later; see ::config_changed() */
BootMessage (_("Reset Control Protocols"));
- ControlProtocolManager::instance().set_session (*this);
+ ControlProtocolManager::instance().set_session (this);
config.set_end_marker_is_free (new_session);
/* step 1: consider deleting all unused playlists */
- if (playlists->maybe_delete_unused (AskAboutPlaylistDeletion)) {
+/* BOOST SIGNALS
+ if (playlists->maybe_delete_unused (boost::bind (AskAboutPlaylistDeletion, _1));
ret = 0;
goto out;
}
-
+*/
/* step 2: find all un-used sources */
rep.paths.clear ();
if (!playlists->source_use_count(i->second) && i->second->length(i->second->timeline_position()) > 0) {
dead_sources.push_back (i->second);
- i->second->GoingAway();
+ i->second->drop_references ();
}
i = tmp;
Glib::Mutex::Lock lm (controllables_lock);
- Controllables::iterator x = controllables.find(
- boost::shared_ptr<Controllable>(c, null_deleter()));
+ Controllables::iterator x = controllables.find (boost::shared_ptr<Controllable>(c, null_deleter()));
if (x != controllables.end()) {
controllables.erase (x);
#include <cerrno>
#include <unistd.h>
-#include <sigc++/bind.h>
-#include <sigc++/retype.h>
#include "pbd/undo.h"
#include "pbd/error.h"
}
AudioFileSource::HeaderPositionOffsetChanged.connect (
- sigc::mem_fun (*this, &SndFileSource::handle_header_position_change));
+ boost::bind (&SndFileSource::handle_header_position_change, this));
}
int
SndFileSource::~SndFileSource ()
{
- GoingAway (); /* EMIT SIGNAL */
+ drop_references ();
if (sf) {
sf_close (sf);
Source::~Source ()
{
DEBUG_TRACE (DEBUG::Destruction, string_compose ("Source %1 destructor\n", _name));
- notify_callbacks ();
}
using namespace std;
using namespace PBD;
-sigc::signal<void,boost::shared_ptr<Source> > SourceFactory::SourceCreated;
+boost::signals2::signal<void(boost::shared_ptr<Source>)> SourceFactory::SourceCreated;
Glib::Cond* SourceFactory::PeaksToBuild;
Glib::StaticMutex SourceFactory::peak_building_lock = GLIBMM_STATIC_MUTEX_INIT;
std::list<boost::weak_ptr<AudioSource> > SourceFactory::files_with_peaks;
#include <cmath>
-#include <sigc++/bind.h>
#include <glibmm/thread.h>
#include "pbd/xml++.h"
using namespace std;
#endif
-namespace ARDOUR
-{
-
+using namespace ARDOUR;
-void Ticker::set_session(Session& s)
+void Ticker::set_session (Session* s)
{
- _session = &s;
+ SessionHandlePtr::set_session (s);
- if (_session) {
- _session->tick.connect(sigc::mem_fun (*this, &Ticker::tick));
- _session->GoingAway.connect(sigc::mem_fun (*this, &Ticker::going_away));
- }
+ if (_session) {
+ _session_connections.add_connection (_session->tick.connect (boost::bind (&Ticker::tick, this, _1, _2, _3)));
+ }
}
-void MidiClockTicker::set_session(Session& s)
+void MidiClockTicker::set_session (Session* s)
{
- Ticker::set_session(s);
+ Ticker::set_session (s);
if (_session) {
- _session->MIDIClock_PortChanged.connect(
- sigc::mem_fun (*this, &MidiClockTicker::update_midi_clock_port));
- _session->TransportStateChange.connect(
- sigc::mem_fun (*this, &MidiClockTicker::transport_state_changed));
- _session->PositionChanged.connect(
- sigc::mem_fun (*this, &MidiClockTicker::position_changed));
- _session->TransportLooped.connect(
- sigc::mem_fun (*this, &MidiClockTicker::transport_looped));
+ _session_connections.add_connection (_session->MIDIClock_PortChanged.connect (boost::bind (&MidiClockTicker::update_midi_clock_port, this)));
+ _session_connections.add_connection (_session->TransportStateChange.connect (boost::bind (&MidiClockTicker::transport_state_changed, this)));
+ _session_connections.add_connection (_session->PositionChanged.connect (boost::bind (&MidiClockTicker::position_changed, this, _1)));
+ _session_connections.add_connection (_session->TransportLooped.connect (boost::bind (&MidiClockTicker::transport_looped, this)));
update_midi_clock_port();
}
}
+void
+MidiClockTicker::session_going_away ()
+{
+ SessionHandlePtr::session_going_away();
+ _midi_port = 0;
+}
+
void MidiClockTicker::update_midi_clock_port()
{
_midi_port = _session->midi_clock_port();
_midi_port->write(_midi_clock_tick, 1, offset);
}
-}
+
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "pbd/error.h"
-#include <sigc++/retype.h>
-#include <sigc++/retype_return.h>
-#include <sigc++/bind.h>
#include "ardour/amp.h"
#include "ardour/audioplaylist.h"
VSTPlugin::~VSTPlugin ()
{
deactivate ();
- GoingAway (); /* EMIT SIGNAL */
+ drop_references ();
fst_close (_fst);
}
'session_directory.cc',
'session_events.cc',
'session_export.cc',
+ 'session_handle.cc',
'session_metadata.cc',
'session_midi.cc',
'session_playlists.cc',
}
prompter->set_text (prompt);
prompter->touch (); // shows popup
- learning_connection = controllable->LearningFinished.connect (mem_fun (*this, &BindingProxy::learning_finished));
+ learning_connection = controllable->LearningFinished.connect (boost::bind (&BindingProxy::learning_finished, this));
}
return true;
}
#define __binding_proxy__
#include <string>
-
#include <gtkmm2ext/popup.h>
#include <boost/shared_ptr.hpp>
+#include <boost/signals2.hpp>
namespace PBD {
class Controllable;
boost::shared_ptr<PBD::Controllable> controllable;
guint bind_button;
guint bind_statemask;
- sigc::connection learning_connection;
+ boost::signals2::scoped_connection learning_connection;
void learning_finished ();
bool prompter_hiding (GdkEventAny *);
};
Glib::signal_idle().connect (bind (slot (&UI::idle_delete<T>), obj));
}
+ template<class T> void delete_in_self (T *obj) {
+ call_slot (boost::bind (&UI::delete_in_self, this, obj));
+ }
+
Gdk::Color get_color (const std::string& prompt, bool& picked, const Gdk::Color *initial = 0);
/* starting is sent just before we enter the main loop,
#include "midi++/port.h"
#include "midi++/channel.h"
-using namespace sigc;
using namespace MIDI;
Channel::Channel (byte channelnum, Port &p) : _port (p)
void
Channel::connect_input_signals ()
-
{
- _port.input()->channel_pressure[_channel_number].connect
- (mem_fun (*this, &Channel::process_chanpress));
- _port.input()->channel_note_on[_channel_number].connect
- (mem_fun (*this, &Channel::process_note_on));
- _port.input()->channel_note_off[_channel_number].connect
- (mem_fun (*this, &Channel::process_note_off));
- _port.input()->channel_poly_pressure[_channel_number].connect
- (mem_fun (*this, &Channel::process_polypress));
- _port.input()->channel_program_change[_channel_number].connect
- (mem_fun (*this, &Channel::process_program_change));
- _port.input()->channel_controller[_channel_number].connect
- (mem_fun (*this, &Channel::process_controller));
- _port.input()->channel_pitchbend[_channel_number].connect
- (mem_fun (*this, &Channel::process_pitchbend));
- _port.input()->reset.connect (mem_fun (*this, &Channel::process_reset));
+ add_connection (_port.input()->channel_pressure[_channel_number].connect
+ (boost::bind (&Channel::process_chanpress, this, _1, _2)));
+ add_connection (_port.input()->channel_note_on[_channel_number].connect
+ (boost::bind (&Channel::process_note_on, this, _1, _2)));
+ add_connection (_port.input()->channel_note_off[_channel_number].connect
+ (boost::bind (&Channel::process_note_off, this, _1, _2)));
+ add_connection (_port.input()->channel_poly_pressure[_channel_number].connect
+ (boost::bind (&Channel::process_polypress, this, _1, _2)));
+ add_connection (_port.input()->channel_program_change[_channel_number].connect
+ (boost::bind (&Channel::process_program_change, this, _1, _2)));
+ add_connection (_port.input()->channel_controller[_channel_number].connect
+ (boost::bind (&Channel::process_controller, this, _1, _2)));
+ add_connection (_port.input()->channel_pitchbend[_channel_number].connect
+ (boost::bind (&Channel::process_pitchbend, this, _1, _2)));
+
+ add_connection (_port.input()->reset.connect (boost::bind (&Channel::process_reset, this, _1)));
}
void
Channel::connect_output_signals ()
{
- _port.output()->channel_pressure[_channel_number].connect
- (mem_fun (*this, &Channel::process_chanpress));
- _port.output()->channel_note_on[_channel_number].connect
- (mem_fun (*this, &Channel::process_note_on));
- _port.output()->channel_note_off[_channel_number].connect
- (mem_fun (*this, &Channel::process_note_off));
- _port.output()->channel_poly_pressure[_channel_number].connect
- (mem_fun (*this, &Channel::process_polypress));
- _port.output()->channel_program_change[_channel_number].connect
- (mem_fun (*this, &Channel::process_program_change));
- _port.output()->channel_controller[_channel_number].connect
- (mem_fun (*this, &Channel::process_controller));
- _port.output()->channel_pitchbend[_channel_number].connect
- (mem_fun (*this, &Channel::process_pitchbend));
- _port.output()->reset.connect (mem_fun (*this, &Channel::process_reset));
+ add_connection (_port.output()->channel_pressure[_channel_number].connect
+ (boost::bind (&Channel::process_chanpress, this, _1, _2)));
+ add_connection (_port.output()->channel_note_on[_channel_number].connect
+ (boost::bind (&Channel::process_note_on, this, _1, _2)));
+ add_connection (_port.output()->channel_note_off[_channel_number].connect
+ (boost::bind (&Channel::process_note_off, this, _1, _2)));
+ add_connection (_port.output()->channel_poly_pressure[_channel_number].connect
+ (boost::bind (&Channel::process_polypress, this, _1, _2)));
+ add_connection (_port.output()->channel_program_change[_channel_number].connect
+ (boost::bind (&Channel::process_program_change, this, _1, _2)));
+ add_connection (_port.output()->channel_controller[_channel_number].connect
+ (boost::bind (&Channel::process_controller, this, _1, _2)));
+ add_connection (_port.output()->channel_pitchbend[_channel_number].connect
+ (boost::bind (&Channel::process_pitchbend, this, _1, _2)));
+
+ add_connection (_port.output()->reset.connect (boost::bind (&Channel::process_reset, this, _1)));
}
void
#include <queue>
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
+#include "pbd/scoped_connections.h"
#include "midi++/types.h"
#include "midi++/parser.h"
* This remembers various useful information about the current 'state' of a
* MIDI channel (eg current pitch bend value).
*/
-class Channel : public sigc::trackable {
+class Channel : public PBD::ScopedConnectionList {
public:
Channel (byte channel_number, Port &);
int get_known_ports (std::vector<PortSet>&);
- sigc::signal<void> PortsChanged;
+ boost::signals2::signal<void()> PortsChanged;
private:
/* This is a SINGLETON pattern */
#ifndef __midipp_mmc_h_h__
#define __midipp_mmc_h_h__
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
+
#include "midi++/types.h"
namespace MIDI {
class Port;
class Parser;
-class MachineControl : public sigc::trackable
-
+class MachineControl
{
public:
+ typedef boost::signals2::signal<void(MachineControl&)> MMCSignal;
typedef byte CommandSignature[60];
typedef byte ResponseSignature[60];
when certain MMC commands are received.
*/
- sigc::signal<void,MachineControl &> Stop;
- sigc::signal<void,MachineControl &> Play;
- sigc::signal<void,MachineControl &> DeferredPlay;
- sigc::signal<void,MachineControl &> FastForward;
- sigc::signal<void,MachineControl &> Rewind;
- sigc::signal<void,MachineControl &> RecordStrobe;
- sigc::signal<void,MachineControl &> RecordExit;
- sigc::signal<void,MachineControl &> RecordPause;
- sigc::signal<void,MachineControl &> Pause;
- sigc::signal<void,MachineControl &> Eject;
- sigc::signal<void,MachineControl &> Chase;
- sigc::signal<void,MachineControl &> CommandErrorReset;
- sigc::signal<void,MachineControl &> MmcReset;
-
- sigc::signal<void,MachineControl &> JogStart;
- sigc::signal<void,MachineControl &> JogStop;
-
- sigc::signal<void,MachineControl &> Write;
- sigc::signal<void,MachineControl &> MaskedWrite;
- sigc::signal<void,MachineControl &> Read;
- sigc::signal<void,MachineControl &> Update;
- sigc::signal<void,MachineControl &> VariablePlay;
- sigc::signal<void,MachineControl &> Search;
- sigc::signal<void,MachineControl &> AssignSystemMaster;
- sigc::signal<void,MachineControl &> GeneratorCommand;
- sigc::signal<void,MachineControl &> MidiTimeCodeCommand;
- sigc::signal<void,MachineControl &> Move;
- sigc::signal<void,MachineControl &> Add;
- sigc::signal<void,MachineControl &> Subtract;
- sigc::signal<void,MachineControl &> DropFrameAdjust;
- sigc::signal<void,MachineControl &> Procedure;
- sigc::signal<void,MachineControl &> Event;
- sigc::signal<void,MachineControl &> Group;
- sigc::signal<void,MachineControl &> CommandSegment;
- sigc::signal<void,MachineControl &> DeferredVariablePlay;
- sigc::signal<void,MachineControl &> RecordStrobeVariable;
- sigc::signal<void,MachineControl &> Wait;
- sigc::signal<void,MachineControl &> Resume;
+ MMCSignal Stop;
+ MMCSignal Play;
+ MMCSignal DeferredPlay;
+ MMCSignal FastForward;
+ MMCSignal Rewind;
+ MMCSignal RecordStrobe;
+ MMCSignal RecordExit;
+ MMCSignal RecordPause;
+ MMCSignal Pause;
+ MMCSignal Eject;
+ MMCSignal Chase;
+ MMCSignal CommandErrorReset;
+ MMCSignal MmcReset;
+ MMCSignal JogStart;
+ MMCSignal JogStop;
+ MMCSignal Write;
+ MMCSignal MaskedWrite;
+ MMCSignal Read;
+ MMCSignal Update;
+ MMCSignal VariablePlay;
+ MMCSignal Search;
+ MMCSignal AssignSystemMaster;
+ MMCSignal GeneratorCommand;
+ MMCSignal MidiTimeCodeCommand;
+ MMCSignal Move;
+ MMCSignal Add;
+ MMCSignal Subtract;
+ MMCSignal DropFrameAdjust;
+ MMCSignal Procedure;
+ MMCSignal Event;
+ MMCSignal Group;
+ MMCSignal CommandSegment;
+ MMCSignal DeferredVariablePlay;
+ MMCSignal RecordStrobeVariable;
+ MMCSignal Wait;
+ MMCSignal Resume;
/* The second argument is the shuttle speed, the third is
true if the direction is "forwards", false for "reverse"
*/
- sigc::signal<void,MachineControl &,float,bool> Shuttle;
+ boost::signals2::signal<void(MachineControl&,float,bool)> Shuttle;
/* The second argument specifies the desired track record enabled
status.
*/
- sigc::signal<void,MachineControl &,size_t,bool>
+ boost::signals2::signal<void(MachineControl &,size_t,bool)>
TrackRecordStatusChange;
/* The second argument specifies the desired track record enabled
status.
*/
- sigc::signal<void,MachineControl &,size_t,bool>
+ boost::signals2::signal<void(MachineControl &,size_t,bool)>
TrackMuteChange;
/* The second argument points to a byte array containing
format (5 bytes, roughly: hrs/mins/secs/frames/subframes)
*/
- sigc::signal<void,MachineControl &, const byte *> Locate;
+ boost::signals2::signal<void(MachineControl &, const byte *)> Locate;
/* The second argument is the number of steps to jump */
- sigc::signal<void,MachineControl &, int> Step;
+ boost::signals2::signal<void(MachineControl &, int)> Step;
protected:
MIDI::Port &_port;
void process_mmc_message (Parser &p, byte *, size_t len);
-
+ boost::signals2::scoped_connection mmc_connection;
+
int do_masked_write (byte *, size_t len);
int do_locate (byte *, size_t len);
int do_step (byte *, size_t len);
#include <string>
#include <iostream>
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
#include "midi++/types.h"
class Port;
class Parser;
-typedef sigc::signal<void, Parser &, byte> OneByteSignal;
-typedef sigc::signal<void, Parser &, EventTwoBytes *> TwoByteSignal;
-typedef sigc::signal<void, Parser &, pitchbend_t> PitchBendSignal;
-typedef sigc::signal<void, Parser &, byte *, size_t> Signal;
+typedef boost::signals2::signal<void(Parser&)> ZeroByteSignal;
+typedef boost::signals2::signal<void(Parser&,nframes_t)> TimestampedSignal;
+typedef boost::signals2::signal<void(Parser&, byte)> OneByteSignal;
+typedef boost::signals2::signal<void(Parser &, EventTwoBytes *)> TwoByteSignal;
+typedef boost::signals2::signal<void(Parser &, pitchbend_t)> PitchBendSignal;
+typedef boost::signals2::signal<void(Parser &, byte *, size_t)> Signal;
-class Parser : public sigc::trackable {
+class Parser {
public:
Parser (Port &p);
~Parser ();
OneByteSignal channel_program_change[16];
PitchBendSignal channel_pitchbend[16];
TwoByteSignal channel_controller[16];
- sigc::signal<void, Parser &> channel_active_preparse[16];
- sigc::signal<void, Parser &> channel_active_postparse[16];
+ ZeroByteSignal channel_active_preparse[16];
+ ZeroByteSignal channel_active_postparse[16];
OneByteSignal mtc_quarter_frame; /* see below for more useful signals */
Signal mtc;
Signal position;
Signal song;
- sigc::signal<void, Parser &> all_notes_off;
- sigc::signal<void, Parser &> tune;
- sigc::signal<void, Parser &, nframes_t> timing;
- sigc::signal<void, Parser &, nframes_t> start;
- sigc::signal<void, Parser &, nframes_t> stop;
- sigc::signal<void, Parser &, nframes_t> contineu; /* note spelling */
- sigc::signal<void, Parser &> active_sense;
- sigc::signal<void, Parser &> reset;
- sigc::signal<void, Parser &> eox;
+ ZeroByteSignal all_notes_off;
+ ZeroByteSignal tune;
+ ZeroByteSignal active_sense;
+ ZeroByteSignal reset;
+ ZeroByteSignal eox;
+
+ TimestampedSignal timing;
+ TimestampedSignal start;
+ TimestampedSignal stop;
+ TimestampedSignal contineu; /* note spelling */
/* This should really be protected, but then derivatives of Port
can't access it.
void set_offline (bool);
bool offline() const { return _offline; }
- sigc::signal<void> OfflineStatusChanged;
+ boost::signals2::signal<void()> OfflineStatusChanged;
- sigc::signal<int, byte *, size_t> edit;
+ boost::signals2::signal<int(byte *, size_t)> edit;
void set_mmc_forwarding (bool yn) {
_mmc_forward = yn;
const byte *mtc_current() const { return _mtc_time; }
bool mtc_locked() const { return _mtc_locked; }
- sigc::signal<void,Parser&,int,nframes_t> mtc_qtr;
- sigc::signal<void,const byte*,bool,nframes_t> mtc_time;
- sigc::signal<void,MTC_Status> mtc_status;
- sigc::signal<bool> mtc_skipped;
+ boost::signals2::signal<void(Parser&,int,nframes_t)> mtc_qtr;
+ boost::signals2::signal<void(const byte*,bool,nframes_t)> mtc_time;
+ boost::signals2::signal<void(MTC_Status)> mtc_status;
+ boost::signals2::signal<bool()> mtc_skipped;
void set_mtc_forwarding (bool yn) {
_mtc_forward = yn;
std::ostream *trace_stream;
std::string trace_prefix;
void trace_event (Parser &p, byte *msg, size_t len);
- sigc::connection trace_connection;
+ boost::signals2::scoped_connection trace_connection;
size_t message_counter[256];
#include <string>
#include <iostream>
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
#include "pbd/xml++.h"
#include "midi++/types.h"
class Channel;
class PortRequest;
-class Port : public sigc::trackable {
+class Port {
public:
enum Type {
Unknown,
int _mode;
size_t _number;
Channel *_channel[16];
- sigc::connection thru_connection;
unsigned int bytes_written;
unsigned int bytes_read;
Parser *input_parser;
_send_device_id = 0x7f;
if ((parser = _port.input()) != 0) {
- parser->mmc.connect
- (mem_fun (*this, &MachineControl::process_mmc_message));
+ mmc_connection = parser->mmc.connect (boost::bind (&MachineControl::process_mmc_message, this, _1, _2, _3));
} else {
warning << "MMC connected to a non-input port: useless!"
<< endmsg;
#include "pbd/transmitter.h"
using namespace std;
-using namespace sigc;
using namespace MIDI;
const char *
cerr << "enabling tracing for port " << _port.name() << endl;
trace_stream = o;
trace_prefix = prefix;
- trace_connection = any.connect (mem_fun (*this, &Parser::trace_event));
+ trace_connection = any.connect (boost::bind (&Parser::trace_event, this, _1, _2, _3));
} else {
trace_prefix = "";
trace_stream = 0;
using namespace PBD;
using namespace std;
-sigc::signal<void,Controllable*> Controllable::Destroyed;
-sigc::signal<bool,Controllable*> Controllable::StartLearning;
-sigc::signal<void,Controllable*> Controllable::StopLearning;
-sigc::signal<void,Controllable*,int,int> Controllable::CreateBinding;
-sigc::signal<void,Controllable*> Controllable::DeleteBinding;
+boost::signals2::signal<void(Controllable*)> Controllable::Destroyed;
+boost::signals2::signal<bool(Controllable*)> Controllable::StartLearning;
+boost::signals2::signal<void(Controllable*)> Controllable::StopLearning;
+boost::signals2::signal<void(Controllable*,int,int)> Controllable::CreateBinding;
+boost::signals2::signal<void(Controllable*)> Controllable::DeleteBinding;
Glib::StaticRWLock Controllable::registry_lock = GLIBMM_STATIC_RW_LOCK_INIT;
Controllable::Controllables Controllable::registry;
, _uri (uri)
, _touching (false)
{
- add ();
+ add (*this);
}
void
-Controllable::add ()
+Controllable::add (Controllable& ctl)
{
+ using namespace boost;
+
Glib::RWLock::WriterLock lm (registry_lock);
- registry.insert (this);
+ registry.insert (&ctl);
- if (!_uri.empty()) {
+ if (!ctl.uri().empty()) {
pair<string,Controllable*> newpair;
- newpair.first = _uri;
- newpair.second = this;
+ newpair.first = ctl.uri();
+ newpair.second = &ctl;
registry_by_uri.insert (newpair);
}
- this->GoingAway.connect (mem_fun (this, &Controllable::remove));
+ /* Controllable::remove() is static - no need to manage this connection */
+
+ ctl.GoingAway.connect (boost::bind (&Controllable::remove, ref (ctl)));
}
void
-Controllable::remove ()
+Controllable::remove (Controllable& ctl)
{
Glib::RWLock::WriterLock lm (registry_lock);
for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
- if ((*i) == this) {
+ if ((*i) == &ctl) {
registry.erase (i);
break;
}
}
- if (!_uri.empty()) {
- ControllablesByURI::iterator i = registry_by_uri.find (_uri);
+ if (!ctl.uri().empty()) {
+ ControllablesByURI::iterator i = registry_by_uri.find (ctl.uri());
if (i != registry_by_uri.end()) {
registry_by_uri.erase (i);
}
}
-
-
}
void
+
/*
Copyright (C) 2006 Paul Davis
Author: Hans Fugal
#include <set>
#include <map>
-#include <sigc++/trackable.h>
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
#include <glibmm/thread.h>
#include "pbd/statefuldestructible.h"
virtual void set_value (float) = 0;
virtual float get_value (void) const = 0;
- sigc::signal<void> LearningFinished;
- static sigc::signal<void,PBD::Controllable*,int,int> CreateBinding;
- static sigc::signal<void,PBD::Controllable*> DeleteBinding;
+ boost::signals2::signal<void()> LearningFinished;
+ static boost::signals2::signal<void(PBD::Controllable*,int,int)> CreateBinding;
+ static boost::signals2::signal<void(PBD::Controllable*)> DeleteBinding;
- static sigc::signal<bool,PBD::Controllable*> StartLearning;
- static sigc::signal<void,PBD::Controllable*> StopLearning;
+ static boost::signals2::signal<bool(PBD::Controllable*)> StartLearning;
+ static boost::signals2::signal<void(PBD::Controllable*)> StopLearning;
- static sigc::signal<void,Controllable*> Destroyed;
-
- sigc::signal<void> Changed;
+ static boost::signals2::signal<void(Controllable*)> Destroyed;
+
+ boost::signals2::signal<void()> Changed;
int set_state (const XMLNode&, int version);
XMLNode& get_state ();
std::string _uri;
bool _touching;
- void add ();
- void remove ();
+ static void add (Controllable&);
+ static void remove (Controllable&);
typedef std::set<PBD::Controllable*> Controllables;
typedef std::map<std::string,PBD::Controllable*> ControllablesByURI;
#ifndef __pbd_destructible_h__
#define __pbd_destructible_h__
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
namespace PBD {
-/* be very very careful using this class. it does not inherit from sigc::trackable and thus
- should only be used in multiple-inheritance situations involving another type
- that does inherit from sigc::trackable (or sigc::trackable itself)
-*/
-
-class ThingWithGoingAway {
- public:
- virtual ~ThingWithGoingAway () {}
- sigc::signal<void> GoingAway;
-};
-
-class Destructible : public sigc::trackable, public ThingWithGoingAway {
+class Destructible {
public:
+ Destructible() : refs_dropped (false){}
virtual ~Destructible () {}
- void drop_references () const { GoingAway(); }
+
+ boost::signals2::signal<void ()> GoingAway;
+ void drop_references () { if (!refs_dropped) { GoingAway(); } refs_dropped = true; }
+ private:
+ bool refs_dropped;
};
}
#include "pbd/command.h"
#include "pbd/stacktrace.h"
#include "pbd/xml++.h"
-#include "pbd/shiva.h"
#include <sigc++/slot.h>
#include <typeinfo>
MementoCommand(obj_T& a_object, XMLNode* a_before, XMLNode* a_after)
: obj(a_object), before(a_before), after(a_after)
{
- /* catch destruction of the object */
- new PBD::PairedShiva< obj_T,MementoCommand<obj_T> > (obj, *this);
+ /* if the object dies, make sure that we die and that everyone knows about it */
+ obj_death_connection = obj.GoingAway.connect (boost::bind (&MementoCommand::object_died, this));
}
~MementoCommand () {
- GoingAway(); /* EMIT SIGNAL */
+ drop_references ();
delete before;
delete after;
}
+ void object_died () {
+ delete this;
+ }
+
void operator() () {
if (after) {
obj.set_state(*after, Stateful::current_state_version);
obj_T& obj;
XMLNode* before;
XMLNode* after;
+ boost::signals2::scoped_connection obj_death_connection;
};
#endif // __lib_pbd_memento_h__
{
};
-/* be very very careful using this class. it does not inherit from sigc::trackable and thus
- should only be used in multiple-inheritance situations involving another type
- that does inherit from sigc::trackable (or sigc::trackable itself)
-*/
-
-class StatefulThingWithGoingAway : public Stateful, public ThingWithGoingAway
-{
-};
-
}
-
#endif /* __pbd_stateful_destructible_h__ */
#include <sigc++/slot.h>
#include <sigc++/bind.h>
#include <sys/time.h>
+
+#include "pbd/scoped_connections.h"
#include "pbd/command.h"
-#include "pbd/shiva.h"
typedef sigc::slot<void> UndoAction;
-class UndoTransaction : public Command
+class UndoTransaction : public Command, public PBD::ScopedConnectionList
{
public:
UndoTransaction ();
private:
std::list<Command*> actions;
- std::list<PBD::ProxyShiva<Command,UndoTransaction>*> shivas;
struct timeval _timestamp;
bool _clearing;
~UndoTransaction ();
void about_to_explicitly_delete ();
-
};
-class UndoHistory : public sigc::trackable
+class UndoHistory : public PBD::ScopedConnectionList
{
public:
UndoHistory();
void set_depth (uint32_t);
- sigc::signal<void> Changed;
+ boost::signals2::signal<void()> Changed;
private:
bool _clearing;
#include <unistd.h>
#include "pbd/stateful.h"
+#include "pbd/destructible.h"
#include "pbd/filesystem.h"
#include "pbd/xml++.h"
#include "pbd/error.h"
UndoTransaction::~UndoTransaction ()
{
- GoingAway ();
+ drop_references ();
clear ();
}
UndoTransaction::add_command (Command *const action)
{
/* catch death of command (e.g. caused by death of object to
- which it refers.
+ which it refers. command_death() is a normal static function
+ so there is no need to manage this connection.
*/
- shivas.push_back (new PBD::ProxyShiva<Command,UndoTransaction> (*action, *this, &command_death));
+
+ scoped_connect (action->GoingAway, boost::bind (&command_death, this, action));
actions.push_back (action);
}
actions.remove (action);
}
-void
-UndoTransaction::about_to_explicitly_delete ()
-{
- /* someone is going to call our destructor and its not Shiva,
- the god of destruction and chaos. This happens when an UndoHistory
- is pruning itself. we must remove Shivas to avoid the god
- striking us down a second time, unnecessarily and illegally.
- */
-
- for (list<PBD::ProxyShiva<Command,UndoTransaction>*>::iterator i = shivas.begin(); i != shivas.end(); ++i) {
- delete *i;
- }
- shivas.clear ();
-}
-
bool
UndoTransaction::empty () const
{
while (cnt--) {
ut = UndoList.front();
UndoList.pop_front ();
- ut->about_to_explicitly_delete ();
delete ut;
}
}
{
uint32_t current_depth = UndoList.size();
- ut->GoingAway.connect (bind (mem_fun (*this, &UndoHistory::remove), ut));
+ scoped_connect (ut->GoingAway, 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
UndoTransaction* ut;
ut = UndoList.front ();
UndoList.pop_front ();
- ut->about_to_explicitly_delete ();
delete ut;
}
}
pool.cc
pthread_utils.cc
receiver.cc
+ scoped_connections.cc
search_path.cc
shortpath.cc
stacktrace.cc
{
Glib::Mutex::Lock lm (pending_lock);
- std::pair<MIDIControllable *, sigc::connection> element;
+#if 0 // BOOST SIGNALS
+ std::pair<MIDIControllable *, boost::signals2::scoped_connection> element;
element.first = mc;
element.second = c->LearningFinished.connect (bind (mem_fun (*this, &GenericMidiControlProtocol::learning_stopped), mc));
pending_controllables.push_back (element);
+#endif
}
mc->learn_about_external_control ();
#include "midicontrollable.h"
-using namespace sigc;
using namespace std;
using namespace MIDI;
using namespace PBD;
MIDIControllable::learn_about_external_control ()
{
drop_external_control ();
- midi_learn_connection = _port.input()->any.connect (mem_fun (*this, &MIDIControllable::midi_receiver));
+ midi_learn_connection = _port.input()->any.connect (boost::bind (&MIDIControllable::midi_receiver, this, _1, _2, _3));
}
void
switch (ev) {
case MIDI::off:
midi_sense_connection[0] = p.channel_note_off[chn_i].connect
- (mem_fun (*this, &MIDIControllable::midi_sense_note_off));
+ (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) {
midi_sense_connection[1] = p.channel_note_on[chn_i].connect
- (mem_fun (*this, &MIDIControllable::midi_sense_note_on));
+ (boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2));
connections = 2;
} else {
connections = 1;
case MIDI::on:
midi_sense_connection[0] = p.channel_note_on[chn_i].connect
- (mem_fun (*this, &MIDIControllable::midi_sense_note_on));
+ (boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2));
if (bistate) {
midi_sense_connection[1] = p.channel_note_off[chn_i].connect
- (mem_fun (*this, &MIDIControllable::midi_sense_note_off));
+ (boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2));
connections = 2;
} else {
connections = 1;
}
_control_description = "MIDI control: NoteOn";
break;
-
+
case MIDI::controller:
midi_sense_connection[0] = p.channel_controller[chn_i].connect
- (mem_fun (*this, &MIDIControllable::midi_sense_controller));
+ (boost::bind (&MIDIControllable::midi_sense_controller, this, _1, _2));
connections = 1;
snprintf (buf, sizeof (buf), "MIDI control: Controller %d", control_additional);
_control_description = buf;
case MIDI::program:
if (!bistate) {
midi_sense_connection[0] = p.channel_program_change[chn_i].connect
- (mem_fun (*this,
- &MIDIControllable::midi_sense_program_change));
+ (boost::bind (&MIDIControllable::midi_sense_program_change, this, _1, _2));
connections = 1;
_control_description = "MIDI control: ProgramChange";
}
case MIDI::pitchbend:
if (!bistate) {
midi_sense_connection[0] = p.channel_pitchbend[chn_i].connect
- (mem_fun (*this, &MIDIControllable::midi_sense_pitchbend));
+ (boost::bind (&MIDIControllable::midi_sense_pitchbend, this, _1, _2));
connections = 1;
_control_description = "MIDI control: Pitchbend";
}
#include <string>
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
#include "midi++/types.h"
#include "pbd/controllable.h"
MIDI::byte last_value;
bool bistate;
int midi_msg_id; /* controller ID or note number */
- sigc::connection midi_sense_connection[2];
- sigc::connection midi_learn_connection;
+ boost::signals2::connection midi_sense_connection[2];
+ boost::signals2::connection midi_learn_connection;
size_t connections;
MIDI::eventType control_type;
MIDI::byte control_additional;
#ifndef mackie_controls_h
#define mackie_controls_h
-#include <sigc++/sigc++.h>
-
#include <map>
#include <vector>
#include <string>
+#include <boost/signals2.hpp>
+
#include "mackie_control_exception.h"
namespace Mackie
virtual unsigned int in_use_timeout() { return _in_use_timeout; }
/// Keep track of the timeout so it can be updated with more incoming events
- sigc::connection in_use_connection;
+ boost::signals2::scoped_connection in_use_connection;
private:
int _id;
using namespace ARDOUR;
using namespace std;
-using namespace sigc;
using namespace Mackie;
using namespace PBD;
MackieControlProtocol::MackieControlProtocol (Session& session)
: ControlProtocol (session, X_("Mackie"))
, _current_initial_bank( 0 )
- , connections_back( _connections )
, _surface( 0 )
, _ports_changed( false )
, _polling( true )
void MackieControlProtocol::connect_session_signals()
{
// receive routes added
- connections_back = session->RouteAdded.connect( ( mem_fun (*this, &MackieControlProtocol::notify_route_added) ) );
+ session_connections.add_connection (session->RouteAdded.connect(boost::bind (&MackieControlProtocol::notify_route_added, this, _1)));
// receive record state toggled
- connections_back = session->RecordStateChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_record_state_changed) ) );
+ session_connections.add_connection (session->RecordStateChanged.connect(boost::bind (&MackieControlProtocol::notify_record_state_changed, this)));
// receive transport state changed
- connections_back = session->TransportStateChange.connect( ( mem_fun (*this, &MackieControlProtocol::notify_transport_state_changed) ) );
+ session_connections.add_connection (session->TransportStateChange.connect(boost::bind (&MackieControlProtocol::notify_transport_state_changed, this)));
// receive punch-in and punch-out
- connections_back = Config->ParameterChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_parameter_changed) ) );
- session->config.ParameterChanged.connect ( ( mem_fun (*this, &MackieControlProtocol::notify_parameter_changed) ) );
+ session_connections.add_connection (Config->ParameterChanged.connect(boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1)));
+ session_connections.add_connection (session->config.ParameterChanged.connect (boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1)));
// receive rude solo changed
- connections_back = session->SoloActive.connect( ( mem_fun (*this, &MackieControlProtocol::notify_solo_active_changed) ) );
+ session_connections.add_connection (session->SoloActive.connect(boost::bind (&MackieControlProtocol::notify_solo_active_changed, this, _1)));
// 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 )
{
- connections_back = (*it)->RemoteControlIDChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_remote_id_changed) ) );
+ session_connections.add_connection ((*it)->RemoteControlIDChanged.connect (boost::bind(&MackieControlProtocol::notify_remote_id_changed, this)));
}
}
{
MackiePort * sport = new MackiePort( *this, midi_port, number );
_ports.push_back( sport );
-
- connections_back = sport->init_event.connect(
- sigc::bind (
- mem_fun (*this, &MackieControlProtocol::handle_port_init)
- , sport
- )
- );
-
- connections_back = sport->active_event.connect(
- sigc::bind (
- mem_fun (*this, &MackieControlProtocol::handle_port_active)
- , sport
- )
- );
-
- connections_back = sport->inactive_event.connect(
- sigc::bind (
- mem_fun (*this, &MackieControlProtocol::handle_port_inactive)
- , sport
- )
- );
+
+ port_connections.add_connection (sport->init_event.connect (boost::bind (&MackieControlProtocol::handle_port_init, this, sport)));
+ port_connections.add_connection (sport->active_event.connect (boost::bind (&MackieControlProtocol::handle_port_active, this, sport)));
+ port_connections.add_connection (sport->inactive_event.connect (boost::bind (&MackieControlProtocol::handle_port_inactive, this, sport)));
_ports_changed = true;
}
_surface->init();
// Connect events. Must be after route table otherwise there will be trouble
- for( MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it )
- {
- connections_back = (*it)->control_event.connect( ( mem_fun (*this, &MackieControlProtocol::handle_control_event) ) );
+
+ for( MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it ) {
+ port_connections.add_connection ((*it)->control_event.connect(boost::bind (&MackieControlProtocol::handle_control_event, this, _1, _2, _3)));
}
}
_polling = false;
pthread_join( thread, 0 );
- // TODO disconnect port active/inactive signals
- // Or at least put a lock here
-
- // disconnect global signals from Session
- // TODO Since *this is a sigc::trackable, this shouldn't be necessary
- // but it is for some reason
-#if 0
- for( vector<sigc::connection>::iterator it = _connections.begin(); it != _connections.end(); ++it )
- {
- it->disconnect();
- }
-#endif
+ port_connections.drop_connections ();
+ session_connections.drop_connections ();
+ route_connections.drop_connections ();
if ( _surface != 0 )
{
// make sure remote id changes in the new route are handled
typedef ARDOUR::RouteList ARS;
- for ( ARS::iterator it = rl.begin(); it != rl.end(); ++it )
- {
- connections_back = (*it)->RemoteControlIDChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_remote_id_changed) ) );
+
+ for (ARS::iterator it = rl.begin(); it != rl.end(); ++it) {
+ route_connections.add_connection ((*it)->RemoteControlIDChanged.connect (boost::bind (&MackieControlProtocol::notify_remote_id_changed, this)));
}
}
/// Protects set_active, and allows waiting on the poll thread
Glib::Cond update_cond;
-
- // because sigc::trackable doesn't seem to be working
- std::vector<sigc::connection> _connections;
- std::back_insert_iterator<std::vector<sigc::connection> > connections_back;
-
- /// The representation of the physical controls on the surface.
+
+ PBD::ScopedConnectionList session_connections;
+ PBD::ScopedConnectionList port_connections;
+ PBD::ScopedConnectionList route_connections;
+
+ /// The representation of the physical controls on the surface.
Mackie::Surface * _surface;
/// If a port is opened or closed, this will be
#include "midi++/types.h"
#include "midi++/port.h"
-#include "sigc++/sigc++.h"
#include "ardour/rc_configuration.h"
#include "i18n.h"
#ifdef PORT_DEBUG
cout << "MackiePort::open " << *this << endl;
#endif
- _sysex = port().input()->sysex.connect( ( mem_fun (*this, &MackiePort::handle_midi_sysex) ) );
+ _sysex = port().input()->sysex.connect (boost::bind (&MackiePort::handle_midi_sysex, this, _1, _2, _3));
// make sure the device is connected
init();
#ifdef DEBUG
cout << "connect input parser " << port().input() << " to handle_midi_any" << endl;
#endif
- _any = port().input()->any.connect( mem_fun( *this, &MackiePort::handle_midi_any ) );
+ _any = port().input()->any.connect (boost::bind (&MackiePort::handle_midi_any, this, _1, _2, _3));
#ifdef DEBUG
cout << "input parser any connections: " << port().input()->any.size() << endl;
#endif
// first disconnect any previous timeouts
control.in_use_connection.disconnect();
+#if 0 // BOOSTSIGNALS
// now connect a new timeout to call handle_control_timeout_event
- sigc::slot<bool> timeout_slot = sigc::bind(
+ sigc::slot<bool> timeout_slot = sigc::bind (
mem_fun( *this, &MackiePort::handle_control_timeout_event )
, &control
);
timeout_slot
, control.in_use_timeout()
);
-
+#endif
// emit the control event
control_event( *this, control, state );
break;
#include "surface_port.h"
#include <midi++/types.h>
-#include <sigc++/signal.h>
-#include <sigc++/connection.h>
+#include <boost/signals2.hpp>
#include <glibmm/thread.h>
private:
MackieControlProtocol & _mcp;
port_type_t _port_type;
- sigc::connection _any;
- sigc::connection _sysex;
+ boost::signals2::scoped_connection _any;
+ boost::signals2::scoped_connection _sysex;
emulation_t _emulation;
bool _initialising;
void RouteSignal::connect()
{
- back_insert_iterator<Connections> cins = back_inserter( _connections );
+ if (_strip.has_solo()) {
+ connections.add_connection (_route->solo_control()->Changed.connect(boost::bind (&MackieControlProtocol::notify_solo_changed, &_mcp, this)));
+ }
- if ( _strip.has_solo() )
- cins = _route->solo_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_solo_changed ), this ) );
-
- if ( _strip.has_mute() )
- cins = _route->mute_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_mute_changed ), this ) );
-
- if ( _strip.has_gain() )
- cins = _route->gain_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_gain_changed ), this, true ) );
-
- cins = _route->NameChanged.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_name_changed ), this ) );
+ if (_strip.has_mute()) {
+ connections.add_connection (_route->mute_control()->Changed.connect(boost::bind (&MackieControlProtocol::notify_mute_changed, &_mcp, this)));
+ }
+
+ if (_strip.has_gain()) {
+ connections.add_connection (_route->gain_control()->Changed.connect(boost::bind (&MackieControlProtocol::notify_gain_changed, &_mcp, this, false)));
+ }
+
+ connections.add_connection (_route->NameChanged.connect (boost::bind (&MackieControlProtocol::notify_name_changed, &_mcp, this)));
if (_route->panner()) {
- cins = _route->panner()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) );
+ connections.add_connection (_route->panner()->Changed.connect(boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false)));
+
for ( unsigned int i = 0; i < _route->panner()->npanners(); ++i ) {
- cins = _route->panner()->streampanner (i).Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) );
+ connections.add_connection (_route->panner()->streampanner(i).Changed.connect (boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false)));
}
}
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route);
if (trk) {
- cins = trk->rec_enable_control()->Changed .connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_record_enable_changed ), this));
+ connections.add_connection (trk->rec_enable_control()->Changed .connect(boost::bind (&MackieControlProtocol::notify_record_enable_changed, &_mcp, this)));
}
// TODO this works when a currently-banked route is made inactive, but not
// when a route is activated which should be currently banked.
- cins = _route->active_changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_active_changed ), this ) );
+ connections.add_connection (_route->active_changed.connect (boost::bind (&MackieControlProtocol::notify_active_changed, &_mcp, this)));
// TODO
// SelectedChanged
void RouteSignal::disconnect()
{
- for ( Connections::iterator it = _connections.begin(); it != _connections.end(); ++it )
- {
- it->disconnect();
- }
+ connections.drop_connections ();
}
void RouteSignal::notify_all()
#ifndef route_signal_h
#define route_signal_h
-#include <sigc++/sigc++.h>
+#include <vector>
#include <boost/shared_ptr.hpp>
-#include <vector>
+#include "pbd/scoped_connections.h"
#include "midi_byte_array.h"
Strip & _strip;
SurfacePort & _port;
- typedef std::vector<sigc::connection> Connections;
- Connections _connections;
+ PBD::ScopedConnectionList connections;
// Last written values for the gain and pan, to avoid overloading
// the midi connection to the surface
#ifndef surface_port_h
#define surface_port_h
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
#include <glibmm/thread.h>
#include "midi_byte_array.h"
/**
Make a relationship between a midi port and a Mackie device.
*/
-class SurfacePort : public sigc::trackable
+class SurfacePort
{
public:
SurfacePort( MIDI::Port & port, int number );
const MIDI::Port & port() const { return *_port; }
// all control notofications are sent from here
- sigc::signal<void, SurfacePort &, Control &, const ControlState &> control_event;
+ boost::signals2::signal<void(SurfacePort &, Control &, const ControlState &)> control_event;
// emitted just before the port goes into initialisation
// where it tries to establish that its device is connected
- sigc::signal<void> init_event;
+ boost::signals2::signal<void()> init_event;
// emitted when the port completes initialisation successfully
- sigc::signal<void> active_event;
+ boost::signals2::signal<void()> active_event;
// emitted when the port goes inactive (ie a read or write failed)
- sigc::signal<void> inactive_event;
+ boost::signals2::signal<void()> inactive_event;
- // the port number - master is 0, extenders are 1,2,3,4
+ // the port number - master is 0(extenders are 1((,4
virtual int number() const { return _number; }
// number of strips handled by this port. Usually 8.
#include <fcntl.h>
#include <glibmm/miscutils.h>
+#include <boost/signals2.hpp>
#include <pbd/pthread_utils.h>
#include <pbd/file_utils.h>
// "Application Hooks"
session_loaded (s);
- session->Exported.connect (sigc::mem_fun (*this, &OSC::session_exported));
+ scoped_connect (session->Exported, boost::bind (&OSC::session_exported, this, _1, _2));
}
OSC::~OSC()
*/
if (!route_exists) {
- route->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &OSC::drop_route), boost::weak_ptr<Route> (route)));
+ scoped_connect (route->GoingAway, (boost::bind (&OSC::drop_route, this, boost::weak_ptr<Route> (route))));
}
}
#include <glibmm/main.h>
-#include <sigc++/sigc++.h>
-
#include "pbd/abstract_ui.h"
+#include "pbd/scoped_connections.h"
#include "ardour/types.h"
#include "control_protocol/control_protocol.h"
~OSCUIRequest() {}
};
-class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
+class OSC : public ARDOUR::ControlProtocol, public PBD::ScopedConnectionList, public AbstractUI<OSCUIRequest>
{
public:
OSC (ARDOUR::Session&, uint32_t port);