-Hacked APC footswitch scene++ functionality into GenericMIDI

This commit is contained in:
Harry van Haaren 2014-04-28 18:34:30 +01:00
parent e6f775ae21
commit c37376ce76
3 changed files with 62 additions and 2 deletions

View file

@ -42,6 +42,29 @@ GenericMIDI::GenericMIDI(int waste, std::string n) :
name = n; name = n;
registerMidiPorts( name ); registerMidiPorts( name );
stat = CONTROLLER_OK; 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) void GenericMIDI::setName(std::string n)
@ -441,6 +464,22 @@ void GenericMIDI::midi(unsigned char* midi)
writeToGuiRingbuffer( &e2 ); 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 // iterate over bindings, execute binding action if matches
for(unsigned int i = 0; i < midiToAction.size(); i++) for(unsigned int i = 0; i < midiToAction.size(); i++)
{ {
@ -465,7 +504,22 @@ void GenericMIDI::midi(unsigned char* midi)
break; break;
case Event::GRID_SELECT_CLIP_EVENT: case Event::GRID_SELECT_CLIP_EVENT:
jack->getGridLogic()->selectedTrackSceneEvent( value ); // 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; break;
case Event::GRID_SELECT_CLIP_ENABLE: case Event::GRID_SELECT_CLIP_ENABLE:
jack->getGridLogic()->setSelectTrackScene( b->active ); jack->getGridLogic()->setSelectTrackScene( b->active );

View file

@ -76,6 +76,11 @@ class GenericMIDI : public Controller, public MidiIO
void trackSend(int t, int send, float v); void trackSend(int t, int send, float v);
void trackSendActive(int t, int send, bool a); void trackSendActive(int t, int send, bool a);
/// footswitch -> scene launch controls
void setFootswitchToNextScene(int v);
bool footswitchNextScene;
bool footswitchPrevScene;
void reset(); void reset();

View file

@ -66,6 +66,7 @@ class GridLogic : public TimeObserver
/// master controls, launches a horizontal scene with one event /// master controls, launches a horizontal scene with one event
void launchScene( int scene ); void launchScene( int scene );
int getCurrentScene(){return sceneLaunch;}
int getLaunchedScene(); int getLaunchedScene();
/// selected track functions /// selected track functions
@ -100,7 +101,7 @@ class GridLogic : public TimeObserver
/// holds last scene launch /// holds last scene launch
int sceneLaunch; 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 bool sampleTrackScene; // turn on to have selected clip, press event acted on
int selectedTrack; int selectedTrack;
int selectedScene; int selectedScene;