Author Topic: Dynamic Bass  (Read 5673 times)

DanaPaul

  • Posts: 335
Dynamic Bass
« on: 22 May '03 - 10:38 »
My understanding of FreeLibrary (dynamic binding) is that the Operating System will physically unload the module sometime, later, when it feels like it, and/or when the O/S needs to free usable memory space.

Regarding single instance Bass exclusively and a 640 MB RAM system...

The problem that I'm having with BassCD and BassWMA is that if I use BassCD to populate a list box with available CD drives in my OnShow form event, unload BassCD and Bass, and then load Bass and BassWMA and try to do anything with BassWMA it (BassWMA) will just sit there.  No error conditions returned trying to create a stream!

If I remove all usage of BassCD the BassWMA module will behave as expected.

Am I missing something, or is this the way that it has to be?
« Last Edit: 22 May '03 - 11:05 by DanaPaul »

fredvs

  • Posts: 325
Re: Dynamic Bass
« Reply #1 on: 22 May '03 - 13:18 »
Hi

I have the same problem. For example , even with your bass header, it is impossible to copy bass.dll in bass2.dll cause in your "uses" you have to put bass.pas and bass2.pas, and at the "form create", it look at bass2.dll before that i have copy it. That meen that bass2.dll must be loaded before bass init (or your loaddll), then i got a error message, "bass2.dll is missing", and i dont have find a way to copy it before, must i have to write 2 apps, the first who dont use bass and who will copy bass.dll in bass2.dll, close it and then load the app who use bass.dll ?

DanaPaul

  • Posts: 335
Re: Dynamic Bass
« Reply #2 on: 22 May '03 - 14:04 »

These are multiple instance questions that are addressed in the multiple instance header file.

Quote

at the "form create", it look at bass2.dll before that i have copy it.

FileCopy(bass.dll, bass2.dll);
LoadBassDll
LoadBass2Dll
Quote

That meen that bass2.dll must be loaded before bass init (or your loaddll),

Yes.
Quote

then i got a error message, "bass2.dll is missing", and i dont have find a way to copy it before, must i have to write 2 apps, the first who dont use bass and who will copy bass.dll in bass2.dll, close it and then load the app who use bass.dll ?

No.

fredvs

  • Posts: 325
Re: Dynamic Bass
« Reply #3 on: 22 May '03 - 14:16 »
Hi
I if i do, a the first line of form.create :

Quote
FileCopy(bass.dll, bass2.dll);
LoadBassDll;
LoadBass2Dll;


It does not work : "Missing bass2.dll" and bass2.dll was NOT copy. Even if i do, for a single bass :

Quote
FileCopy(c:\temp\bass.dll, bass.dll);
LoadBassDll;


I receive "Missing bass.dll and bass.dll was not copied.
« Last Edit: 22 May '03 - 14:24 by fredvs »

DanaPaul

  • Posts: 335
Re: Dynamic Bass
« Reply #4 on: 22 May '03 - 14:25 »
Fred,

Support for multiple Bass instances using the single instance header file is tempting, but time consuming considering the fact that the multiple instance header file fully supports multiple instances.

Quote

It does not work : "Missing bass2.dll" and bass2.dll was NOT copy.


The Delphi help files have a wealth of information regarding files, copy and delete.  Look for "ExpandFileName" :)

fredvs

  • Posts: 325
Re: Dynamic Bass
« Reply #5 on: 22 May '03 - 14:31 »
Hi
Quote
Look for "ExpandFileName"


Thanks but i know that.

Have you try, with a simple instance ?
Quote
FileCopy(c:\temp\bass.dll, bass.dll);
LoadBassDll;


It does not work because delphi look at bass.dll before to copy it.

DanaPaul

  • Posts: 335
Re: Dynamic Bass
« Reply #6 on: 22 May '03 - 14:38 »

Quote

It does not work because delphi look at bass.dll before to copy it.


Ahhhh, now we get into hardware :)

You probably have "Write behind Cache" enabled in your Operating System options.  Yes, I have tried the header files many times, my fingers are down to stubs  ;)

Try this...

FileCopy(Blah, Blah2)
Sleep(50)
LoadBassDll

Ian @ un4seen

  • Administrator
  • Posts: 26028
Re: Dynamic Bass
« Reply #7 on: 22 May '03 - 14:52 »
Quote
The problem that I'm having with BassCD and BassWMA is that if I use BassCD to populate a list box with available CD drives in my OnShow form event, unload BassCD and Bass, and then load Bass and BassWMA and try to do anything with BassWMA it (BassWMA) will just sit there.  No error conditions returned trying to create a stream!

I'm not sure what you mean by "just sit there". Do you mean a call to BASS_WMA_StreamCreateFile never returns?

But, why are you unloading BASS, if you're then going to reload it? :)

DanaPaul

  • Posts: 335
Re: Dynamic Bass
« Reply #8 on: 22 May '03 - 14:57 »

Quote

I'm not sure what you mean by "just sit there". Do you mean a call to BASS_WMA_StreamCreateFile never returns?


The call returns, but without a stream and without any error.

Quote

But, why are you unloading BASS, if you're then going to reload it? :)

Ummmm, it is reloading in response to a user event.  I'll check to see if this makes a difference, BRB :)

DanaPaul

  • Posts: 335
Re: Dynamic Bass
« Reply #9 on: 22 May '03 - 15:12 »
QQps,

Ummm, all fixed.  I had (one) more calls to load BassCD than Unload.  BassCD and BassWMA do get along. Thanks :)

fredvs

  • Posts: 325
Re: Dynamic Bass
« Reply #10 on: 22 May '03 - 23:26 »
Hi DP  :-*

Quote
Sleep(50)


:P Whouaw...

Too much, you are too much, how is it possible to be so intelligent.

Of course it works perfectly now and i finally have understand why my pc refused to copy this bass2.dll.

Thanks a lot.  :-*