-Default MIDI controller backend loading OK
This commit is contained in:
parent
f700c2bd4e
commit
2505b44274
4 changed files with 37 additions and 7 deletions
|
@ -80,9 +80,7 @@ int DiskReader::loadPreferences()
|
||||||
LUPPP_NOTE("Loading controller %s", ctlr->valuestring);
|
LUPPP_NOTE("Loading controller %s", ctlr->valuestring);
|
||||||
stringstream s;
|
stringstream s;
|
||||||
s << getenv("HOME") << "/.config/openAV/luppp/controllers/" << ctlr->valuestring;
|
s << getenv("HOME") << "/.config/openAV/luppp/controllers/" << ctlr->valuestring;
|
||||||
GenericMIDI* c = new GenericMIDI( s.str().c_str() );
|
gui->addMidiControllerToSetup( s.str() );
|
||||||
EventControllerInstance e(c);
|
|
||||||
writeToDspRingbuffer( &e );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
20
src/gui.cxx
20
src/gui.cxx
|
@ -338,6 +338,8 @@ Gui::Gui(std::string argZero) :
|
||||||
{
|
{
|
||||||
LUPPP_NOTE( "%s", "Gui()" );
|
LUPPP_NOTE( "%s", "Gui()" );
|
||||||
|
|
||||||
|
gui = this;
|
||||||
|
|
||||||
// setup callback to signalChecker()
|
// setup callback to signalChecker()
|
||||||
Fl::add_timeout( 0.1, (Fl_Timeout_Handler)&signalChecker, 0 );
|
Fl::add_timeout( 0.1, (Fl_Timeout_Handler)&signalChecker, 0 );
|
||||||
|
|
||||||
|
@ -466,6 +468,24 @@ Gui::Gui(std::string argZero) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Gui::addMidiControllerToSetup(std::string c)
|
||||||
|
{
|
||||||
|
controllerVector.push_back( c );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gui::setupMidiControllers()
|
||||||
|
{
|
||||||
|
for(int i = 0; i < controllerVector.size(); i++)
|
||||||
|
{
|
||||||
|
GenericMIDI* c = new GenericMIDI( controllerVector.at(i).c_str() );
|
||||||
|
if ( c )
|
||||||
|
{
|
||||||
|
EventControllerInstance e(c);
|
||||||
|
writeToDspRingbuffer( &e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Gui::reset()
|
void Gui::reset()
|
||||||
{
|
{
|
||||||
// signal to DSP to reset state
|
// signal to DSP to reset state
|
||||||
|
|
|
@ -64,6 +64,10 @@ class Gui
|
||||||
/// resets the state to "new"
|
/// resets the state to "new"
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
/// sets up MIDI controllers: must be done *after* backend is started
|
||||||
|
void addMidiControllerToSetup(std::string);
|
||||||
|
void setupMidiControllers();
|
||||||
|
|
||||||
GTrack* getTrack(int id);
|
GTrack* getTrack(int id);
|
||||||
GMasterTrack* getMasterTrack(){return master;}
|
GMasterTrack* getMasterTrack(){return master;}
|
||||||
|
|
||||||
|
@ -84,6 +88,8 @@ class Gui
|
||||||
nsm_client_t* getNsm(){return nsm;}
|
nsm_client_t* getNsm(){return nsm;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
vector<std::string> controllerVector;
|
||||||
|
|
||||||
Fl_Double_Window window;
|
Fl_Double_Window window;
|
||||||
|
|
||||||
Fl_Group* lupppGroup;
|
Fl_Group* lupppGroup;
|
||||||
|
|
14
src/jack.cxx
14
src/jack.cxx
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "state/state.hxx"
|
#include "state/state.hxx"
|
||||||
|
|
||||||
|
#include "gui.hxx"
|
||||||
#include "logic.hxx"
|
#include "logic.hxx"
|
||||||
#include "config.hxx"
|
#include "config.hxx"
|
||||||
#include "looper.hxx"
|
#include "looper.hxx"
|
||||||
|
@ -46,7 +47,8 @@ using namespace std;
|
||||||
|
|
||||||
int AudioBuffer::privateID = 0;
|
int AudioBuffer::privateID = 0;
|
||||||
|
|
||||||
// static pointer from main.
|
// static pointers from main
|
||||||
|
extern Gui* gui;
|
||||||
extern Jack* jack;
|
extern Jack* jack;
|
||||||
|
|
||||||
void Jack::setup(std::string name)
|
void Jack::setup(std::string name)
|
||||||
|
@ -226,13 +228,17 @@ Jack::Jack( std::string name ) :
|
||||||
// Watch out for RT stuff, loading file, registering ports etc: before activate?!
|
// Watch out for RT stuff, loading file, registering ports etc: before activate?!
|
||||||
//Controller* m = new GenericMIDI("akai_apc.ctlr","apc");
|
//Controller* m = new GenericMIDI("akai_apc.ctlr","apc");
|
||||||
|
|
||||||
Controller* gui = new LupppGUI();
|
Controller* g = new LupppGUI();
|
||||||
controllerUpdater->registerController( gui );
|
controllerUpdater->registerController( g );
|
||||||
|
|
||||||
if ( !gui )
|
if ( !g )
|
||||||
{
|
{
|
||||||
LUPPP_ERROR("%s","Error creating LupppGUI Controller instance");
|
LUPPP_ERROR("%s","Error creating LupppGUI Controller instance");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// call into the GUI, telling it to register default controllers
|
||||||
|
gui->setupMidiControllers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Jack::~Jack()
|
Jack::~Jack()
|
||||||
|
|
Loading…
Reference in a new issue