From 03bc20b9d2aca8a23ab22e474f590d9dfcd5a2eb Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Tue, 18 Sep 2018 21:58:06 -0400
Subject: [PATCH] update mmio backend to work with double precision

---
 pd/src/s_audio_mmio.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/pd/src/s_audio_mmio.c b/pd/src/s_audio_mmio.c
index 6bb1f0877..0ada2c23c 100644
--- a/pd/src/s_audio_mmio.c
+++ b/pd/src/s_audio_mmio.c
@@ -32,12 +32,12 @@ int nt_realdacblksize;
 #define MAXBUFFER 100   /* number of buffers in use at maximum advance */
 #define DEFBUFFER 30    /* default is about 30x6 = 180 msec! */
 static int nt_naudiobuffer = DEFBUFFER;
-float sys_dacsr = DEFAULTSRATE;
+t_float sys_dacsr = DEFAULTSRATE;
 
 static int nt_whichapi = API_MMIO;
 static int nt_meters;        /* true if we're metering */
-static float nt_inmax;       /* max input amplitude */
-static float nt_outmax;      /* max output amplitude */
+static t_float nt_inmax;       /* max input amplitude */
+static t_float nt_outmax;      /* max output amplitude */
 static int nt_nwavein, nt_nwaveout;     /* number of WAVE devices in and out */
 
 typedef struct _sbuf
@@ -489,7 +489,7 @@ void nt_logerror(int which)
 /* system buffer with t_sample types for one tick */
 t_sample *sys_soundout;
 t_sample *sys_soundin;
-float sys_dacsr;
+t_float sys_dacsr;
 
 int mmio_send_dacs(void)
 {
@@ -498,7 +498,7 @@ int mmio_send_dacs(void)
     HANDLE hFormat; 
     int i, j;
     short *sp1, *sp2;
-    float *fp1, *fp2;
+    t_float *fp1, *fp2;
     int nextfill, doxfer = 0;
     int nda, nad;
     if (!nt_nwavein && !nt_nwaveout) return (0);
@@ -507,11 +507,11 @@ int mmio_send_dacs(void)
     if (nt_meters)
     {
         int i, n;
-        float maxsamp;
+        t_float maxsamp;
         for (i = 0, n = 2 * nt_nwavein * DEFDACBLKSIZE, maxsamp = nt_inmax;
             i < n; i++)
         {
-            float f = sys_soundin[i];
+            t_float f = sys_soundin[i];
             if (f > maxsamp) maxsamp = f;
             else if (-f > maxsamp) maxsamp = -f;
         }
@@ -519,7 +519,7 @@ int mmio_send_dacs(void)
         for (i = 0, n = 2 * nt_nwaveout * DEFDACBLKSIZE, maxsamp = nt_outmax;
             i < n; i++)
         {
-            float f = sys_soundout[i];
+            t_float f = sys_soundout[i];
             if (f > maxsamp) maxsamp = f;
             else if (-f > maxsamp) maxsamp = -f;
         }
@@ -600,7 +600,7 @@ int mmio_send_dacs(void)
             for (j = 0, fp2 = fp1, sp2 = sp1; j < DEFDACBLKSIZE;
                 j++, fp2++, sp2 += CHANNELS_PER_DEVICE)
             {
-                *fp2 = ((float)(1./32767.)) * (float)(*sp2);    
+                *fp2 = ((t_float)(1./32767.)) * (t_float)(*sp2);    
             }
         }
     }
-- 
GitLab