BASS_Init effects all streams

Started by suathd,

suathd

I want to play two different ??? ogg files from 2 different soundcard. This is necessary for previewing the music from 2nd sound card while 1st soundcard plays another file.

Since the DeviceId parameter can be set just in the BASS_Init function, It seems to be imposibble for doing this with single instance of a BASS library.

Is there any way of doing this ?

Chris

#1
if you are developing in delphi I suggest you will try the
Delphi multi-instance Header from Dana Paul...
You will find the Link here http://members.aol.com/wtgdana/private/Bass/...
Greets Chris

suathd

Yes,
This is a solution.  ??? But I already know the file BASS_18.pas (multi-instance header of BASS library).

In my original mail, I express that "doing this with a single instance of BASS.DLL".

Because, it is not sensible that loading more than 1 BASS.DLL for such an operation. There must be another way of doing this with 1 BASS.DLL

Thanks for your interest, my friend ...

bigjim

Nope theres no internal way at the minute as far as i know to use multiple sound cards without using multiple bass.dll instances- unless you wish to output to different speakers on the same flag then you can use the BASS_SPEAKER flags.

However you must have noticed how small and efficient bass.dll is and really loading a couple of instances should have no noticable effect in performance :)

Chris

#4
QuoteBut I already know the file BASS_18.pas (multi-instance header of BASS library).

Nope...The Bass_18.pas is for a singleInstance !!!!
For are MultiInstance you must take
the Bass_Two.pas

Greets
Chris

bigjim

Tell me if im totally off the mark- but what the bass_18 source does is make a copy or multiple copies of the dll to work from though wrapping it to appear theres only on dll in use as the c++ multi example does.

Chris

#6
// singleInstance
uses Bass;
BASS_Init(1, 44100, 0, AppHWND)


multiInstance
uses Bass_Two;
privat
player1 ,player2 : TBassInstance;

//// on create
player1 := hBass1;
player2 := hBass2;

BASS_Init[player1](1, 44100, 0, AppHWND);
BASS_Init[player2](2, 44100, 0, AppHWND);

and so on......
Greets Chris




suathd

Many thanks for your interest my frieds.

It seems that the only solution is using multiple instance of the BASS.DLL.

Although, BASS.DLL is 100k (compressed with an Exe compressor), it will occupy more memory after loading.
Moreover, it is not logical for repeating code blocks of the DLL (by loading it multiple times)

I would expect such a solution (or function design) from BASS developers.

hBASS1 :=BASS_Init(1, 44100, 0, MyWnd);

...

hStream1_1:= BASS_StreamCreateFile(hBASS1, False, PChar(FileName), 0
  0,0);

hStream1_2:= BASS_StreamCreateFile(hBASS1, False, PChar(FileName), 0
  0,0);

...

If Ian reads this topic, in future releases the overloaded versions of some functions may be added to library  ;)

Have a nice day ...

DanaPaul


QuoteIt seems that the only solution is using multiple instance of the BASS.DLL. ... I would expect such a solution (or function design) from BASS developers.

Nice idea. I suspect that the design you posted would require a library (Bass.dll) that is thread safe, and application thread safe code loading and accessing the library.

The current design doesn't require thread safe code.

Ian @ un4seen

It's not a threading issue (BASS should be perfectly thread-safe as it is :)). It's an internal structuring issue, and it would likely require API changes that would not be backward-compatible... it's something I'm considering for BASS 2.0

In the meantime... the total image size of BASS is about 300K, including code and initialized/uninitialized data. And, of course, the shared libraries (eg. C run-time, DSound) are still loaded just once. So loading multiple BASS instances won't have any major hit on resources :)

DanaPaul


Quoteit's something I'm considering for BASS 2.0 ... the total image size of BASS is about 300K, including code and initialized/uninitialized data ... So loading multiple BASS instances won't have any major hit on resources :)

The one and only limitation that Delphi has (as well as many other executable compilers) is that it doesn't support shared (PE) data sections.  If Bass was to implement its own multiple instance functionality would it be possible to also include inter-process communications? Such as the number of applications that have a Bass (library) instance loaded? And the number of Audio channels currently in use? etc, etc, etc...? :)

Ian @ un4seen

Support for using multiple devices would not require BASS to share memory or communicate with other instances, so I'm not sure what you mean... why would you want BASS to communicate with other processes? :)

DanaPaul


Quotewhy would you want BASS to communicate with other processes? :)

Currently, multiple instances of Bass.dll within the same process return identical (decode) channel handles for the first stream created/opened in each Bass instance (LoWord(Channel) = 1).

I thought, maybe, Bass could be more of a diagnostic or utility helper library if multiple instances of Bass across processes utilised unique channel handles and stored channel data such as frequency, bitrate, etc.