Author Topic: _ENABLE_FLOATDSP issues: any 32-bit fp dsp code?  (Read 1837 times)

materialworlds

  • Posts: 17
Any C examples of 32-bit floating-point dsp code for BASS_ChannelSetDSP() callback functions?
(or failing that - links to info on how to handle, add, muliply etc in this format)
I noticed horrible distortion after setting
  BASS_SetConfig(BASS_CONFIG_FLOATDSP, TRUE);
but then realized it must be because my code is 16-bit.
Thanks, Jonathan

PS
Another possibly slightly related issue...
The (yes latest) pre-compiled bass_fx sample dsp.exe (which uses BASS_CONFIG_FLOATDSP) causes horrible very loud distortion on my computer, but tempo.exe (which doesn't use BASS_CONFIG_FLOATDSP) sounds fine.
How can this be? I thought BASS_CONFIG_FLOATDSP only was "in software" and so wouldn't be affected by any possible sound card driver peculiarities. Unless bass_fx doesn't like my AMD Athlon 64 with 32-bit (I think) Windows XP service pack 3.



« Last Edit: 5 Jun '10 - 21:54 by materialworlds »

Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: _ENABLE_FLOATDSP issues: any 32-bit fp dsp code?
« Reply #1 on: 7 Jun '10 - 15:07 »
You can find some floating-point DSP code in the DSPTEST example. Processing floating-point sample data is actually simpler than integer, eg. you don't have to bother with clipping the result.

Regarding the distortion, are you sure it is caused be enabling the FLOATDSP option? Are you using the BASS_SAMPLE_FLOAT flag too, eg. when calling BASS_StreamCreateFile? If so, perhaps the driver is having some trouble with that; you could try adding the BASS_SAMPLE_SOFTWARE flag to it.

materialworlds

  • Posts: 17
Re: _ENABLE_FLOATDSP issues: any 32-bit fp dsp code?
« Reply #2 on: 8 Jun '10 - 18:03 »
Thanks Ian, the floating-point DSP code in the DSPTEST example was very useful for fixing my own dsp callback code (with the BASS_CONFIG_FLOATDSP option active).
So I am right (in a hard limiting routine) to use +-1 float values in place of the 16-bit integer +-32767 ?

And yes, BASS_SAMPLE_FLOAT (which I wasn't using in my own code - but did then try) does seem to upset my sound card / driver. And yes this is fixed by BASS_SAMPLE_SOFTWARE.

How much overhead (processor loading) is there is using BASS_SAMPLE_SOFTWARE? Any other disadvantages?


Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: _ENABLE_FLOATDSP issues: any 32-bit fp dsp code?
« Reply #3 on: 10 Jun '10 - 16:02 »
So I am right (in a hard limiting routine) to use +-1 float values in place of the 16-bit integer +-32767 ?

Yes.

How much overhead (processor loading) is there is using BASS_SAMPLE_SOFTWARE? Any other disadvantages?

It shouldn't result in any noticeable CPU load increase (perhaps if you have loads of sounds playing), but it is likely to increase playback latency (how long it takes for playback to start) from a few ms to around 30ms.