#1358 Latency Compensation Bug in Subgroups

Future Release
closed
nobody
None
1
2013-06-07
2012-09-30
Holger Marzen
No

It seems we have an off-by-one bug in latency compensation. It's reproducable.

New song
4 subgroups in audio mixer
LADSPA-plugin with noticable latency, eg Multiband-EQ or autotalent
Track 1, Instrument 1: Drum Track with Fluidsynth DSSI-Plugin
Track 2, Instrument 2: Copy of the above

Instrument 1 routed to Master
Instrument 2 routed to Subgroup 1 without LADSPA-plugin
-> perfectly in sync

Instrument 1 routed to Master
Instrument 2 routed to subgroup 1 with LADSPA-plugin
-> audible difference in timing

Instrument 1 routed to Master
Instrument 2 routed to subgroup 1 with LADSPA-plugin
LADSPA-plugin also added to unused subgroup 2
-> latency compensation works, good sync (with some phase effects)

Instrument 1 routed to Master
Instrument 2 routed to subgroup 1 without LADSPA-plugin
LADSPA-plugin added to unused subgroup 2
-> latency compensation works in error, audible difference in timing

So it looks as if latency detection for instruments that are routet to subgroups grabs the wrong subgroup (1 + real subgroup). That would also explain why LADSPA-plugin in the last subgroup never get compensated.

Maybe the bug is hidden in sound/JackDriver.cpp in JackDriver::updateAudioData.

Discussion

    • milestone: 12.12 --> Future Release
     
  • Ted Felix
    Ted Felix
    2013-04-18

    Update from Holger on the dev mailing list 4/18/2013:

    "I browsed sound/JackDriver.cpp and found in line 2087 and 88:

    pluginLatency +=
        m_instrumentMixer->getPluginLatency((unsigned int) * connections.begin());
    

    I guessed this could be the latency in subgroups. [...] Bug 1358 is an off-by-one bug, so I tried

    pluginLatency +=
        m_instrumentMixer->getPluginLatency(
            (unsigned int) * connections.begin() - 1);
    

    and it looks like the bug is gone."

     
  • Ted Felix
    Ted Felix
    2013-04-19

    The "minus one" might be acting as a conversion from one kind of ID to another that is indeed fixing the problem. It appears that there might be a disagreement between the numbers returned by MappedAudioFader::getConnections() and the numbers expected by AudioInstrumentMixer::getPluginLatency(). Close examination of those two functions should reveal the problem.

     
  • Holger Marzen
    Holger Marzen
    2013-05-29

    I wrote this patch that solves the problem. I hope it'll make it into the official source code some time.

     
    • status: open --> closed
     
  • rev 13264