Author Topic: BASS_WADSP problems  (Read 4536 times)

3delite

  • Posts: 903
BASS_WADSP problems
« on: 29 Mar '07 - 15:18 »
Hi!

Having some problems with BASS_WADSP.

Code: [Select]
    Set8087CW($133F);
    BASS_WADSP_Start(Plugin.WinAMPDSPs[WADSPIndex].Handle, WADSPModule, Streams.Index[Index].Channel);
    //Application.ProcessMessages;
    Sleep(200);

Trying to use two WinAMP DSP plugins at the same time (copied it renamed and loaded), and BASS_WADSP_Start() locks the whole application for the second time.
Only tried Enhancer 0.17 thus this is the only WinAMP DSP I use, really don't have sense if it doesn't work.
Tried to solve it with Sleep() with no luck, couldn't try Application.ProcessMessages() as it interferes with the app. code.
The application does continue the playback with two WinAMP DSPs I think.

Could it be something like the plugin is meant to work in single process space, or WinAMP DSP is not optimized for multiple WinAMP DSP copies of the same type? I am suspicious about massage processing as it locks the window's interaction with the mouse.

Any ideas?

Best regards
3delite


radio42

  • Posts: 4576
Re: BASS_WADSP problems
« Reply #1 on: 29 Mar '07 - 17:46 »
Have you tired placing the two Enhancer DSPs in two different directories?

The Enhancer creates a sub-dir called "Enhancer" underneath it's start directory by itself.
So in order to run this plug-in two times, you need to place them in two different sub-directories, so that the two instances can create individual sub-directories by it's own.

E.g.:
\your exe dir
    \plugInA
        dsp_enh.dll
        \Enhancer
        ...
    \plugInB
        dsp_enh.dll
        \Enhancer

In that case you need to make sure to load the two Winamp DSP instances from the two different directories "pluginA" and "pluginB".

3delite

  • Posts: 903
Re: BASS_WADSP problems
« Reply #2 on: 30 Mar '07 - 16:28 »
They are in different directories, the code copies the new .dll to the Temp folder and is loaded from there.

So it works ok there? That would be good news. :)

radio42

  • Posts: 4576
Re: BASS_WADSP problems
« Reply #3 on: 30 Mar '07 - 18:52 »
Yes, here it works fine...I tried it with the provided WinampDSP sample.

3delite

  • Posts: 903
Re: BASS_WADSP problems
« Reply #4 on: 2 Apr '07 - 13:01 »
Did a quick test and seems working.

3delite

  • Posts: 903
Re: BASS_WADSP problems
« Reply #5 on: 2 Apr '07 - 14:40 »
After some modification, it locks still.
It seems returning from BASS_WADSP_Start() but the application doesn't receive mouse clicks for example, but does receive inputs like mouse over, hints, etc.
Log

No ideas.

Best regards
3delite

3delite

  • Posts: 903
Re: BASS_WADSP problems
« Reply #6 on: 2 Apr '07 - 14:49 »
Check Enhancer when no Stream is selected, use crossfade (>10sec) that will require two WinAMP DSPs, and it locks here after starting the second song.

MP3 Stream Editor 3.3.3.1524 Beta Developer.zip
Copy to over: MP3 Stream Editor 3.3.3 Setup.exe
Sources: MP3 Stream Editor 3.3.3.1524 Beta Developer source.zip

Best regards
3delite
« Last Edit: 2 Apr '07 - 15:08 by 3delite »

radio42

  • Posts: 4576
Re: BASS_WADSP problems
« Reply #7 on: 2 Apr '07 - 16:36 »
So did it only lock in your application when you are doing any crossfades?
Or does it also lock in your 'small' test application?

I guess it must have something to do with other parts of your code...

Unfortunately I am not a Delphi guy, so I can not make much use of your source code provided, since I don't even have a Delphi development environment.

But as said: I tested it with a small demo app (like you did as well) and in there it was working well (for you and me) - right?!

3delite

  • Posts: 903
Re: BASS_WADSP problems
« Reply #8 on: 7 Apr '07 - 10:35 »
As you said, it works here too with the modified tutorial example, but doesn't work with (locks) the project I am woring on.

Does BASS_WADSP handle the messages in a special way or something?

This modified tutorial works:

Code: [Select]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Bass, bass_wadsp, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    OpenDialog: TOpenDialog;
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

_streamA, Stream2: Integer;
_dspPluginA, hDsp, _dspPluginB: Integer;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
    // at startup of your application call this...
    if BASS_Init(-1, 44100, 0, 0, nil) then begin

        // init bass_dsp with your applications main window handle
        BASS_WADSP_Init( Handle );
    end;

    // and load a Winamp DSP plugin
    _dspPluginA := BASS_WADSP_Load(PChar('dsp_enh.dll'), 5, 5, 100, 100, nil);
    // and start it's first module (0)
    BASS_WADSP_Start(_dspPluginA, 0, 0);

    BASS_WADSP_Config(_dspPluginA);

    if OpenDialog.Execute then begin
        // create the stream
        _streamA := BASS_StreamCreateFile(False, PChar(OpenDialog.FileName), 0, 0, BASS_STREAM_AUTOFREE);
        if _streamA <> 0  then begin
            // the next will setup a DSP on the channel - like a normal Bass DSP
            hDsp := BASS_WADSP_ChannelSetDSP(_dspPluginA, _streamA, 1);
            //showmessage(IntToStr(hDSP));
            // and finally start playing it...
            BASS_ChannelPlay(_streamA, false);
        end;
    end;

    if OpenDialog.Execute then begin
        // create the stream
        Stream2 := BASS_StreamCreateFile(False, PChar(OpenDialog.FileName), 0, 0, BASS_STREAM_AUTOFREE);
        if Stream2 <> 0 then begin
            // the next will setup a DSP on the channel - like a normal Bass DSP
            hDsp := BASS_WADSP_ChannelSetDSP(_dspPluginA, Stream2, 1);
            //showmessage(IntToStr(hDSP));
            // and finally start playing it...
            BASS_ChannelPlay(Stream2, false);
        end;
    end;

end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
// when you exit your application call
    BASS_Stop();
  // needed in a catch, since some Winamp dsps might raise an exception when closing
    BASS_WADSP_Free();
    BASS_Free();
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
    BASS_WADSP_Config(2);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin

    // and load a Winamp DSP plugin
    _dspPluginB := BASS_WADSP_Load(PChar('E2/dsp_enh2.dll'), 5, 5, 100, 100, nil);
    // and start it's first module (0)
    BASS_WADSP_Start(_dspPluginB, 0, 0);

    BASS_WADSP_Config(_dspPluginB);

    hDsp := BASS_WADSP_ChannelSetDSP(_dspPluginB, Stream2, 0);

    showmessage(IntToStr(hDsp));
end;

end.
« Last Edit: 7 Apr '07 - 12:33 by 3delite »

3delite

  • Posts: 903
Re: BASS_WADSP problems
« Reply #9 on: 14 Apr '07 - 11:14 »
Didn't come up with any solutions.

radio42

  • Posts: 4576
Re: BASS_WADSP problems
« Reply #10 on: 22 Apr '07 - 23:15 »
I am really not a delphy guy - so my tests here simply work fine.
So I am affraid I am not much able to help out - even if I would like to...