From a3f9eda1d47ce02619a5fa507523d18796a5d7cc Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Wed, 4 Dec 2013 14:13:13 +0000 Subject: [PATCH] -Fixed "double-register" of GuiController --- src/controllerupdater.cxx | 8 +++++++- src/jack.cxx | 28 ++++++++++++++-------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/controllerupdater.cxx b/src/controllerupdater.cxx index 36ee5a1..dbffeca 100644 --- a/src/controllerupdater.cxx +++ b/src/controllerupdater.cxx @@ -11,9 +11,15 @@ ControllerUpdater::ControllerUpdater() void ControllerUpdater::registerController( Controller* controller ) { + if (!controller) + LUPPP_ERROR("Register Controller passed NULL controller!"); + + LUPPP_NOTE("Registering controller %s", controller->getName().c_str() ); + // store the controller instance c.push_back( controller ); + // and tell it to register itself (MidiObserver / AudioObserver etc) controller->registerComponents(); } @@ -99,7 +105,7 @@ void ControllerUpdater::specialScene(int t, int scene) { for(unsigned int i = 0; i < c.size(); i++) { - printf("calling on c %i\n", i); + printf("calling on c %i, %s\n", i, c.at(i)->getName().c_str() ); c.at(i)->specialScene(t, scene); } } diff --git a/src/jack.cxx b/src/jack.cxx index 8c8ad71..ea90280 100644 --- a/src/jack.cxx +++ b/src/jack.cxx @@ -202,6 +202,20 @@ Jack::Jack( std::string name ) : { LUPPP_ERROR("%s","Error setting timebase callback"); } + + //Controller* m = new AkaiAPC(); + + // TODO: Add GUI dialog to add controllers, and insert them into the controller map. + // Watch out for RT stuff, loading file, registering ports etc: before activate?! + //Controller* m = new GenericMIDI("akai_apc.ctlr","apc"); + + Controller* gui = new LupppGUI(); + controllerUpdater->registerController( gui ); + + if ( !gui ) + { + LUPPP_ERROR("%s","Error creating LupppGUI Controller instance"); + } } Jack::~Jack() @@ -219,20 +233,6 @@ Jack::~Jack() void Jack::activate() { - //Controller* m = new AkaiAPC(); - - // TODO: Add GUI dialog to add controllers, and insert them into the controller map. - // Watch out for RT stuff, loading file, registering ports etc: before activate?! - //Controller* m = new GenericMIDI("akai_apc.ctlr","apc"); - - Controller* gui = new LupppGUI(); - controllerUpdater->registerController( gui ); - - if ( !gui ) - { - LUPPP_ERROR("%s","Error creating LupppGUI Controller instance"); - } - jack_activate( client ); jack_transport_start(client); }