Author Topic: How many streams can be inited for BASS?  (Read 10316 times)

3delite

  • Posts: 907
How many streams can be inited for BASS?
« on: 13 Mar '04 - 21:47 »
Hi!

There is an option in MP3SE (http://3delite.fly.to/MP3SE) to StreamCreate() files when opening them. I tried how far can it go and it seems like the limit is 508 streams at once. Is this correct? I mean is it a fixed maximum?  :o

Just curious...  ::)

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re:How many streams can be inited for BASS?
« Reply #1 on: 14 Mar '04 - 14:46 »
BASS doesn't have any limit, but I guess it's possible DirectSound/drivers may have (none is mentioned). I tried creating 10000 streams (BASS_StreamCreate) just now, and was successful. But remember that resources need to be allocated for each stream, so I wouldn't recommend creating hundreds/thousands of streams for no particular reason.

3delite

  • Posts: 907
Re:How many streams can be inited for BASS?
« Reply #2 on: 15 Mar '04 - 07:07 »
I tried again and I could Bass_StreamCreate() exactly 507 files. I tried with the BASS_MP3_SETPOS enabled and disabled (if its free memory dependant) but there was no difference. After the 507th stream BASS_GetErrorCode() reports BASS_ERROR_HANDLE. My previous 508 was probably a mistake and one of the files was bad. Mainly MP3 some WMA and OGG files were used for the test. After the 508th I couldn't add music modules either. :( Tryed NoSound + BASS_STREAM_DECODE but no change.  ???

It's funny that I had a similar error or bug!? I am using Delphi6 and when I switched to dynamic arrays for holding the stream infos I got Out of memory error when I incremented the array one by one. Originaly it was a static array of Word (65536 slots) and worked flawlessly. I could open around 1700 real streams (MP3 WAV OGG WMA). After using the dynamic allocation it went to only 1200 and then failed with Out of memory. As a solution it now works as allocating by 1000 when needed. Hmmm... :-\

My config is WinXP Pro 512MB RAM with SB Live! Value
Hope this helps you! You're right, it's really not needed to Bass_StreamCreate() >508 files, you just never know...  ::)

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re:How many streams can be inited for BASS?
« Reply #3 on: 15 Mar '04 - 18:00 »
After the 507th stream BASS_GetErrorCode() reports BASS_ERROR_HANDLE.

BASS_StreamCreate/File never gives that error. I guess you're checking after something like a BASS_StreamPlay call? Try checking straight after the BASS_StreamCreate/File call.

It's funny that I had a similar error or bug!? I am using Delphi6 and when I switched to dynamic arrays for holding the stream infos I got Out of memory error when I incremented the array one by one. Originaly it was a static array of Word (65536 slots) and worked flawlessly. I could open around 1700 real streams (MP3 WAV OGG WMA). After using the dynamic allocation it went to only 1200 and then failed with Out of memory. As a solution it now works as allocating by 1000 when needed. Hmmm... :-\

Maybe it's a Delphi problem then? Although, from what I've seen before, Windows doesn't seem to like a load of reallocations anyway (though, as I recall, that was Win9x only). Either way, it's probably best to (re)allocate memory in larger chunks if you're going to have that many elements in the array.

Note that you should be using 32-bit DWORDs to store handles though, not 16-bit WORDs. In fact, 16-bits won't hold a stream handle value, so I guess you didn't really use an "array of Word". Maybe that's the problem - you're allocating space for an array of WORDs, while accessing it as an array of DWORDs? :)

3delite

  • Posts: 907
Re:How many streams can be inited for BASS?
« Reply #4 on: 16 Mar '04 - 07:18 »
You're ;D right! The error reporting line was a leftover from the past when I didn't have a separate stream create function. The new one reports only if there is an error, and I only looked for the old error line in the log. :-[
So it's now BASS_ERROR_FILEOPEN.  :'( Is there a way to get more info about that?  ::)

The channel handles are stored as Cardinal, Delphi help says: unsigned 32-bit. It's must be ok... I meant array of Word (65536 slots) like: Array[Word] of TBassStreamItem; Sorry it's just me...  ;D

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re:How many streams can be inited for BASS?
« Reply #5 on: 16 Mar '04 - 15:41 »
So it's now BASS_ERROR_FILEOPEN.  :'( Is there a way to get more info about that?  ::)

That simply means BASS couldn't open the file - check the filename... if you're sure the file exists, see if you can play it in one of the precompiled examples (and any other apps).

3delite

  • Posts: 907
Re:How many streams can be inited for BASS?
« Reply #6 on: 17 Mar '04 - 06:10 »
mail  >:(

3delite

  • Posts: 907
Re:How many streams can be inited for BASS?
« Reply #7 on: 17 Mar '04 - 19:48 »
nice!  :) 2048 handles!  8)

3delite

  • Posts: 907
Re:How many streams can be inited for BASS?
« Reply #8 on: 23 Mar '04 - 16:42 »
I'm stuck with that ~500 streams. It must some DS limit as you mentioned before.
Tryed on a computer with some cheap sound card (even without WDM drivers) and got the same results (516 streams).  :'(

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re:How many streams can be inited for BASS?
« Reply #9 on: 24 Mar '04 - 17:05 »
Are you sure you're using the update I sent you? The reason for the limit was that the MSVC runtime library has a default limit of 512 file handles, but the update doesn't use the runtime library file routines, so there should not be that limit. Having said that, I wouldn't recommend creating that many streams for no reason, as I mentioned above :)

3delite

  • Posts: 907
Re:How many streams can be inited for BASS?
« Reply #10 on: 25 Mar '04 - 19:19 »
I didn't get any update! I downloaded the newest version (2.0.19) but no progress. ???

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re:How many streams can be inited for BASS?
« Reply #11 on: 26 Mar '04 - 14:55 »
hmm... I sent it twice (once as a DLL, and once in a ZIP). Maybe your ISP doesn't allow any attachments? Or your mailbox is full?

3delite

  • Posts: 907
Re:How many streams can be inited for BASS?
« Reply #12 on: 26 Mar '04 - 16:22 »
Well, my ISP has a limit on attachments (2MB/mail) and the inbox has also a limit of 5MBs. I only got that error message pic in the attachment.  :-\
Why don't you upload it to the site, so that others don't get the same problem?

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re:How many streams can be inited for BASS?
« Reply #13 on: 27 Mar '04 - 16:12 »
Can't just bung these things up without testing them a bit :)

Anyway, it seems to be ok, so it should be in the next update. In the meantime, you can get the latest DLL to try here.

3delite

  • Posts: 907
Re:How many streams can be inited for BASS?
« Reply #14 on: 27 Mar '04 - 23:52 »
Definetly not that one!  ;D
Quote
The application failed to initalize properly (0xc000001d). Click on OK to terminate the application.
Gives this error message twice. Can't even start it now...
Anyway how did you manage to shrink it to 75KB???  :o


WingZero

  • Posts: 167
Re:How many streams can be inited for BASS?
« Reply #15 on: 28 Mar '04 - 07:49 »
 You must have a bad download, or are reading it wrong, because it's 95 KB, not 75 KB.

3delite

  • Posts: 907
Re:How many streams can be inited for BASS?
« Reply #16 on: 28 Mar '04 - 09:30 »
 :-[
Thanx WingZero!
I wondered why its so small end there was no version info in the file, so I thought it's some kind of lite version ment for testing.  ::)
Now it works great! I could open all the files in my MP3 folder (1624 files) without problems!
One thing I noticed is that BASS CPU usage reports 0.2% with this many opened streams. That's nice!
Thanx Ian!  ;D