Author Topic: Delphi & Multi Bass  (Read 10971 times)

DanaPaul

  • Posts: 335
Delphi & Multi Bass
« on: 18 May '03 - 23:25 »
I have posted a Delphi header file that will load multiple instances of Bass.dll ver 1.8.


    Dynamically load and unload
multiple instances of Bass.Dll

ASM support for Delphi 2.0 and 3.0 64 bit return values used in Bass position and seek functions

LoadModule reference indexing supported[/list]
 The calling conventions for all procedures and functions follow the calling conventions defined in Bass original header files, with one major difference.  All functions and procedures include an array index reference...
Code: [Select]
( This is defined in the header file )
 type
   TBassInstance = (hBass1, hBass2);

( Usage might look something like... )  
 begin
   LoadBassDll(hBass1);
   BASS_Init[hBass1](idx,Freq,0,fHWND);
   BASS_Start[hBass1];
     ( ...Do sum stuff... )
   Bass_Stop[hBass1];
   Bass_Free[hBass1];
   UnloadBassDll(hBass1);
   end;





Chris

  • Posts: 2210
Re: Delphi & Multi Bass
« Reply #1 on: 19 May '03 - 04:19 »
@ DanaPaul looks very Good...
(I'm develoment with delphi 6 spack2)
i will try it today and will then send you an report)
Chris


--------Edit---------
works fantastic....
But please ..isit possible to rewrite the bass_cd and bass_wma too ??? to make it multible ??
Chris
« Last Edit: 19 May '03 - 09:11 by Chris »

DanaPaul

  • Posts: 335
Re: Delphi & Multi Bass
« Reply #2 on: 19 May '03 - 09:19 »

Quote

One Question.....the multible Instance with the same dll ??


You will need DLL's named bass.dll and bass1.dll.  If you add additional elements (instances) to the enumeration type TBassInstance = (hBass1, hBass2, hBass3, hBass4...) then you will need addititional DLL's named bass2.dll, bass3.dll, etc.  If you don't want multiple Dll files sitting on the disk then you will need to look into multi threading :)

Heads up, another update will post within hours.

Question for Ian...

BassWMA doesn't appear to be returning any error condition when initializing bass and (trying to) create a stream, however, bass and bassWMA will do neither if I use BassCD, even if BassCD is a second instance that, err... was loaded and unloaded first, am I missing something? :)

Regards...


Chris

  • Posts: 2210
Re: Delphi & Multi Bass
« Reply #3 on: 19 May '03 - 09:25 »
I have make (for testing) 2 Instances....
not bass1.dll  ...
it wants 1.dll 2.dll   it works fine without errors
But...(I'm not shure but can it be possible that the rewritten int64(assembler) is a little bit slower than the
orginal Int64 ??
But by the way Thankz for your hard working.....
Chris
« Last Edit: 19 May '03 - 09:52 by Chris »

DanaPaul

  • Posts: 335
Re: Delphi & Multi Bass
« Reply #4 on: 19 May '03 - 15:43 »

Quote

I have make (for testing) 2 Instances.... not bass1.dll  ...
it wants 1.dll 2.dll  


This has been cleaned up in the latest upload.

Quote
But...(I'm not shure but can it be possible that the rewritten int64(assembler) is a little bit slower than the orginal Int64 ??


Obsolutely.  This ASM routine for retrieving a 64 bit return value from Bass.dll is a conditional compile that should compile in projects run in Delphi 2 and 3.  Later versions of Delphi should see a direct method binding approach using INT64.

DanaPaul

  • Posts: 335
Re: Delphi & Multi Bass
« Reply #5 on: 19 May '03 - 15:56 »

Quote

@ DanaPaul looks very Good...
But please ..isit possible to rewrite the bass_cd and bass_wma too ??? to make it multible ??


Yes, but... err... how would you tell BassWMA or BassCD which bass module name to use?  We would need another function from Ian...

BassWMA.UseThisHandle(GetModuleHandle('bass2.dll'));
BassCD.UseThisHandle(GetModuleHandle('bass1.dll'));

Setting this handle could be optional, of course :)


Chris

  • Posts: 2210
Re: Delphi & Multi Bass
« Reply #6 on: 19 May '03 - 16:11 »
About that error.....
I have
3 weeks ago start to build an modification Version of the
visible TBassplayer but i go a other way....
At first i have go the way bass1.dll  bass2 dll
but then i have errors with the backcall of the wmadll
because the wmadll try to call allways to the bass.dll
So I try the way with subdir (AND THIS WILL work)
Hold on i will at this moment try something...
(I work with delphi 6)
Greets chris

if Im ready i will send it to you

-------------------------------------------------------
One Bug i have found at your modifikation....

it`s only possible to build 2 instances of Bass

of Cource i have change

TBassInstance = (hBass0,hBass1,hBass2,hBass3,hBass4,hBass5,hBass6,hBass7,hBass8,hBass9);

But only 2 Instances are posssible....

If you want you can call me at ICQ

Greets Chris



« Last Edit: 19 May '03 - 16:12 by Chris »

Ian @ un4seen

  • Administrator
  • Posts: 26028
Re: Delphi & Multi Bass
« Reply #7 on: 19 May '03 - 16:32 »
Quote
BassWMA doesn't appear to be returning any error condition when initializing bass and (trying to) create a stream, however, bass and bassWMA will do neither if I use BassCD, even if BassCD is a second instance that, err... was loaded and unloaded first, am I missing something? :)

hmm... I think I'm missing something :D

I'm not really sure what you're asking, but incase it's something to do with loading multiple instances... Note that the BASSWMA.DLL should have "wma" somewhere in it's name, and the BASS.DLL that it uses must have exactly the same name without the "wma" bit. For example, BASSWMA1.DLL + BASS1.DLL, BASS2WMA.DLL + BASS2.DLL, WMABLAH.DLL + BLAH.DLL, etc... The same thing applies to BASSCD, except "cd" replaces "wma".

If this doesn't help with what you were asking, let me know :)

Quote
Yes, but... err... how would you tell BassWMA or BassCD which bass module name to use?

See above :)


Anyway, this looks like some nice work, and very useful. I do have a suggestion though :) ... You could create temporary copies of the DLLs for the extra instances - saves having to distribute/install multiple copies of the same DLL. You can see an example of this in the MULTI.C example source.

DanaPaul

  • Posts: 335
Re: Delphi & Multi Bass
« Reply #8 on: 19 May '03 - 16:45 »

Quote

For example, BASSWMA1.DLL + BASS1.DLL, BASS2WMA.DLL + BASS2.DLL, WMABLAH.DLL + BLAH.DLL, etc... The same thing applies to BASSCD, except "cd" replaces "wma".


Yep, I missed that part :)

Quote
You could create temporary copies of the DLLs for the extra instances - saves having to distribute/install multiple copies of the same DLL. You can see an example of this in the MULTI.C example source.


Nice touch.  Point well taken, RTFM, eh? :)

Chris

  • Posts: 2210
Re: Delphi & Multi Bass
« Reply #9 on: 19 May '03 - 17:26 »
@ DanaPaul we must change the Load_BassDDL procedure / function to

function Load_BassDLL to

Load_bassDLL (hBass: TBassInstance,const dllpath : string; const dllfilename : string): boolean;

so we can put bass.dll   basswam.dll basscd.dll
in subdirs....

because the wma and cd dll`s are always serching for the bass.dll

Chris

« Last Edit: 19 May '03 - 17:38 by Chris »

Chris

  • Posts: 2210
Re: Delphi & Multi Bass
« Reply #10 on: 19 May '03 - 21:32 »
@ DanaPaul
Congratulations....I have tested the new Uploding of your Bass_two Header (99,146 kb)...Now it will work PERFEKT....
I have tested it with 3 Instances.....Without any Problems...PERFEKT !!!!!!!!!!
Chris


DanaPaul

  • Posts: 335
Re: Delphi & Multi Bass
« Reply #11 on: 19 May '03 - 22:52 »

Quote

change the Load_BassDDL procedure / function to

Load_bassDLL (hBass: TBassInstance,const dllpath : string; const dllfilename : string): boolean;


In keeping with the Bass Multiple Instance example written in C and provided with the Bass.dll suite, the library file names are (by default)... bass.dll and basswma.dll.

The new header files search for these 2 library files in the system path.  Additional instances, or copies of these libraries, are created in the Windows "Temp" folder and given a corresponding library instance suffix, bass1.dll, bassWMA1.dll, etc.  These Temp files are deleted when the application is terminated.

A BassWMA multiple instance header file has posted. A BassCD flavor will upload soon.


Chris

  • Posts: 2210
Re: Delphi & Multi Bass
« Reply #12 on: 19 May '03 - 23:30 »
Once more I must say Big Thanks for your great Job both (wma and the bass) instances will working perfekt !!!
Chris

DanaPaul

  • Posts: 335
Re: Delphi & Multi Bass
« Reply #13 on: 20 May '03 - 03:18 »
Delphi multiple instance header files for Bass.dll, BassWMA.dll, and BassCD.dll are posted...

http://members.aol.com/wtgdana/private/Bass/

Please report any bugs.

DJ, thank you for your support :)

Chris

  • Posts: 2210
Re: Delphi & Multi Bass
« Reply #14 on: 20 May '03 - 16:01 »
Hi
It looks like that there is a Problem with all
Attributes Functions...

The Rest will all work fine but if I try this...

procedure TPlayerA.FadeOut(Volume : Integer;Time : Integer);
begin
Bass_ChannelSlideAttributes[fPlayerNr](Channel,-1,Volume,-101,Time);
end;

then my application will crashed.....
Chris
« Last Edit: 20 May '03 - 16:11 by Chris »

DanaPaul

  • Posts: 335
Re: Delphi & Multi Bass
« Reply #15 on: 20 May '03 - 17:36 »

Quote

Bass_ChannelSlideAttributes[fPlayerNr](Channel,-1,Volume,-101,Time);


Nice catch!  The posted header file has been updated.

Or you can edit the header file yourself.  The following methods were missing from the GetProcPointers section

BASS_ChannelSlideAttributes
BASS_ChannelIsSliding

Chris

  • Posts: 2210
Re: Delphi & Multi Bass
« Reply #16 on: 20 May '03 - 17:59 »
Perfekt....
Now PitchBend,FadeIn,FadeOut will work perfekt..!!!!

Thanks
Chris

DanaPaul

  • Posts: 335
Re: Delphi & Multi Bass
« Reply #17 on: 22 May '03 - 07:17 »
The Bass_Two.pas multiple instance header file has been optimized (err... optimised!) and now carries the last modification date annotated in the file.

The latest modifications include ASM function binding methods for LoadBass(hInstance) speed.

No further update notifications will be posted in this forum.  However, all bugs should continue to be reported :)




DanaPaul

  • Posts: 335
Re: Delphi & Multi Bass
« Reply #18 on: 26 May '03 - 16:05 »
Just a quick heads up...

Adding more instances of Bass, BassWMA, and BassCD is as easy as adding additional elements to the following enumeration type defined in Bass_Two.pas...

TBassInstance(hBass1, hBass2, hBass3, etc...)

However, please do not redefine this enumeration type in other units or the header file will not function properly.  Instead, you may edit the existing enumeration type to your own liking...

TBassInstance(Hers, His, Mine, TheKids, CD1, CD2, DVD1, WMA1, WMA2, MP3, WAV, etc...)

I (heart) Delphi :)