diff jssmix.h @ 51:36e2f910219c

A non-working implementation of floating point audio mixing.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 01 Oct 2012 03:48:21 +0300
parents 033c660c25f5
children 8725853609db
line wrap: on
line diff
--- a/jssmix.h	Mon Oct 01 03:46:10 2012 +0300
+++ b/jssmix.h	Mon Oct 01 03:48:21 2012 +0300
@@ -11,6 +11,13 @@
 #define DBG(...) do { /* stub */ } while (0)
 
 
+#ifdef JSS_MIX_FP
+#define JMIXER_ADDBUF_TYPE double
+#else
+#define JMIXER_ADDBUF_TYPE Sint32
+#endif
+
+
 // Mixing limits
 #define JVM_LIMIT_16_POS    (32767)
 #define JVM_LIMIT_16_NEG    (-32767)
@@ -40,7 +47,7 @@
     int     chVolume,       // Volume
             chPanning;      // Panning
 
-    Sint32  chPrevR, chPrevL;
+    JMIXER_ADDBUF_TYPE chPrevR, chPrevL;
 } JSSChannel;
 
 
@@ -60,7 +67,7 @@
     JSSChannel      channels[jsetNChannels];
     
     int             addBufSize;
-    Sint32         *addBuffer;
+    JMIXER_ADDBUF_TYPE *addBuffer;
 
     // Callback handling
     int             cbFreq, cbCounter;
@@ -68,9 +75,9 @@
     void            (*cbFunction)(void *, void *);
 
     // Mixing routine pointers
-    int (*jvmMixChannel_FW)(JSSMixer *, JSSChannel *, Sint32 *, const int, const Sint32);
-    int (*jvmMixChannel_BW)(JSSMixer *, JSSChannel *, Sint32 *, const int, const Sint32);
-    void (*jvmPostProcess)(Sint32 *, void *mixBuffer, int);
+    int    (*jvmMixChannel_FW)(JSSMixer *, JSSChannel *, JMIXER_ADDBUF_TYPE *, const int, const Sint32);
+    int    (*jvmMixChannel_BW)(JSSMixer *, JSSChannel *, JMIXER_ADDBUF_TYPE *, const int, const Sint32);
+    void   (*jvmPostProcess)(JMIXER_ADDBUF_TYPE *, void *, const int);
 
     // Device locking
 #ifdef JSS_SUP_THREADS