changeset 36:f3407a58e01e

Change DMFixedPoint types and appropriate JSS functions back to using signed integers, easier than trying to get unsigned sizes etc. to work properly in audio mixing.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 29 Sep 2012 20:41:36 +0300
parents fb5200deeda8
children cec910d02b26
files dmlib.h fptest.c jmix_c.h jssmix.c jssmix.h
diffstat 5 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/dmlib.h	Sat Sep 29 20:33:27 2012 +0300
+++ b/dmlib.h	Sat Sep 29 20:41:36 2012 +0300
@@ -97,15 +97,15 @@
  */
 typedef union
 {
-    Uint64 dw;
-    Uint32 w[2];
+    Sint64 dw;
+    Sint32 w[2];
 } DMFixedPoint;
 
 
 typedef union
 {
-    Uint32 dw;
-    Uint16 w[2];
+    Sint32 dw;
+    Sint16 w[2];
 } DMFixedPoint32;
 
 
--- a/fptest.c	Sat Sep 29 20:33:27 2012 +0300
+++ b/fptest.c	Sat Sep 29 20:41:36 2012 +0300
@@ -4,7 +4,7 @@
 #define FP_DW_SIZE 8
 #define FP_W0_SIZE 4
 
-void check(const char *str, DMFixedPoint v, Uint64 dw)
+void check(const char *str, DMFixedPoint v, Sint64 dw)
 {
     DMFixedPoint *q = (DMFixedPoint *) &dw;
 
--- a/jmix_c.h	Sat Sep 29 20:33:27 2012 +0300
+++ b/jmix_c.h	Sat Sep 29 20:41:36 2012 +0300
@@ -5,9 +5,9 @@
  */
 
 #ifdef JMIXER_HEADER
-int JMIXER_NAME (JSSMixer *, JSSChannel *, Sint32 *, const int, const Uint32);
+int JMIXER_NAME (JSSMixer *, JSSChannel *, Sint32 *, const int, const Sint32);
 #else
-int JMIXER_NAME (JSSMixer *mixer, JSSChannel *chn, Sint32 *addBuffer, const int mixLength, const Uint32 endPos)
+int JMIXER_NAME (JSSMixer *mixer, JSSChannel *chn, Sint32 *addBuffer, const int mixLength, const Sint32 endPos)
 {
     const JSSVolumeTable *volTab8 = (const JSSVolumeTable *) &(mixer->volTab8);
     Sint32 *ap = addBuffer;
--- a/jssmix.c	Sat Sep 29 20:33:27 2012 +0300
+++ b/jssmix.c	Sat Sep 29 20:41:36 2012 +0300
@@ -27,8 +27,8 @@
     int    mixerID;
     int    outFormat;
     int    outChannels;
-    int    (*jvmMixChannel_FW)(JSSMixer *, JSSChannel *, Sint32 *, const int, const Uint32);
-    int    (*jvmMixChannel_BW)(JSSMixer *, JSSChannel *, Sint32 *, const int, const Uint32);
+    int    (*jvmMixChannel_FW)(JSSMixer *, JSSChannel *, Sint32 *, const int, const Sint32);
+    int    (*jvmMixChannel_BW)(JSSMixer *, JSSChannel *, Sint32 *, const int, const Sint32);
     void   (*jvmPostProcess)(Sint32 *, void *, const int);
 } JSSMixingRoutine;
 
@@ -502,8 +502,8 @@
 
 
 void jvmSetSample(JSSMixer * mixer, const int channel,
-          void *data, const Uint32 size, const Uint32 loopS,
-          const Uint32 loopE, const int flags)
+          void *data, const Sint32 size, const Sint32 loopS,
+          const Sint32 loopE, const int flags)
 {
     JSSChannel *c;
     
@@ -577,7 +577,7 @@
 }
 
 
-void jvmSetPos(JSSMixer * mixer, const int channel, const Uint32 pos)
+void jvmSetPos(JSSMixer * mixer, const int channel, const Sint32 pos)
 {
     JSS_LOCK(mixer);
     FP_SETH(mixer->channels[channel].chPos, pos);
@@ -586,9 +586,9 @@
 }
 
 
-Uint32 jvmGetPos(JSSMixer * mixer, const int channel)
+Sint32 jvmGetPos(JSSMixer * mixer, const int channel)
 {
-    Uint32 tmp;
+    Sint32 tmp;
 
     JSS_LOCK(mixer);
     tmp = FP_GETH(mixer->channels[channel].chPos);
--- a/jssmix.h	Sat Sep 29 20:33:27 2012 +0300
+++ b/jssmix.h	Sat Sep 29 20:41:36 2012 +0300
@@ -25,7 +25,7 @@
             chDeltaO;       // Delta in 32:32 UNSIGNED! (chDirection)
 
     int     chFreq;         // Frequency of sampel in Hz
-    Uint32
+    Sint32
             chSize,         // Length of sample in UNITS
             chLoopS,        // Loop start in UNITS
             chLoopE;        // Loop end in UNITS
@@ -71,8 +71,8 @@
     void            (*cbFunction)(void *, void *);
 
     // Mixing routine pointers
-    int (*jvmMixChannel_FW)(JSSMixer *, JSSChannel *, Sint32 *, const int, const Uint32);
-    int (*jvmMixChannel_BW)(JSSMixer *, JSSChannel *, Sint32 *, const int, const Uint32);
+    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);
 
     // Device locking
@@ -100,8 +100,8 @@
 int         jvmSetCallback(JSSMixer *mixer, void (*cbFunction)(void *, void *), void *cbData);
 void        jvmRemoveCallback(JSSMixer *mixer);
 int         jvmSetCallbackFreq(JSSMixer *mixer, const int cbFreq);
-Uint32      jvmGetLastCBBufPos(JSSMixer *mixer, const int cbHandle);
-Uint32      jvmGetNextCBBufPos(JSSMixer *mixer, const int cbHandle);
+Sint32      jvmGetLastCBBufPos(JSSMixer *mixer, const int cbHandle);
+Sint32      jvmGetNextCBBufPos(JSSMixer *mixer, const int cbHandle);
 
 int         jvmGetSampleSize(JSSMixer *mixer);
 int         jvmGetSampleRes(JSSMixer *mixer);
@@ -126,15 +126,15 @@
 void        jvmStop(JSSMixer *mixer, const int channel);
 
 void        jvmSetSample(JSSMixer *mixer, const int channel,
-            void *data, const Uint32 size, const Uint32 loopS,
-            const Uint32 loopE, const int flags);
+            void *data, const Sint32 size, const Sint32 loopS,
+            const Sint32 loopE, const int flags);
 
 void        jvmSetFreq(JSSMixer *mixer, const int channel, const int freq);
 int         jvmGetFreq(JSSMixer *mixer, const int channel);
 void        jvmSetVolume(JSSMixer *mixer, const int channel, const int volume);
 int         jvmGetVolume(JSSMixer *mixer, const int channel);
-void        jvmSetPos(JSSMixer *mixer, const int channel, const Uint32 pos);
-Uint32      jvmGetPos(JSSMixer *mixer, const int channel);
+void        jvmSetPos(JSSMixer *mixer, const int channel, const Sint32 pos);
+Sint32      jvmGetPos(JSSMixer *mixer, const int channel);
 
 void        jvmSetPan(JSSMixer *mixer, const int channel, const int panning);
 int         jvmGetPan(JSSMixer *mixer, const int channel);