Author Topic: BASS_VST 2.4.0.6 - available for download  (Read 103291 times)

radio42

  • Posts: 4576
Re: BASS_VST 2.2.0.2 - available for download
« Reply #25 on: 2 May '06 - 22:51 »
All easy...was just a joke...not ment to be any offence.

Yes, Delphi might direclty use a HWND instead.
Like for the upcomming .Net folks I will prepare this ith an overload using an IntPtr.

C/C++ is not ment to be a type-safe language, so you can in often cases use a generic (void*) which is just a pointer to any memory address. It is up the developer then to interpret this pointer correctly.
So a void-pointer is always like a call-by-reference.

Other languages, like Delphi or in VB or C# are much more type-safe, so a call-by-reference always expects a pointer to a defined structure or class object.
But even here you can generalize things by using a generic "object" type or "IntPtr".

jensrodi

  • Posts: 39
Re: BASS_VST 2.2.0.2 - available for download
« Reply #26 on: 2 May '06 - 23:36 »
Is Delphi available for OSX? If not, I guess the Delphi API could just use "HWND" :)

Delphi does not (yet) exist for OSX, could be cool but I doubt it's gonna happen. As for Pascal on OSX, there do exist at least one compiler: FreePascal. I have never tried it, but it should be complient with all standard pascal and a lot of object pascal as well. I don't know if it could compile code that uses BASS on OSX, but I can't see why not.

All easy...was just a joke...not ment to be any offence.

No offence taken, I know you where joking :)

bpetersen

  • Posts: 70
Re: BASS_VST 2.2.0.2 - available for download
« Reply #27 on: 3 May '06 - 00:58 »
Hello together -

funny how much discussion a little HWND can create ;-) When writing the API I have not thought long about it, as the underlying VST SDK also uses just void* for both, Win and Mac, -- and I've seen a window handle as a void pointer more than once. eg. in wxWidgets.

However, in the next release (probably 2.3 if there are no bugs to fix), I use HWND instead of void* on Windows - I think this little change is not worth a new revision; if you like, you can change void* to HWND in bass_vst.h, this does not affect the DLL.

Best regards,
Bjoern

sail2000

  • Posts: 42
Re: BASS_VST 2.2.0.2 - available for download
« Reply #28 on: 4 May '06 - 09:53 »
 ???
someone can upload a example for delphi to use BASS_VST.pas?

se

  • Posts: 22
Re: BASS_VST 2.2.0.2 - available for download
« Reply #29 on: 4 May '06 - 18:03 »
From the sample Plugins:

I added one editbox (VST effect DLL path and filename), a checkbox (to assign an effect to the channel or not), a button (to show the embedded Effect form).

 
Code: [Select]
unit frmMain;

interface

uses
  Windows, Messages, SysUtils, classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, ExtCtrls, Buttons;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    ListBox1: TListBox;
    Button1: TButton;
    Label1: TLabel;
    TrackBar1: TTrackBar;
    Timer1: TTimer;
    OpenDialog1: TOpenDialog;
    VSTEdit: TEdit;
    BitBtn1: TBitBtn;
    VSTEffectCbx: TCheckBox;
    VSTEffectShowBtn: TButton;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure TrackBar1Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure VSTEffectCbxClick(Sender: TObject);
    procedure VSTEffectShowBtnClick(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Bass, Bass_vst, unit2;

var
  chan: HSTREAM;
  vstHandle : dword;

{$R *.dfm}

// display error messages
procedure Error(es: String);
begin
  MessageBox(Application.Handle, PChar(es + #13#10 + '(error code: ' + IntToStr(BASS_ErrorGetCode()) + ')'), PChar('Error'), MB_OK);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  sRec: TSearchRec;
  i: Integer;
begin
// Check that BASS 2.2 was loaded
if (BASS_GetVersion <> DWORD(MAKELONG(2,2))) then
  begin
MessageBox(0,'BASS version 2.2 was not loaded','Incorrect BASS.DLL',0);
Halt;
end;

  // initialize default output device
  if (not BASS_Init(-1,44100,0,Handle,nil)) then
  begin
    Error('Can''t initialize device');
    Halt;
  end;
  // look for plugins (in the current directory)
  i := FindFirst('bass*.dll', faAnyFile, sRec);
  while i = 0 do
  begin
    if (BASS_PluginLoad(pchar(sRec.Name)) <> 0) then // plugin loaded...
      ListBox1.Items.Add(sRec.Name);
    i := FindNext(sRec);
  end;
  FindClose(sRec);

  if (ListBox1.Items.Count = 0) then // no plugins...
  begin
    ListBox1.Items.Add('no plugins - ');
    ListBox1.Items.Add('visit the BASS');
    ListBox1.Items.Add('webpage to get some');
  end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  BASS_Free();
  BASS_PluginFree(0);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  TrackBar1.Position := Trunc(BASS_ChannelBytes2Seconds(chan,BASS_ChannelGetPosition(chan))); // update position
end;

procedure TForm1.TrackBar1Change(Sender: TObject);
begin
  // set the position
//removed because repeat the sample twice.  BASS_ChannelSetPosition(chan,BASS_ChannelSeconds2Bytes(chan,TrackBar1.Position));
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  info: BASS_CHANNELINFO;
begin
  if (not OpenDialog1.Execute) then
    Exit;

  BASS_StreamFree(chan);
  chan := BASS_StreamCreateFile(False, pchar(OpenDialog1.FileName), 0, 0, BASS_SAMPLE_LOOP);
  if (chan = 0) then
  begin // it ain't playable
    Button1.Caption := 'Click here to open a file...';
    Label1.Caption := '';
    Error('Can''t play the file');
    Exit;
  end;

  BASS_ChannelGetInfo(chan, info);
  Button1.Caption := OpenDialog1.FileName;
  Label1.Caption := 'channel type = ' + IntToHex(info.ctype, 5);
  TrackBar1.Max := Trunc(BASS_ChannelBytes2Seconds(chan, BASS_ChannelGetLength(chan)));
  BASS_ChannelPlay(chan, False);
end;

procedure TForm1.VSTEffectCbxClick(Sender: TObject);
begin
  if vsteffectCbx.checked then
    // assign a VST plugin DLL to the channel
      vstHandle := BASS_VST_ChannelSetDSP(chan, pchar(VSTEdit.text), 0, 0)
  else
    BASS_VST_ChannelRemoveDSP(Chan, vstHandle);
end;

procedure TForm1.VSTEffectShowBtnClick(Sender: TObject);
begin
  if EffectForm.visible or ((vsthandle<>0)
     and BASS_VST_EmbedEditor(vsthandle, EffectForm.handle)) then
    EffectForm.show;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  if (not OpenDialog1.Execute) then exit;
  VSTEdit.text := OpenDialog1.filename;

end;

end.


The effectForm is a simple form, used to show the GUI of the VST effect.

I'm using this modified Delphi header for Bass_vst.pas   (thks to Chris)
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.

VST effect I'm using for testing:
EQ Killer v1.1
http://www.djmarko.pwp.blueyonder.co.uk
scuzzphut@blueyonder.co.uk

I hope it's helping.

SE

__ramses

  • Guest
Re: BASS_VST 2.2.0.2 - available for download
« Reply #30 on: 4 May '06 - 20:17 »
Hi,

Some problem with the BASS_VST_EmbedEditor function.

-Can we call this function without a window handle ? (means that the plugin load himself with his window)

-When i call BASS_VST_EmbedEditor first time then close the window and call another time it did not work (the plugin interface doesn't appear)

-How can we know the size of the Window require by the plugin ?

Thanks for answer,

Philippe

victor

  • Posts: 124
Re: BASS_VST 2.2.0.2 - available for download
« Reply #31 on: 4 May '06 - 20:33 »
Hi Philippe,

here's a delphi code sniped i use

Code: [Select]
if BASS_VST_GetInfo(VSTHost1Handle, VSTPlugInfo)
   then begin
   if VSTPlugInfo.hasEditor
      then begin
      MixVST1Form.Caption := ' ' + string(VSTPlugInfo.effectName) + ' - ' + string(VSTPlugInfo.vendorName);
      if VSTPlugInfo.editorHeight = 0
         then MixVST1Form.ClientHeight := 150
         else MixVST1Form.ClientHeight := VSTPlugInfo.editorHeight;
      if VSTPlugInfo.editorWidth = 0
         then MixVST1Form.ClientWidth  := 300
         else MixVST1Form.ClientWidth  := VSTPlugInfo.editorWidth;
      if (VSTPlugInfo.editorHeight = 0) or (VSTPlugInfo.editorWidth = 0)
         then MixVST1Form.BorderStyle := bsSizeable
         else MixVST1Form.BorderStyle := bsDialog;

      if BASS_VST_EmbedEditor(VSTHost1Handle, MixVST1Form.Handle)
         then begin
         if MixVST1Form.Visible
            then MixVST1Form.BringToFront
            else MixVST1Form.Visible := true;
         end;
      end;

hope it helps.

Viktor

sail2000

  • Posts: 42
Re: BASS_VST 2.2.0.2 - available for download
« Reply #32 on: 5 May '06 - 01:09 »
SE, thanks a lot! ;D

bpetersen

  • Posts: 70
Re: BASS_VST 2.2.0.2 - available for download
« Reply #33 on: 5 May '06 - 08:27 »
Hello, some of the the questions of Philippe should already be answered by victor's code snippets, however ...

[...]Some problem with the BASS_VST_EmbedEditor function.

-Can we call this function without a window handle ? (means that the plugin load himself with his window)

No - the plugin only provides a "child window" for which the user has to provide a parent window. BASS_VST does nothing in this direction.

-When i call BASS_VST_EmbedEditor first time then close the window and call another time it did not work (the plugin interface doesn't appear)

You should "unembed" the editor before by calling BASS_VST_EmbedEditor(vstHandle, NULL); - this is required at least by some plugins.

-How can we know the size of the Window require by the plugin ?

The Delphi code is already above, for C/C++ this is

Code: [Select]
BASS_VST_INFO info;
BASS_VST_GetInfo(vstHandle, &info);
DWORD w = info.editorWidth, h = info.editorHeight;
« Last Edit: 5 May '06 - 11:07 by bpetersen »

__ramses

  • Guest
Re: BASS_VST 2.2.0.2 - available for download
« Reply #34 on: 5 May '06 - 14:56 »
Thanks it works fine know.


radio42

  • Posts: 4576
Re: BASS_VST 2.2.0.2 - available for download
« Reply #35 on: 6 May '06 - 01:01 »
Hi Björn,

one more thing regarding the embedded editor.

All works smooth, but I discovered, that when you change a parameter using the embedded editor...e.g. using the mouse and dragging some sliders, that for this time BASS stops playing the channel.
It is obviously because you do all in a DSP callback, which is a synchronious call...meaning it'll wait until your DSP callback returns.

Just wondring, if that is also the case with the embedded editor...or do you see any workaround for that...so that the user can change the embedded editor without interrupting the channel playing?

And one more thing...some VST effects have so called programs or presets to use...any chance to get and/or set them?

bpetersen

  • Posts: 70
Re: BASS_VST 2.2.0.2 - available for download
« Reply #36 on: 6 May '06 - 21:36 »
[...] I discovered, that when you change a parameter using the embedded editor...e.g. using the mouse and dragging some sliders, that for this time BASS stops playing the channel.

For my program, I use an "unchanneled" editor (by setting the channel to NULL on BASS_VST_ChannelSetDSP(), see the documentation in bass_vst.h) and everything works great. Moreover, I have just tried using the editor for effects assigned to a channel - also without problems. Maybe this happens only for some plugins?

It is obviously because you do all in a DSP callback, which is a synchronious call...meaning it'll wait until your DSP callback returns.

The editor runs in an independent thread (normally the GUI one) - this should not be the problem. When calling the get/set parameter functions, I do a little lock, that may halt the DSP thread if the plugin does really time-consuming calculations on parameter changes - but I have not seen such a plugin.

The only "special" thing I do when an editor window is opened is to poll 20 times a second for parameter changes to create the BASS_VST_PARAM_CHANGED events if needed (VST has no other mechanism for that). This may also lock the DSP thread if getParameter is really time-consuming - however, these polls should be really fast, only some plugin-getParameter calls - and, for my tests I do not found any problems or any high CPU usages.

Just wondring, if that is also the case with the embedded editor...or do you see any workaround for that...so that the user can change the embedded editor without interrupting the channel playing?

Sorry, I do not understand what you mean here.

And one more thing...some VST effects have so called programs or presets to use...any chance to get and/or set them?

Well, I decided not to create functions for this, as the program functionality has a rather dirty API in VST, eg. depending on the plugin's implementation, you cannot query the name or the settings of a preset without selecting it. Some other plugins only implement the "chunk" mechanism and so on. Moreover, most plugins do not really save the programs if the plugin is loaded again.

My suggestion is to load/save the parameters yourself from/to files and initialize the effect by some BASS_VST_SetParam() calls then.

If you really want to access the programs - most times there are only a very few different presets -, you can use the VST API directly:

Code: [Select]
#include <aeffectx.h> // you can get this file from Steinberg
BASS_VST_INFO info;
BASS_VST_GetInfo(vstHandle, &info);
AEffect* aeffect = (AEffect*)info.aeffect;

// get the number of programs - "currProgram" in the following code must be between 0 and numPrograms-1 then
int numPrograms = aeffect->numPrograms;

// get the selected program
int currProgram = aeffect->dispatcher(aeffect, effGetProgram, 0, 0, NULL, 0.0);

// get the name of the selected program
char currProgramName[kVstMaxProgNameLen+1];
aeffect->dispatcher(aeffect, effGetProgramName, 0, 0, currProgramName, 0.0);

// change the name of the selected program
aeffect->dispatcher(aeffect, effSetProgramName, 0, 0, "new name", 0.0);

// select a program
aeffect->dispatcher(aeffect, effSetProgram, 0, currProgram, NULL, 0.0);

Of course, I could add some BASS_VST_* functions for the program handling, but - again - I do not find them very useful (maybe I have not really understood its purpose?).

Bjoern
« Last Edit: 6 May '06 - 22:48 by bpetersen »

radio42

  • Posts: 4576
Re: BASS_VST 2.2.0.2 - available for download
« Reply #37 on: 7 May '06 - 17:46 »
Quote
For my program, I use an "unchanneled" editor ...
Do you mean you call "BASS_VST_ChannelSetDSP" multiple times, e.g.
- once without any channel (chan=0) and use this instance for the editor
- once with a real channel, to apply the effect
?

Quote
Maybe this happens only for some plugins?
Yepp - just tried a couple more.
So the first 3 VSTs I tested had this effect...as I tested more VSTs...the others work fine!



bpetersen

  • Posts: 70
Re: BASS_VST 2.2.0.2 - available for download
« Reply #38 on: 7 May '06 - 19:54 »
Quote
For my program, I use an "unchanneled" editor ...
Do you mean you call "BASS_VST_ChannelSetDSP" multiple times, e.g.
- once without any channel (chan=0) and use this instance for the editor
- once with a real channel, to apply the effect?

Yes, eg. for crossfadings, I use several BASS channels for playback (I do not use BASS_MIX at the moment) - each should have the same VST-effects of course.

So changes done in the VST-editor need to be applied to several channels under some circumstances -- on the other hand, if the player is stopped and no channel is available, the VST-editor should still be accessible.

In a glance, I do the following:

For "normal" playback of a stream (ch2 is the "next" stream) ...

Code: [Select]
// create the "real" channels to use
DWORD ch1 = BASS_StreamCreateFile(...);
DWORD vst1 = BASS_VST_ChannelSetDSP(ch1, "effect.dll", ...);

DWORD ch2 = BASS_StreamCreateFile(...);
DWORD vst2 = BASS_VST_ChannelSetDSP(ch2, "effect.dll", ...);

... and when the user opens the VST-editor:

Code: [Select]
// create an "unchanneled" VST-editor
DWORD vstEditor = BASS_VST_ChannelSetDSP(0, "effect.dll", ...);

// we want to be notified about parameter changes ...
BASS_VST_SetCallback(vstEditor, vstEditorCallback, 0);

// our callback
DWORD CALLBACK vstEditorCallback(DWORD vstEditor, DWORD action, DWORD param1, DWORD param2, DWORD user)
{
  if( action == BASS_VST_PARAM_CHANGED )
  {
     // the user has changed some sliders in the editor -- copy the changes to the "real" channels
     for( int i = BASS_VST_GetParamCount(vstEditor)-1; i >= 0; i-- )
     {
        BASS_VST_SetParam(vst1, i, BASS_VST_GetParam(vstEditor, i));
        BASS_VST_SetParam(vst2, i, BASS_VST_GetParam(vstEditor, i));
     }
  }
  return 0; 
}

Of course, there are some more things to do, eg. you have to initialize the parameters - but I think you'll get the idea.

Quote
Maybe this happens only for some plugins?
Yepp - just tried a couple more. So the first 3 VSTs I tested had this effect...as I tested more VSTs...the others work fine!

Maybe you can post the links to the plugins that don't work as expected? Then I can check whether the problem is on the side of BASS_VST.

Bjoern
« Last Edit: 7 May '06 - 20:51 by bpetersen »

victor

  • Posts: 124
Re: BASS_VST 2.2.0.2 - available for download
« Reply #39 on: 8 May '06 - 01:07 »
Of course, I could add some BASS_VST_* functions for the program handling, but - again - I do not find them very useful (maybe I have not really understood its purpose?).

Bjoern

i think some handling of programs (presets) would be very usefull.
Some of the presets that come with the plugins are very usefull to start with and having a describing name (like "Vocal large hall"), takes a beginner faster to a better result.
Also saving the current settings to a program (preset) for a later use is desirable.

I know that it is posible to save the settings but access to the presets would be great.

Viktor

KixAss

  • Posts: 21
Re: BASS_VST 2.2.0.2 - available for download
« Reply #40 on: 8 May '06 - 14:02 »
Is it possible to use it in .net?

I've tried to make a module for it, but it doesn't work yet. Does anyone know what i'm doing wrong?

Code: [Select]
Module modBassVST
    Const BASS_VST_PARAM_CHANGED = 1
    Const BASS_VST_EDITOR_RESIZED = 2
    Const BASS_VST_AUDIO_MASTER = 3

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


    Structure BASS_VST_PARAM_INFO
        <VBFixedString(15), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=15)> Public name() As Char
        <VBFixedString(15), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=15)> Public FUnit() As Char
        <VBFixedString(15), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=15)> Public Display() As Char
        Dim defaultValue As Single
        <VBFixedString(255), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=255)> Public rsvd() As Char
    End Structure


    Structure BASS_VST_INFO
        Dim ChannelHandle As Long
        Dim uniqueID As Long
        <VBFixedString(79), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=79)> Public effectName() As Char
        Dim effectVersion As Long
        Dim effectVstVersion As Long
        Dim hostVstVersion As Long
        <VBFixedString(79), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=79)> Public productName() As Char
        <VBFixedString(79), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=79)> Public vendorName() As Char
        Dim vendorVersion As Long
        Dim chansIn As Long
        Dim chansOut As Long
        Dim initialDelay As Long
        Dim hasEditor As Long
        Dim editorWidth As Long
        Dim editorHeight As Long
        Dim aeffect As Long ': Pointer;                     // the underlying AEffect object (see the VST SDK)
        <VBFixedString(255), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=255)> Public rsvd() As Char
    End Structure

    Public Declare Function BASS_VST_ChannelSetDSP Lib "bass_vst.dll" (ByVal chan As Integer, ByRef strFilename As String, ByVal prio As Int32) As Integer
    Public Declare Function BASS_VST_ChannelRemoveDSP Lib "bass_vst.dll" (ByVal chan As Integer, ByVal handle As Integer) As Boolean
    Public Declare Function BASS_VST_EmbedEditor Lib "bass_vst.dll" (ByVal chan As Integer, ByVal hWnd As Integer) As Boolean
    Public Declare Function BASS_VST_GetInfo Lib "bass_vst.dll" (ByVal handle As Integer, ByVal Info As BASS_VST_INFO) As Boolean
    Public Declare Function BASS_VST_GetParam Lib "bass_vst.dll" (ByVal handle As Integer, ByVal index As Integer) As Boolean
    Public Declare Function BASS_VST_SetParam Lib "bass_vst.dll" (ByVal handle As Integer, ByVal index As Integer, ByVal value As Single) As Boolean
    Public Declare Function BASS_VST_GetParamCount Lib "bass_vst.dll" (ByVal handle As Integer) As Integer
    Public Declare Function BASS_VST_GetParamInfo Lib "bass_vst.dll" (ByVal handle As Integer, ByVal index As Integer, ByVal Info As BASS_VST_PARAM_INFO) As Boolean
    Public Declare Function BASS_VST_Resume Lib "bass_vst.dll" (ByVal handle As Integer) As Boolean
    Public Declare Function BASS_VST_SetCallback Lib "bass_vst.dll" (ByVal handle As Integer, ByVal hWnd As Integer) As Boolean
    Public Declare Function BASS_VST_SetLanguage Lib "bass_vst.dll" (ByVal lang As Char) As Boolean
End Module

I'm getting the following error:

Quote
A call to PInvoke function 'Project1!Project1.modBassVST::BASS_VST_ChannelSetDSP' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
« Last Edit: 8 May '06 - 14:13 by KixAss »

radio42

  • Posts: 4576
Re: BASS_VST 2.2.0.2 - available for download
« Reply #41 on: 8 May '06 - 14:29 »
Hi Folk,

yes...the update is on its way. But I decided to include it to the forthcomming 2.3 version - which should be released very soon...so no need for an extra 2.2 upgrade then...

So the BASS.NET API will include full BASS_VST add-on support!
Plus, some more useful VST class wrappers and helpers, e.g. full access to the AEffect methods (e.g. the 'dispatcher') directly from within .Net  plus program (preset) access etc.!

So just wait a few days, until Ian releases it's 2.3 version and all is included and fully working already.

Note, that .Net version 1.1. Framework users will get a little limitation:
The AEffect class implementation and use of it's methods (e.g. the 'dispatcher') is not possible with .Net version 1.1, due to a limitation to marshal C function pointers within structs.
However .Net 2.0 user will leverage it all.


But to your VB wrapper:
In the BASS_VST_PARAM_INFO structure:
- use 16 instead of 15
- use 256 instead of 255
as the fixed string length

In your BASS_VST_INFO:
- it should be 80 instead of 79
- it should be 256 instead of 255

se

  • Posts: 22
Re: BASS_VST 2.2.0.2 - available for download
« Reply #42 on: 8 May '06 - 21:30 »
Bjoern,

any tip or idea for debugging program (on delphi5) with your library?
In fact I have some VST effect errors not very clear, and I don't know exactly where to put some debug points.
Is there any entry point where we can check what is inputed inside the VST effect ?

DO we have to use some specific flags like 32bits or 16bits for BassConfig?

Thank you for your help

bpetersen

  • Posts: 70
Re: BASS_VST 2.2.0.2 - available for download
« Reply #43 on: 9 May '06 - 13:16 »
[...]any tip or idea for debugging program (on delphi5) with your library?
In fact I have some VST effect errors not very clear, and I don't know exactly where to put some debug points. Is there any entry point where we can check what is inputed inside the VST effect ?

Well, I do not know much about Delphi and its possibilities - In C/C++ I would simply add a breakpoint before/after the "critical" function. Debugging the DSP callback itself is not possible - the only thing you can do is to add your own DSP callbacks before/after the VST callback. Again, for error reports, it would be good to know about the exact error situations and about the effects used.

DO we have to use some specific flags like 32bits or 16bits for BassConfig? [...]

No, BASS_VST finds out the channel format itself, 16bits and 32bits are supported whereas 32bit should be preferred (VST also uses at least 32bit internally). 8bit streams are not supported and are ignored silently.

bpetersen

  • Posts: 70
BASS_VST updated to 2.2.0.3
« Reply #44 on: 9 May '06 - 13:21 »
Hello,

the download link in the first post is now updated to point to the new version of BASS_VST, 2.2.0.3. I've added some functions for the VST program/preset handling and did some minor changes for some parameter/structure definitions (which, however are not incompatible to the prior version). Moreover, the BASS_ErrorGetCode() function always returns BASS_OK on success now.

For more details, please have a look at bass_vst.h

Best regards,
Bjoern

hukka

  • Posts: 77
Re: BASS_VST 2.2.0.3 - available for download
« Reply #45 on: 25 May '06 - 22:21 »
How about a BASS_VST_Process function so I could use VST effects from my BASSASIO ASIOProc?

bpetersen

  • Posts: 70
Re: BASS_VST 2.2.0.3 - available for download
« Reply #46 on: 26 May '06 - 17:34 »
How about a BASS_VST_Process function so I could use VST effects from my BASSASIO ASIOProc?

I don't know ASIO nor BASS_ASIO very well, but isn't a common combination to use normal BASS decoding channels and calling BASS_ChannelGetData() in the ASIOProc then?

hukka

  • Posts: 77
Re: BASS_VST 2.2.0.3 - available for download
« Reply #47 on: 26 May '06 - 20:05 »
I don't know ASIO nor BASS_ASIO very well, but isn't a common combination to use normal BASS decoding channels and calling BASS_ChannelGetData() in the ASIOProc then?

Oops! Sorry, slight brainfart on my side - I for some reason thought that you can't use ChannelSetDSP on a decoding channel.

hukka

  • Posts: 77
Re: BASS_VST 2.2.0.3 - available for download
« Reply #48 on: 27 May '06 - 09:46 »
Can I set multiple VSTs on a single channel?

BTW, actually a Process function would still be better suited to my case. Any change of implementing such? I'd be eternally thankful. :)

bpetersen

  • Posts: 70
Re: BASS_VST 2.2.0.3 - available for download
« Reply #49 on: 27 May '06 - 13:58 »
Can I set multiple VSTs on a single channel?

This is no problem, just keep in mind to use the correct handle for subsequent BASS_VST calls (each VST has its own handle that is returned by BASS_VST_ChannelSetDSP()).

BTW, actually a Process function would still be better suited to my case. Any change of implementing such? I'd be eternally thankful. :)

Actually, there are no plans in this direction as a simple BASS_VST_Process() would not be enough - the VSTs also need lots of meta-data as frequency, channels, position and so on. As all this stuff is already provided by the channels I only see lots of work but no real advantages in using VSTs independingly of channels.

Maybe a "lightweight wrap" around BASS_VST using BASS_StreamCreate() would do the job for you?

Bjoern
« Last Edit: 28 May '06 - 18:36 by bpetersen »