Delphi & Multi Bass

Started by DanaPaul, 18 May '03 - 23:25

DanaPaul

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...
( 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

#1
@ 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

DanaPaul


QuoteOne 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

#3
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

DanaPaul


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

This has been cleaned up in the latest upload.

QuoteBut...(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


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

#6
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




Ian @ un4seen

QuoteBassWMA 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 :)

QuoteYes, 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


QuoteFor 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 :)

QuoteYou 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

#9
@ 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


Chris

@ 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


Quotechange 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

Once more I must say Big Thanks for your great Job both (wma and the bass) instances will working perfekt !!!
Chris

DanaPaul

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

#14
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

DanaPaul


QuoteBass_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

Perfekt....
Now PitchBend,FadeIn,FadeOut will work perfekt..!!!!

Thanks
Chris

DanaPaul

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

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 :)

Quick Reply

Warning: this topic has not been posted in for at least 365 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
Shortcuts: ALT+S post or ALT+P preview