mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Hacked APC footswitch scene++ functionality into GenericMIDI
This commit is contained in:
parent
e6f775ae21
commit
c37376ce76
3 changed files with 62 additions and 2 deletions
|
@ -42,6 +42,29 @@ GenericMIDI::GenericMIDI(int waste, std::string n) :
|
|||
name = n;
|
||||
registerMidiPorts( name );
|
||||
stat = CONTROLLER_OK;
|
||||
|
||||
setFootswitchToNextScene( 0 );
|
||||
}
|
||||
|
||||
|
||||
void GenericMIDI::setFootswitchToNextScene(int v)
|
||||
{
|
||||
LUPPP_NOTE("Set Footswitch to %i", v );
|
||||
if ( v == 0 )
|
||||
{
|
||||
footswitchNextScene = false;
|
||||
footswitchPrevScene = false;
|
||||
}
|
||||
else if ( v > 0 )
|
||||
{
|
||||
footswitchNextScene = true;
|
||||
footswitchPrevScene = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
footswitchNextScene = false;
|
||||
footswitchPrevScene = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GenericMIDI::setName(std::string n)
|
||||
|
@ -441,6 +464,22 @@ void GenericMIDI::midi(unsigned char* midi)
|
|||
writeToGuiRingbuffer( &e2 );
|
||||
}
|
||||
|
||||
if ( status == 0x90 && data == 0x64 ) // nudge +
|
||||
{
|
||||
// footpedal to scene++
|
||||
setFootswitchToNextScene( 1 );
|
||||
}
|
||||
else if ( status == 0x90 && data == 0x65 ) // nudge
|
||||
{
|
||||
// footpedal to scene--
|
||||
setFootswitchToNextScene( -1 );
|
||||
}
|
||||
else if ( status == 0x90 && data == 0x60 ) // > on bank select: clear scene
|
||||
{
|
||||
// footpedal to special clip
|
||||
setFootswitchToNextScene( 0 );
|
||||
}
|
||||
|
||||
// iterate over bindings, execute binding action if matches
|
||||
for(unsigned int i = 0; i < midiToAction.size(); i++)
|
||||
{
|
||||
|
@ -465,7 +504,22 @@ void GenericMIDI::midi(unsigned char* midi)
|
|||
break;
|
||||
|
||||
case Event::GRID_SELECT_CLIP_EVENT:
|
||||
// hack to do scene ++ / -- with footswitch
|
||||
if ( footswitchNextScene && value > 0.5 ) // avoid note offs
|
||||
{
|
||||
cout << "footswitch next scene *now*" << endl;
|
||||
jack->getGridLogic()->launchScene( jack->getGridLogic()->getCurrentScene() + 1 );
|
||||
}
|
||||
else if ( footswitchPrevScene && value > 0.5 )
|
||||
{
|
||||
cout << "footswitch prev scene *now*" << endl;
|
||||
jack->getGridLogic()->launchScene( jack->getGridLogic()->getCurrentScene() - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "footswitch special clip action now" << endl;
|
||||
jack->getGridLogic()->selectedTrackSceneEvent( value );
|
||||
}
|
||||
break;
|
||||
case Event::GRID_SELECT_CLIP_ENABLE:
|
||||
jack->getGridLogic()->setSelectTrackScene( b->active );
|
||||
|
|
|
@ -76,6 +76,11 @@ class GenericMIDI : public Controller, public MidiIO
|
|||
void trackSend(int t, int send, float v);
|
||||
void trackSendActive(int t, int send, bool a);
|
||||
|
||||
/// footswitch -> scene launch controls
|
||||
void setFootswitchToNextScene(int v);
|
||||
bool footswitchNextScene;
|
||||
bool footswitchPrevScene;
|
||||
|
||||
|
||||
void reset();
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ class GridLogic : public TimeObserver
|
|||
|
||||
/// master controls, launches a horizontal scene with one event
|
||||
void launchScene( int scene );
|
||||
int getCurrentScene(){return sceneLaunch;}
|
||||
int getLaunchedScene();
|
||||
|
||||
/// selected track functions
|
||||
|
@ -100,7 +101,7 @@ class GridLogic : public TimeObserver
|
|||
/// holds last scene launch
|
||||
int sceneLaunch;
|
||||
|
||||
/// holds selected track / scene
|
||||
/// holds selected track / scene for special clip
|
||||
bool sampleTrackScene; // turn on to have selected clip, press event acted on
|
||||
int selectedTrack;
|
||||
int selectedScene;
|
||||
|
|
Loading…
Add table
Reference in a new issue