Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10027
Modified Files:
Tag: desiredata
d_soundfile.c
Log Message:
remove struct prefix
Index: d_soundfile.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_soundfile.c,v
retrieving revision 1.4.4.11.2.10.2.6
retrieving revision 1.4.4.11.2.10.2.7
diff -C2 -d -r1.4.4.11.2.10.2.6 -r1.4.4.11.2.10.2.7
*** d_soundfile.c 28 Jun 2007 08:50:28 -0000 1.4.4.11.2.10.2.6
--- d_soundfile.c 3 Jul 2007 00:35:53 -0000 1.4.4.11.2.10.2.7
***************
*** 47,60 ****
/* the NeXTStep sound header structure; can be big or little endian */
! typedef struct _nextstep
! {
! char ns_fileid[4]; /* magic number '.snd' if file is big-endian */
! uint32 ns_onset; /* byte offset of first sample */
! uint32 ns_length; /* length of sound in bytes */
! uint32 ns_format; /* format; see below */
! uint32 ns_sr; /* sample rate */
! uint32 ns_nchans; /* number of channels */
! char ns_info[4]; /* comment */
! } t_nextstep;
#define NS_FORMAT_LINEAR_16 3
--- 47,59 ----
/* the NeXTStep sound header structure; can be big or little endian */
! struct t_nextstep {
! char ns_fileid[4]; /* magic number '.snd' if file is big-endian */
! uint32 onset; /* byte offset of first sample */
! uint32 length; /* length of sound in bytes */
! uint32 format; /* format; see below */
! uint32 sr; /* sample rate */
! uint32 nchans; /* number of channels */
! char info[4]; /* comment */
! };
#define NS_FORMAT_LINEAR_16 3
***************
*** 67,102 ****
always; same for AIFF and the "COMM" chunk. */
! typedef struct _wave
! {
! char w_fileid[4]; /* chunk id 'RIFF' */
! uint32 w_chunksize; /* chunk size */
! char w_waveid[4]; /* wave chunk id 'WAVE' */
! char w_fmtid[4]; /* format chunk id 'fmt ' */
! uint32 w_fmtchunksize; /* format chunk size */
! uint16 w_fmttag; /* format tag (WAV_INT etc) */
! uint16 w_nchannels; /* number of channels */
! uint32 w_samplespersec; /* sample rate in hz */
! uint32 w_navgbytespersec; /* average bytes per second */
! uint16 w_nblockalign; /* number of bytes per frame */
! uint16 w_nbitspersample; /* number of bits in a sample */
! char w_datachunkid[4]; /* data chunk id 'data' */
! uint32 w_datachunksize; /* length of data chunk */
! } t_wave;
! typedef struct _fmt /* format chunk */
! {
! uint16 f_fmttag; /* format tag, 1 for PCM */
! uint16 f_nchannels; /* number of channels */
! uint32 f_samplespersec; /* sample rate in hz */
! uint32 f_navgbytespersec; /* average bytes per second */
! uint16 f_nblockalign; /* number of bytes per frame */
! uint16 f_nbitspersample; /* number of bits in a sample */
! } t_fmt;
! typedef struct _wavechunk /* ... and the last two items */
! {
! char wc_id[4]; /* data chunk id, e.g., 'data' or 'fmt ' */
! uint32 wc_size; /* length of data chunk */
! } t_wavechunk;
#define WAV_INT 1
--- 66,98 ----
always; same for AIFF and the "COMM" chunk. */
! struct t_wave {
! char fileid[4]; /* chunk id 'RIFF' */
! uint32 chunksize; /* chunk size */
! char waveid[4]; /* wave chunk id 'WAVE' */
! char fmtid[4]; /* format chunk id 'fmt ' */
! uint32 fmtchunksize; /* format chunk size */
! uint16 fmttag; /* format tag (WAV_INT etc) */
! uint16 nchannels; /* number of channels */
! uint32 samplespersec; /* sample rate in hz */
! uint32 navgbytespersec; /* average bytes per second */
! uint16 nblockalign; /* number of bytes per frame */
! uint16 nbitspersample; /* number of bits in a sample */
! char datachunkid[4]; /* data chunk id 'data' */
! uint32 datachunksize; /* length of data chunk */
! };
! struct t_fmt { /* format chunk */
! uint16 fmttag; /* format tag, 1 for PCM */
! uint16 nchannels; /* number of channels */
! uint32 samplespersec; /* sample rate in hz */
! uint32 navgbytespersec; /* average bytes per second */
! uint16 nblockalign; /* number of bytes per frame */
! uint16 nbitspersample; /* number of bits in a sample */
! };
! struct t_wavechunk { /* ... and the last two items */
! char id[4]; /* data chunk id, e.g., 'data' or 'fmt ' */
! uint32 size; /* length of data chunk */
! };
#define WAV_INT 1
***************
*** 106,159 ****
that. */
! typedef struct _datachunk
! {
! char dc_id[4]; /* data chunk id 'SSND' */
! uint32 dc_size; /* length of data chunk */
! uint32 dc_offset; /* additional offset in bytes */
! uint32 dc_block; /* block size */
! } t_datachunk;
! typedef struct _comm
! {
! uint16 c_nchannels; /* number of channels */
! uint16 c_nframeshi; /* # of sample frames (hi) */
! uint16 c_nframeslo; /* # of sample frames (lo) */
! uint16 c_bitspersamp; /* bits per sample */
! unsigned char c_samprate[10]; /* sample rate, 80-bit float! */
! } t_comm;
! /* this version is more convenient for writing them out: */
! typedef struct _aiff
! {
! char a_fileid[4]; /* chunk id 'FORM' */
! uint32 a_chunksize; /* chunk size */
! char a_aiffid[4]; /* aiff chunk id 'AIFF' */
! char a_fmtid[4]; /* format chunk id 'COMM' */
! uint32 a_fmtchunksize; /* format chunk size, 18 */
! uint16 a_nchannels; /* number of channels */
! uint16 a_nframeshi; /* # of sample frames (hi) */
! uint16 a_nframeslo; /* # of sample frames (lo) */
! uint16 a_bitspersamp; /* bits per sample */
! unsigned char a_samprate[10]; /* sample rate, 80-bit float! */
! } t_aiff;
#define AIFFHDRSIZE 38 /* probably not what sizeof() gives */
-
-
#define AIFFPLUS (AIFFHDRSIZE + 16) /* header size including SSND chunk hdr */
-
#define WHDR1 sizeof(t_nextstep)
#define WHDR2 (sizeof(t_wave) > WHDR1 ? sizeof (t_wave) : WHDR1)
#define WRITEHDRSIZE (AIFFPLUS > WHDR2 ? AIFFPLUS : WHDR2)
-
#define READHDRSIZE (16 > WHDR2 + 2 ? 16 : WHDR2 + 2)
-
#define OBUFSIZE MAXPDSTRING /* assume MAXPDSTRING is bigger than headers */
#ifdef MSW
#include <fcntl.h>
! #define BINCREATE _O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY
#else
! #define BINCREATE O_WRONLY | O_CREAT | O_TRUNC
#endif
--- 102,147 ----
that. */
! struct t_datachunk {
! char id[4]; /* data chunk id 'SSND' */
! uint32 size; /* length of data chunk */
! uint32 offset; /* additional offset in bytes */
! uint32 block; /* block size */
! };
! struct t_comm {
! uint16 nchannels; /* number of channels */
! uint16 nframeshi; /* # of sample frames (hi) */
! uint16 nframeslo; /* # of sample frames (lo) */
! uint16 bitspersamp; /* bits per sample */
! unsigned char samprate[10]; /* sample rate, 80-bit float! */
! };
! /* this version is more convenient for writing them out: */
! struct t_aiff {
! char fileid[4]; /* chunk id 'FORM' */
! uint32 chunksize; /* chunk size */
! char aiffid[4]; /* aiff chunk id 'AIFF' */
! char fmtid[4]; /* format chunk id 'COMM' */
! uint32 fmtchunksize; /* format chunk size, 18 */
! uint16 nchannels; /* number of channels */
! uint16 nframeshi; /* # of sample frames (hi) */
! uint16 nframeslo; /* # of sample frames (lo) */
! uint16 bitspersamp; /* bits per sample */
! unsigned char samprate[10]; /* sample rate, 80-bit float! */
! };
#define AIFFHDRSIZE 38 /* probably not what sizeof() gives */
#define AIFFPLUS (AIFFHDRSIZE + 16) /* header size including SSND chunk hdr */
#define WHDR1 sizeof(t_nextstep)
#define WHDR2 (sizeof(t_wave) > WHDR1 ? sizeof (t_wave) : WHDR1)
#define WRITEHDRSIZE (AIFFPLUS > WHDR2 ? AIFFPLUS : WHDR2)
#define READHDRSIZE (16 > WHDR2 + 2 ? 16 : WHDR2 + 2)
#define OBUFSIZE MAXPDSTRING /* assume MAXPDSTRING is bigger than headers */
#ifdef MSW
#include <fcntl.h>
! #define BINCREATE (_O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY)
#else
! #define BINCREATE (O_WRONLY | O_CREAT | O_TRUNC)
#endif
***************
*** 184,188 ****
/******************** soundfile access routines **********************/
-
/* This routine opens a file, looks for either a nextstep or "wave" header,
* seeks to end of it, and fills in bytes per sample and number of channels.
--- 172,175 ----
***************
*** 225,231 ****
if (format == FORMAT_NEXT) { /* nextstep header */
if (bytesread < (int)sizeof(t_nextstep)) goto badheader;
! nchannels = swap4(((t_nextstep *)buf)->ns_nchans, swap);
! format = swap4(((t_nextstep *)buf)->ns_format, swap);
! headersize = swap4(((t_nextstep *)buf)->ns_onset, swap);
if (format == NS_FORMAT_LINEAR_16) bytespersamp = 2;
else if (format == NS_FORMAT_LINEAR_24) bytespersamp = 3;
--- 212,218 ----
if (format == FORMAT_NEXT) { /* nextstep header */
if (bytesread < (int)sizeof(t_nextstep)) goto badheader;
! nchannels = swap4(((t_nextstep *)buf)->nchans, swap);
! format = swap4(((t_nextstep *)buf)->format, swap);
! headersize = swap4(((t_nextstep *)buf)->onset, swap);
if (format == NS_FORMAT_LINEAR_16) bytespersamp = 2;
else if (format == NS_FORMAT_LINEAR_24) bytespersamp = 3;
***************
*** 247,260 ****
memcpy(buf, buf + headersize, sizeof(t_wavechunk));
/* read chunks in loop until we get to the data chunk */
! while (strncmp(((t_wavechunk *)buf)->wc_id, "data", 4)) {
! long chunksize = swap4(((t_wavechunk *)buf)->wc_size, swap),
seekto = headersize + chunksize + 8, seekout;
! if (!strncmp(((t_wavechunk *)buf)->wc_id, "fmt ", 4)) {
long commblockonset = headersize + 8;
seekout = lseek(fd, commblockonset, SEEK_SET);
if (seekout != commblockonset) goto badheader;
if (read(fd, buf, sizeof(t_fmt)) < (int) sizeof(t_fmt)) goto badheader;
! nchannels = swap2(((t_fmt *)buf)->f_nchannels, swap);
! format = swap2(((t_fmt *)buf)->f_nbitspersample, swap);
if (format == 16) bytespersamp = 2;
else if (format == 24) bytespersamp = 3;
--- 234,247 ----
memcpy(buf, buf + headersize, sizeof(t_wavechunk));
/* read chunks in loop until we get to the data chunk */
! while (strncmp(((t_wavechunk *)buf)->id, "data", 4)) {
! long chunksize = swap4(((t_wavechunk *)buf)->size, swap),
seekto = headersize + chunksize + 8, seekout;
! if (!strncmp(((t_wavechunk *)buf)->id, "fmt ", 4)) {
long commblockonset = headersize + 8;
seekout = lseek(fd, commblockonset, SEEK_SET);
if (seekout != commblockonset) goto badheader;
if (read(fd, buf, sizeof(t_fmt)) < (int) sizeof(t_fmt)) goto badheader;
! nchannels = swap2(((t_fmt *)buf)->nchannels, swap);
! format = swap2(((t_fmt *)buf)->nbitspersample, swap);
if (format == 16) bytespersamp = 2;
else if (format == 24) bytespersamp = 3;
***************
*** 267,271 ****
headersize = seekto;
}
! bytelimit = swap4(((t_wavechunk *)buf)->wc_size, swap);
headersize += 8;
} else {
--- 254,258 ----
headersize = seekto;
}
! bytelimit = swap4(((t_wavechunk *)buf)->size, swap);
headersize += 8;
} else {
***************
*** 279,292 ****
memcpy(buf, buf + headersize, sizeof(t_datachunk));
/* read chunks in loop until we get to the data chunk */
! while (strncmp(((t_datachunk *)buf)->dc_id, "SSND", 4)) {
! long chunksize = swap4(((t_datachunk *)buf)->dc_size, swap),
seekto = headersize + chunksize + 8, seekout;
! if (!strncmp(((t_datachunk *)buf)->dc_id, "COMM", 4)) {
long commblockonset = headersize + 8;
seekout = lseek(fd, commblockonset, SEEK_SET);
if (seekout != commblockonset) goto badheader;
if (read(fd, buf, sizeof(t_comm)) < (int) sizeof(t_comm)) goto badheader;
! nchannels = swap2(((t_comm *)buf)->c_nchannels, swap);
! format = swap2(((t_comm *)buf)->c_bitspersamp, swap);
if (format == 16) bytespersamp = 2;
else if (format == 24) bytespersamp = 3;
--- 266,279 ----
memcpy(buf, buf + headersize, sizeof(t_datachunk));
/* read chunks in loop until we get to the data chunk */
! while (strncmp(((t_datachunk *)buf)->id, "SSND", 4)) {
! long chunksize = swap4(((t_datachunk *)buf)->size, swap),
seekto = headersize + chunksize + 8, seekout;
! if (!strncmp(((t_datachunk *)buf)->id, "COMM", 4)) {
long commblockonset = headersize + 8;
seekout = lseek(fd, commblockonset, SEEK_SET);
if (seekout != commblockonset) goto badheader;
if (read(fd, buf, sizeof(t_comm)) < (int) sizeof(t_comm)) goto badheader;
! nchannels = swap2(((t_comm *)buf)->nchannels, swap);
! format = swap2(((t_comm *)buf)->bitspersamp, swap);
if (format == 16) bytespersamp = 2;
else if (format == 24) bytespersamp = 3;
***************
*** 298,302 ****
headersize = seekto;
}
! bytelimit = swap4(((t_datachunk *)buf)->dc_size, swap);
headersize += 8;
}
--- 285,289 ----
headersize = seekto;
}
! bytelimit = swap4(((t_datachunk *)buf)->size, swap);
headersize += 8;
}
***************
*** 492,503 ****
if (bigendian) strncpy(nexthdr->ns_fileid, ".snd", 4);
else strncpy(nexthdr->ns_fileid, "dns.", 4);
! nexthdr->ns_onset = swap4(sizeof(*nexthdr), swap);
! nexthdr->ns_length = 0;
! nexthdr->ns_format = swap4((bytespersamp == 3 ? NS_FORMAT_LINEAR_24 :
(bytespersamp == 4 ? NS_FORMAT_FLOAT : NS_FORMAT_LINEAR_16)), swap);
! nexthdr->ns_sr = swap4((size_t)samplerate, swap);
! nexthdr->ns_nchans = swap4((size_t)nchannels, swap);
! strcpy(nexthdr->ns_info, "Pd ");
! swapstring(nexthdr->ns_info, swap);
headersize = sizeof(t_nextstep);
} else if (filetype == FORMAT_AIFF) {
--- 479,490 ----
if (bigendian) strncpy(nexthdr->ns_fileid, ".snd", 4);
else strncpy(nexthdr->ns_fileid, "dns.", 4);
! nexthdr->onset = swap4(sizeof(*nexthdr), swap);
! nexthdr->length = 0;
! nexthdr->format = swap4((bytespersamp == 3 ? NS_FORMAT_LINEAR_24 :
(bytespersamp == 4 ? NS_FORMAT_FLOAT : NS_FORMAT_LINEAR_16)), swap);
! nexthdr->sr = swap4((size_t)samplerate, swap);
! nexthdr->nchans = swap4((size_t)nchannels, swap);
! strcpy(nexthdr->info, "Pd ");
! swapstring(nexthdr->info, swap);
headersize = sizeof(t_nextstep);
} else if (filetype == FORMAT_AIFF) {
***************
*** 509,542 ****
strcmp(filenamebuf + strlen(filenamebuf)-5, ".aiff"))
strcat(filenamebuf, ".aif");
! strncpy(aiffhdr->a_fileid, "FORM", 4);
! aiffhdr->a_chunksize = swap4(datasize + sizeof(*aiffhdr) + 4, swap);
! strncpy(aiffhdr->a_aiffid, "AIFF", 4);
! strncpy(aiffhdr->a_fmtid, "COMM", 4);
! aiffhdr->a_fmtchunksize = swap4(18, swap);
! aiffhdr->a_nchannels = swap2(nchannels, swap);
longtmp = swap4(nframes, swap);
! memcpy(&aiffhdr->a_nframeshi, &longtmp, 4);
! aiffhdr->a_bitspersamp = swap2(8 * bytespersamp, swap);
! memcpy(aiffhdr->a_samprate, dogdoo, sizeof(dogdoo));
longtmp = swap4(datasize, swap);
! memcpy(aiffhdr->a_samprate + sizeof(dogdoo), &longtmp, 4);
! memset(aiffhdr->a_samprate + sizeof(dogdoo) + 4, 0, 8);
headersize = AIFFPLUS;
} else { /* WAVE format */
long datasize = nframes * nchannels * bytespersamp;
if (strcmp(filenamebuf + strlen(filenamebuf)-4, ".wav")) strcat(filenamebuf, ".wav");
! strncpy(wavehdr->w_fileid, "RIFF", 4);
! wavehdr->w_chunksize = swap4(datasize + sizeof(*wavehdr) - 8, swap);
! strncpy(wavehdr->w_waveid, "WAVE", 4);
! strncpy(wavehdr->w_fmtid, "fmt ", 4);
! wavehdr->w_fmtchunksize = swap4(16, swap);
! wavehdr->w_fmttag = swap2((bytespersamp == 4 ? WAV_FLOAT : WAV_INT), swap);
! wavehdr->w_nchannels = swap2(nchannels, swap);
! wavehdr->w_samplespersec = swap4(size_t(samplerate), swap);
! wavehdr->w_navgbytespersec = swap4((int)(samplerate * nchannels * bytespersamp), swap);
! wavehdr->w_nblockalign = swap2(nchannels * bytespersamp, swap);
! wavehdr->w_nbitspersample = swap2(8 * bytespersamp, swap);
! strncpy(wavehdr->w_datachunkid, "data", 4);
! wavehdr->w_datachunksize = swap4(datasize, swap);
headersize = sizeof(t_wave);
}
--- 496,529 ----
strcmp(filenamebuf + strlen(filenamebuf)-5, ".aiff"))
strcat(filenamebuf, ".aif");
! strncpy(aiffhdr->fileid, "FORM", 4);
! aiffhdr->chunksize = swap4(datasize + sizeof(*aiffhdr) + 4, swap);
! strncpy(aiffhdr->aiffid, "AIFF", 4);
! strncpy(aiffhdr->fmtid, "COMM", 4);
! aiffhdr->fmtchunksize = swap4(18, swap);
! aiffhdr->nchannels = swap2(nchannels, swap);
longtmp = swap4(nframes, swap);
! memcpy(&aiffhdr->nframeshi, &longtmp, 4);
! aiffhdr->bitspersamp = swap2(8 * bytespersamp, swap);
! memcpy(aiffhdr->samprate, dogdoo, sizeof(dogdoo));
longtmp = swap4(datasize, swap);
! memcpy(aiffhdr->samprate + sizeof(dogdoo), &longtmp, 4);
! memset(aiffhdr->samprate + sizeof(dogdoo) + 4, 0, 8);
headersize = AIFFPLUS;
} else { /* WAVE format */
long datasize = nframes * nchannels * bytespersamp;
if (strcmp(filenamebuf + strlen(filenamebuf)-4, ".wav")) strcat(filenamebuf, ".wav");
! strncpy(wavehdr->fileid, "RIFF", 4);
! wavehdr->chunksize = swap4(datasize + sizeof(*wavehdr) - 8, swap);
! strncpy(wavehdr->waveid, "WAVE", 4);
! strncpy(wavehdr->fmtid, "fmt ", 4);
! wavehdr->fmtchunksize = swap4(16, swap);
! wavehdr->fmttag = swap2((bytespersamp == 4 ? WAV_FLOAT : WAV_INT), swap);
! wavehdr->nchannels = swap2(nchannels, swap);
! wavehdr->samplespersec = swap4(size_t(samplerate), swap);
! wavehdr->navgbytespersec = swap4((int)(samplerate * nchannels * bytespersamp), swap);
! wavehdr->nblockalign = swap2(nchannels * bytespersamp, swap);
! wavehdr->nbitspersample = swap2(8 * bytespersamp, swap);
! strncpy(wavehdr->datachunkid, "data", 4);
! wavehdr->datachunksize = swap4(datasize, swap);
headersize = sizeof(t_wave);
}
***************
*** 561,568 ****
if (filetype == FORMAT_WAVE) {
long datasize = itemswritten * bytesperframe, mofo;
! if (lseek(fd, ((char *)(&((t_wave *)0)->w_chunksize)) - (char *)0, SEEK_SET) == 0) goto baddonewrite;
mofo = swap4(datasize + sizeof(t_wave) - 8, swap);
if (write(fd, (char *)(&mofo), 4) < 4) goto baddonewrite;
! if (lseek(fd, ((char *)(&((t_wave *)0)->w_datachunksize)) - (char *)0, SEEK_SET) == 0) goto baddonewrite;
mofo = swap4(datasize, swap);
if (write(fd, (char *)(&mofo), 4) < 4) goto baddonewrite;
--- 548,555 ----
if (filetype == FORMAT_WAVE) {
long datasize = itemswritten * bytesperframe, mofo;
! if (lseek(fd, ((char *)(&((t_wave *)0)->chunksize)) - (char *)0, SEEK_SET) == 0) goto baddonewrite;
mofo = swap4(datasize + sizeof(t_wave) - 8, swap);
if (write(fd, (char *)(&mofo), 4) < 4) goto baddonewrite;
! if (lseek(fd, ((char *)(&((t_wave *)0)->datachunksize)) - (char *)0, SEEK_SET) == 0) goto baddonewrite;
mofo = swap4(datasize, swap);
if (write(fd, (char *)(&mofo), 4) < 4) goto baddonewrite;
***************
*** 570,577 ****
if (filetype == FORMAT_AIFF) {
long mofo;
! if (lseek(fd, ((char *)(&((t_aiff *)0)->a_nframeshi)) - (char *)0, SEEK_SET) == 0) goto baddonewrite;
mofo = swap4(itemswritten, swap);
if (write(fd, (char *)(&mofo), 4) < 4) goto baddonewrite;
! if (lseek(fd, ((char *)(&((t_aiff *)0)->a_chunksize)) - (char *)0, SEEK_SET) == 0) goto baddonewrite;
mofo = swap4(itemswritten*bytesperframe+AIFFHDRSIZE, swap);
if (write(fd, (char *)(&mofo), 4) < 4) goto baddonewrite;
--- 557,564 ----
if (filetype == FORMAT_AIFF) {
long mofo;
! if (lseek(fd, ((char *)(&((t_aiff *)0)->nframeshi)) - (char *)0, SEEK_SET) == 0) goto baddonewrite;
mofo = swap4(itemswritten, swap);
if (write(fd, (char *)(&mofo), 4) < 4) goto baddonewrite;
! if (lseek(fd, ((char *)(&((t_aiff *)0)->chunksize)) - (char *)0, SEEK_SET) == 0) goto baddonewrite;
mofo = swap4(itemswritten*bytesperframe+AIFFHDRSIZE, swap);
if (write(fd, (char *)(&mofo), 4) < 4) goto baddonewrite;
***************
*** 2192,2196 ****
x->x_insamplerate = x->x_samplerate = 0;
x->x_state = STATE_IDLE;
! x->x_clock = 0; /* no callback needed here */
x->x_canvas = canvas_getcurrent();
x->x_bytespersample = 2;
--- 2179,2183 ----
x->x_insamplerate = x->x_samplerate = 0;
x->x_state = STATE_IDLE;
! x->x_clock = 0; /* no callback needed here */
x->x_canvas = canvas_getcurrent();
x->x_bytespersample = 2;
***************
*** 2286,2296 ****
else if (x->x_insamplerate > 0) x->x_samplerate = x->x_insamplerate;
else x->x_samplerate = sys_getsr();
! /* set fifosize from bufsize. fifosize must be a
! multiple of the number of bytes eaten for each DSP tick. */
! x->x_fifosize = x->x_bufsize - (x->x_bufsize %
! (x->x_bytespersample * x->x_sfchannels * MAXVECSIZE));
/* arrange for the "request" condition to be signalled 16 times per buffer */
! x->x_sigcountdown = x->x_sigperiod =
! (x->x_fifosize / (16 * x->x_bytespersample * x->x_sfchannels * x->x_vecsize));
sfread_cond_signal(&x->x_requestcondition);
pthread_mutex_unlock(&x->x_mutex);
--- 2273,2280 ----
else if (x->x_insamplerate > 0) x->x_samplerate = x->x_insamplerate;
else x->x_samplerate = sys_getsr();
! /* set fifosize from bufsize. fifosize must be a multiple of the number of bytes eaten for each DSP tick. */
! x->x_fifosize = x->x_bufsize - (x->x_bufsize % (x->x_bytespersample * x->x_sfchannels * MAXVECSIZE));
/* arrange for the "request" condition to be signalled 16 times per buffer */
! x->x_sigcountdown = x->x_sigperiod = x->x_fifosize / (16 * x->x_bytespersample * x->x_sfchannels * x->x_vecsize);
sfread_cond_signal(&x->x_requestcondition);
pthread_mutex_unlock(&x->x_mutex);