Rich Rattanni wrote:
> Claudio:
>    This morning Shane and I recompiled libvorbis and FusionSound with
> the -msoft-float option. It did not have any effect on the audio (still
> sounds distorted).  I tried using both my application and music.c to
> play audio.  (was recompiling libvorbis and FusionSound with
> -msoft-float all that was required?)
> 

I'm not expert about gcc's internals, but if float emulation is
implemented using 16.16 fixed point numbers, it doesn't work because
FusionSound requires larger integer part: internally volume is
represented as a 9.23 fixed point number, therefore the floating value
must be multiplied by 2^23 to obtain the internal value (this happens in
src/core/playback.c, fs_playback_set_volume()).
If my assumption is right, the attached patch should fix the problem.

BTW:
Right today, I have added support for using the Tremor decoder in the
vorbis music provider. Unlike libvorbis, this is an integers based
decoder, so it's optimal for embedded devices without a FPU.
Get it from xiph's svn (http://svn.xiph.org/trunk/Tremor/)


-- 
Regards,
     Claudio Ciccani

[EMAIL PROTECTED]
http://directfb.org
http://sf.net/projects/php-directfb
--- FusionSound/src/core/playback.c	2007-03-05 17:23:47.000000000 +0100
+++ /home/klan/src/FusionSound/src/core/playback.c	2007-03-05 17:48:54.000000000 +0100
@@ -280,6 +280,8 @@
                         float         left,
                         float         right )
 {
+     int l, r;
+     
      D_ASSERT( playback != NULL );
      D_ASSERT( left >= 0.0f );
      D_ASSERT( left <= 64.0f );
@@ -291,8 +293,10 @@
           return DFB_FUSION;
 
      /* Adjust volume. */
-     playback->left  = fsf_from_float( left  );
-     playback->right = fsf_from_float( right );
+     l = left * 256.f + 0.5f;
+     r = right * 256.f + 0.5f;
+     playback->left  = fsf_from_int_scaled( l, 8 );
+     playback->right = fsf_from_int_scaled( r, 8 );
 
      /* Unlock playback. */
      fusion_skirmish_dismiss( &playback->lock );
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to