-Fixed timestretching, adjusted APC feedback

main
Harry van Haaren 2013-05-19 02:23:18 +01:00
parent f16f502c41
commit aa8364db20
3 changed files with 19 additions and 10 deletions

View File

@ -31,7 +31,7 @@ void AkaiAPC::clipSelect(int t, int clip, ClipMode cm)
case CLIP_MODE_PLAYING: data[2] = 1; break;
case CLIP_MODE_PLAY_QUEUED: data[2] = 2; break;
case CLIP_MODE_RECORDING: data[2] = 3; break;
//case CLIP_MODE_RECORDING: data[2] = 4; break;
// case flashing red light?: data[2] = 4; break;
case CLIP_MODE_LOADED: data[2] = 5; break;
}

View File

@ -87,6 +87,12 @@ void Looper::updateControllers()
{
numBeats = 0;
jack->getControllerUpdator()->recordArm(track, true);
jack->getControllerUpdator()->clipSelect(track, currentClip, Controller::CLIP_MODE_RECORD_QUEUED);
}
else if (state == STATE_RECORDING )
{
jack->getControllerUpdator()->recordArm(track, true);
jack->getControllerUpdator()->clipSelect(track, currentClip, Controller::CLIP_MODE_RECORDING);
}
else
{
@ -95,20 +101,21 @@ void Looper::updateControllers()
if (state == STATE_PLAY_QUEUED )
{
jack->getControllerUpdator()->clipSelect(track, 0, Controller::CLIP_MODE_PLAY_QUEUED);
jack->getControllerUpdator()->clipSelect(track, currentClip, Controller::CLIP_MODE_PLAY_QUEUED);
}
else if ( state == STATE_PLAYING )
if ( state == STATE_PLAYING )
{
jack->getControllerUpdator()->clipSelect(track, 0, Controller::CLIP_MODE_PLAYING);
jack->getControllerUpdator()->clipSelect(track, currentClip, Controller::CLIP_MODE_PLAYING);
}
if (state == STATE_STOP_QUEUED )
{
jack->getControllerUpdator()->clipSelect(track, 0, Controller::CLIP_MODE_LOADED);
jack->getControllerUpdator()->clipSelect(track, currentClip, Controller::CLIP_MODE_LOADED);
}
else if ( state == STATE_STOPPED )
{
jack->getControllerUpdator()->clipSelect(track, 0, Controller::CLIP_MODE_LOADED);
jack->getControllerUpdator()->clipSelect(track, currentClip, Controller::CLIP_MODE_LOADED);
}
}
@ -139,11 +146,11 @@ void Looper::process(int nframes, Buffers* buffers)
{
if ( playPoint < endPoint )
{
tmpBuffer[i] = sample[playPoint] * gain;
tmpBuffer[i] = sample[int(playPoint)];// * gain;
}
// always update playPoint, even when not playing sound.
// it updates the UI of progress
playPoint++;
playPoint += playbackSpeed;
}
// now pitch-shift the audio in the buffer
@ -218,7 +225,7 @@ void Looper::bar()
if ( barTmpState != state )
{
jack->getControllerUpdator()->recordArm( track, state == STATE_RECORDING ? 1 : 0 );
updateControllers();
}
}

View File

@ -40,6 +40,7 @@ class Looper : public Observer // for notifications
private:
const int track;
State state;
int currentClip;
int fpb;
float gain;
@ -47,7 +48,8 @@ class Looper : public Observer // for notifications
int playedBeats;
bool stopRecordOnBar;
int endPoint, playPoint, lastWrittenSampleIndex;
int endPoint, lastWrittenSampleIndex;
float playPoint;
float sample[44100*60];
// Pitch Shifting