24 May '13 - 15:05 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Difference between BASS_CONFIG_FLOATDSP and BASS_SAMPLE_FLOAT  (Read 2120 times)
dj28
Posts: 45


« on: 12 Jul '07 - 19:22 »
Reply with quoteQuote

Hi,

What is the difference between BASS_CONFIG_FLOATDSP and BASS_SAMPLE_FLOAT, really?

If I use BASS_SAMPLE_FLOAT when creating a stream, do I need to use BASS_CONFIG_FLOATDSP also to get it in 32bit floatsamples in a DSP proc?

Or is it enough to use only BASS_CONFIG_FLOATDSP to get all the streams i create in order to get it in 32bit floatsamples?

I'm a bit confused  Tongue
Logged
radio42
Posts: 4012


« Reply #1 on: 13 Jul '07 - 09:54 »
Reply with quoteQuote

BASS_SAMPLE_FLOAT is the option for creating streams. So this option is even relevant when creating an output stream - meaning float sample data will also be send to the output device.

In addition BASS_SAMPLE_FLOAT will ensure, that any DSPPROC on that channel receives float data (so if you always use the SAMPLE_FLOAT option with your streams you don't need to worry about FLOATDSP).
So SAMPLE_FLOAT already converts the original sample data during the decoding process to float values (if needed)!
As almost all compressed formats (like MP3, OGG etc.) deliver float sample data - which in fact means , that they don't even need to be converted to float, since they are already.
So using the BASS_SAMPLE_FLOAT flag on compressed formats is even more efficient ;-)
And NOT specifying BASS_SAMPLE_FLOAT would convert the sample data to short values.
The contrary is true for e.g. WAV files. If they are originally 16-bit, they would be converted to float when using the BASS_SAMPLE_FLOAT flag.

BASS_CONFIG_FLOATDSP will 'just' ensure, that whatever you set as stream flags, any DSPPROC will always receive float sample data.
This means, that when you have NOT specified BASS_SAMPLE_FLOAT but you have set BASS_CONFIG_FLOATDSP, that e.g. the output device will receive 16-bit sample data - while any internal DSPs receive the data as float values.

As you can see, depending on the original file format and these 2 flags there might be a lot of internal conversions taking place...which takes CPU power.
Example:
SAMPLE_FLOAT    FLOATDSP     Original-Format    At-DECODING    At-DSPPROC    At-Output
-------------------------------------------------------------------------------------
TRUE            TRUE         16-bit (wav)       convTo32       32-bit        32-bit
FALSE           TRUE         16-bit (wav)       nothing        convTo32*     16-bit
TRUE            TRUE         32-bit (mp3)       nothing        32-bit        32-bit
FALSE           TRUE         32-bit (mp3)       convTo16       convTo32*     16-bit
TRUE            FALSE        32-bit (mp3)       nothing        32-bit        32-bit
FALSE           FALSE        32-bit (mp3)       convTo16       16-bit        16-bit
*at the DSPPROC stage it might even be necessary to convert the sample data twice (incomming from 16 to 32-bit, outgoing back to 16-bit).

Hope this helps...
Logged
dj28
Posts: 45


« Reply #2 on: 13 Jul '07 - 13:22 »
Reply with quoteQuote

Tnx,

I think it will help...so in order to minimize the load of the CPU I should use both of them? Cause I have several DSP procedures.
Logged
radio42
Posts: 4012


« Reply #3 on: 13 Jul '07 - 13:58 »
Reply with quoteQuote

In general when using for example BASS_FX or BASSFX as DSPs then the FLOATDSP is anyhow recommended, since float DSPs have much better quality.

And if you mainly use compressed formats like MP3, OGG, WMA etc. then I would also use both flags in order to minimize CPU load. However, in such case your output will be 32-bit as well (depending what you use on the output side - for example you might also use a BASSmix stream on the output side ;-)

But in short my answer would be yes ;-)
Logged
Ian @ un4seen
Administrator
Posts: 15270


« Reply #4 on: 14 Jul '07 - 15:29 »
Reply with quoteQuote

I think it will help...so in order to minimize the load of the CPU I should use both of them? Cause I have several DSP procedures.

If you use the BASS_SAMPLE_FLOAT flag, then the FLOATDSP option has no effect, as the sample data will already be floating-point Smiley

Also note that the number of DSP procedures will not affect the amount of processing required by the FLOATDSP option. The data will be converted to floating-point, then fed to all the DSP/FX, and then converted back to the channel's format.
Logged
dj28
Posts: 45


« Reply #5 on: 14 Jul '07 - 16:26 »
Reply with quoteQuote

Oh...

Now I'm even more confused  Shocked
So the FLOATDSP option and BASS_SAMPLE_FLOAT flag does the same thing when it comes to giving the DSP procedures in 32bit floats?

So the table that radio42 showed is not accurate? Pls clear this out for me cause I don't want to be confused  Grin
Logged
radio42
Posts: 4012


« Reply #6 on: 14 Jul '07 - 17:26 »
Reply with quoteQuote

The table is correct   - I hope ;-)

It it just a question where the convertion takes place.
And as you can see in my table, that whenever the SAMPLE_FLOAT option is used (TRUE) the conversion (if needed) already takes place at the decoding stage. And when deeling with compressed formats no conversion is needed at all.
Logged
Ian @ un4seen
Administrator
Posts: 15270


« Reply #7 on: 14 Jul '07 - 17:38 »
Reply with quoteQuote

So the FLOATDSP option and BASS_SAMPLE_FLOAT flag does the same thing when it comes to giving the DSP procedures in 32bit floats?

Yes, both will result in the DSP receiving floating-point data.

So the table that radio42 showed is not accurate? Pls clear this out for me cause I don't want to be confused  Grin

Bernd's table includes the format of the source data, eg. a 16-bit WAV file or an MP3 file (which is decoded in floating-point). If you play a 16-bit file and use the FLOAT flag, then BASS will convert the source 16-bit data to floating-point. Likewise, if you play a floating-point file without the FLOAT flag, BASS will convert the source floating-point data to 16-bit. This conversion takes place in decoding, before the data reaches the DSP stuff.

Hopefully things are a bit clearer now Smiley
Logged
dj28
Posts: 45


« Reply #8 on: 14 Jul '07 - 18:40 »
Reply with quoteQuote

Ok it's a bit clearer now. I think Tongue But why have 2 different flags doing the same stuff? Is BASS_CONFIG_FLOATDSP flag for the lazy ones that don't want to set BASS_SAMPLE_FLOAT for every stream they create?
Logged
radio42
Posts: 4012


« Reply #9 on: 15 Jul '07 - 10:47 »
Reply with quoteQuote

No - it's not for the lazy once. And the flags are not doing the same thing.
E.g. if you want the output to be 16-bit then you must use the FLOATDSP flag but NOT the SAMPLE_FLOAT flag!
Logged
dj28
Posts: 45


« Reply #10 on: 16 Jul '07 - 12:53 »
Reply with quoteQuote

No - it's not for the lazy once. And the flags are not doing the same thing.
E.g. if you want the output to be 16-bit then you must use the FLOATDSP flag but NOT the SAMPLE_FLOAT flag!


This is weird....Ian says they both do the same thing and you say they doesn't.
Since Ian is the one doing BASS I think I have to stick to what he says. No hard feelings Smiley
Logged
radio42
Posts: 4012


« Reply #11 on: 16 Jul '07 - 13:04 »
Reply with quoteQuote

No hard feelings - but Ian never said, that they do exactly the same thing!
He only said: they are doing the same thing when it comes to the DSP stage.
Quote from: Ian
If you use the BASS_SAMPLE_FLOAT flag, then the FLOATDSP option has no effect, as the sample data will already be floating-point
And I also never said something different ;-)

Pls read the posts from the beginning til the end...may be then you'll grasp what the difference between the two flags is...and since there are 2 flags...they must be there for something different :-)

But to make it short: if you are simply interested in the DSPPROC stuff, then yes: it does not matter which flag you use - both ensure that you'll receive flat sample data.

Second: DSPPROC is not the only place where 16-bit or 32-bit sample data is used! Take a look to the OUTPUT side of the world! The FLOATDSP flag ONLY controls the DSPPROC stage - but the SAMPLE_FLOAT flag also effects the output send to the soundcard!
« Last Edit: 16 Jul '07 - 13:09 by radio42 » Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines