Reset Internal Clock on Transport Change
-
I'm building a plugin that includes a step sequencer that can either sync with the DAW or a custom BPM. This is done using a transportHandler that is set to PreferExternal or InternalOnly.
While using a custom BPM, I would like the transportHandler clock to reset when the user presses play within the DAW. I tried using
th.setOnTransportChange(), but it is not triggered when usingth.setSyncMode(th.InternalOnly).Do you have any ideas of how to reset and retrigger the transpotHandler on Transport Change?
-
@obolig Mmmm... That seems an expected behaviour if you set
InternalOnly...the MasterClock class shows:
enum class SyncModes { Inactive, //> No syncing going on ExternalOnly, //< only reacts on external clock events InternalOnly, //< only reacts on internal clock events PreferInternal, //< override the clock value with the internal clock if it plays PreferExternal, //< override the clock value with the external clock if it plays SyncInternal, //< sync the internal clock when external playback starts numSyncModes };SyncInternalmight do the job -
@ustk Thanks for the suggestion. I just tried calling
th.setSyncMode(th.SyncInternal)and it does triggersetOnTransportChangethe first time the DAW is stopped. After that, the function is not triggered again by playing or stopping. The clock actually stops altogether.