Loopp/src/logic.cxx

71 lines
1.4 KiB
C++
Raw Normal View History

#include "logic.hxx"
#include "jack.hxx"
extern Jack* jack;
Logic::Logic()
{
}
void Logic::tapTempo()
{
jack->getTimeManager()->tap();
}
void Logic::metronomeEnable(bool b)
{
jack->getMetronome()->setActive(b);
jack->getControllerUpdater()->metronomeEnable( b );
}
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 );
}
}
void Logic::trackRecordArm(int t, bool v)
{
jack->getTrackOutput( t )->recordArm( v );
jack->getControllerUpdater()->recordArm( t, v );
}
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
jack->getTrackOutput( t )->setSend( send, v );
jack->getControllerUpdater()->setTrackSend( t, send, v );
}
void Logic::looperClipLenght(int t, int s, int l)
{
jack->getLooper( t )->getClip( s )->setBeats(l);
}
void Logic::looperUseAsTempo(int t, int s)
{
size_t clipBeats = jack->getLooper( t )->getClip( s )->getBeats();
size_t clipFrames = jack->getLooper( t )->getClip( s )->getBufferLenght();
if ( clipBeats > 0 )
{
size_t framesPerBeat = clipFrames / clipBeats;
jack->getTimeManager()->setFpb( framesPerBeat );
}
}