diff src/audacious/plugin.h @ 4240:29c8603a877a

added FMT_FIXED32, an equivalent of mad_fixed_t, already supported by libSAD; some endianness-related changes
author Eugene Zagidullin <e.asphyx@gmail.com>
date Mon, 04 Feb 2008 01:30:53 +0300
parents 8f6956130372
children 8157686b8115
line wrap: on
line diff
--- a/src/audacious/plugin.h	Sun Feb 03 19:02:04 2008 +0300
+++ b/src/audacious/plugin.h	Mon Feb 04 01:30:53 2008 +0300
@@ -86,8 +86,32 @@
     FMT_S32_NE,
 
     FMT_FLOAT,
+    FMT_FIXED32, /* equivalent of libmad's mad_fixed_t explained below */
 } AFormat;
 
+/* From mad.h:
+ *
+ * Fixed-point format: 0xABBBBBBB
+ * A == whole part      (sign + 3 bits)
+ * B == fractional part (28 bits)
+ *
+ * Values are signed two's complement, so the effective range is:
+ * 0x80000000 to 0x7fffffff
+ *       -8.0 to +7.9999999962747097015380859375
+ *
+ * The smallest representable value is:
+ * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
+ *
+ * 28 bits of fractional accuracy represent about
+ * 8.6 digits of decimal accuracy.
+ *
+ * Fixed-point numbers can be added or subtracted as normal
+ * integers, but multiplication requires shifting the 64-bit result
+ * from 56 fractional bits back to 28 (and rounding.)
+ */
+
+#define __AUDACIOUS_ASSUMED_MAD_F_FRACBITS__ 28 /* useful for build time check for plugins linked against libmad, i.e. madplug */
+
 typedef enum {
     INPUT_VIS_ANALYZER,
     INPUT_VIS_SCOPE,