mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 17:11:40 -05:00
-Updated controller, fixed MIDI output bug
This commit is contained in:
parent
98ffb78732
commit
c1e3296a10
5 changed files with 134 additions and 19 deletions
|
@ -452,22 +452,18 @@ int GenericMIDI::loadController( std::string file )
|
|||
|
||||
|
||||
|
||||
cJSON* feedbackBindings = cJSON_GetObjectItem( controllerJson, "feedbackBindings");
|
||||
if ( feedbackBindings )
|
||||
cJSON* outputBindings = cJSON_GetObjectItem( controllerJson, "outputBindings");
|
||||
if ( outputBindings )
|
||||
{
|
||||
int nBindings = cJSON_GetArraySize( feedbackBindings );
|
||||
int nBindings = cJSON_GetArraySize( outputBindings );
|
||||
for(int i = 0; i < nBindings; i++ )
|
||||
{
|
||||
cJSON* binding = cJSON_GetArrayItem( feedbackBindings, i );
|
||||
cJSON* bindingJson = cJSON_GetArrayItem( outputBindings, i );
|
||||
Binding* tmp = setupBinding( bindingJson );
|
||||
if ( tmp )
|
||||
actionToMidi.push_back( tmp );
|
||||
|
||||
cJSON* action = cJSON_GetObjectItem( binding, "action" );
|
||||
|
||||
cJSON* status = cJSON_GetObjectItem( binding, "status" );
|
||||
cJSON* data = cJSON_GetObjectItem( binding, "data" );
|
||||
|
||||
LUPPP_NOTE("Binding from %s to %i %i", action->valuestring, status->valueint, data->valueint );
|
||||
|
||||
//actionToMidi.push_back( Binding(status->valueint, data->valueint, action->valuestring ) );
|
||||
//LUPPP_NOTE("Binding from %s to %i %i", actionJ->valuestring, statusJson->valueint, dataJson->valueint );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -546,9 +542,12 @@ Binding* GenericMIDI::setupBinding( cJSON* binding )
|
|||
tmp->active = 0; // release event
|
||||
}
|
||||
|
||||
else if ( strcmp( actionJson->valuestring, "footpedal1" ) == 0 ) {
|
||||
//tmp->action = Event::MASTER_VOL;
|
||||
}
|
||||
else if ( strcmp( actionJson->valuestring, "master:volume" ) == 0 ) {
|
||||
tmp->action = Event::MASTER_VOL;
|
||||
}
|
||||
}
|
||||
|
||||
// check for valid event: otherwise pass
|
||||
if ( tmp->action != Event::EVENT_NULL )
|
||||
|
|
|
@ -254,6 +254,13 @@ int Jack::process (jack_nframes_t nframes)
|
|||
memset( buffers.audio[Buffers::SIDECHAIN_KEY] , 0, sizeof(float) * nframes );
|
||||
memset( buffers.audio[Buffers::SIDECHAIN_SIGNAL] , 0, sizeof(float) * nframes );
|
||||
|
||||
|
||||
/// init buffers for each MidiIO
|
||||
for(unsigned int i = 0; i < midiIO.size(); i++ )
|
||||
{
|
||||
midiIO.at(i)->initBuffers( nframes );
|
||||
}
|
||||
|
||||
/// do events from the ringbuffer
|
||||
handleDspEvents();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ void MidiIO::writeMidi( unsigned char* data )
|
|||
}
|
||||
else
|
||||
{
|
||||
cout << "JC::writeMidi() " << int(data[0]) << ", " << int(data[1]) << ", " << int(data[2]) << endl;
|
||||
cout << "JC::writeMidi() port = " << jackOutputPort << int(data[0]) << ", " << int(data[1]) << ", " << int(data[2]) << endl;
|
||||
//memcpy( buffer, data, sizeof(unsigned char)*3 );
|
||||
buffer[0] = data[0];
|
||||
buffer[1] = data[1];
|
||||
|
@ -56,7 +56,8 @@ void MidiIO::registerMidiPorts(std::string name)
|
|||
|
||||
if ( jackInputPort && jackOutputPort )
|
||||
{
|
||||
LUPPP_NOTE("%i, %i", jackInputPort, jackOutputPort );
|
||||
cout << jackOutputPort << endl;
|
||||
//LUPPP_NOTE("%i, %i", jackInputPort, jackOutputPort );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -65,12 +66,17 @@ void MidiIO::registerMidiPorts(std::string name)
|
|||
}
|
||||
|
||||
|
||||
void MidiIO::initBuffers(int nframes)
|
||||
{
|
||||
// clear the output buffer
|
||||
void* outputBuffer= (void*) jack_port_get_buffer( jackOutputPort, nframes );
|
||||
jack_midi_clear_buffer( outputBuffer );
|
||||
}
|
||||
|
||||
void MidiIO::process(int nframes)
|
||||
{
|
||||
// get port buffers and setup
|
||||
void* inputBuffer = (void*) jack_port_get_buffer( jackInputPort, nframes );
|
||||
void* outputBuffer= (void*) jack_port_get_buffer( jackOutputPort, nframes );
|
||||
jack_midi_clear_buffer( outputBuffer );
|
||||
|
||||
jack_midi_event_t in_event;
|
||||
int index = 0;
|
||||
|
|
|
@ -25,6 +25,9 @@ class MidiIO
|
|||
///
|
||||
int status();
|
||||
|
||||
/// gets / clears MIDI buffers
|
||||
void initBuffers(int nframes);
|
||||
|
||||
/// gets called each process() in JACK
|
||||
void process(int nframes);
|
||||
|
||||
|
|
|
@ -8,6 +8,15 @@
|
|||
|
||||
"inputBindings" : [
|
||||
{
|
||||
"status" : 176,
|
||||
"data" : 14,
|
||||
"action" : "master:volume"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"__COMMENT__" : "track 0",
|
||||
|
||||
"status" : 176,
|
||||
"data" : 7,
|
||||
"action" : "track:volume",
|
||||
|
@ -16,16 +25,107 @@
|
|||
{
|
||||
"status" : 176,
|
||||
"data" : 16,
|
||||
"action" : "track:sendAmount",
|
||||
"action" : "track:send",
|
||||
"track" : 0
|
||||
},
|
||||
{
|
||||
"status" : 176,
|
||||
"data" : 20,
|
||||
"action" : "track:xside",
|
||||
"track" : 0
|
||||
},
|
||||
{
|
||||
"status" : 144,
|
||||
"data" : 48,
|
||||
"action" : "track:recordarm",
|
||||
"track" : 0,
|
||||
"active" : 1
|
||||
},
|
||||
{
|
||||
"status" : 128,
|
||||
"data" : 48,
|
||||
"action" : "track:recordarm",
|
||||
"track" : 0,
|
||||
"active" : 0
|
||||
},
|
||||
{
|
||||
"status" : 144,
|
||||
"data" : 49,
|
||||
"action" : "track:keyactive",
|
||||
"track" : 0,
|
||||
"active" : 1
|
||||
},
|
||||
{
|
||||
"status" : 128,
|
||||
"data" : 49,
|
||||
"action" : "track:keyactive",
|
||||
"track" : 0,
|
||||
"active" : 0
|
||||
},
|
||||
{
|
||||
"status" : 144,
|
||||
"data" : 50,
|
||||
"action" : "track:sendactive",
|
||||
"track" : 0,
|
||||
"active" : 1
|
||||
},
|
||||
{
|
||||
"status" : 128,
|
||||
"data" : 50,
|
||||
"action" : "track:sendactive",
|
||||
"track" : 0,
|
||||
"active" : 0
|
||||
},
|
||||
{
|
||||
"status" : 144,
|
||||
"data" : 53,
|
||||
"action" : "track:clippressed",
|
||||
"track" : 0,
|
||||
"scene" : 0
|
||||
},
|
||||
{
|
||||
"status" : 144,
|
||||
"data" : 54,
|
||||
"action" : "track:clippressed",
|
||||
"track" : 0,
|
||||
"scene" : 1
|
||||
},
|
||||
{
|
||||
"status" : 144,
|
||||
"data" : 55,
|
||||
"action" : "track:clippressed",
|
||||
"track" : 0,
|
||||
"scene" : 2
|
||||
},
|
||||
{
|
||||
"status" : 144,
|
||||
"data" : 56,
|
||||
"action" : "track:clippressed",
|
||||
"track" : 0,
|
||||
"scene" : 3
|
||||
},
|
||||
{
|
||||
"status" : 144,
|
||||
"data" : 57,
|
||||
"action" : "track:clippressed",
|
||||
"track" : 0,
|
||||
"scene" : 4
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"__COMMENT__" : "track 1",
|
||||
|
||||
"status" : 177,
|
||||
"data" : 7,
|
||||
"action" : "track:volume",
|
||||
"track" : 1
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"__COMMENT__" : "track 2",
|
||||
|
||||
"status" : 178,
|
||||
"data" : 7,
|
||||
"action" : "track:volume",
|
||||
|
@ -64,7 +164,7 @@
|
|||
{
|
||||
"status" : 176,
|
||||
"data" : 64,
|
||||
"action" : "footpedal"
|
||||
"action" : "footpedal1"
|
||||
}
|
||||
],
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue