AudioPlayHead::CurrentPositionInfo different times


#1

Hi Jucers,

I made a small plugin that uses the AudioPlayHead::CurrentPositionInfo time information to send it through a network connection.

It’s a lot like the JuceDemoPlugin - just a small difference: to send the message independent from what’s happening in the editor, I put it in the JuceDemoPluginAudioProcessor::processBlock().

The code would be:

if (getPlayHead() != 0 && getPlayHead()->getCurrentPosition (newTime))
{
	const char * userContext;
	juce::MemoryBlock msg;
	int sender = 1213;
	msg.append(&sender, sizeof(int));
	userContext = "timing";
	msg.append(userContext, (strlen(userContext) + 1) * sizeof(char));
	msg.append(&(newTime.timeInSeconds), sizeof(double));
	_mvc->composeSocketMessage(msg);
	
    // Successfully got the current time from the host..
    lastPosInfo = newTime;
}
else
{
    // If the host fails to fill-in the current time, we'll just clear it to a default..
    lastPosInfo.resetToDefault();
}

When the PluginEditor is visible the time is correct, no problem.
When I close the PluginEditor the time is different - an offset of about 5 seconds.

I’ve tested this in Ableton Live and Digital Performer… the problem only occurs in DP.
Any idea what this might be?