Getting project tempo?

I don’t know if I’m missing something, or if there is other documentation somewhere that I missed, but I can barely find any information about something that seems like it would be so basic…

I’m working on a VST, and almost the only thing I need it to do, is get whatever the current project tempo is - just like any delay plugin that has a tempo sync button.

I thought it would just be like, x = currentproject.tempo or something super basic but apparently it’s not, and I can’t find any seemingly relevant documentation. There’s a couple of guys on youtube about it but they didn’t prove to be too helpful to me - which could be and probably is my own fault.

Can someone point me in the right direction of where to look? Is there even a universal way to code a tempo detection so that you can just open the VST in any DAW and receive the current project tempo?

Never used it myself but it looks like the SyncDelay example plugin extract the tempo in the process function.

tresult PLUGIN_API SyncDelayProcessor::process (ProcessData& data)

	if (data.processContext && data.processContext->state & ProcessContext::kTempoValid)
	{
		if (data.processContext->tempo != mTempo)
		{
			mTempo = data.processContext->tempo;
		}
	}
3 Likes