r10s / BASS_VST

BASS_VST allows the usage of VST plugins in the BASS audio library.
GNU Lesser General Public License v3.0
25 stars 8 forks source link

AccessViolationException in BASS_VST_GetInfo on a ChannelSetDSP(0...) test handle #5

Closed RainOrigami closed 2 years ago

RainOrigami commented 2 years ago

Hi

Does using GetInfo not work when testing a VST Plugin using ChannelSetDSP(0, ...)? I am getting an AccessViolationException when doing this. I need to get the plugin information before setting it up on a proper channel because I need to verify that the plugin is an effect, not an instrument.

int handle = BassVst.ChannelSetDSP(0, @"C:\Program Files\VSTPlugins\ReaPlugs\readelay-standalone.dll", BassVstDsp.Default, 0);
if (handle == 0)
    throw new Exception("Error setting DSP: " + Bass.LastError.ToString());

// Issue here:
if (!BassVst.GetInfo(handle, out BassVstInfo vstInfo)) // Access Violation Exception
    throw new Exception("Error getting info: " + Bass.LastError.ToString());

if (vstInfo.IsInstrument)
    throw new Exception("Plugin is not an effect");

if (!BassVst.ChannelRemoveDSP(0, handle))
    throw new Exception("Error removing DSP: " + Bass.LastError.ToString());

Note, I am using ManagedBass.Vst in C# however it is just a wrapper and should not be the cause of this issue. Debugging shows that handle at the point of calling GetInfo is (int)1 so it should be a valid handle. I was unable to find any information specific to this issue in the documentation so maybe I am just messing up somewhere?

RainOrigami commented 2 years ago

Never mind this, it seems to also not work when assigning the plugin to a proper channel. There must be a different issue somewhere that I am overlooking. :(