Console1: cleanup, fix event loop initialization
This commit is contained in:
parent
c7eb410d0b
commit
68f55d62d0
@ -21,6 +21,7 @@
|
|||||||
#include "ardour/phase_control.h"
|
#include "ardour/phase_control.h"
|
||||||
#include "ardour/presentation_info.h"
|
#include "ardour/presentation_info.h"
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
|
|
||||||
#include "c1_control.h"
|
#include "c1_control.h"
|
||||||
#include "console1.h"
|
#include "console1.h"
|
||||||
|
|
||||||
|
@ -16,13 +16,7 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "console1.h"
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <glibmm-2.4/glibmm/main.h>
|
|
||||||
|
|
||||||
#include "pbd/abstract_ui.cc" // instantiate template
|
#include "pbd/abstract_ui.cc" // instantiate template
|
||||||
#include "pbd/controllable.h"
|
#include "pbd/controllable.h"
|
||||||
@ -41,6 +35,8 @@
|
|||||||
#include "ardour/stripable.h"
|
#include "ardour/stripable.h"
|
||||||
#include "ardour/track.h"
|
#include "ardour/track.h"
|
||||||
#include "ardour/vca_manager.h"
|
#include "ardour/vca_manager.h"
|
||||||
|
|
||||||
|
#include "console1.h"
|
||||||
#include "c1_control.h"
|
#include "c1_control.h"
|
||||||
#include "c1_gui.h"
|
#include "c1_gui.h"
|
||||||
|
|
||||||
@ -56,6 +52,7 @@ Console1::Console1 (Session& s)
|
|||||||
, blink_state (false)
|
, blink_state (false)
|
||||||
, rec_enable_state (false)
|
, rec_enable_state (false)
|
||||||
{
|
{
|
||||||
|
run_event_loop ();
|
||||||
port_setup ();
|
port_setup ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +60,7 @@ Console1::~Console1 ()
|
|||||||
{
|
{
|
||||||
all_lights_out ();
|
all_lights_out ();
|
||||||
|
|
||||||
|
stop_event_loop ();
|
||||||
MIDISurface::drop ();
|
MIDISurface::drop ();
|
||||||
|
|
||||||
tear_down_gui ();
|
tear_down_gui ();
|
||||||
@ -79,11 +77,6 @@ Console1::~Console1 ()
|
|||||||
for (const auto& mb : multi_buttons) {
|
for (const auto& mb : multi_buttons) {
|
||||||
delete mb.second;
|
delete mb.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stop event loop */
|
|
||||||
DEBUG_TRACE (DEBUG::Console1, "BaseUI::quit ()\n");
|
|
||||||
|
|
||||||
BaseUI::quit ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -103,24 +96,7 @@ Console1::set_active (bool yn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yn) {
|
|
||||||
|
|
||||||
/* start event loop */
|
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Console1, "Console1::set_active\n");
|
|
||||||
|
|
||||||
BaseUI::run ();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/* Control Protocol Manager never calls us with false, but
|
|
||||||
* insteads destroys us.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
ControlProtocol::set_active (yn);
|
ControlProtocol::set_active (yn);
|
||||||
/* this needs to be done that early, otherwise we'll miss the call of the signal */
|
|
||||||
session->SessionLoaded.connect (
|
|
||||||
session_connections, MISSING_INVALIDATOR, boost::bind (&Console1::notify_session_loaded, this), this);
|
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Console1, string_compose ("Console1::set_active done with yn: '%1'\n", yn));
|
DEBUG_TRACE (DEBUG::Console1, string_compose ("Console1::set_active done with yn: '%1'\n", yn));
|
||||||
|
|
||||||
@ -174,14 +150,25 @@ Console1::output_port_name () const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Console1::run_event_loop ()
|
||||||
|
{
|
||||||
|
DEBUG_TRACE (DEBUG::Launchpad, "start event loop\n");
|
||||||
|
BaseUI::run ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Console1::stop_event_loop ()
|
||||||
|
{
|
||||||
|
DEBUG_TRACE (DEBUG::Launchpad, "stop event loop\n");
|
||||||
|
BaseUI::quit ();
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Console1::begin_using_device ()
|
Console1::begin_using_device ()
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::Console1, "sending device inquiry message...\n");
|
DEBUG_TRACE (DEBUG::Console1, "sending device inquiry message...\n");
|
||||||
|
|
||||||
if (MIDISurface::begin_using_device ()) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
with this sysex command we can enter the 'native mode'
|
with this sysex command we can enter the 'native mode'
|
||||||
But there's no need to do so
|
But there's no need to do so
|
||||||
@ -191,9 +178,7 @@ Console1::begin_using_device ()
|
|||||||
load_mappings ();
|
load_mappings ();
|
||||||
setup_controls ();
|
setup_controls ();
|
||||||
|
|
||||||
/*
|
/* Connection to the blink-timer */
|
||||||
Connection to the blink-timer
|
|
||||||
*/
|
|
||||||
Glib::RefPtr<Glib::TimeoutSource> blink_timeout = Glib::TimeoutSource::create (200); // milliseconds
|
Glib::RefPtr<Glib::TimeoutSource> blink_timeout = Glib::TimeoutSource::create (200); // milliseconds
|
||||||
blink_connection = blink_timeout->connect (sigc::mem_fun (*this, &Console1::blinker));
|
blink_connection = blink_timeout->connect (sigc::mem_fun (*this, &Console1::blinker));
|
||||||
blink_timeout->attach (main_loop ()->get_context ());
|
blink_timeout->attach (main_loop ()->get_context ());
|
||||||
@ -204,7 +189,12 @@ Console1::begin_using_device ()
|
|||||||
periodic_timer->attach (main_loop ()->get_context ());
|
periodic_timer->attach (main_loop ()->get_context ());
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Console1, "************** begin_using_device() ********************\n");
|
DEBUG_TRACE (DEBUG::Console1, "************** begin_using_device() ********************\n");
|
||||||
return 0;
|
|
||||||
|
create_strip_inventory ();
|
||||||
|
connect_internal_signals ();
|
||||||
|
stripable_selection_changed ();
|
||||||
|
|
||||||
|
return MIDISurface::begin_using_device ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -242,8 +232,6 @@ Console1::connect_session_signals ()
|
|||||||
session_connections, MISSING_INVALIDATOR, boost::bind (&Console1::master_monitor_has_changed, this), this);
|
session_connections, MISSING_INVALIDATOR, boost::bind (&Console1::master_monitor_has_changed, this), this);
|
||||||
session->RouteAdded.connect (
|
session->RouteAdded.connect (
|
||||||
session_connections, MISSING_INVALIDATOR, boost::bind (&Console1::strip_inventory_changed, this, _1), this);
|
session_connections, MISSING_INVALIDATOR, boost::bind (&Console1::strip_inventory_changed, this, _1), this);
|
||||||
// window.signal_window_state_event().connect (sigc::bind (sigc::mem_fun (*this,
|
|
||||||
// &ARDOUR_UI::tabbed_window_state_event_handler), owner));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -265,15 +253,6 @@ Console1::connect_internal_signals ()
|
|||||||
console1_connections, MISSING_INVALIDATOR, [] () { DEBUG_TRACE (DEBUG::Console1, "VerticalZoomOut\n"); }, this);
|
console1_connections, MISSING_INVALIDATOR, [] () { DEBUG_TRACE (DEBUG::Console1, "VerticalZoomOut\n"); }, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Console1::notify_session_loaded ()
|
|
||||||
{
|
|
||||||
DEBUG_TRACE (DEBUG::Console1, "************** Session Loaded() ********************\n");
|
|
||||||
create_strip_inventory ();
|
|
||||||
connect_internal_signals ();
|
|
||||||
stripable_selection_changed ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Console1::setup_controls ()
|
Console1::setup_controls ()
|
||||||
{
|
{
|
||||||
@ -436,6 +415,7 @@ Console1::stop_using_device ()
|
|||||||
blink_connection.disconnect ();
|
blink_connection.disconnect ();
|
||||||
periodic_connection.disconnect ();
|
periodic_connection.disconnect ();
|
||||||
stripable_connections.drop_connections ();
|
stripable_connections.drop_connections ();
|
||||||
|
console1_connections.drop_connections ();
|
||||||
MIDISurface::stop_using_device ();
|
MIDISurface::stop_using_device ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -505,12 +485,6 @@ Console1::handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes* tb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Console1::tabbed_window_state_event_handler (GdkEventWindowState* ev, void* object)
|
|
||||||
{
|
|
||||||
DEBUG_TRACE (DEBUG::Console1, string_compose ("tabbed_window_state_event_handler: %1\n", ev->type));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Console1::notify_solo_active_changed (bool state)
|
Console1::notify_solo_active_changed (bool state)
|
||||||
{
|
{
|
||||||
|
@ -23,20 +23,14 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include <glibmm/threads.h>
|
|
||||||
|
|
||||||
#define ABSTRACT_UI_EXPORTS
|
#define ABSTRACT_UI_EXPORTS
|
||||||
#include <midi++/types.h>
|
|
||||||
|
|
||||||
#include "glibmm/main.h"
|
|
||||||
#include "pbd/abstract_ui.h"
|
#include "pbd/abstract_ui.h"
|
||||||
#include "pbd/controllable.h"
|
|
||||||
|
|
||||||
#include "ardour/presentation_info.h"
|
#include "ardour/presentation_info.h"
|
||||||
#include "ardour/readonly_control.h"
|
|
||||||
#include "ardour/types.h"
|
|
||||||
#include "control_protocol/control_protocol.h"
|
#include "control_protocol/control_protocol.h"
|
||||||
#include "gdk/gdkevents.h"
|
#include "control_protocol/types.h"
|
||||||
|
|
||||||
#include "midi_surface/midi_byte_array.h"
|
#include "midi_surface/midi_byte_array.h"
|
||||||
#include "midi_surface/midi_surface.h"
|
#include "midi_surface/midi_surface.h"
|
||||||
|
|
||||||
@ -49,7 +43,9 @@ namespace ARDOUR {
|
|||||||
class AsyncMIDIPort;
|
class AsyncMIDIPort;
|
||||||
class Bundle;
|
class Bundle;
|
||||||
class Port;
|
class Port;
|
||||||
|
class Plugin;
|
||||||
class Processor;
|
class Processor;
|
||||||
|
class ReadOnlyControl;
|
||||||
class Route;
|
class Route;
|
||||||
class Session;
|
class Session;
|
||||||
class MidiPort;
|
class MidiPort;
|
||||||
@ -78,9 +74,8 @@ using order_t = ARDOUR::PresentationInfo::order_t;
|
|||||||
|
|
||||||
class ControlNotFoundException : public std::exception
|
class ControlNotFoundException : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ControlNotFoundException () {}
|
ControlNotFoundException () {}
|
||||||
virtual ~ControlNotFoundException () {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Console1 : public MIDISurface
|
class Console1 : public MIDISurface
|
||||||
@ -92,9 +87,10 @@ class Console1 : public MIDISurface
|
|||||||
friend Meter;
|
friend Meter;
|
||||||
friend Encoder;
|
friend Encoder;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Console1 (ARDOUR::Session&);
|
Console1 (ARDOUR::Session&);
|
||||||
virtual ~Console1 ();
|
~Console1 ();
|
||||||
|
|
||||||
void map_p ();
|
void map_p ();
|
||||||
|
|
||||||
int set_active (bool yn);
|
int set_active (bool yn);
|
||||||
@ -275,7 +271,7 @@ class Console1 : public MIDISurface
|
|||||||
{ "TRACK_COPY", ControllerID::TRACK_COPY },
|
{ "TRACK_COPY", ControllerID::TRACK_COPY },
|
||||||
{ "TRACK_GROUP", ControllerID::TRACK_GROUP } };
|
{ "TRACK_GROUP", ControllerID::TRACK_GROUP } };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string config_dir_name = "c1mappings";
|
std::string config_dir_name = "c1mappings";
|
||||||
/* GUI */
|
/* GUI */
|
||||||
mutable C1GUI* gui;
|
mutable C1GUI* gui;
|
||||||
@ -324,11 +320,12 @@ class Console1 : public MIDISurface
|
|||||||
void connect_session_signals ();
|
void connect_session_signals ();
|
||||||
void connect_internal_signals ();
|
void connect_internal_signals ();
|
||||||
|
|
||||||
|
void run_event_loop ();
|
||||||
|
void stop_event_loop ();
|
||||||
|
|
||||||
/* MIDI-Message handler - we only have controller messages */
|
/* MIDI-Message handler - we only have controller messages */
|
||||||
void handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes* tb);
|
void handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes* tb);
|
||||||
|
|
||||||
void tabbed_window_state_event_handler (GdkEventWindowState* ev, void* object);
|
|
||||||
|
|
||||||
void master_monitor_has_changed ();
|
void master_monitor_has_changed ();
|
||||||
|
|
||||||
/* Strip inventory */
|
/* Strip inventory */
|
||||||
@ -338,7 +335,7 @@ class Console1 : public MIDISurface
|
|||||||
|
|
||||||
void create_strip_inventory ();
|
void create_strip_inventory ();
|
||||||
|
|
||||||
void strip_inventory_changed (ARDOUR::RouteList&) {
|
void strip_inventory_changed (ARDOUR::RouteList&) {
|
||||||
create_strip_inventory ();
|
create_strip_inventory ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +373,6 @@ class Console1 : public MIDISurface
|
|||||||
/* */
|
/* */
|
||||||
void all_lights_out ();
|
void all_lights_out ();
|
||||||
|
|
||||||
void notify_session_loaded ();
|
|
||||||
void notify_transport_state_changed () override;
|
void notify_transport_state_changed () override;
|
||||||
void notify_solo_active_changed (bool) override;
|
void notify_solo_active_changed (bool) override;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ def build(bld):
|
|||||||
'''
|
'''
|
||||||
obj.defines = [ 'PACKAGE="ardour_console1"' ]
|
obj.defines = [ 'PACKAGE="ardour_console1"' ]
|
||||||
obj.defines += [ 'ARDOURSURFACE_DLL_EXPORTS' ]
|
obj.defines += [ 'ARDOURSURFACE_DLL_EXPORTS' ]
|
||||||
obj.includes = [ '.', './console1', './midi_surface/midi_surface']
|
obj.includes = [ '.', './console1']
|
||||||
obj.name = 'libardour_console1'
|
obj.name = 'libardour_console1'
|
||||||
obj.target = 'ardour_console1'
|
obj.target = 'ardour_console1'
|
||||||
obj.uselib = 'GTKMM GTK GDK XML OSX'
|
obj.uselib = 'GTKMM GTK GDK XML OSX'
|
||||||
|
Loading…
Reference in New Issue
Block a user