Need advice for debugging plugin
-
- KVRian
- 960 posts since 27 Jun, 2009 from Germany
Hi there,
I guess it's time now to ask for some advice or help.
I am struggling for the last couple of days with debugging my new plugin (pg-8x), developed in VST-SDK 2.4 and VST-GUI 3.6.
It compiles and links without problems. It runs nicely in Herman Seib's Savihost (produces sound, reacts to parameter changes, etc.). In Seib's VstHost it does not create any sound (and does not produce any error message or crash either). Even if I run it through a debugger and specify the command line options to switch off VstHosts own error correction. Reaper plays some sound, but with strange behaviour (falling back to old note when a key is released. This does not happen in SaveHost), and when I try to run Reaper through the debugger, reaper crashes on startup, probably while trying to load my plugin, but it does not produce any usefull information. The calltree seems to be just Windows callbacks and reaper routines...
Does anybody have any ideas what to do next? Is there any good (free) host, which would be good for such debugging? Are there any other tools? Are there any typical things which could have gone wrong in my plugin, which could cause such behaviour?
Thanks a lot, and best regards,
Martin
I guess it's time now to ask for some advice or help.
I am struggling for the last couple of days with debugging my new plugin (pg-8x), developed in VST-SDK 2.4 and VST-GUI 3.6.
It compiles and links without problems. It runs nicely in Herman Seib's Savihost (produces sound, reacts to parameter changes, etc.). In Seib's VstHost it does not create any sound (and does not produce any error message or crash either). Even if I run it through a debugger and specify the command line options to switch off VstHosts own error correction. Reaper plays some sound, but with strange behaviour (falling back to old note when a key is released. This does not happen in SaveHost), and when I try to run Reaper through the debugger, reaper crashes on startup, probably while trying to load my plugin, but it does not produce any usefull information. The calltree seems to be just Windows callbacks and reaper routines...
Does anybody have any ideas what to do next? Is there any good (free) host, which would be good for such debugging? Are there any other tools? Are there any typical things which could have gone wrong in my plugin, which could cause such behaviour?
Thanks a lot, and best regards,
Martin
-
- KVRAF
- 2256 posts since 29 May, 2012
Check the number of input/output channels and processing precision (32/64 bit).martin_l wrote:Hi there,
Are there any typical things which could have gone wrong in my plugin, which could cause such behaviour?
~stratum~
-
- KVRian
- Topic Starter
- 960 posts since 27 Jun, 2009 from Germany
Everything is 32 bit (I am even using win32 for developing at the moment).stratum wrote:Check the number of input/output channels and processing precision (32/64 bit).martin_l wrote:Hi there,
Are there any typical things which could have gone wrong in my plugin, which could cause such behaviour?
I declare the channels as 0 input and 2 ouput channels.
Cheers,
Martin
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
Hi Martin,martin_l wrote:Everything is 32 bit (I am even using win32 for developing at the moment).stratum wrote:Check the number of input/output channels and processing precision (32/64 bit).martin_l wrote:Hi there,
Are there any typical things which could have gone wrong in my plugin, which could cause such behaviour?
I declare the channels as 0 input and 2 ouput channels.
Cheers,
Martin
Looking forward to this one!
Reaper doesn't run in the debugger at all? That's odd. Try launching Reaper first, then using the Attach to Process feature to attach the debugger to it, then load your plug-in.
Note that Reaper also keeps a plug-in database, that you might want to force a refresh on. Many hosts won't necessarily notice your plug-in has been updated unless you either remove it entirely, launch and close the host. And/or do a refresh of the plug-in database. (Hosts keep this info so they don't have to launch every plug-in every time they start to find out what channels it supports, etc.)
You'll probably want to test on Ableton and FLS too.
Also make sure you're handling the various canDos for what you do/don't support, particularly calling
canProcessReplacing()
canDoubleReplacing()
I'd really recommend handling processDoubleReplacing, even if it's just a dumb wrapper around your 32 bit code. (I do it the other way around, processDoubleReplacing is the real function, and I've written adaptors to go back to 32 bit float.)
Aside from that, put breakpoints at the entry point of your plug-in, as well as all the process(whatever) functions, resume, setParameter, getParameter setProgram, etc. Any function the host might call. Then step through until it explodes.
-
- KVRian
- Topic Starter
- 960 posts since 27 Jun, 2009 from Germany
Hi, thanks for the tips.
I think I got one step further. Attaching the debugger to reaper while running, and then rescanning the plugins, helped me identifying the problem why reaper crashed during startup. I had some memory corruption: due to a type I tried to de-allocate the same memory block twice when closing down the plugin. Fixing this solved the reaper crash.
Now, I see in reaper that I get an auto-mute whenever I play a note. Seems like something goes badly out of bounds... I just don't understand why this does not happen in savihost. Well, I guess I will start to switch off one component after the other one to see whether I can spot the culprit.
Cheers,
Martin
I think I got one step further. Attaching the debugger to reaper while running, and then rescanning the plugins, helped me identifying the problem why reaper crashed during startup. I had some memory corruption: due to a type I tried to de-allocate the same memory block twice when closing down the plugin. Fixing this solved the reaper crash.
Now, I see in reaper that I get an auto-mute whenever I play a note. Seems like something goes badly out of bounds... I just don't understand why this does not happen in savihost. Well, I guess I will start to switch off one component after the other one to see whether I can spot the culprit.
Cheers,
Martin
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
Nothing against Hermann's little hosts but I think you'll do better concentrating on the big host products. Reaper is definitely your friend.martin_l wrote:Hi, thanks for the tips.
I think I got one step further. Attaching the debugger to reaper while running, and then rescanning the plugins, helped me identifying the problem why reaper crashed during startup. I had some memory corruption: due to a type I tried to de-allocate the same memory block twice when closing down the plugin. Fixing this solved the reaper crash.
Now, I see in reaper that I get an auto-mute whenever I play a note. Seems like something goes badly out of bounds... I just don't understand why this does not happen in savihost. Well, I guess I will start to switch off one component after the other one to see whether I can spot the culprit.
Cheers,
Martin
Check out TobyBear's Minihost too. It's nice as it starts instantly and loads only one plug-in. Good for debugging instruments.
Keep going, you'll find it! And don't be afraid to walk through each and every function.
-
- KVRAF
- 1940 posts since 16 Aug, 2004 from Vienna, Austria
You might want to look into the PlugIn's Info window. If it produced a crash, and VSTHost is able to notice it, it stops the PlugIn from processing. The fact is reported in the Info window.martin_l wrote:In Seib's VstHost it does not create any sound (and does not produce any error message or crash either).
-
- KVRian
- Topic Starter
- 960 posts since 27 Jun, 2009 from Germany
Thanks very much,
I'll try that one.
Do you have any idea what might be a reason for the different behaviour in savihost and vsthost? What are the main differences between the two hosts?
Thanks,
Martin
I'll try that one.
Do you have any idea what might be a reason for the different behaviour in savihost and vsthost? What are the main differences between the two hosts?
Thanks,
Martin
arakula wrote:You might want to look into the PlugIn's Info window. If it produced a crash, and VSTHost is able to notice it, it stops the PlugIn from processing. The fact is reported in the Info window.martin_l wrote:In Seib's VstHost it does not create any sound (and does not produce any error message or crash either).
-
- KVRAF
- 1940 posts since 16 Aug, 2004 from Vienna, Austria
VSTHost is much bigger (i.e., you might hit "interesting" code and data addresses more easily if a pointer in your PlugIn is wandering off into the dark); VSTHost uses as many cores as possible for audio processing; and, of course, there's quite some difference in the routing of the audio and MIDI signals (which SAVIHost doesn't need at all).
Just a shot in the dark... in process(Replacing), do you modify the original audio frame pointers (like "outputs[0]++", for example), which would be a very bad idea?
Just a shot in the dark... in process(Replacing), do you modify the original audio frame pointers (like "outputs[0]++", for example), which would be a very bad idea?
-
- KVRian
- Topic Starter
- 960 posts since 27 Jun, 2009 from Germany
You got me scared there for a minute, as the pointers themselves are passed by reference (i.e. pointer to the pointers) into the processReplacing() function.arakula wrote: Just a shot in the dark... in process(Replacing), do you modify the original audio frame pointers (like "outputs[0]++", for example), which would be a very bad idea?
But inside, I pass them by value, i.e. myProcess(float* out1, float* out2) and I call it as myProcess(output[0], output[1]), so code as out1++ inside my plugin should not affect the pointers passed to processReplacing().
But I will investigate the info window of vsthost, when I come home tonight.
Thanks again,
Martin
-
- KVRist
- 95 posts since 25 Jul, 2007 from Finland
Slightly unrelated, but if there's Visual Studio Express users out there you have to do some tricks to access the Attach to Process feature: http://stackoverflow.com/questions/4411 ... t-possibleAdmiralQuality wrote:Try launching Reaper first, then using the Attach to Process feature to attach the debugger to it, then load your plug-in.
I debugged my plugin blindly for quite a while before I found out that attaching the debugger to another process is possible even in the Express version.
-
- KVRian
- Topic Starter
- 960 posts since 27 Jun, 2009 from Germany
Thanks for that. Right now, I am using VS 2008, but I will move to Visual Studio Express on my new Windows 7 machine for the port to 64 bit. Your link will be handy for that.mr.bungle wrote:
Slightly unrelated, but if there's Visual Studio Express users out there you have to do some tricks to access the Attach to Process feature: http://stackoverflow.com/questions/4411 ... t-possible
I debugged my plugin blindly for quite a while before I found out that attaching the debugger to another process is possible even in the Express version.
Cheers,
Martin
- KVRAF
- 8476 posts since 12 Feb, 2006 from Helsinki, Finland
I think that's just the C# version.mr.bungle wrote:Slightly unrelated, but if there's Visual Studio Express users out there you have to do some tricks to access the Attach to Process feature: http://stackoverflow.com/questions/4411 ... t-possibleAdmiralQuality wrote:Try launching Reaper first, then using the Attach to Process feature to attach the debugger to it, then load your plug-in.
IIRC even in 2010 (I'm still using MSVC2008 because 2010 IDE is just horrid), in C++ version you press ctrl-alt-P and that's it.
-
- KVRAF
- 2460 posts since 3 Oct, 2002 from SF CA USA NA Earth
This could be something like the host detecting you're outputting way too loud a signal and bypassing your plug to save your ears and speakers. Popular causes: uncontrolled feedback loops (either in feedback delays or resonant filters), bad math, out of bounds array accesses. Different hosts will have different ideas about tolerating out of range data, which could explain the different behavior in savihost vs reaper.martin_l wrote:Now, I see in reaper that I get an auto-mute whenever I play a note. Seems like something goes badly out of bounds... I just don't understand why this does not happen in savihost. Well, I guess I will start to switch off one component after the other one to see whether I can spot the culprit.
Some hosts are going to be actively hostile to debuggers, by the way, as an anti-crack measure. So if a host behaves frighteningly differently depending on whether or not there's a debugger attached, you probably need to debug in a different host.
Once you've gotten a little further along, you will want to get s(m)exoscope from Smartelectronix - this is a stunningly useful oscilloscope plugin.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
VS 2008 will compile x64. Just install it on a x64 OS and the x64 target will be offered.martin_l wrote:Thanks for that. Right now, I am using VS 2008, but I will move to Visual Studio Express on my new Windows 7 machine for the port to 64 bit. Your link will be handy for that.mr.bungle wrote:
Slightly unrelated, but if there's Visual Studio Express users out there you have to do some tricks to access the Attach to Process feature: http://stackoverflow.com/questions/4411 ... t-possible
I debugged my plugin blindly for quite a while before I found out that attaching the debugger to another process is possible even in the Express version.
Cheers,
Martin


