VST: setProgram () overrides data retrieved via setChunk ()

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi guys,

I recently encountered a strange behaviour with Cubase SX 2 (PC): my set/getChunk functions work perfectly, but if I load back a .cpr file, Cubase calls setProgram () after setChunk (). So my worthy chunk data bites the dust.
Anyone experienced this, too? How did you solve it?
[well, I could force setProgram to return without action on startup but I think it's just an ugly hack from behind...]

Thanks for any brainstorming,
Sascha
Sascha Eversmeier
drummer of The Board
software dev in the studio-speaker biz | former plugin creator [u-he, samplitude & digitalfishphones]

Post

Hiya Sascha,

isn't the Chunk saved in a song a bank-chunk (isPreset==false)? - The solution would be saving all programs in one über-Chunk when the host asks for settings to save with song...

Or am I totally wrong here?

Cheers,

;) Urs

Post

No, no Über-Chunks... würg... doesn't matter much anyway.
To my knowledge, even the Über-Chunk would be overwritten as I don't manage to keep SX from calling setProgram (). The sequence seems to be a) setChunk (), b) setProgram ().
I could ignore setProgram () completely but thereby would sacrifice program seletion via the inspector etc..
Sascha Eversmeier
drummer of The Board
software dev in the studio-speaker biz | former plugin creator [u-he, samplitude & digitalfishphones]

Post

Well, no...

you get an überChunk with *all* Programs. Danach called der host setPogram, um die richtige sub-Chunk auszuwählen... ist eigentlich alles ganz richtig...

At least, I think so...

;) Urs

Post

Yes.
What's wrong with that behaviour?

It's exactly as intented. Otherwise it would'nt work as intended (for the majority of developers).

BTW: It's on you, what you do on setParameter(), so it is obviously your mistake, if the chunk data is wrongly overwritten.

Post

Problem is with my case:
- a chunk refers to data in memory. The plug's last state is saved with the song, regardless of programs and such. I want the host to not think here, I just pass data and he stores it.
- a program refers to data on the disk. The plug performs a file collection upon instanciating and setProgram switches them.
- When I load back a project, my thinking is to perform the collection first (which I trigger anyway) and then allow the host to send me back the chunk of data. I don't want to switch programs, I just want my data back. Saving *all* data doesn't work here because - as said - my chunk is the 'current state'. It's none of the host's business what's in there. That's why I think 'isPreset' doesn't apply either.

Could it be that I'm interpreting Steinis way of 'chunks' the wrong way? Not all hosts seem to call the same sequence here...

Sascha

Post

sascha wrote:Cubase calls setProgram () after setChunk (). So my worthy chunk data bites the dust.
According to my limited understanding of things, setProgram() shouldn't change the contents of any program - just select which program is currently active.
Image
Don't do it my way.

Post

sascha wrote:my chunk is the 'current state'. It's none of the host's business what's in there.
Switch to Mac and do AU :hihi:

;) Urs

Post

I think unless you can have all setting information for each program stored in memory, the only solution for you is going to 1 Program in total. VST isn't exactly sharp when it comes to dynamic program lists, i.e. based upon the content of a directory... :-|

However, you can also detect the situation (setProgram() upon song loaded) by measuring the time that elapses from instatiation of the plugin and call to setProgram. If it's less than say half a second, it should be a new song. If it's longer, then it's most likely a program set by user interaction.

Cheers,

;) Urs

Post

Russel, of course setProgram does nothing much by design. But I use it in the same way as a midi prg change. Only problem is that such a prg pool is stored on the disk while the 'current prg' I got from the chunk is in memory. The only solution with this would be to suck everything in from the disk plus the current state on getChunk () and send that 'end-monster supersized' chunk for the host to swallow. But I'm not keen on that.
Urs wrote:I think unless you can have all setting information for each program stored in memory, the only solution for you is going to 1 Program in total.
I don't want to... ;)
Urs wrote:However, you can also detect the situation (setProgram() upon song loaded) by measuring the time that elapses from instatiation of the plugin and call to setProgram. If it's less than say half a second, it should be a new song. If it's longer, then it's most likely a program set by user interaction.
Thought of a similar thing. But I'd consider the timing thing pretty diffuse and unpredictable.
I just testet if it helps to only react on a 2nd setProgram () if a chunk was just sent. If no chunk exists, I react to the first call. Seems to work, though I'm not sure this is correct under all circumstances...

Urs, no need to tease with AU... Flitzpiepe... it's not an outside-world project, I was just hacking in a helper tool for my singer who knows nothing but Cubase PC ;)

Post

sascha wrote:Russel, of course setProgram does nothing much by design. But I use it in the same way as a midi prg change. Only problem is that such a prg pool is stored on the disk while the 'current prg' I got from the chunk is in memory.
Then I fear you're going to be at the mercy of the variations among different hosts.
Image
Don't do it my way.

Post

Borogove wrote: Then I fear you're going to be at the mercy of the variations among different hosts.
Yeah, of course. But it's a custom project, so I don't mind :)

Post Reply

Return to “DSP and Plugin Development”