Get low-leap timecode in standalone


#1

Hey Guys,

at the moment im working on a playlist, like in pro-tools, where the user can import sound files and play them/move them on the timeline by dragging with the mouse.

when i run the plugin in standalone-mode, i need a timecode to let my playbackEngine know the actuall playtime. My first approach was to use atomic doubles and calculate the passed time in the process block by adding 1/f every cycle, but if a high blocksize is choosen, the time leaps are to high(e.g. 46ms for blocksize 2048/44100)
So i changed it and made a timer class with the chrono high_resolution_clock, wich works like a stopwatch. this works fine to get the current position, but strictly speaking, my stopwatch and the processBlock are not synced now.

Since the high_resolution_clock is very accurate, my question now is, how accurate gets the processBlock called time-wise? In my understanding, in the first place it gets called through the soundcard, wich has an own clock for this and should be very precise.

Another option would be making a hybrid between both methods and sync the stopwatch after every block, but is this relly necessery?

Sorry, if this is a really basic question, but I am new to audio-programming.


#2

I believe the most accurate time will come from counting samples.


#3

The ONLY accurate time comes from counting samples!

Don’t ever make any assumptions about when your process method will be called, hosts do offline rendering at non-realtime speeds.


#4

Ok, thanks. Same goes for Standalone-mode? because for VST in host mode i will use the Playhead.


#5

Just stick to counting samples. In a standalone app you might need to generate your own playhead times, but do it by counting samples.


#6

Ok


#7

the main reason i want the clockValues to be smooth is so that the timline-cursor in the GUI doesnt leap. Is the LinearSmoothedValue-Class appropriate for this purpose?