2013-08-05 14:56:38 +02:00
|
|
|
|
|
|
|
#include "logic.hxx"
|
|
|
|
|
|
|
|
#include "jack.hxx"
|
|
|
|
extern Jack* jack;
|
|
|
|
|
|
|
|
Logic::Logic()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-08-05 18:52:53 +02:00
|
|
|
void Logic::tapTempo()
|
|
|
|
{
|
|
|
|
jack->getTimeManager()->tap();
|
|
|
|
}
|
|
|
|
|
2013-09-18 11:09:26 +02:00
|
|
|
void Logic::metronomeEnable(bool b)
|
|
|
|
{
|
|
|
|
jack->getMetronome()->setActive(b);
|
|
|
|
jack->getControllerUpdater()->metronomeEnable( b );
|
|
|
|
}
|
|
|
|
|
2013-09-20 14:11:47 +02:00
|
|
|
void Logic::masterInputVol( float v )
|
|
|
|
{
|
|
|
|
jack->inputVolume( v );
|
|
|
|
}
|
|
|
|
|
2013-09-20 14:02:27 +02:00
|
|
|
void Logic::masterInputTo( Event::INPUT_TO inputTo, float v)
|
2013-09-20 13:40:50 +02:00
|
|
|
{
|
2013-09-20 14:02:27 +02:00
|
|
|
jack->inputTo( inputTo, v );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Logic::masterInputToActive( Event::INPUT_TO inputTo, bool active)
|
|
|
|
{
|
|
|
|
jack->inputToActive( inputTo, active);
|
2013-09-20 13:40:50 +02:00
|
|
|
}
|
|
|
|
|
2013-08-05 14:56:38 +02:00
|
|
|
void Logic::trackVolume(int t, float v)
|
|
|
|
{
|
2013-08-16 13:50:31 +02:00
|
|
|
if ( t < 0 ) // master track
|
|
|
|
{
|
|
|
|
jack->masterVolume(v);
|
|
|
|
jack->getControllerUpdater()->masterVolume( v );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jack->getTrackOutput( t )->setMaster( v );
|
|
|
|
jack->getControllerUpdater()->volume( t, v );
|
|
|
|
}
|
2013-08-05 14:56:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Logic::trackRecordArm(int t, bool v)
|
|
|
|
{
|
2013-08-27 19:05:21 +02:00
|
|
|
jack->getTrackOutput( t )->recordArm( v );
|
|
|
|
jack->getControllerUpdater()->recordArm( t, v );
|
2013-08-05 14:56:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-09-23 16:23:48 +02:00
|
|
|
void Logic::trackSendActive(int t, int s, bool v)
|
|
|
|
{
|
|
|
|
jack->getTrackOutput( t )->setSendActive( s, v );
|
|
|
|
}
|
|
|
|
|
2013-08-05 14:56:38 +02:00
|
|
|
void Logic::trackSend(int t, int send, float v)
|
|
|
|
{
|
2013-08-27 01:01:51 +02:00
|
|
|
#ifdef DEBUG_LOGIC
|
|
|
|
cout << "Logic::trackSend() " << t << " " << send << " " << v << endl;
|
|
|
|
#endif
|
2013-08-05 14:56:38 +02:00
|
|
|
jack->getTrackOutput( t )->setSend( send, v );
|
|
|
|
jack->getControllerUpdater()->setTrackSend( t, send, v );
|
|
|
|
}
|
2013-08-13 18:03:33 +02:00
|
|
|
|
|
|
|
void Logic::looperClipLenght(int t, int s, int l)
|
|
|
|
{
|
|
|
|
jack->getLooper( t )->getClip( s )->setBeats(l);
|
|
|
|
}
|
2013-08-13 19:34:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
void Logic::looperUseAsTempo(int t, int s)
|
|
|
|
{
|
2013-08-22 00:50:52 +02:00
|
|
|
size_t clipBeats = jack->getLooper( t )->getClip( s )->getBeats();
|
|
|
|
size_t clipFrames = jack->getLooper( t )->getClip( s )->getBufferLenght();
|
2013-08-13 19:34:08 +02:00
|
|
|
|
2013-08-22 00:50:52 +02:00
|
|
|
if ( clipBeats > 0 )
|
2013-08-13 19:34:08 +02:00
|
|
|
{
|
2013-08-22 00:50:52 +02:00
|
|
|
size_t framesPerBeat = clipFrames / clipBeats;
|
|
|
|
jack->getTimeManager()->setFpb( framesPerBeat );
|
2013-08-13 19:34:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|