Author Topic: BASS_VST_EmbedEditor for macOS with Delphi 10.3.3 Rio  (Read 438 times)

victor

  • Posts: 136
while rewriting my app to macOS using Delphi 10.3.3 Rio i'm having trouble with the parameters of "BASS_VST_EmbedEditor".
What window handle do i need to pass to "BASS_VST_EmbedEditor" so that the editor window of the VST effect/instrument can be shown by macOS in 64bit on a Delphi form?

Thank you!
« Last Edit: 5 Dec '19 - 11:12 by victor »

Ian @ un4seen

  • Administrator
  • Posts: 22249
I haven't used BASS_VST with Delphi or on OSX myself, so I'm afraid I can't answer your question but perhaps looking at the BASS_VST_EmbedEditor function's source code will give you some ideas on what it wants? You can check that here:

   https://github.com/r10s/BASS_VST/blob/dc9677fd18328e770945c1df1f736db1da26b2c9/source/bass_vst_impl.cpp

victor

  • Posts: 136
thanks for the link.
On Windows BASS_VST_EmbedEditor needs the HWND of a regular form (created by Delphi).

On macOS 64-bit it needs to be a contentView of a cacaoWindow.
I made a small test app, that only loads the VST instrument and tries to display the editor window
Unfortunatelly on the first attempt to load it shows an empty editor window.
Only on the second atempt of load, embedEditor and show the editor is shown and is responsive ...  :(
« Last Edit: 13 Dec '19 - 03:00 by victor »

victor

  • Posts: 136
i found the solution by accident: it appears that with Delphi, the form that the VST plugin editor will be displayed on needs to be already visible at the moment BASS_VST_EmbedEditor links the editor to it.

Btw. is there any updated bass_vst.pas?
« Last Edit: 13 Dec '19 - 21:21 by victor »

Ian @ un4seen

  • Administrator
  • Posts: 22249
Good to see that you have found a solution. And thanks for posting it, in case anybody else has the same problem.

Regarding bass_vst.pas, I don't think there is one currently, at least not in the BASS_VST package. Where did you get it from?

please

  • Guest
Code: [Select]
Unit Bass_VST;

interface

uses
  Windows;


const
  BASS_VST_PARAM_CHANGED = 1;
  BASS_VST_EDITOR_RESIZED = 2;
  BASS_VST_AUDIO_MASTER = 3;

  BASS_VST_ERROR_NOINPUTS     = 3000;// the given effect has no inputs and is probably a VST instrument and no effect
  BASS_VST_ERROR_NOOUTPUTS    = 3001; // the given effect has no outputs
  BASS_VST_ERROR_NOREALTIME   = 3002; // the given effect does not support realtime processing


type

BASS_VST_PARAM_INFO = record
    name :  array [0..15] of Char;         // examples: Time, Gain, RoomType
    FUnit : array [0..15] of Char;         // examples: sec, dB, type
    Display : array [0..15] of Char;         // the current value in a readable format, examples: 0.5, -3, PLATE
    defaultValue : single;                 // the default value
    rsvd : array [0..255] of Char;
end;

BASS_VST_INFO = record
    ChannelHandle : DWORD;                 // the channelHandle as given to BASS_VST_ChannelSetDSP()
    uniqueID :DWORD;                       // a unique ID for the effect (the IDs are registered at Steinberg)
    effectName : array [0..79] of Char;    // the effect name
    effectVersion : DWORD;                 // the effect version
    effectVstVersion : DWORD;              // the VST version, the effect was written for
    hostVstVersion : DWORD;                // the VST version supported by BASS_VST, currently 2.4
    productName : array [0..79] of Char;   // the product name, may be empty
    vendorName: array [0..79] of Char;     // the vendor name, may be empty
    vendorVersion : DWORD;                 // vendor-specific version number
    chansIn : DWORD;                       // max. number of possible input channels
    chansOut : DWORD;                      // max. number of possible output channels
    initialDelay : DWORD;                  // for algorithms which need input in the first place, in milliseconds
    hasEditor : DWORD;                     // can the BASS_VST_EmbedEditor() function be called?
    editorWidth : DWORD;                   // initial/current width of the editor, also note BASS_VST_EDITOR_RESIZED
    editorHeight : DWORD;                  // initial/current height of the editor, also note BASS_VST_EDITOR_RESIZED
    aeffect : Pointer;                     // the underlying AEffect object (see the VST SDK)
    rsvd: array [0..255] of Char;
end;



VSTPROC = procedure (vstHandle : DWORD;Action : DWORD;Param1,Param2,User : DWORD);stdcall;

const BASS_VSTDLL = 'bass_vst.dll';

function BASS_VST_ChannelSetDSP (Channel : DWORD;const DLLFile : PChar;flags: DWORD; priority:Integer): DWORD;stdcall;external BASS_VSTDLL;
function BASS_VST_ChannelRemoveDSP(Channel : DWORD;vstHandle : DWORD): Bool;stdcall;external BASS_VSTDLL;

 function BASS_VST_EmbedEditor(Channel : DWORD;ParentWindow : hwnd): Bool;stdcall;external BASS_VSTDLL;

function BASS_VST_GetInfo(VSTHandle : DWORD;pInfo: Pointer):Bool;stdcall;external BASS_VSTDLL;
function BASS_VST_GetParam(vstHandle : DWORD;paramIndex : integer): single;stdcall;external BASS_VSTDLL;
function BASS_VST_SetParam(vstHandle : DWORD;paramIndex : integer;value : single): Bool;stdcall;external BASS_VSTDLL;
function BASS_VST_GetParamCount(vstHandle : DWORD) : integer;stdcall;external BASS_VSTDLL;
function BASS_VST_GetParamInfo(vstHandle : DWORD;paramIndex : Integer;var Info : BASS_VST_PARAM_INFO): boolean;stdcall;external BASS_VSTDLL;
function BASS_VST_Resume(vstHandle : DWORD):Bool;stdcall;external BASS_VSTDLL;
function BASS_VST_SetCallback(vstHandle : DWORD; PROC : Pointer; user : DWORD):Bool;stdcall;external BASS_VSTDLL;
function BASS_VST_SetLanguage(const Lang : PChar):Bool;stdcall;external BASS_VSTDLL;
function BASS_VST_SetBypass(vstHandle : DWORD; state:boolean):bool;stdcall;external BASS_VSTDLL;
function BASS_VST_GetBypass(vstHandle : DWORD):dword;stdcall;external BASS_VSTDLL;

implementation

end.

i hope that works and all function implement.


Ian @ un4seen

  • Administrator
  • Posts: 22249
Thanks for that. It looks like there are some things missing though. Perhaps it's based on an older version of BASS_VST?

please

  • Guest
Thanks for that. It looks like there are some things missing though. Perhaps it's based on an older version of BASS_VST?

https://codes-sources.commentcamarche.net/forum/affich-1321573-liberer-les-ressources-object