Crazy Cubase <=10 Bug That Messes Up The Variables
-
I have one guitar plugin in testing. It's got a lot of feautes for tweaking the playback, multitracking, performance articulation stacking etc. It's 9 groups in a sampler for the main guitar, then another two samplers for releases and noises.
The main sampler playback logic is pretty hefty - the way it picks the correct string, then the correct sample etc.
All works great everywhere, except Cubase versions 10 and lower on Windows. If a loop is playing, and I switch away from the window, Cubase closes the plugin interface (or hides it). If I switch back to Cubase, the interface pops up again, but the playback sometimes hicks up for just a moment, But what always happens is it starts picking the wrong samples. Particularly the groups - wrong strings are playing, and sometimes no note plays at all, which means that it adjusts the variable of the correct RR group for that particular note, which is calculated in the on note function.
I'm using global variables all over (David will finally get some gloating material, if they're at fault here).
How or why would this happen? Why would a DAW interface refresh mess up any variables that I'm referencing to pick a correct group?
Disabling Plugins Always On Top in Cubase helps , but sometimes it still happens. We'll have to try Disable Suspend Audio Device in Background, but that's a feature some people might wanna use still.
-
@aaronventure I might not add a lot here, but have you deferred the interface script?
-
@aaronventure Does it happen in other DAWs if you manually close/open the UI?
-
-
@aaronventure See if you can make a minimal project that is able to recreate the issue. This will make it easier to find the cause/solution.
-
Are you passing values through the globals that affect which sample is chosen?
Debugging DAW-specific problems is tricky. Dropping in Christoph's file logger can make it much easier.
-
I'm circling back around to this as I'm seeing some Cubase-specific fixes being pushed.
So far I haven't been able to reproduce this in a minimal example, but I found the trigger.
In older versions of Cubase (sub-12) it happens whenever Cubase has to switch focus which causes a jump in its audio engine. Like switching to another window for a minute, then switching back to Cubase. Suspend settings do nothing here: you can leave the playback of the plugin going and it plays perfectly until you switch back to Cubase, it hicks up for a second and then it starts picking the wrong samples.
-
@aaronventure the fix I've just pushed was just a regression from my plugin parameter redesign - it basically caused all plugin-parameter assigned buttons to stop working on Cubase because the new change gesture callbacks apparently send a value change of the previous button value so it snaps back as soon as Cubase processes that change.
Does it also exhibit this behaviour when your plugin window isn't open?
-
@Christoph-Hart Yes.
If you do something like add a stereo track while it's playing, it'll just start doing weird stuff like picking wrong samples from wrong velocities or even wrong groups.
-
@aaronventure can you reproduce this is a minimal example or does it only happen in the full project?
-
@Christoph-Hart I tried to, but all works well when I try to reproduce a minimal example.
This uses the old sample mapping system, and the bug has been present for a couple of months at least. I even tried building with a version from last summer and (after fixing all the errors that popped up) it was still happening.
The instrument has a pretty complex on note function where it determines which sample from which group to play, and it's here somewhere that shit goes wrong, but I cannot possibly imagine why. How would a host hiccup mess up the way samples are picked?
-
@aaronventure the only thing that could happen is that a timer callback is being dropped because Cubase's UI thread is very prone to being overloaded, but it obviously does not have access to any variables so what you are experiencing seems to be a very odd glitch.
If you want you can send me the project, then I'll take a look at it, I'm currently debugging stuff in Cubase anyways.