-Scene launch feedback

This commit is contained in:
Harry van Haaren 2013-08-25 23:36:08 +01:00
parent c439bb01e5
commit e72fc9dd44
6 changed files with 60 additions and 15 deletions

View file

@ -81,6 +81,24 @@ void AkaiAPC::setSceneState(int t, int clip, GridLogic::State s)
jack->writeApcOutput( &data[0] );
}
void AkaiAPC::launchScene( int s )
{
unsigned char data[3];
for(int i = 0; i < 5; i++ )
{
data[0] = 128;
data[1] = 82 + i; // scene play
data[2] = 0;
jack->writeApcOutput( &data[0] );
}
data[0] = 144;
data[1] = 82 + s;
data[2] = 127;
jack->writeApcOutput( &data[0] );
}
void AkaiAPC::mute(int t, bool b)
{
@ -92,7 +110,7 @@ void AkaiAPC::volume(int t, float f)
}
void noteOn( int track, int note, int vel )
void AkaiAPC::noteOn( int track, int note, int vel )
{
printf("apc noteOn: t = %i, n = %i, vel = %i\n", track, note, vel);
if ( note >= 53 && note <= 57 )
@ -130,7 +148,7 @@ void noteOn( int track, int note, int vel )
}
void noteOff( int track, int note, int vel )
void AkaiAPC::noteOff( int track, int note, int vel )
{
printf("apc noteOff: t = %i, n = %i, vel = %i\n", track, note, vel);
if ( note >= 53 && note <= 57 )
@ -138,16 +156,25 @@ void noteOff( int track, int note, int vel )
jack->getGridLogic()->released( track, note - 53 );
}
switch( note )
switch( note )
{
case 99: { // tap tempo
EventTimeTempoTap e(false);
writeToGuiRingbuffer( &e );
} break;
case 82: // scene launch
case 83:
case 84:
case 85:
case 86: {
int s = jack->getGridLogic()->getLaunchedScene();
launchScene( s );
} break ;
}
}
void ccChange( int track, int cc, float value )
void AkaiAPC::ccChange( int track, int cc, float value )
{
switch( cc )
{

View file

@ -19,6 +19,7 @@ class AkaiAPC : public Controller, public MidiObserver
void volume(int t, float f);
void progress(int t, int s, float f);
void recordArm(int t, bool b);
void launchScene( int scene );
void setSceneState(int track, int clip, GridLogic::State s);
/// track FX
@ -26,6 +27,11 @@ class AkaiAPC : public Controller, public MidiObserver
void midi(unsigned char* data);
private:
/// for handling events
void ccChange( int track, int cc, float value );
void noteOff( int track, int note, int vel );
void noteOn( int track, int note, int vel );
};
#endif // LUPPP_APC_H

View file

@ -27,12 +27,15 @@ class Controller
/// Time
virtual void tapTempo(bool b){};
/// track functionality
virtual void mute(int t, bool b){};
virtual void volume(int t, float f){};
virtual void progress(int t, int s, float f){};
virtual void recordArm(int t, bool r){};
virtual void setSceneState(int track, int scene, GridLogic::State s){};
virtual void launchScene( int scene ){};
};
#endif // LUPPP_CONTROLLER_H

View file

@ -60,6 +60,12 @@ class ControllerUpdater
c.at(i)->trackSend(t, send, v);
}
void launchScene( int scene )
{
for(unsigned int i = 0; i < c.size(); i++)
c.at(i)->launchScene(scene);
}
void setSceneState(int t, int clip, GridLogic::State s)
{
for(unsigned int i = 0; i < c.size(); i++)

View file

@ -19,10 +19,12 @@ const char* GridLogic::StateString[8] = {
GridLogic::GridLogic()
{
for( int i = 0; i < NTRACKS*NSCENES; i++ )
{
//state[i] = STATE_EMPTY;
}
sceneLaunch = 0;
}
int GridLogic::getLaunchedScene()
{
return sceneLaunch;
}
@ -51,12 +53,9 @@ void GridLogic::launchScene( int scene )
}
}
/*
for(unsigned int s = 0; s < NSCENES; s++ )
{
}
*/
sceneLaunch = scene;
jack->getControllerUpdater()->launchScene( scene );
}
void GridLogic::pressed( int track, int scene )
@ -66,7 +65,7 @@ void GridLogic::pressed( int track, int scene )
GridLogic::State s = lc->getState();
#ifdef DEBUG_CLIP
printf("GridLogic::pressed() before press state = %s\n", StateString[ int(s) ] );
printf("GridLogic::pressed() before press state = %s\n", StateString[ int(scene) ] );
#endif
if ( s == STATE_EMPTY )
lc->queueRecord();

View file

@ -48,6 +48,7 @@ class GridLogic : public TimeObserver
/// master controls, launches a horizontal scene with one event
void launchScene( int scene );
int getLaunchedScene();
/// GUI load event
void load(int track, int scene, AudioBuffer* ab);
@ -62,6 +63,9 @@ class GridLogic : public TimeObserver
/// for debug purposes: use static_cast<int>(GridLogic::State) to access
static const char* StateString[8];
private:
/// holds last scene launch
int sceneLaunch;
};
#endif // LUPPP_GRID_LOGIC_H