Browse Source

Fix BBT timing of Carla and Ildaeil modules

Closes #73
tags/22.02
falkTX 3 years ago
parent
commit
397ca366c3
2 changed files with 14 additions and 14 deletions
  1. +7
    -7
      plugins/Cardinal/src/Carla.cpp
  2. +7
    -7
      plugins/Cardinal/src/Ildaeil.cpp

+ 7
- 7
plugins/Cardinal/src/Carla.cpp 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;
}
}



+ 7
- 7
plugins/Cardinal/src/Ildaeil.cpp 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;
}
}



Loading…
Cancel
Save