How to get Playhead Position of DAW
-
Is there a way to get the position of the playhead from the DAW. I know, i can use
setOnTransportChange()
to check, if it's playing or stopped. But how can I, for example, find out, if the playhead got reset to the start? I triedEngine.getPlayhead()
, but I couldn't figuere out, how to use it... it just spit out an empty object. -
Engine.getPlayhead() seems to be the method of choice, but how to use it? Any examples?
-
@toxonic For what purpose ? Syncing to playhead ?
If so then this works.// Create a transport handler const var transportHandler = Engine.createTransportHandler(); transportHandler.setEnableGrid(true, 8); transportHandler.setSyncMode(transportHandler.PreferExternal); transportHandler.startInternalClock(0); // The grid callback needs to be enabled for the LFO // to sync itself to the clock. // The clock will now prefer the external clock source. This // means that as long as the external clock isn't running // (the DAW playback is stopped) it will use the internal clock // and as soon as the DAW playback is started it will resync // itself to match the DAW position // Start the internal clock. This will cause the LFO to run // even if the DAW playback is stopped. (if you omit this line // the LFO will not move unless the DAW playback is started).
-
@lalalandsynth Thank you much, that's a good starting point!