13
0

Clean init process to prevent exceptions

This commit is contained in:
Holger Dehnhardt 2023-10-28 13:56:39 +02:00 committed by Robin Gareus
parent 828d45c6fa
commit 03e3546422
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 25 additions and 24 deletions

View File

@ -98,8 +98,6 @@ Console1::set_active (bool yn)
ControlProtocol::set_active (yn);
DEBUG_TRACE (DEBUG::Console1, string_compose ("Console1::set_active done with yn: '%1'\n", yn));
return 0;
}
@ -187,16 +185,30 @@ Console1::begin_using_device ()
Glib::RefPtr<Glib::TimeoutSource> periodic_timer = Glib::TimeoutSource::create (100);
periodic_connection = periodic_timer->connect (sigc::mem_fun (*this, &Console1::periodic));
periodic_timer->attach (main_loop ()->get_context ());
connect_session_signals ();
connect_internal_signals ();
create_strip_inventory ();
DEBUG_TRACE (DEBUG::Console1, "************** begin_using_device() ********************\n");
create_strip_inventory ();
connect_internal_signals ();
stripable_selection_changed ();
return MIDISurface::begin_using_device ();
}
int
Console1::stop_using_device ()
{
DEBUG_TRACE (DEBUG::Console1, "stop_using_device()\n");
if (!_in_use)
return 0;
blink_connection.disconnect ();
periodic_connection.disconnect ();
stripable_connections.drop_connections ();
session_connections.drop_connections ();
console1_connections.drop_connections ();
MIDISurface::stop_using_device ();
return 0;
}
void
Console1::connect_session_signals ()
{
@ -407,19 +419,6 @@ Console1::setup_controls ()
new Meter (this, ControllerID::OUTPUT_METER_R, boost::function<void ()> ([] () {}));
}
int
Console1::stop_using_device ()
{
DEBUG_TRACE (DEBUG::Console1, "stop_using_device()\n");
blink_connection.disconnect ();
periodic_connection.disconnect ();
stripable_connections.drop_connections ();
console1_connections.drop_connections ();
MIDISurface::stop_using_device ();
return 0;
}
void
Console1::handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes* tb)
{
@ -513,6 +512,9 @@ void
Console1::stripable_selection_changed ()
{
DEBUG_TRACE (DEBUG::Console1, "stripable_selection_changed \n");
if (!_in_use)
return;
std::shared_ptr<Stripable> r = ControlProtocol::first_selected_stripable ();
if (r) {
set_current_stripable (r);
@ -1194,11 +1196,10 @@ Console1::select_rid_by_index (uint32_t index)
std::shared_ptr<Stripable> s = session->get_remote_nth_stripable (rid, PresentationInfo::MixerStripables);
if (s) {
session->selection ().select_stripable_and_maybe_group (s, true, false, 0);
}
else {
} else {
success = false;
}
if( !success ){
if (!success) {
map_select ();
}
}

View File

@ -22,7 +22,7 @@ def build(bld):
obj.includes = [ '.', './console1']
obj.name = 'libardour_console1'
obj.target = 'ardour_console1'
obj.uselib = 'SIGCPP XML OSX'
obj.uselib = 'GTKMM SIGCPP XML OSX'
obj.use = 'libardour libardour_cp libardour_midisurface libgtkmm2ext libpbd libevoral libtemporal'
obj.install_path = os.path.join(bld.env['LIBDIR'], 'surfaces')