Commit 03bc20b9 authored by Jonathan Wilkes's avatar Jonathan Wilkes

update mmio backend to work with double precision

parent 22680d90
Pipeline #1386 passed with stage
in 406 minutes and 45 seconds
...@@ -32,12 +32,12 @@ int nt_realdacblksize; ...@@ -32,12 +32,12 @@ int nt_realdacblksize;
#define MAXBUFFER 100 /* number of buffers in use at maximum advance */ #define MAXBUFFER 100 /* number of buffers in use at maximum advance */
#define DEFBUFFER 30 /* default is about 30x6 = 180 msec! */ #define DEFBUFFER 30 /* default is about 30x6 = 180 msec! */
static int nt_naudiobuffer = DEFBUFFER; static int nt_naudiobuffer = DEFBUFFER;
float sys_dacsr = DEFAULTSRATE; t_float sys_dacsr = DEFAULTSRATE;
static int nt_whichapi = API_MMIO; static int nt_whichapi = API_MMIO;
static int nt_meters; /* true if we're metering */ static int nt_meters; /* true if we're metering */
static float nt_inmax; /* max input amplitude */ static t_float nt_inmax; /* max input amplitude */
static float nt_outmax; /* max output amplitude */ static t_float nt_outmax; /* max output amplitude */
static int nt_nwavein, nt_nwaveout; /* number of WAVE devices in and out */ static int nt_nwavein, nt_nwaveout; /* number of WAVE devices in and out */
typedef struct _sbuf typedef struct _sbuf
...@@ -489,7 +489,7 @@ void nt_logerror(int which) ...@@ -489,7 +489,7 @@ void nt_logerror(int which)
/* system buffer with t_sample types for one tick */ /* system buffer with t_sample types for one tick */
t_sample *sys_soundout; t_sample *sys_soundout;
t_sample *sys_soundin; t_sample *sys_soundin;
float sys_dacsr; t_float sys_dacsr;
int mmio_send_dacs(void) int mmio_send_dacs(void)
{ {
...@@ -498,7 +498,7 @@ int mmio_send_dacs(void) ...@@ -498,7 +498,7 @@ int mmio_send_dacs(void)
HANDLE hFormat; HANDLE hFormat;
int i, j; int i, j;
short *sp1, *sp2; short *sp1, *sp2;
float *fp1, *fp2; t_float *fp1, *fp2;
int nextfill, doxfer = 0; int nextfill, doxfer = 0;
int nda, nad; int nda, nad;
if (!nt_nwavein && !nt_nwaveout) return (0); if (!nt_nwavein && !nt_nwaveout) return (0);
...@@ -507,11 +507,11 @@ int mmio_send_dacs(void) ...@@ -507,11 +507,11 @@ int mmio_send_dacs(void)
if (nt_meters) if (nt_meters)
{ {
int i, n; int i, n;
float maxsamp; t_float maxsamp;
for (i = 0, n = 2 * nt_nwavein * DEFDACBLKSIZE, maxsamp = nt_inmax; for (i = 0, n = 2 * nt_nwavein * DEFDACBLKSIZE, maxsamp = nt_inmax;
i < n; i++) i < n; i++)
{ {
float f = sys_soundin[i]; t_float f = sys_soundin[i];
if (f > maxsamp) maxsamp = f; if (f > maxsamp) maxsamp = f;
else if (-f > maxsamp) maxsamp = -f; else if (-f > maxsamp) maxsamp = -f;
} }
...@@ -519,7 +519,7 @@ int mmio_send_dacs(void) ...@@ -519,7 +519,7 @@ int mmio_send_dacs(void)
for (i = 0, n = 2 * nt_nwaveout * DEFDACBLKSIZE, maxsamp = nt_outmax; for (i = 0, n = 2 * nt_nwaveout * DEFDACBLKSIZE, maxsamp = nt_outmax;
i < n; i++) i < n; i++)
{ {
float f = sys_soundout[i]; t_float f = sys_soundout[i];
if (f > maxsamp) maxsamp = f; if (f > maxsamp) maxsamp = f;
else if (-f > maxsamp) maxsamp = -f; else if (-f > maxsamp) maxsamp = -f;
} }
...@@ -600,7 +600,7 @@ int mmio_send_dacs(void) ...@@ -600,7 +600,7 @@ int mmio_send_dacs(void)
for (j = 0, fp2 = fp1, sp2 = sp1; j < DEFDACBLKSIZE; for (j = 0, fp2 = fp1, sp2 = sp1; j < DEFDACBLKSIZE;
j++, fp2++, sp2 += CHANNELS_PER_DEVICE) j++, fp2++, sp2 += CHANNELS_PER_DEVICE)
{ {
*fp2 = ((float)(1./32767.)) * (float)(*sp2); *fp2 = ((t_float)(1./32767.)) * (t_float)(*sp2);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment