From 56861e45d1223b905f6c0306aeb4eb07fb68f6d7 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Mon, 25 May 2009 16:37:29 +0000 Subject: fix multiple defs; fix warnings; reformat svn path=/trunk/; revision=11502 --- desiredata/src/s_audio_mmio.c | 57 +++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 37 deletions(-) (limited to 'desiredata/src') diff --git a/desiredata/src/s_audio_mmio.c b/desiredata/src/s_audio_mmio.c index 9165ee93..73fb20d0 100644 --- a/desiredata/src/s_audio_mmio.c +++ b/desiredata/src/s_audio_mmio.c @@ -5,17 +5,15 @@ /* modified 2/98 by Winfried Ritsch to deal with up to 4 synchronized "wave" devices, which is how ADAT boards appear to the WAVE API. */ -#include "m_pd.h" +#include "desire.h" #include "s_stuff.h" #include #include -#include +#include /* ------------------------- audio -------------------------- */ -static void nt_close_midiin(); static void nt_noresync(); -static void postflags(); #define NAPORTS 16 /* wini hack for multiple ADDA devices */ #define CHANNELS_PER_DEVICE 2 @@ -29,9 +27,7 @@ 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; -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 */ @@ -342,9 +338,6 @@ static void nt_resyncaudio() { #define LATE 0 #define RESYNC 1 #define NOTHING 2 -static int nt_errorcount; -static int nt_resynccount; -static double nt_nextreporttime = -1; void nt_logerror(int which) { #if 0 @@ -360,33 +353,20 @@ void nt_logerror(int which) { #endif } -/* system buffer with t_sample types for one tick */ -t_sample *sys_soundout; -t_sample *sys_soundin; -float sys_dacsr; - int mmio_send_dacs() { - HMMIO hmmio; UINT mmresult; - HANDLE hFormat; - int i, j; - short *sp1, *sp2; - float *fp1, *fp2; - int nextfill, doxfer = 0; if (!nt_nwavein && !nt_nwaveout) return 0; if (nt_meters) { - int i, n; - float maxsamp; - for (i = 0, n = 2 * nt_nwavein * sys_dacblocksize, maxsamp = nt_inmax; i < n; i++) { + float maxsamp = nt_inmax; + for (int i=0, n=2*nt_nwavein*sys_dacblocksize; i maxsamp) maxsamp = f; - else if (-f > maxsamp) maxsamp = -f; + if (f > maxsamp) maxsamp = f; else if (-f > maxsamp) maxsamp = -f; } nt_inmax = maxsamp; - for (i = 0, n = 2 * nt_nwaveout * sys_dacblocksize, maxsamp = nt_outmax; i < n; i++) { + maxsamp = nt_outmax; + for (int i=0, n=2*nt_nwaveout*sys_dacblocksize; i maxsamp) maxsamp = f; - else if (-f > maxsamp) maxsamp = -f; + if (f > maxsamp) maxsamp = f; else if (-f > maxsamp) maxsamp = -f; } nt_outmax = maxsamp; } @@ -415,15 +395,17 @@ int mmio_send_dacs() { } } /* Convert audio output to fixed-point and put it in the output buffer. */ + int i, j; + short *sp1, *sp2; + float *fp1, *fp2; fp1 = sys_soundout; for (int nda=0; nda 32767) x1 = 32767; - else if (x1 < -32767) x1 = -32767; - *sp2 = x1; + sp1=(short *)(ntsnd_outvec[nda][phase].lpData)+CHANNELS_PER_DEVICE*nt_fill; + for (int i=0; i<2; i++, fp1 += sys_dacblocksize, sp1++) { + fp2 = fp1; sp2 = sp1; + for (int j=0; j 1 ? WAVE_MAPPER : -1) : audiooutdev[0]); if (naudiooutdev > 1 || naudioindev > 1) post("separate audio device choice not supported; using sequential devices."); mmio_do_open_audio(); + return 0; } #if 0 -- cgit v1.2.1