-Added APC footcontroller support, ControllerUpdater has reset()
parent
92e9ad59bb
commit
2a29891b98
|
@ -11,7 +11,10 @@ extern Jack* jack;
|
||||||
|
|
||||||
AkaiAPC::AkaiAPC() :
|
AkaiAPC::AkaiAPC() :
|
||||||
Controller(),
|
Controller(),
|
||||||
MidiObserver("apc")
|
MidiObserver("apc"),
|
||||||
|
shiftPressed(false),
|
||||||
|
footpedalTrack(0),
|
||||||
|
footpedalScene(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +124,13 @@ void AkaiAPC::noteOn( int track, int note, int vel )
|
||||||
printf("apc noteOn: t = %i, n = %i, vel = %i\n", track, note, vel);
|
printf("apc noteOn: t = %i, n = %i, vel = %i\n", track, note, vel);
|
||||||
if ( note >= 53 && note <= 57 )
|
if ( note >= 53 && note <= 57 )
|
||||||
{
|
{
|
||||||
jack->getGridLogic()->pressed( track, note - 53 );
|
if ( shiftPressed )
|
||||||
|
{
|
||||||
|
footpedalTrack = track;
|
||||||
|
footpedalScene = note - 53;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
jack->getGridLogic()->pressed( track, note - 53 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +149,10 @@ void AkaiAPC::noteOn( int track, int note, int vel )
|
||||||
jack->getGridLogic()->launchScene(note - 82);
|
jack->getGridLogic()->launchScene(note - 82);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case 98: { // Shift
|
||||||
|
shiftPressed = true;
|
||||||
|
break; }
|
||||||
|
|
||||||
case 99: { // tap tempo
|
case 99: { // tap tempo
|
||||||
jack->getLogic()->tapTempo();
|
jack->getLogic()->tapTempo();
|
||||||
jack->getControllerUpdater()->tapTempo( true );
|
jack->getControllerUpdater()->tapTempo( true );
|
||||||
|
@ -185,6 +198,10 @@ void AkaiAPC::noteOff( int track, int note, int vel )
|
||||||
int s = jack->getGridLogic()->getLaunchedScene();
|
int s = jack->getGridLogic()->getLaunchedScene();
|
||||||
launchScene( s );
|
launchScene( s );
|
||||||
} break ;
|
} break ;
|
||||||
|
|
||||||
|
case 98: { // Shift
|
||||||
|
shiftPressed = false;
|
||||||
|
break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,8 +232,16 @@ void AkaiAPC::ccChange( int track, int cc, float value )
|
||||||
break; }
|
break; }
|
||||||
|
|
||||||
case 64: { // FootSwitch 1
|
case 64: { // FootSwitch 1
|
||||||
|
if ( value > 0.5 )
|
||||||
break; }
|
{
|
||||||
|
printf("footpedal press %i, %i\n", footpedalTrack, footpedalScene );
|
||||||
|
jack->getGridLogic()->pressed( footpedalTrack, footpedalScene );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("footpedal release %i, %i\n", footpedalTrack, footpedalScene );
|
||||||
|
jack->getGridLogic()->released( footpedalTrack, footpedalScene );
|
||||||
|
} break; }
|
||||||
case 67: { // FootSwitch 2
|
case 67: { // FootSwitch 2
|
||||||
|
|
||||||
break; }
|
break; }
|
||||||
|
@ -252,3 +277,17 @@ void AkaiAPC::midi(unsigned char* data)
|
||||||
ccChange( b1 - 176, b2, data[2] / 127.f );
|
ccChange( b1 - 176, b2, data[2] / 127.f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AkaiAPC::reset()
|
||||||
|
{
|
||||||
|
unsigned char data[3];
|
||||||
|
// setup "volume" style rotary display
|
||||||
|
for(int i = 0; i < NTRACKS; i++)
|
||||||
|
{
|
||||||
|
data[0] = 176 + i;
|
||||||
|
data[1] = 0x19;
|
||||||
|
data[2] = 2;
|
||||||
|
jack->writeApcOutput( &data[0] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -25,9 +25,16 @@ class AkaiAPC : public Controller, public MidiObserver
|
||||||
/// track FX
|
/// track FX
|
||||||
void trackSend(int t, int send, float v);
|
void trackSend(int t, int send, float v);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
void midi(unsigned char* data);
|
void midi(unsigned char* data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool shiftPressed;
|
||||||
|
|
||||||
|
int footpedalTrack;
|
||||||
|
int footpedalScene;
|
||||||
|
|
||||||
/// for handling events
|
/// for handling events
|
||||||
void ccChange( int track, int cc, float value );
|
void ccChange( int track, int cc, float value );
|
||||||
void noteOff( int track, int note, int vel );
|
void noteOff( int track, int note, int vel );
|
||||||
|
|
|
@ -35,6 +35,11 @@ class ControllerUpdater
|
||||||
c.push_back( controller );
|
c.push_back( controller );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
for(unsigned int i = 0; i < c.size(); i++)
|
||||||
|
c.at(i)->reset();
|
||||||
|
}
|
||||||
|
|
||||||
void mute(int t, bool b)
|
void mute(int t, bool b)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue