Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Multi-instance components? (Read 1418 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Multi-instance components?

First off, a disclaimer: I'm not a component developer myself, and I have little knowledge with C++ and the foobar2000 SDK. I understand standard C quite well though.

Okay, with that out of the way; there's an anonymous author who maintains an open-source decoder called viopsf. It has had an incompatibility with Zao's Waveform Seekbar for a while (waveform rendering halts playback sometimes, or vice versa) because viopsf isn't a "multi-instance component". Of course, this makes me want to try and fix that. But I can't identify anything in the code that explicitly makes it "single-instance". Can someone point out what needs to be done to make it multi-instance? I realize there may not even be a proper way to do so, because it is a time-critical decoding component after all, but I'd be grateful to get an explanation at least.

Thanks!

 

Re: Multi-instance components?

Reply #1
The issue must come from the external binaries it uses to do its job. If state is stored in global variables it will be shared by all instances of the decoder and it will instantly get corrupted when more than one thread is in use.

You should be able to workaround it by loading a different copy of the dll file in each decoder instance. Make a temporary copy of the dll with a unique name so loading the copy won't reuse the existing instance in the memory.