mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-06 01:21:38 -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");
|
cJSON* outputBindings = cJSON_GetObjectItem( controllerJson, "outputBindings");
|
||||||
if ( feedbackBindings )
|
if ( outputBindings )
|
||||||
{
|
{
|
||||||
int nBindings = cJSON_GetArraySize( feedbackBindings );
|
int nBindings = cJSON_GetArraySize( outputBindings );
|
||||||
for(int i = 0; i < nBindings; i++ )
|
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" );
|
//LUPPP_NOTE("Binding from %s to %i %i", actionJ->valuestring, statusJson->valueint, dataJson->valueint );
|
||||||
|
|
||||||
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 ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -546,6 +542,9 @@ Binding* GenericMIDI::setupBinding( cJSON* binding )
|
||||||
tmp->active = 0; // release event
|
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 ) {
|
else if ( strcmp( actionJson->valuestring, "master:volume" ) == 0 ) {
|
||||||
tmp->action = Event::MASTER_VOL;
|
tmp->action = Event::MASTER_VOL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_KEY] , 0, sizeof(float) * nframes );
|
||||||
memset( buffers.audio[Buffers::SIDECHAIN_SIGNAL] , 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
|
/// do events from the ringbuffer
|
||||||
handleDspEvents();
|
handleDspEvents();
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ void MidiIO::writeMidi( unsigned char* data )
|
||||||
}
|
}
|
||||||
else
|
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 );
|
//memcpy( buffer, data, sizeof(unsigned char)*3 );
|
||||||
buffer[0] = data[0];
|
buffer[0] = data[0];
|
||||||
buffer[1] = data[1];
|
buffer[1] = data[1];
|
||||||
|
@ -56,7 +56,8 @@ void MidiIO::registerMidiPorts(std::string name)
|
||||||
|
|
||||||
if ( jackInputPort && jackOutputPort )
|
if ( jackInputPort && jackOutputPort )
|
||||||
{
|
{
|
||||||
LUPPP_NOTE("%i, %i", jackInputPort, jackOutputPort );
|
cout << jackOutputPort << endl;
|
||||||
|
//LUPPP_NOTE("%i, %i", jackInputPort, jackOutputPort );
|
||||||
}
|
}
|
||||||
else
|
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)
|
void MidiIO::process(int nframes)
|
||||||
{
|
{
|
||||||
// get port buffers and setup
|
// get port buffers and setup
|
||||||
void* inputBuffer = (void*) jack_port_get_buffer( jackInputPort, nframes );
|
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;
|
jack_midi_event_t in_event;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
|
@ -25,6 +25,9 @@ class MidiIO
|
||||||
///
|
///
|
||||||
int status();
|
int status();
|
||||||
|
|
||||||
|
/// gets / clears MIDI buffers
|
||||||
|
void initBuffers(int nframes);
|
||||||
|
|
||||||
/// gets called each process() in JACK
|
/// gets called each process() in JACK
|
||||||
void process(int nframes);
|
void process(int nframes);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,15 @@
|
||||||
|
|
||||||
"inputBindings" : [
|
"inputBindings" : [
|
||||||
{
|
{
|
||||||
|
"status" : 176,
|
||||||
|
"data" : 14,
|
||||||
|
"action" : "master:volume"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"__COMMENT__" : "track 0",
|
||||||
|
|
||||||
"status" : 176,
|
"status" : 176,
|
||||||
"data" : 7,
|
"data" : 7,
|
||||||
"action" : "track:volume",
|
"action" : "track:volume",
|
||||||
|
@ -16,16 +25,107 @@
|
||||||
{
|
{
|
||||||
"status" : 176,
|
"status" : 176,
|
||||||
"data" : 16,
|
"data" : 16,
|
||||||
"action" : "track:sendAmount",
|
"action" : "track:send",
|
||||||
"track" : 0
|
"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,
|
"status" : 177,
|
||||||
"data" : 7,
|
"data" : 7,
|
||||||
"action" : "track:volume",
|
"action" : "track:volume",
|
||||||
"track" : 1
|
"track" : 1
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
"__COMMENT__" : "track 2",
|
||||||
|
|
||||||
"status" : 178,
|
"status" : 178,
|
||||||
"data" : 7,
|
"data" : 7,
|
||||||
"action" : "track:volume",
|
"action" : "track:volume",
|
||||||
|
@ -64,7 +164,7 @@
|
||||||
{
|
{
|
||||||
"status" : 176,
|
"status" : 176,
|
||||||
"data" : 64,
|
"data" : 64,
|
||||||
"action" : "footpedal"
|
"action" : "footpedal1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue