Ableton Live 9 AU wrapper CurrentPositionInfo::timeInSamples bugs


There are two bugs affecting the AU wrapper in Ableton Live 9.

  • In Ableton Live 9.0.6 the host doesn't provide a "HostTransportState" callback so no timeInSamples is available. I suggest that in this case JUCE use the sample location given to the AU render call instead.
  • In Ableton Live 9.1.4 (the latest version at the moment) the callback is available, but the sample location provided by JUCE is sometimes off by 1. This is due to the float CurrentSampleInTimeLine value given from Ableton sometimes being very close to the true integer value but below it by an epsilon and the cast to int64 at JuceAU::getCurrentPosition reducing it to the integer below.

Suggested fixes for JuceAU::getCurrentPosition:

if (CallHostTransportState (&playing,
                            &outCycleEndBeat) == noErr)
    info.isPlaying = playing;
    // Take sample time from lastTimeStamp if HostTransportState
    // callback not available (Ableton Live 9.0.6)
    outCurrentSampleInTimeLine = lastTimeStamp.mSampleTime;
// Use rounded mSampleTime as in some hosts (Ableton Live 9.1.4)
// this can be a float value that is slightly below the integer.
info.timeInSamples = (int64) (outCurrentSampleInTimeLine + 0.5);
info.timeInSeconds = outCurrentSampleInTimeLine / getSampleRate();

Cheers, Yair


Nice one, thanks, I'll take a look asap!