I am trying to load a stored
TempoSequence value tree into an edit, like this:
void MainComponent::setSongTempo(const juce::ValueTree &tempoSequence)
This seems to update the MIDI clips when I draw them but not the playback. Is there a function I need to call to tell the engine that I have updated the tempo track? Or is this a bad approach?
I think this was only intended to be called at once during startup but I can’t see any obvious reason why calling it later would hurt (as long as there are no other bits of the Engine that hold on the references for any of the time sig or tempo objects).
I think it’s
Edit::sendTempoOrPitchSequenceChangedUpdates which should retrigger audio proxies to be recreated but as far as I can tell, that should be async via
Can you put a breakpoint in
sendTempoOrPitchSequenceChangedUpdates and see if it gets called after you set your new sequence?
Ok, I put a breakpoint in
sendTempoOrPitchSequenceChangedUpdates and it does get called!
Another piece of the puzzle: MIDI clips added after the tempo sequence has been changed do reflect the new tempo whereas MIDI clips already in the tracks are not updated.
TransportControl::editHasChanged force a rebuild of the audio graph and fix the problem?
I would have thought that would happen automatically but there might be a chance it doesn’t in this code path.
This seems to work:
Ah yes, sorry I forgot that’s what happens during a normal tempo change.
That basically converts all the times in seconds of the clips to beats and then back again with the new tempos.
Maybe we should add a
bool remapEdit parameter to that
setState function to be consistent with the other tempo ones which would handle this automatically for you.
Yeah, that would be a nice feature!
I’ve added this on my working branch but this will make it’s way over to develop/master soon: