-Fixed "double-register" of GuiController

This commit is contained in:
Harry van Haaren 2013-12-04 14:13:13 +00:00
parent d8411389a9
commit a3f9eda1d4
2 changed files with 21 additions and 15 deletions

View file

@ -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);
}
}

View file

@ -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);
}