Fix BBT timing of Carla and Ildaeil modules

Closes #73
This commit is contained in:
falkTX 2021-12-08 19:43:06 +00:00
parent d7248a9acc
commit 397ca366c3
2 changed files with 14 additions and 14 deletions

View file

@ -313,18 +313,18 @@ struct CarlaModule : Module {
int32_t newBar = fCarlaTimeInfo.bbt.bar;
int32_t newBeat = fCarlaTimeInfo.bbt.beat;
double newTick = fCarlaTimeInfo.bbt.tick + samplesPerTick * BUFFER_SIZE;
double newTick = fCarlaTimeInfo.bbt.tick + (double)BUFFER_SIZE / samplesPerTick;
while (newTick > pcontext->ticksPerBeat)
while (newTick >= fCarlaTimeInfo.bbt.ticksPerBeat)
{
newTick -= pcontext->ticksPerBeat;
newTick -= fCarlaTimeInfo.bbt.ticksPerBeat;
if (++fCarlaTimeInfo.bbt.beat > pcontext->beatsPerBar)
if (++newBeat > fCarlaTimeInfo.bbt.beatsPerBar)
{
fCarlaTimeInfo.bbt.beat = 1;
newBeat = 1;
if (++newBar)
fCarlaTimeInfo.bbt.barStartTick += pcontext->beatsPerBar * pcontext->ticksPerBeat;
++newBar;
fCarlaTimeInfo.bbt.barStartTick += fCarlaTimeInfo.bbt.beatsPerBar * fCarlaTimeInfo.bbt.ticksPerBeat;
}
}

View file

@ -498,18 +498,18 @@ struct IldaeilModule : Module {
int32_t newBar = fCarlaTimeInfo.bbt.bar;
int32_t newBeat = fCarlaTimeInfo.bbt.beat;
double newTick = fCarlaTimeInfo.bbt.tick + samplesPerTick * BUFFER_SIZE;
double newTick = fCarlaTimeInfo.bbt.tick + (double)BUFFER_SIZE / samplesPerTick;
while (newTick > pcontext->ticksPerBeat)
while (newTick >= fCarlaTimeInfo.bbt.ticksPerBeat)
{
newTick -= pcontext->ticksPerBeat;
newTick -= fCarlaTimeInfo.bbt.ticksPerBeat;
if (++fCarlaTimeInfo.bbt.beat > pcontext->beatsPerBar)
if (++newBeat > fCarlaTimeInfo.bbt.beatsPerBar)
{
fCarlaTimeInfo.bbt.beat = 1;
newBeat = 1;
if (++newBar)
fCarlaTimeInfo.bbt.barStartTick += pcontext->beatsPerBar * pcontext->ticksPerBeat;
++newBar;
fCarlaTimeInfo.bbt.barStartTick += fCarlaTimeInfo.bbt.beatsPerBar * fCarlaTimeInfo.bbt.ticksPerBeat;
}
}