mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
Change an unnamed union to a named one and fix resulting problems.
This commit is contained in:
parent
aa2a32427f
commit
2e9e61e19d
@ -1,3 +1,11 @@
|
||||
2004-08-29 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/common.h
|
||||
Change the unnamed union into a named union so gcc-2.95 will compile it.
|
||||
|
||||
* src/*.c
|
||||
Fixes to allow for the above change.
|
||||
|
||||
2004-08-20 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* examples/sndfile-play.c
|
||||
|
44
src/aiff.c
44
src/aiff.c
@ -393,14 +393,14 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
psf_log_printf (psf, " time stamp : %d\n", psf->pchunk->timestamp) ;
|
||||
psf_log_printf (psf, " Ch Position Value\n") ;
|
||||
|
||||
cptr = psf->scbuf ;
|
||||
cptr = psf->u.scbuf ;
|
||||
for (dword = 0 ; dword < psf->sf.channels ; dword++)
|
||||
{ psf_binheader_readf (psf, "Ef4", &(psf->pchunk->peaks [dword].value),
|
||||
&(psf->pchunk->peaks [dword].position)) ;
|
||||
|
||||
LSF_SNPRINTF (cptr, sizeof (psf->scbuf), " %2d %-12d %g\n",
|
||||
LSF_SNPRINTF (cptr, sizeof (psf->u.scbuf), " %2d %-12d %g\n",
|
||||
dword, psf->pchunk->peaks [dword].position, psf->pchunk->peaks [dword].value) ;
|
||||
cptr [sizeof (psf->scbuf) - 1] = 0 ;
|
||||
cptr [sizeof (psf->u.scbuf) - 1] = 0 ;
|
||||
psf_log_printf (psf, cptr) ;
|
||||
} ;
|
||||
|
||||
@ -441,12 +441,12 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
dword += (dword & 1) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
if (dword > SIGNED_SIZEOF (psf->scbuf))
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf))
|
||||
{ psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->scbuf ;
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
|
||||
@ -458,12 +458,12 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
dword += (dword & 1) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
if (dword > SIGNED_SIZEOF (psf->scbuf))
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf))
|
||||
{ psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->scbuf ;
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
|
||||
@ -475,12 +475,12 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
dword += (dword & 1) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
if (dword > SIGNED_SIZEOF (psf->scbuf))
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf))
|
||||
{ psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->scbuf ;
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
|
||||
@ -492,13 +492,13 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
dword += (dword & 1) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
if (dword >= SIGNED_SIZEOF (psf->scbuf))
|
||||
if (dword >= SIGNED_SIZEOF (psf->u.scbuf))
|
||||
{ psf_log_printf (psf, " %M : %d (too big, skipping)\n", marker, dword) ;
|
||||
psf_binheader_readf (psf, "j", dword) ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
cptr = psf->scbuf ;
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
|
||||
@ -517,12 +517,12 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
dword += (dword & 1) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
if (dword > SIGNED_SIZEOF (psf->scbuf))
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf))
|
||||
{ psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->scbuf ;
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
|
||||
@ -534,12 +534,12 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
dword += (dword & 1) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
if (dword > SIGNED_SIZEOF (psf->scbuf))
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf))
|
||||
{ psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->scbuf ;
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
|
||||
@ -597,8 +597,8 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
|
||||
pstr_len += (pstr_len & 1) + 1 ; /* fudgy, fudgy, hack, hack */
|
||||
|
||||
bytesread += psf_binheader_readf (psf, "b", psf->scbuf, pstr_len) ;
|
||||
psf_log_printf (psf, " Name : %s\n", psf->scbuf) ;
|
||||
bytesread += psf_binheader_readf (psf, "b", psf->u.scbuf, pstr_len) ;
|
||||
psf_log_printf (psf, " Name : %s\n", psf->u.scbuf) ;
|
||||
|
||||
mark_count -- ;
|
||||
} ;
|
||||
@ -703,11 +703,11 @@ aiff_read_comm_chunk (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
|
||||
bytesread += psf_binheader_readf (psf, "Em1", &(comm_fmt->encoding), &encoding_len) ;
|
||||
|
||||
memset (psf->scbuf, 0, comm_fmt->size) ;
|
||||
memset (psf->u.scbuf, 0, comm_fmt->size) ;
|
||||
|
||||
bytesread += psf_binheader_readf (psf, "b", psf->scbuf,
|
||||
bytesread += psf_binheader_readf (psf, "b", psf->u.scbuf,
|
||||
comm_fmt->size - SIZEOF_AIFC_COMM + 1) ;
|
||||
psf->scbuf [encoding_len] = 0 ;
|
||||
psf->u.scbuf [encoding_len] = 0 ;
|
||||
} ;
|
||||
|
||||
psf_log_printf (psf, " COMM : %d\n", comm_fmt->size) ;
|
||||
@ -807,10 +807,10 @@ aiff_read_comm_chunk (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
error = SFE_UNIMPLEMENTED ;
|
||||
} ;
|
||||
|
||||
if (! psf->scbuf [0])
|
||||
if (! psf->u.scbuf [0])
|
||||
psf_log_printf (psf, " Encoding : %M\n", comm_fmt->encoding) ;
|
||||
else
|
||||
psf_log_printf (psf, " Encoding : %M => %s\n", comm_fmt->encoding, psf->scbuf) ;
|
||||
psf_log_printf (psf, " Encoding : %M => %s\n", comm_fmt->encoding, psf->u.scbuf) ;
|
||||
|
||||
return error ;
|
||||
} /* aiff_read_comm_chunk */
|
||||
|
48
src/alaw.c
48
src/alaw.c
@ -358,13 +358,13 @@ alaw_read_alaw2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2s_array (psf->ucbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2s_array (psf->u.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -379,13 +379,13 @@ alaw_read_alaw2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2i_array (psf->ucbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2i_array (psf->u.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -403,13 +403,13 @@ alaw_read_alaw2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2f_array (psf->ucbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2f_array (psf->u.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -426,13 +426,13 @@ alaw_read_alaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
double normfact ;
|
||||
|
||||
normfact = (psf->norm_double) ? 1.0 / ((double) 0x8000) : 1.0 ;
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2d_array (psf->ucbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2d_array (psf->u.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -450,13 +450,13 @@ alaw_write_s2alaw (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2alaw_array (ptr + total, bufferlen, psf->ucbuf) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
s2alaw_array (ptr + total, bufferlen, psf->u.ucbuf) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -471,13 +471,13 @@ alaw_write_i2alaw (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2alaw_array (ptr + total, bufferlen, psf->ucbuf) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
i2alaw_array (ptr + total, bufferlen, psf->u.ucbuf) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -495,13 +495,13 @@ alaw_write_f2alaw (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) / 16.0 : 1.0 / 16 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
f2alaw_array (ptr + total, bufferlen, psf->ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
f2alaw_array (ptr + total, bufferlen, psf->u.ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -519,13 +519,13 @@ alaw_write_d2alaw (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double) ? (1.0 * 0x7FFF) / 16.0 : 1.0 / 16.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
d2alaw_array (ptr + total, bufferlen, psf->ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
d2alaw_array (ptr + total, bufferlen, psf->u.ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
@ -281,7 +281,7 @@ au_g72x_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
@ -313,7 +313,7 @@ au_g72x_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
@ -344,7 +344,7 @@ au_g72x_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
@ -523,7 +523,7 @@ au_g72x_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
@ -553,7 +553,7 @@ au_g72x_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
@ -584,7 +584,7 @@ au_g72x_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
|
@ -252,9 +252,9 @@ psf_calc_signal_max (SF_PRIVATE *psf, int normalize)
|
||||
position = sf_seek ((SNDFILE*) psf, 0, SEEK_CUR) ; /* Get current position in file */
|
||||
sf_seek ((SNDFILE*) psf, 0, SEEK_SET) ; /* Go to start of file. */
|
||||
|
||||
len = ARRAY_LEN (psf->dbuf) ;
|
||||
len = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
data = psf->dbuf ;
|
||||
data = psf->u.dbuf ;
|
||||
|
||||
readcount = len ;
|
||||
while (readcount > 0)
|
||||
@ -295,9 +295,9 @@ psf_calc_max_all_channels (SF_PRIVATE *psf, double *peaks, int normalize)
|
||||
position = sf_seek ((SNDFILE*) psf, 0, SEEK_CUR) ; /* Get current position in file */
|
||||
sf_seek ((SNDFILE*) psf, 0, SEEK_SET) ; /* Go to start of file. */
|
||||
|
||||
len = ARRAY_LEN (psf->dbuf) ;
|
||||
len = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
data = psf->dbuf ;
|
||||
data = psf->u.dbuf ;
|
||||
|
||||
chan = 0 ;
|
||||
readcount = len ;
|
||||
|
@ -162,7 +162,7 @@ typedef struct sf_private_tag
|
||||
char cbuf [SF_BUFFER_LEN / sizeof (char)] ;
|
||||
signed char scbuf [SF_BUFFER_LEN / sizeof (signed char)] ;
|
||||
unsigned char ucbuf [SF_BUFFER_LEN / sizeof (signed char)] ;
|
||||
} ;
|
||||
} u ;
|
||||
|
||||
char filename [SF_FILENAME_LEN] ;
|
||||
|
||||
|
150
src/double64.c
150
src/double64.c
@ -488,17 +488,17 @@ host_read_d2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
d2s_array (psf->dbuf, readcount, ptr + total) ;
|
||||
d2s_array (psf->u.dbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
len -= readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -513,17 +513,17 @@ host_read_d2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
d2i_array (psf->dbuf, readcount, ptr + total) ;
|
||||
d2i_array (psf->u.dbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
len -= readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -538,17 +538,17 @@ host_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
d2f_array (psf->dbuf, readcount, ptr + total) ;
|
||||
d2f_array (psf->u.dbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
len -= readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -566,14 +566,14 @@ host_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
if (psf->float_endswap != SF_TRUE)
|
||||
return psf_fread (ptr, sizeof (double), len, psf) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
endswap_long_copy ((long*) (ptr + total), psf->lbuf, readcount) ;
|
||||
endswap_long_copy ((long*) (ptr + total), psf->u.lbuf, readcount) ;
|
||||
|
||||
total += readcount ;
|
||||
len -= readcount ;
|
||||
@ -589,21 +589,21 @@ host_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
|
||||
s2d_array (ptr + total, psf->dbuf, bufferlen) ;
|
||||
s2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, psf->dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -618,20 +618,20 @@ host_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2d_array (ptr + total, psf->dbuf, bufferlen) ;
|
||||
i2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, psf->dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -646,20 +646,20 @@ host_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
f2d_array (ptr + total, psf->dbuf, bufferlen) ;
|
||||
f2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, psf->dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -680,15 +680,15 @@ host_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
if (psf->float_endswap != SF_TRUE)
|
||||
return psf_fwrite (ptr, sizeof (double), len, psf) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
|
||||
endswap_long_copy (psf->lbuf, (long*) (ptr + total), bufferlen) ;
|
||||
endswap_long_copy (psf->u.lbuf, (long*) (ptr + total), bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -752,19 +752,19 @@ replace_read_d2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
d2bd_read (psf->dbuf, bufferlen) ;
|
||||
d2bd_read (psf->u.dbuf, bufferlen) ;
|
||||
|
||||
d2s_array (psf->dbuf, readcount, ptr + total) ;
|
||||
d2s_array (psf->u.dbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -779,19 +779,19 @@ replace_read_d2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
d2bd_read (psf->dbuf, bufferlen) ;
|
||||
d2bd_read (psf->u.dbuf, bufferlen) ;
|
||||
|
||||
d2i_array (psf->dbuf, readcount, ptr + total) ;
|
||||
d2i_array (psf->u.dbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -806,19 +806,19 @@ replace_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
d2bd_read (psf->dbuf, bufferlen) ;
|
||||
d2bd_read (psf->u.dbuf, bufferlen) ;
|
||||
|
||||
memcpy (ptr + total, psf->dbuf, bufferlen * sizeof (double)) ;
|
||||
memcpy (ptr + total, psf->u.dbuf, bufferlen * sizeof (double)) ;
|
||||
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -835,19 +835,19 @@ replace_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
/* FIXME : This is probably nowhere near optimal. */
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, readcount) ;
|
||||
endswap_long_array (psf->u.lbuf, readcount) ;
|
||||
|
||||
d2bd_read (psf->dbuf, readcount) ;
|
||||
d2bd_read (psf->u.dbuf, readcount) ;
|
||||
|
||||
memcpy (ptr + total, psf->dbuf, readcount * sizeof (double)) ;
|
||||
memcpy (ptr + total, psf->u.dbuf, readcount * sizeof (double)) ;
|
||||
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -863,22 +863,22 @@ replace_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2d_array (ptr + total, psf->dbuf, bufferlen) ;
|
||||
s2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, psf->dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
bd2d_write (psf->dbuf, bufferlen) ;
|
||||
bd2d_write (psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -893,22 +893,22 @@ replace_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2d_array (ptr + total, psf->dbuf, bufferlen) ;
|
||||
i2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, psf->dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
bd2d_write (psf->dbuf, bufferlen) ;
|
||||
bd2d_write (psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -923,19 +923,19 @@ replace_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
f2d_array (ptr + total, psf->dbuf, bufferlen) ;
|
||||
f2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
bd2d_write (psf->dbuf, bufferlen) ;
|
||||
bd2d_write (psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -954,20 +954,20 @@ replace_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, ptr, len, 0) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->dbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
|
||||
memcpy (psf->dbuf, ptr + total, bufferlen * sizeof (double)) ;
|
||||
memcpy (psf->u.dbuf, ptr + total, bufferlen * sizeof (double)) ;
|
||||
|
||||
bd2d_write (psf->dbuf, bufferlen) ;
|
||||
bd2d_write (psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_long_array (psf->lbuf, bufferlen) ;
|
||||
endswap_long_array (psf->u.lbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
24
src/dwvw.c
24
src/dwvw.c
@ -185,8 +185,8 @@ dwvw_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pdwvw = (DWVW_PRIVATE*) psf->fdata ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
|
||||
@ -241,8 +241,8 @@ dwvw_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
|
||||
@ -272,8 +272,8 @@ dwvw_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80000000) : 1.0 ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
|
||||
@ -552,8 +552,8 @@ dwvw_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pdwvw = (DWVW_PRIVATE*) psf->fdata ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -608,8 +608,8 @@ dwvw_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFFFFFF) : 1.0 ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -639,8 +639,8 @@ dwvw_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFFFFFF) : 1.0 ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
|
152
src/float32.c
152
src/float32.c
@ -440,18 +440,18 @@ host_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
/* Fix me : Need lef2s_array */
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
f2s_array (psf->fbuf, readcount, ptr + total) ;
|
||||
f2s_array (psf->u.fbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -466,17 +466,17 @@ host_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
f2i_array (psf->fbuf, readcount, ptr + total) ;
|
||||
f2i_array (psf->u.fbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -494,14 +494,14 @@ host_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
if (psf->float_endswap != SF_TRUE)
|
||||
return psf_fread (ptr, sizeof (float), len, psf) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
endswap_int_copy ((int*) (ptr + total), psf->ibuf, readcount) ;
|
||||
endswap_int_copy ((int*) (ptr + total), psf->u.ibuf, readcount) ;
|
||||
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -517,18 +517,18 @@ host_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
/* Fix me : Need lef2d_array */
|
||||
f2d_array (psf->fbuf, readcount, ptr + total) ;
|
||||
f2d_array (psf->u.fbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -543,20 +543,20 @@ host_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2f_array (ptr + total, psf->fbuf, bufferlen) ;
|
||||
s2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -571,20 +571,20 @@ host_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2f_array (ptr + total, psf->fbuf, bufferlen) ;
|
||||
i2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->fbuf, sizeof (float) , bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.fbuf, sizeof (float) , bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -605,15 +605,15 @@ host_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
if (psf->float_endswap != SF_TRUE)
|
||||
return psf_fwrite (ptr, sizeof (float), len, psf) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
|
||||
endswap_int_copy (psf->ibuf, (int*) (ptr + total), bufferlen) ;
|
||||
endswap_int_copy (psf->u.ibuf, (int*) (ptr + total), bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -628,21 +628,21 @@ host_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
|
||||
d2f_array (ptr + total, psf->fbuf, bufferlen) ;
|
||||
d2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -706,19 +706,19 @@ replace_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
bf2f_array (psf->fbuf, bufferlen) ;
|
||||
bf2f_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
f2s_array (psf->fbuf, readcount, ptr + total) ;
|
||||
f2s_array (psf->u.fbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -733,19 +733,19 @@ replace_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
bf2f_array (psf->fbuf, bufferlen) ;
|
||||
bf2f_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
f2i_array (psf->fbuf, readcount, ptr + total) ;
|
||||
f2i_array (psf->u.fbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -762,19 +762,19 @@ replace_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
/* FIX THIS */
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
bf2f_array (psf->fbuf, bufferlen) ;
|
||||
bf2f_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
memcpy (ptr + total, psf->fbuf, bufferlen * sizeof (float)) ;
|
||||
memcpy (ptr + total, psf->u.fbuf, bufferlen * sizeof (float)) ;
|
||||
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -790,19 +790,19 @@ replace_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
bf2f_array (psf->fbuf, bufferlen) ;
|
||||
bf2f_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
f2d_array (psf->fbuf, readcount, ptr + total) ;
|
||||
f2d_array (psf->u.fbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -817,22 +817,22 @@ replace_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2f_array (ptr + total, psf->fbuf, bufferlen) ;
|
||||
s2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
f2bf_array (psf->fbuf, bufferlen) ;
|
||||
f2bf_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -847,22 +847,22 @@ replace_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2f_array (ptr + total, psf->fbuf, bufferlen) ;
|
||||
i2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
f2bf_array (psf->fbuf, bufferlen) ;
|
||||
f2bf_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -881,20 +881,20 @@ replace_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, ptr, len, 0) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
|
||||
memcpy (psf->fbuf, ptr + total, bufferlen * sizeof (float)) ;
|
||||
memcpy (psf->u.fbuf, ptr + total, bufferlen * sizeof (float)) ;
|
||||
|
||||
f2bf_array (psf->fbuf, bufferlen) ;
|
||||
f2bf_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->fbuf, sizeof (float) , bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.fbuf, sizeof (float) , bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -909,22 +909,22 @@ replace_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->fbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
d2f_array (ptr + total, psf->fbuf, bufferlen) ;
|
||||
d2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
|
||||
f2bf_array (psf->fbuf, bufferlen) ;
|
||||
f2bf_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->ibuf, bufferlen) ;
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
24
src/gsm610.c
24
src/gsm610.c
@ -270,8 +270,8 @@ gsm610_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = gsm610_read_block (psf, pgsm610, sptr, readcount) ;
|
||||
@ -298,8 +298,8 @@ gsm610_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = gsm610_read_block (psf, pgsm610, sptr, readcount) ;
|
||||
@ -326,8 +326,8 @@ gsm610_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = gsm610_read_block (psf, pgsm610, sptr, readcount) ;
|
||||
@ -499,8 +499,8 @@ gsm610_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -527,8 +527,8 @@ gsm610_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -555,8 +555,8 @@ gsm610_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
|
@ -686,8 +686,8 @@ ima_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pima = (IMA_ADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = ima_read_block (psf, pima, sptr, readcount) ;
|
||||
@ -716,8 +716,8 @@ ima_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = ima_read_block (psf, pima, sptr, readcount) ;
|
||||
@ -746,8 +746,8 @@ ima_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = ima_read_block (psf, pima, sptr, readcount) ;
|
||||
@ -922,8 +922,8 @@ ima_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pima = (IMA_ADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -952,8 +952,8 @@ ima_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -982,8 +982,8 @@ ima_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
|
@ -242,8 +242,8 @@ mat4_read_header (SF_PRIVATE *psf)
|
||||
|
||||
psf_binheader_readf (psf, "d", &value) ;
|
||||
|
||||
LSF_SNPRINTF (psf->scbuf, sizeof (psf->scbuf), " Value : %f\n", value) ;
|
||||
psf_log_printf (psf, psf->scbuf) ;
|
||||
LSF_SNPRINTF (psf->u.scbuf, sizeof (psf->u.scbuf), " Value : %f\n", value) ;
|
||||
psf_log_printf (psf, psf->u.scbuf) ;
|
||||
|
||||
if ((rows != 1) || (cols != 1))
|
||||
return SFE_MAT4_NO_SAMPLERATE ;
|
||||
|
18
src/mat5.c
18
src/mat5.c
@ -203,11 +203,11 @@ mat5_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
psf_fseek (psf, 0, SEEK_SET) ;
|
||||
|
||||
psf_binheader_writef (psf, "S", "MATLAB 5.0 MAT-file, written by " PACKAGE "-" VERSION ", ") ;
|
||||
psf_get_date_str (psf->scbuf, sizeof (psf->scbuf)) ;
|
||||
psf_binheader_writef (psf, "jS", -1, psf->scbuf) ;
|
||||
psf_get_date_str (psf->u.scbuf, sizeof (psf->u.scbuf)) ;
|
||||
psf_binheader_writef (psf, "jS", -1, psf->u.scbuf) ;
|
||||
|
||||
memset (psf->scbuf, ' ', 124 - psf->headindex) ;
|
||||
psf_binheader_writef (psf, "b", psf->scbuf, 124 - psf->headindex) ;
|
||||
memset (psf->u.scbuf, ' ', 124 - psf->headindex) ;
|
||||
psf_binheader_writef (psf, "b", psf->u.scbuf, 124 - psf->headindex) ;
|
||||
|
||||
psf->rwf_endian = psf->endian ;
|
||||
|
||||
@ -260,15 +260,15 @@ mat5_read_header (SF_PRIVATE *psf)
|
||||
short version, endian ;
|
||||
int type, size, flags1, flags2, rows, cols ;
|
||||
|
||||
psf_binheader_readf (psf, "pb", 0, psf->scbuf, 124) ;
|
||||
psf_binheader_readf (psf, "pb", 0, psf->u.scbuf, 124) ;
|
||||
|
||||
psf->scbuf [125] = 0 ;
|
||||
psf->u.scbuf [125] = 0 ;
|
||||
|
||||
if (strlen (psf->scbuf) >= 124)
|
||||
if (strlen (psf->u.scbuf) >= 124)
|
||||
return SFE_UNIMPLEMENTED ;
|
||||
|
||||
if (strstr (psf->cbuf, "MATLAB 5.0 MAT-file") == psf->cbuf)
|
||||
psf_log_printf (psf, "%s\n", psf->scbuf) ;
|
||||
if (strstr (psf->u.cbuf, "MATLAB 5.0 MAT-file") == psf->u.cbuf)
|
||||
psf_log_printf (psf, "%s\n", psf->u.scbuf) ;
|
||||
|
||||
|
||||
psf_binheader_readf (psf, "E22", &version, &endian) ;
|
||||
|
@ -359,8 +359,8 @@ msadpcm_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pms = (MSADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = msadpcm_read_block (psf, pms, sptr, readcount) ;
|
||||
@ -387,8 +387,8 @@ msadpcm_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
pms = (MSADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = msadpcm_read_block (psf, pms, sptr, readcount) ;
|
||||
@ -416,8 +416,8 @@ msadpcm_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pms = (MSADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = msadpcm_read_block (psf, pms, sptr, readcount) ;
|
||||
@ -669,8 +669,8 @@ msadpcm_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pms = (MSADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -698,8 +698,8 @@ msadpcm_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -727,8 +727,8 @@ msadpcm_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pms = (MSADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
|
@ -125,7 +125,7 @@ nist_read_header (SF_PRIVATE *psf)
|
||||
|
||||
psf->sf.format = SF_FORMAT_NIST ;
|
||||
|
||||
psf_header = psf->cbuf ;
|
||||
psf_header = psf->u.cbuf ;
|
||||
|
||||
if (sizeof (psf->header) <= NIST_HEADER_LENGTH)
|
||||
return SFE_INTERNAL ;
|
||||
|
24
src/paf.c
24
src/paf.c
@ -572,8 +572,8 @@ paf24_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
ppaf24 = (PAF24_PRIVATE*) psf->fdata ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = paf24_read (psf, ppaf24, iptr, readcount) ;
|
||||
@ -613,8 +613,8 @@ paf24_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 / 0x80000000) : (1.0 / 0x100) ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = paf24_read (psf, ppaf24, iptr, readcount) ;
|
||||
@ -640,8 +640,8 @@ paf24_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? (1.0 / 0x80000000) : (1.0 / 0x100) ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = paf24_read (psf, ppaf24, iptr, readcount) ;
|
||||
@ -738,8 +738,8 @@ paf24_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
ppaf24 = (PAF24_PRIVATE*) psf->fdata ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -791,8 +791,8 @@ paf24_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFFFFFF) : (1.0 / 0x100) ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -821,8 +821,8 @@ paf24_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFFFFFF) : (1.0 / 0x100) ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
|
360
src/pcm.c
360
src/pcm.c
@ -700,13 +700,13 @@ pcm_read_sc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->scbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.scbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2s_array (psf->scbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2s_array (psf->u.scbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -721,13 +721,13 @@ pcm_read_uc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2s_array (psf->ucbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2s_array (psf->u.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -764,13 +764,13 @@ pcm_read_bet2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2s_array ((tribyte*) (psf->ucbuf), readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2s_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -785,13 +785,13 @@ pcm_read_let2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2s_array ((tribyte*) (psf->ucbuf), readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2s_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -806,13 +806,13 @@ pcm_read_bei2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
bei2s_array (psf->ibuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
bei2s_array (psf->u.ibuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -827,13 +827,13 @@ pcm_read_lei2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
lei2s_array (psf->ibuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
lei2s_array (psf->u.ibuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -851,13 +851,13 @@ pcm_read_sc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->scbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.scbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2i_array (psf->scbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2i_array (psf->u.scbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -872,13 +872,13 @@ pcm_read_uc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2i_array (psf->ucbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2i_array (psf->u.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -893,13 +893,13 @@ pcm_read_bes2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
bes2i_array (psf->sbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
bes2i_array (psf->u.sbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -914,13 +914,13 @@ pcm_read_les2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
les2i_array (psf->sbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
les2i_array (psf->u.sbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -935,13 +935,13 @@ pcm_read_bet2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2i_array ((tribyte*) (psf->ucbuf), readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2i_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -956,13 +956,13 @@ pcm_read_let2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2i_array ((tribyte*) (psf->ucbuf), readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2i_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1005,13 +1005,13 @@ pcm_read_sc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->scbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.scbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2f_array (psf->scbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2f_array (psf->u.scbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1029,13 +1029,13 @@ pcm_read_uc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2f_array (psf->ucbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2f_array (psf->u.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1053,13 +1053,13 @@ pcm_read_bes2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
bes2f_array (psf->sbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
bes2f_array (psf->u.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1077,13 +1077,13 @@ pcm_read_les2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
les2f_array (psf->sbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
les2f_array (psf->u.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1102,13 +1102,13 @@ pcm_read_bet2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
/* Special normfactor because tribyte value is read into an int. */
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2f_array ((tribyte*) (psf->ucbuf), readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2f_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1127,13 +1127,13 @@ pcm_read_let2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
/* Special normfactor because tribyte value is read into an int. */
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2f_array ((tribyte*) (psf->ucbuf), readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2f_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1151,13 +1151,13 @@ pcm_read_bei2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
bei2f_array (psf->ibuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
bei2f_array (psf->u.ibuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1175,13 +1175,13 @@ pcm_read_lei2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
lei2f_array (psf->ibuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
lei2f_array (psf->u.ibuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1202,13 +1202,13 @@ pcm_read_sc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->scbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.scbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2d_array (psf->scbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2d_array (psf->u.scbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1226,13 +1226,13 @@ pcm_read_uc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2d_array (psf->ucbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2d_array (psf->u.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1250,13 +1250,13 @@ pcm_read_bes2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
bes2d_array (psf->sbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
bes2d_array (psf->u.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1274,13 +1274,13 @@ pcm_read_les2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
les2d_array (psf->sbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
les2d_array (psf->u.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1298,13 +1298,13 @@ pcm_read_bet2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80000000) : 1.0 / 256.0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2d_array ((tribyte*) (psf->ucbuf), readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2d_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1323,13 +1323,13 @@ pcm_read_let2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
/* Special normfactor because tribyte value is read into an int. */
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80000000) : 1.0 / 256.0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2d_array ((tribyte*) (psf->ucbuf), readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2d_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1347,13 +1347,13 @@ pcm_read_bei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80000000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
bei2d_array (psf->ibuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
bei2d_array (psf->u.ibuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1371,13 +1371,13 @@ pcm_read_lei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80000000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
lei2d_array (psf->ibuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
lei2d_array (psf->u.ibuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -1397,13 +1397,13 @@ pcm_write_s2sc (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->scbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.scbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2sc_array (ptr + total, psf->scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
s2sc_array (ptr + total, psf->u.scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1418,13 +1418,13 @@ pcm_write_s2uc (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2uc_array (ptr + total, psf->ucbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
s2uc_array (ptr + total, psf->u.ucbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1443,13 +1443,13 @@ pcm_write_s2bes (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
return psf_fwrite (ptr, sizeof (short), len, psf) ;
|
||||
else
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
endswap_short_copy (psf->sbuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
endswap_short_copy (psf->u.sbuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1467,13 +1467,13 @@ pcm_write_s2les (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
if (CPU_IS_LITTLE_ENDIAN)
|
||||
return psf_fwrite (ptr, sizeof (short), len, psf) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
endswap_short_copy (psf->sbuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
endswap_short_copy (psf->u.sbuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1488,13 +1488,13 @@ pcm_write_s2bet (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2bet_array (ptr + total, (tribyte*) (psf->ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
s2bet_array (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1509,13 +1509,13 @@ pcm_write_s2let (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2let_array (ptr + total, (tribyte*) (psf->ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
s2let_array (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1530,13 +1530,13 @@ pcm_write_s2bei (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2bei_array (ptr + total, psf->ibuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
s2bei_array (ptr + total, psf->u.ibuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1551,13 +1551,13 @@ pcm_write_s2lei (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2lei_array (ptr + total, psf->ibuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
s2lei_array (ptr + total, psf->u.ibuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1575,13 +1575,13 @@ pcm_write_i2sc (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->scbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.scbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2sc_array (ptr + total, psf->scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
i2sc_array (ptr + total, psf->u.scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1596,13 +1596,13 @@ pcm_write_i2uc (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2uc_array (ptr + total, psf->ucbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
i2uc_array (ptr + total, psf->u.ucbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1617,13 +1617,13 @@ pcm_write_i2bes (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2bes_array (ptr + total, psf->sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
i2bes_array (ptr + total, psf->u.sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1638,13 +1638,13 @@ pcm_write_i2les (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2les_array (ptr + total, psf->sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
i2les_array (ptr + total, psf->u.sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1659,13 +1659,13 @@ pcm_write_i2bet (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2bet_array (ptr + total, (tribyte*) (psf->ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
i2bet_array (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1680,13 +1680,13 @@ pcm_write_i2let (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2let_array (ptr + total, (tribyte*) (psf->ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
i2let_array (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1704,13 +1704,13 @@ pcm_write_i2bei (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
if (CPU_IS_BIG_ENDIAN)
|
||||
return psf_fwrite (ptr, sizeof (int), len, psf) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
endswap_int_copy (psf->ibuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
endswap_int_copy (psf->u.ibuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1728,13 +1728,13 @@ pcm_write_i2lei (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
if (CPU_IS_LITTLE_ENDIAN)
|
||||
return psf_fwrite (ptr, sizeof (int), len, psf) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
endswap_int_copy (psf->ibuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
endswap_int_copy (psf->u.ibuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1788,13 +1788,13 @@ pcm_write_f2sc (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? f2sc_clip_array : f2sc_array ;
|
||||
bufferlen = ARRAY_LEN (psf->scbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.scbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->scbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.scbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1846,13 +1846,13 @@ pcm_write_f2uc (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? f2uc_clip_array : f2uc_array ;
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->ucbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.ucbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1918,13 +1918,13 @@ pcm_write_f2bes (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? f2bes_clip_array : f2bes_array ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->sbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.sbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1990,13 +1990,13 @@ pcm_write_f2les (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? f2les_clip_array : f2les_array ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->sbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.sbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2066,13 +2066,13 @@ pcm_write_f2let (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? f2let_clip_array : f2let_array ;
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, (tribyte*) (psf->ucbuf), bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
convert (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2142,13 +2142,13 @@ pcm_write_f2bet (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? f2bet_clip_array : f2bet_array ;
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, (tribyte*) (psf->ucbuf), bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
convert (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2221,13 +2221,13 @@ pcm_write_f2bei (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? f2bei_clip_array : f2bei_array ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->ibuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.ibuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2301,13 +2301,13 @@ pcm_write_f2lei (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? f2lei_clip_array : f2lei_array ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->ibuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.ibuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2359,13 +2359,13 @@ pcm_write_d2sc (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? d2sc_clip_array : d2sc_array ;
|
||||
bufferlen = ARRAY_LEN (psf->scbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.scbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->scbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.scbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2417,13 +2417,13 @@ pcm_write_d2uc (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? d2uc_clip_array : d2uc_array ;
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->ucbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.ucbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2489,13 +2489,13 @@ pcm_write_d2bes (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? d2bes_clip_array : d2bes_array ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->sbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.sbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2561,13 +2561,13 @@ pcm_write_d2les (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? d2les_clip_array : d2les_array ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->sbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.sbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2637,13 +2637,13 @@ pcm_write_d2let (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? d2let_clip_array : d2let_array ;
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, (tribyte*) (psf->ucbuf), bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
convert (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2713,13 +2713,13 @@ pcm_write_d2bet (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? d2bet_clip_array : d2bet_array ;
|
||||
bufferlen = sizeof (psf->ucbuf) / SIZEOF_TRIBYTE ;
|
||||
bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, (tribyte*) (psf->ucbuf), bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
convert (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2793,13 +2793,13 @@ pcm_write_d2bei (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? d2bei_clip_array : d2bei_array ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->ibuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.ibuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2873,13 +2873,13 @@ pcm_write_d2lei (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
convert = (psf->add_clipping) ? d2lei_clip_array : d2lei_array ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, psf->ibuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->ibuf, sizeof (int), bufferlen, psf) ;
|
||||
convert (ptr + total, psf->u.ibuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
24
src/sds.c
24
src/sds.c
@ -549,8 +549,8 @@ sds_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
psds = (SDS_PRIVATE*) psf->fdata ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = sds_read (psf, psds, iptr, readcount) ;
|
||||
@ -594,8 +594,8 @@ sds_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
else
|
||||
normfact = 1.0 / (1 << psds->bitwidth) ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = sds_read (psf, psds, iptr, readcount) ;
|
||||
@ -625,8 +625,8 @@ sds_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
else
|
||||
normfact = 1.0 / (1 << psds->bitwidth) ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = sds_read (psf, psds, iptr, readcount) ;
|
||||
@ -876,8 +876,8 @@ sds_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
psds = (SDS_PRIVATE*) psf->fdata ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -921,8 +921,8 @@ sds_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
else
|
||||
normfact = 1.0 * (1 << psds->bitwidth) ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -952,8 +952,8 @@ sds_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
else
|
||||
normfact = 1.0 * (1 << psds->bitwidth) ;
|
||||
|
||||
iptr = psf->ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->ibuf) ;
|
||||
iptr = psf->u.ibuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
|
48
src/ulaw.c
48
src/ulaw.c
@ -859,13 +859,13 @@ ulaw_read_ulaw2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2s_array (psf->ucbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2s_array (psf->u.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -880,13 +880,13 @@ ulaw_read_ulaw2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2i_array (psf->ucbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2i_array (psf->u.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -904,13 +904,13 @@ ulaw_read_ulaw2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2f_array (psf->ucbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2f_array (psf->u.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -927,13 +927,13 @@ ulaw_read_ulaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
double normfact ;
|
||||
|
||||
normfact = (psf->norm_double) ? 1.0 / ((double) 0x8000) : 1.0 ;
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2d_array (psf->ucbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2d_array (psf->u.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -951,13 +951,13 @@ ulaw_write_s2ulaw (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2ulaw_array (ptr + total, bufferlen, psf->ucbuf) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
s2ulaw_array (ptr + total, bufferlen, psf->u.ucbuf) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -972,13 +972,13 @@ ulaw_write_i2ulaw (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2ulaw_array (ptr + total, bufferlen, psf->ucbuf) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
i2ulaw_array (ptr + total, bufferlen, psf->u.ucbuf) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -997,13 +997,13 @@ ulaw_write_f2ulaw (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
/* Factor in a divide by 4. */
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (0.25 * 0x7FFF) : 0.25 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
f2ulaw_array (ptr + total, bufferlen, psf->ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
f2ulaw_array (ptr + total, bufferlen, psf->u.ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1022,13 +1022,13 @@ ulaw_write_d2ulaw (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
/* Factor in a divide by 4. */
|
||||
normfact = (psf->norm_double) ? (0.25 * 0x7FFF) : 0.25 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
d2ulaw_array (ptr + total, bufferlen, psf->ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (psf->ucbuf, 1, bufferlen, psf) ;
|
||||
d2ulaw_array (ptr + total, bufferlen, psf->u.ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
@ -317,8 +317,8 @@ vox_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pvox = (VOX_ADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = vox_read_block (psf, pvox, sptr, readcount) ;
|
||||
@ -347,8 +347,8 @@ vox_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = vox_read_block (psf, pvox, sptr, readcount) ;
|
||||
@ -377,8 +377,8 @@ vox_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = vox_read_block (psf, pvox, sptr, readcount) ;
|
||||
@ -451,8 +451,8 @@ vox_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
return 0 ;
|
||||
pvox = (VOX_ADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -481,8 +481,8 @@ vox_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
@ -511,8 +511,8 @@ vox_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
|
||||
|
||||
sptr = psf->sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
|
42
src/wav.c
42
src/wav.c
@ -412,14 +412,14 @@ wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
|
||||
psf_log_printf (psf, " time stamp : %d\n", psf->pchunk->timestamp) ;
|
||||
psf_log_printf (psf, " Ch Position Value\n") ;
|
||||
|
||||
cptr = psf->cbuf ;
|
||||
cptr = psf->u.cbuf ;
|
||||
for (dword = 0 ; dword < psf->sf.channels ; dword++)
|
||||
{ psf_binheader_readf (psf, "ef4", & (psf->pchunk->peaks [dword].value),
|
||||
& (psf->pchunk->peaks [dword].position)) ;
|
||||
|
||||
LSF_SNPRINTF (cptr, sizeof (psf->cbuf), " %2d %-12d %g\n",
|
||||
LSF_SNPRINTF (cptr, sizeof (psf->u.cbuf), " %2d %-12d %g\n",
|
||||
dword, psf->pchunk->peaks [dword].position, psf->pchunk->peaks [dword].value) ;
|
||||
cptr [sizeof (psf->cbuf) - 1] = 0 ;
|
||||
cptr [sizeof (psf->u.cbuf) - 1] = 0 ;
|
||||
psf_log_printf (psf, cptr) ;
|
||||
} ;
|
||||
|
||||
@ -1123,12 +1123,12 @@ wav_subchunk_parse (SF_PRIVATE *psf, int chunk)
|
||||
case ISRC_MARKER :
|
||||
bytesread += psf_binheader_readf (psf, "e4", &dword) ;
|
||||
dword += (dword & 1) ;
|
||||
if (dword > SIGNED_SIZEOF (psf->cbuf))
|
||||
if (dword > SIGNED_SIZEOF (psf->u.cbuf))
|
||||
{ psf_log_printf (psf, " *** %M : %d (too big)\n", chunk, dword) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->cbuf ;
|
||||
cptr = psf->u.cbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
bytesread += dword ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
@ -1141,12 +1141,12 @@ wav_subchunk_parse (SF_PRIVATE *psf, int chunk)
|
||||
bytesread += psf_binheader_readf (psf, "e44", &dword, &mark_id) ;
|
||||
dword -= 4 ;
|
||||
dword += (dword & 1) ;
|
||||
if (dword > SIGNED_SIZEOF (psf->cbuf))
|
||||
if (dword > SIGNED_SIZEOF (psf->u.cbuf))
|
||||
{ psf_log_printf (psf, " *** %M : %d (too big)\n", chunk, dword) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->cbuf ;
|
||||
cptr = psf->u.cbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
bytesread += dword ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
@ -1179,22 +1179,22 @@ wav_subchunk_parse (SF_PRIVATE *psf, int chunk)
|
||||
|
||||
switch (chunk)
|
||||
{ case ISFT_MARKER :
|
||||
psf_store_string (psf, SF_STR_SOFTWARE, psf->cbuf) ;
|
||||
psf_store_string (psf, SF_STR_SOFTWARE, psf->u.cbuf) ;
|
||||
break ;
|
||||
case ICOP_MARKER :
|
||||
psf_store_string (psf, SF_STR_COPYRIGHT, psf->cbuf) ;
|
||||
psf_store_string (psf, SF_STR_COPYRIGHT, psf->u.cbuf) ;
|
||||
break ;
|
||||
case INAM_MARKER :
|
||||
psf_store_string (psf, SF_STR_TITLE, psf->cbuf) ;
|
||||
psf_store_string (psf, SF_STR_TITLE, psf->u.cbuf) ;
|
||||
break ;
|
||||
case IART_MARKER :
|
||||
psf_store_string (psf, SF_STR_ARTIST, psf->cbuf) ;
|
||||
psf_store_string (psf, SF_STR_ARTIST, psf->u.cbuf) ;
|
||||
break ;
|
||||
case ICMT_MARKER :
|
||||
psf_store_string (psf, SF_STR_COMMENT, psf->cbuf) ;
|
||||
psf_store_string (psf, SF_STR_COMMENT, psf->u.cbuf) ;
|
||||
break ;
|
||||
case ICRD_MARKER :
|
||||
psf_store_string (psf, SF_STR_DATE, psf->cbuf) ;
|
||||
psf_store_string (psf, SF_STR_DATE, psf->u.cbuf) ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
@ -1231,9 +1231,9 @@ wav_read_smpl_chunk (SF_PRIVATE *psf, unsigned int chunklen)
|
||||
|
||||
bytesread += psf_binheader_readf (psf, "e4", &dword) ;
|
||||
if (dword != 0)
|
||||
{ LSF_SNPRINTF (psf->cbuf, sizeof (psf->cbuf), "%f",
|
||||
{ LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f",
|
||||
(1.0 * 0x80000000) / ((unsigned int) dword)) ;
|
||||
psf_log_printf (psf, " Pitch Fract. : %s\n", psf->cbuf) ;
|
||||
psf_log_printf (psf, " Pitch Fract. : %s\n", psf->u.cbuf) ;
|
||||
}
|
||||
else
|
||||
psf_log_printf (psf, " Pitch Fract. : 0\n") ;
|
||||
@ -1242,9 +1242,9 @@ wav_read_smpl_chunk (SF_PRIVATE *psf, unsigned int chunklen)
|
||||
psf_log_printf (psf, " SMPTE Format : %u\n", dword) ;
|
||||
|
||||
bytesread += psf_binheader_readf (psf, "e4", &dword) ;
|
||||
LSF_SNPRINTF (psf->cbuf, sizeof (psf->cbuf), "%02d:%02d:%02d %02d",
|
||||
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%02d:%02d:%02d %02d",
|
||||
(dword >> 24) & 0x7F, (dword >> 16) & 0x7F, (dword >> 8) & 0x7F, dword & 0x7F) ;
|
||||
psf_log_printf (psf, " SMPTE Offset : %s\n", psf->cbuf) ;
|
||||
psf_log_printf (psf, " SMPTE Offset : %s\n", psf->u.cbuf) ;
|
||||
|
||||
bytesread += psf_binheader_readf (psf, "e4", &loop_count) ;
|
||||
psf_log_printf (psf, " Loop Count : %u\n", loop_count) ;
|
||||
@ -1334,14 +1334,14 @@ wav_read_acid_chunk (SF_PRIVATE *psf, unsigned int chunklen)
|
||||
chunklen += (chunklen & 1) ;
|
||||
|
||||
bytesread += psf_binheader_readf (psf, "e224f", &rootnote, &q1, &q2, &q3) ;
|
||||
LSF_SNPRINTF (psf->cbuf, sizeof (psf->cbuf), "%f", q2) ;
|
||||
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", q2) ;
|
||||
psf_log_printf (psf, " Root note : %d\n ???? : %d\n ???? : %s\n ???? : %d\n",
|
||||
rootnote, q1, psf->cbuf, q3) ;
|
||||
rootnote, q1, psf->u.cbuf, q3) ;
|
||||
|
||||
bytesread += psf_binheader_readf (psf, "e422f", &beats, &meter_denom, &meter_numer, &tempo) ;
|
||||
LSF_SNPRINTF (psf->cbuf, sizeof (psf->cbuf), "%f", tempo) ;
|
||||
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", tempo) ;
|
||||
psf_log_printf (psf, " Beats : %d\n Meter : %d/%d\n Tempo : %s\n",
|
||||
beats, meter_denom, meter_numer, psf->cbuf) ;
|
||||
beats, meter_denom, meter_numer, psf->u.cbuf) ;
|
||||
|
||||
psf_binheader_readf (psf, "j", chunklen - bytesread) ;
|
||||
|
||||
|
@ -151,8 +151,8 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
||||
for (k = 0 ; k < wav_fmt->msadpcm.numcoeffs ; k++)
|
||||
{ bytesread +=
|
||||
psf_binheader_readf (psf, "e22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ;
|
||||
LSF_SNPRINTF (psf->cbuf, sizeof (psf->cbuf), " %2d %7d %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
|
||||
psf_log_printf (psf, psf->cbuf) ;
|
||||
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), " %2d %7d %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
|
||||
psf_log_printf (psf, psf->u.cbuf) ;
|
||||
} ;
|
||||
break ;
|
||||
|
||||
|
104
src/xi.c
104
src/xi.c
@ -250,18 +250,18 @@ dpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
||||
|
||||
if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_DPCM_16)
|
||||
{ total = offset ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (total > 0)
|
||||
{ len = (total > bufferlen) ? bufferlen : total ;
|
||||
total -= dpcm_read_dles2s (psf, psf->sbuf, len) ;
|
||||
total -= dpcm_read_dles2s (psf, psf->u.sbuf, len) ;
|
||||
} ;
|
||||
}
|
||||
else
|
||||
{ total = offset ;
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
while (total > 0)
|
||||
{ len = (total > bufferlen) ? bufferlen : total ;
|
||||
total -= dpcm_read_dsc2s (psf, psf->sbuf, len) ;
|
||||
total -= dpcm_read_dsc2s (psf, psf->u.sbuf, len) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
@ -489,13 +489,13 @@ dpcm_read_dsc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
if ((pxi = psf->fdata) == NULL)
|
||||
return 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2s_array (pxi, psf->scbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2s_array (pxi, psf->u.scbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -514,13 +514,13 @@ dpcm_read_dsc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
if ((pxi = psf->fdata) == NULL)
|
||||
return 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2i_array (pxi, psf->scbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2i_array (pxi, psf->u.scbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -542,13 +542,13 @@ dpcm_read_dsc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2f_array (pxi, psf->scbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2f_array (pxi, psf->u.scbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -570,13 +570,13 @@ dpcm_read_dsc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2d_array (pxi, psf->scbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2d_array (pxi, psf->u.scbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -598,13 +598,13 @@ dpcm_read_dles2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
if ((pxi = psf->fdata) == NULL)
|
||||
return 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2s_array (pxi, psf->sbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2s_array (pxi, psf->u.sbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -623,13 +623,13 @@ dpcm_read_dles2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
if ((pxi = psf->fdata) == NULL)
|
||||
return 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2i_array (pxi, psf->sbuf, readcount, ptr + total) ;
|
||||
readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2i_array (pxi, psf->u.sbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -651,13 +651,13 @@ dpcm_read_dles2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2f_array (pxi, psf->sbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2f_array (pxi, psf->u.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -679,13 +679,13 @@ dpcm_read_dles2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2d_array (pxi, psf->sbuf, readcount, ptr + total, normfact) ;
|
||||
readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2d_array (pxi, psf->u.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
break ;
|
||||
@ -718,13 +718,13 @@ dpcm_write_s2dsc (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
if ((pxi = psf->fdata) == NULL)
|
||||
return 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2dsc_array (pxi, ptr + total, psf->scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
s2dsc_array (pxi, ptr + total, psf->u.scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -743,13 +743,13 @@ dpcm_write_i2dsc (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
if ((pxi = psf->fdata) == NULL)
|
||||
return 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2dsc_array (pxi, ptr + total, psf->scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
i2dsc_array (pxi, ptr + total, psf->u.scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -771,13 +771,13 @@ dpcm_write_f2dsc (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7F) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
f2dsc_array (pxi, ptr + total, psf->scbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
f2dsc_array (pxi, ptr + total, psf->u.scbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -799,13 +799,13 @@ dpcm_write_d2dsc (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7F) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->ucbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.ucbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
d2dsc_array (pxi, ptr + total, psf->scbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (psf->scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
d2dsc_array (pxi, ptr + total, psf->u.scbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -825,13 +825,13 @@ dpcm_write_s2dles (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
if ((pxi = psf->fdata) == NULL)
|
||||
return 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2dles_array (pxi, ptr + total, psf->sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
s2dles_array (pxi, ptr + total, psf->u.sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -850,13 +850,13 @@ dpcm_write_i2dles (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
if ((pxi = psf->fdata) == NULL)
|
||||
return 0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2dles_array (pxi, ptr + total, psf->sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
i2dles_array (pxi, ptr + total, psf->u.sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -878,13 +878,13 @@ dpcm_write_f2dles (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
f2dles_array (pxi, ptr + total, psf->sbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
f2dles_array (pxi, ptr + total, psf->u.sbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -906,13 +906,13 @@ dpcm_write_d2dles (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->sbuf) ;
|
||||
bufferlen = ARRAY_LEN (psf->u.sbuf) ;
|
||||
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
d2dles_array (pxi, ptr + total, psf->sbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (psf->sbuf, sizeof (short), bufferlen, psf) ;
|
||||
d2dles_array (pxi, ptr + total, psf->u.sbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
Loading…
Reference in New Issue
Block a user