Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BassVst.GetInfo does not work #52

Open
MillKaDe opened this issue Aug 31, 2018 · 1 comment
Open

BassVst.GetInfo does not work #52

MillKaDe opened this issue Aug 31, 2018 · 1 comment

Comments

@MillKaDe
Copy link

Function BassVst.GetInfo does not work.
Looks like the strings in struct BassVstInfo are not marshalled correctly.
In the unmanaged struct, the three strings are embedded directly in the struct.

This code works for me:

using SRI = System.Runtime.InteropServices;

[SRI.StructLayout (SRI.LayoutKind.Sequential)]
public struct bugfix_BassVstInfo {
  const int StrLen = 80; // 80 bytes, not 80 chars
  public int ChannelHandle, UniqueID;
  [SRI.MarshalAs (SRI.UnmanagedType.ByValTStr, SizeConst = StrLen)] public string _EffectName; // = string.Empty;
  public int EffectVersion, EffectVstVersion, HostVstVersion;
  [SRI.MarshalAs (SRI.UnmanagedType.ByValTStr, SizeConst = StrLen)] public string _ProductName; // = string.Empty;
  [SRI.MarshalAs (SRI.UnmanagedType.ByValTStr, SizeConst = StrLen)] public string _VendorName; // = string.Empty;
  public int VendorVersion, ChansIn, ChansOut, InitialDelay;
  [SRI.MarshalAs (SRI.UnmanagedType.Bool)] public bool HasEditor;
  public int EditorWidth, EditorHeight;
  public IntPtr AEffect; // = IntPtr.Zero;
  [SRI.MarshalAs (SRI.UnmanagedType.Bool)] public bool IsInstrument;
  public int DspHandle;
  public string EffectName => _EffectName ?? string.Empty;
  public string ProductName => _ProductName ?? string.Empty;
  public string VendorName => _VendorName ?? string.Empty;
  public override string ToString () => EffectName;
}

[SRI.DllImport ("bass_vst", EntryPoint = "BASS_VST_GetInfo")]
[return: SRI.MarshalAs (SRI.UnmanagedType.Bool)]
public static extern bool bugfix_BassVst_GetInfo (int vstHandle, out bugfix_BassVstInfo ret);

BassVstParamInfo seems to suffer from the same problem, but i have not tested that yet ..

@MathewSachin
Copy link
Member

I'm currently unable to test BassVst, will be happy to accept a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants