Tempo changes in tempoSequence are not updated immediatelly

Hi, maybe the title is not a good description of the problem, so sorry for This!

Problem actually is:

On a project if I insert a new tempo in a tempoSequence it is not updated immediately:

for example in my MainComponent constructor I wrote this:

    MainComponent::MainComponent()
{
    setSize (1000, 600);
    edit.reset(new tracktion_engine::Edit{engine, tracktion_engine::createEmptyEdit(), tracktion_engine::Edit::forEditing, nullptr, 0});
    edit->tempoSequence.getTempoAt(0).setBpm(120);
    edit->tempoSequence.getTempoAt(0).setCurve(0.0);
    edit->tempoSequence.insertTempo(4, 120, 0.0);
    edit->tempoSequence.insertTempo(4, 300, 0.0);
    edit->tempoSequence.insertTempo(8, 300, 0.0);        
    for (auto tempo : edit->tempoSequence.getTempos())
    {
        DBG(tempo->getStartTime());
    }
}

It prints: 0 0 0 0 (It happens also if I put the cycle in resized() method for example). I noticed (putting cycle in a timerCallback) that those values are updated only after a while (printing correctly 0 2 2 2.8).

Why? Problem obviously rise because some of my classes needs to know “tempo->getStartTime()” values to do some stuff immediately when Program is launched.

Thank you in advice!

Thanks for reporting. Should be fixed here: https://github.com/Tracktion/tracktion_engine/commit/6f361787eb671da296a8a567fb0385e77011636a

I also added some tests and more documentation.

1 Like

Really really great!

Thanks for big work you’re doing!

I tried it: now it works, but in compile time two error rise up:

  1. line 172 of tracktion_DeviceManager.cpp (in func removeHostedAudioDeviceInsterfaces())
  2. line 321 of tracktion_HostedAudioDevice.cpp, to solve I add .get() to dm.deviceManager.addAudioDeviceType (std::unique_ptr(deviceType).get());

Maybe you need to update JUCE?

I’m using Juce 5.4.5, to be sure I’ve just download again from website…

You’ll need to use the develop branch from GitHub.
If you look here: https://github.com/Tracktion/tracktion_engine/tree/develop/modules
you’ll see the juce commit we’re building against (currently https://github.com/WeAreROLI/JUCE/tree/1003579c5acbf091370a6ca3df4c4d5031056206).

In general we always build against the tip of JUCE develop as we need the most recent additions for some Engine features.

2 Likes

Ok thank you! :slight_smile: