VST: setProgram () overrides data retrieved via setChunk ()
-
- KVRian
- Topic Starter
- 1115 posts since 2 Oct, 2001 from Berlin, Germany
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
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]
drummer of The Board
software dev in the studio-speaker biz | former plugin creator [u-he, samplitude & digitalfishphones]
- u-he
- 28063 posts since 8 Aug, 2002 from Berlin
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
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
-
- KVRian
- Topic Starter
- 1115 posts since 2 Oct, 2001 from Berlin, Germany
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..
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]
drummer of The Board
software dev in the studio-speaker biz | former plugin creator [u-he, samplitude & digitalfishphones]
- u-he
- 28063 posts since 8 Aug, 2002 from Berlin
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
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
-
- KVRian
- 1325 posts since 1 Sep, 2004
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.
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.
-
- KVRian
- Topic Starter
- 1115 posts since 2 Oct, 2001 from Berlin, Germany
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
- 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
-
- KVRAF
- 2458 posts since 3 Oct, 2002 from SF CA USA NA Earth
- u-he
- 28063 posts since 8 Aug, 2002 from Berlin
Switch to Mac and do AUsascha wrote:my chunk is the 'current state'. It's none of the host's business what's in there.
Urs
- u-he
- 28063 posts since 8 Aug, 2002 from Berlin
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
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
-
- KVRian
- Topic Starter
- 1115 posts since 2 Oct, 2001 from Berlin, Germany
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.
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
I don't want to...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.
Thought of a similar thing. But I'd consider the timing thing pretty diffuse and unpredictable.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.
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
-
- KVRAF
- 2458 posts since 3 Oct, 2002 from SF CA USA NA Earth
Then I fear you're going to be at the mercy of the variations among different hosts.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.
-
- KVRian
- Topic Starter
- 1115 posts since 2 Oct, 2001 from Berlin, Germany
Yeah, of course. But it's a custom project, so I don't mindBorogove wrote: Then I fear you're going to be at the mercy of the variations among different hosts.