mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
Fixed issue with glitches on beats/bars
This commit is contained in:
parent
17baee40cd
commit
bc71739b3a
4 changed files with 21 additions and 5 deletions
11
src/jack.cxx
11
src/jack.cxx
|
@ -527,6 +527,17 @@ void Jack::processFrames(int nframes)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Jack::clearInternalBuffers(int nframes)
|
||||||
|
{
|
||||||
|
memset(buffers.audio[Buffers::SEND],0,sizeof(float)*nframes);
|
||||||
|
memset(buffers.audio[Buffers::SIDECHAIN_KEY],0,sizeof(float)*nframes);
|
||||||
|
memset(buffers.audio[Buffers::SIDECHAIN_SIGNAL],0,sizeof(float)*nframes);
|
||||||
|
memset(buffers.audio[Buffers::MASTER_OUT_L],0,sizeof(float)*nframes);
|
||||||
|
memset(buffers.audio[Buffers::MASTER_OUT_R],0,sizeof(float)*nframes);
|
||||||
|
for(int i=0;i<NTRACKS;i++)
|
||||||
|
memset(buffers.audio[Buffers::TRACK_0 + i],0,sizeof(float)*nframes);
|
||||||
|
}
|
||||||
|
|
||||||
void Jack::masterVolume(float vol)
|
void Jack::masterVolume(float vol)
|
||||||
{
|
{
|
||||||
masterVol = vol;
|
masterVol = vol;
|
||||||
|
|
|
@ -69,6 +69,9 @@ class Jack
|
||||||
|
|
||||||
// Luppp process callback: bar() events can occur between these
|
// Luppp process callback: bar() events can occur between these
|
||||||
void processFrames(int nframes);
|
void processFrames(int nframes);
|
||||||
|
|
||||||
|
//Sets the first nframes of all the internal output buffers to zero. NO LIMIT CHECKS
|
||||||
|
void clearInternalBuffers(int nframes);
|
||||||
|
|
||||||
/// get functions for components owned by Jack
|
/// get functions for components owned by Jack
|
||||||
Looper* getLooper(int t);
|
Looper* getLooper(int t);
|
||||||
|
|
|
@ -292,7 +292,7 @@ void LooperClip::bar()
|
||||||
_buffer->setAudioFrames( jack->getTimeManager()->getFpb() * _buffer->getBeats() );
|
_buffer->setAudioFrames( jack->getTimeManager()->getFpb() * _buffer->getBeats() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( _playhead > 0.9 * _recordhead )
|
if ( _playhead == _recordhead )
|
||||||
{
|
{
|
||||||
_playhead = 0.f;
|
_playhead = 0.f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,9 +186,9 @@ void TimeManager::process(Buffers* buffers)
|
||||||
|
|
||||||
if ( beatFrameCountdown < nframes )
|
if ( beatFrameCountdown < nframes )
|
||||||
{
|
{
|
||||||
//length of beat is not multiple of nframes, so need to process last frames *before*
|
//length of beat is not multiple of nframes, so need to process last frames of last beat *before* setting next beat
|
||||||
//then set beat (get the queued actions: play, rec etc)
|
//then set new beat (get the queued actions: play, rec etc)
|
||||||
// then process first frames *after* beat
|
// then process first frames *after* new beat
|
||||||
int before=(beatCounter*fpb)%nframes;
|
int before=(beatCounter*fpb)%nframes;
|
||||||
int after=nframes-before;
|
int after=nframes-before;
|
||||||
|
|
||||||
|
@ -230,8 +230,10 @@ void TimeManager::process(Buffers* buffers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// process after
|
// process after
|
||||||
|
// we need to clear internal buffers in order to write *after* frames to them
|
||||||
|
jack->clearInternalBuffers(nframes);
|
||||||
jack->processFrames( after );
|
jack->processFrames( after );
|
||||||
|
|
||||||
// write new beat to UI (bar info currently not used)
|
// write new beat to UI (bar info currently not used)
|
||||||
EventTimeBarBeat e( barCounter, beatCounter );
|
EventTimeBarBeat e( barCounter, beatCounter );
|
||||||
writeToGuiRingbuffer( &e );
|
writeToGuiRingbuffer( &e );
|
||||||
|
|
Loading…
Add table
Reference in a new issue