More whitespace and cstyle fixes.

This commit is contained in:
Erik de Castro Lopo 2012-01-21 14:24:38 +11:00
parent 18c1105981
commit 8508ec5679
42 changed files with 237 additions and 237 deletions

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@ -91,6 +91,6 @@ main (void)
puts (sf_strerror (file)) ;
sf_close (file) ;
return 0 ;
return 0 ;
} /* main */

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@ -68,9 +68,9 @@ convert_to_text (SNDFILE * infile, FILE * outfile, int channels)
int
main (int argc, char * argv [])
{ char *progname, *infilename, *outfilename ;
SNDFILE *infile = NULL ;
SNDFILE *infile = NULL ;
FILE *outfile = NULL ;
SF_INFO sfinfo ;
SF_INFO sfinfo ;
progname = strrchr (argv [0], '/') ;
progname = progname ? progname + 1 : argv [0] ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008 George Blood Audio
**
** All rights reserved.
@ -41,9 +41,9 @@
#include "common.h"
#define BUFFER_LEN 4096
#define BUFFER_LEN 4096
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
void
sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels)

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@ -32,7 +32,7 @@
#define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof (x [0])))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
typedef struct
{ const char * title ;

View File

@ -67,8 +67,8 @@ usage_exit (const char *progname)
int
main (int argc, char *argv [])
{ const char *progname, *outfilename ;
SNDFILE *outfile, **infiles ;
SF_INFO sfinfo_out, sfinfo_in ;
SNDFILE *outfile, **infiles ;
SF_INFO sfinfo_out, sfinfo_in ;
void (*func) (SNDFILE*, SNDFILE*, int) ;
int k ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@ -91,8 +91,8 @@ usage_exit (const char *progname)
int
main (int argc, char * argv [])
{ const char *progname, *infilename, *outfilename ;
SNDFILE *infile = NULL, *outfile = NULL ;
SF_INFO sfinfo ;
SNDFILE *infile = NULL, *outfile = NULL ;
SF_INFO sfinfo ;
int k, outfilemajor, outfileminor = 0, infileminor ;
int override_sample_rate = 0 ; /* assume no sample rate override. */

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@ -222,8 +222,8 @@ generate_duration_str (SF_INFO *sfinfo)
static void
info_dump (const char *filename)
{ static char strbuffer [BUFFER_LEN] ;
SNDFILE *file ;
SF_INFO sfinfo ;
SNDFILE *file ;
SF_INFO sfinfo ;
double signal_max, decibels ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
@ -287,8 +287,8 @@ str_of_type (int mode)
static int
instrument_dump (const char *filename)
{ SNDFILE *file ;
SF_INFO sfinfo ;
{ SNDFILE *file ;
SF_INFO sfinfo ;
SF_INSTRUMENT inst ;
int got_inst, k ;
@ -326,8 +326,8 @@ instrument_dump (const char *filename)
static int
broadcast_dump (const char *filename)
{ SNDFILE *file ;
SF_INFO sfinfo ;
{ SNDFILE *file ;
SF_INFO sfinfo ;
SF_BROADCAST_INFO_2K bext ;
double time_ref_sec ;
int got_bext ;
@ -382,8 +382,8 @@ broadcast_dump (const char *filename)
static int
chanmap_dump (const char *filename)
{ SNDFILE *file ;
SF_INFO sfinfo ;
{ SNDFILE *file ;
SF_INFO sfinfo ;
int * channel_map ;
int got_chanmap, k ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2010 George Blood Audio
**
** All rights reserved.
@ -131,14 +131,14 @@ process_args (SNDFILE * file, const SF_BROADCAST_INFO_2K * binfo, int argc, char
{ const char * str ;
int k, do_all = 0 ;
#define HANDLE_BEXT_ARG(cmd,name,field) \
#define HANDLE_BEXT_ARG(cmd, name, field) \
if (do_all || strcmp (argv [k], cmd) == 0) \
{ printf ("%-20s : %.*s\n", name, (int) sizeof (binfo->field), binfo->field) ; \
if (! do_all) \
continue ; \
} ;
#define HANDLE_STR_ARG(cmd,name,id) \
#define HANDLE_STR_ARG(cmd, name, id) \
if (do_all || strcmp (argv [k], cmd) == 0) \
{ str = sf_get_string (file, id) ; \
printf ("%-20s : %s\n", name, str ? str : "") ; \

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2010 George Blood Audio
**
** All rights reserved.
@ -87,7 +87,7 @@ main (int argc, char *argv [])
continue ;
} ;
#define HANDLE_BEXT_ARG(cmd,field) \
#define HANDLE_BEXT_ARG(cmd, field) \
if (strcmp (argv [k], cmd) == 0) \
{ k ++ ; \
if (k == argc) missing_param (argv [k - 1]) ; \
@ -104,7 +104,7 @@ main (int argc, char *argv [])
HANDLE_BEXT_ARG ("--bext-coding-hist", coding_history) ;
HANDLE_BEXT_ARG ("--bext-time-ref", time_ref) ;
#define HANDLE_STR_ARG(cmd,field) \
#define HANDLE_STR_ARG(cmd, field) \
if (strcmp (argv [k], cmd) == 0) \
{ k ++ ; \
if (k == argc) missing_param (argv [k - 1]) ; \

View File

@ -835,7 +835,7 @@ static void
sndio_play (int argc, char *argv [])
{ struct sio_hdl *hdl ;
struct sio_par par ;
short buffer [BUFFER_LEN] ;
short buffer [BUFFER_LEN] ;
SNDFILE *sndfile ;
SF_INFO sfinfo ;
int k, readcount ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2006-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2006-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2006 Paul Davis <paul@linuxaudiosystems.com>
**
** This program is free software; you can redistribute it and/or modify
@ -60,7 +60,7 @@ broadcast_var_set (SF_PRIVATE *psf, const SF_BROADCAST_INFO * info, size_t datas
if (psf->broadcast_16k == NULL)
{ if ((psf->broadcast_16k = broadcast_var_alloc ()) == NULL)
{ psf->error = SFE_MALLOC_FAILED ;
{ psf->error = SFE_MALLOC_FAILED ;
return SF_FALSE ;
} ;
} ;
@ -120,16 +120,16 @@ gen_coding_history (char * added_history, int added_history_max, const SF_INFO *
** Parameter Variable string <allowed option> Unit
** ==========================================================================================
** Coding Algorithm A=<ANALOGUE, PCM, MPEG1L1, MPEG1L2, MPEG1L3,
** MPEG2L1, MPEG2L2, MPEG2L3>
** MPEG2L1, MPEG2L2, MPEG2L3>
** Sampling frequency F=<11000,22050,24000,32000,44100,48000> [Hz]
** Bit-rate B=<any bit-rate allowed in MPEG 2 (ISO/IEC [kbit/s per channel]
** 13818-3)>
** 13818-3)>
** Word Length W=<8, 12, 14, 16, 18, 20, 22, 24> [bits]
** Mode M=<mono, stereo, dual-mono, joint-stereo>
** Text, free string T=<a free ASCII-text string for in house use.
** This string should contain no commas (ASCII
** 2Chex). Examples of the contents: ID-No; codec
** type; A/D type>
** This string should contain no commas (ASCII
** 2Chex). Examples of the contents: ID-No; codec
** type; A/D type>
*/
switch (psfinfo->channels)

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2001-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2001-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -115,10 +115,10 @@ static SF_FORMAT_INFO const major_formats [] =
{
{ SF_FORMAT_AIFF, "AIFF (Apple/SGI)", "aiff" },
{ SF_FORMAT_AU, "AU (Sun/NeXT)", "au" },
{ SF_FORMAT_AVR, "AVR (Audio Visual Research)", "avr" },
{ SF_FORMAT_CAF, "CAF (Apple Core Audio File)", "caf" },
{ SF_FORMAT_AVR, "AVR (Audio Visual Research)", "avr" },
{ SF_FORMAT_CAF, "CAF (Apple Core Audio File)", "caf" },
#if HAVE_EXTERNAL_LIBS
{ SF_FORMAT_FLAC, "FLAC (FLAC Lossless Audio Codec)", "flac" },
{ SF_FORMAT_FLAC, "FLAC (FLAC Lossless Audio Codec)", "flac" },
#endif
{ SF_FORMAT_HTK, "HTK (HMM Tool Kit)", "htk" },
{ SF_FORMAT_SVX, "IFF (Amiga IFF/SVX8/SV16)", "iff" },
@ -126,11 +126,11 @@ static SF_FORMAT_INFO const major_formats [] =
{ SF_FORMAT_MAT5, "MAT5 (GNU Octave 2.1 / Matlab 5.0)", "mat" },
{ SF_FORMAT_MPC2K, "MPC (Akai MPC 2k)", "mpc" },
#if HAVE_EXTERNAL_LIBS
{ SF_FORMAT_OGG, "OGG (OGG Container format)", "oga" },
{ SF_FORMAT_OGG, "OGG (OGG Container format)", "oga" },
#endif
{ SF_FORMAT_PAF, "PAF (Ensoniq PARIS)", "paf" },
{ SF_FORMAT_PVF, "PVF (Portable Voice Format)", "pvf" },
{ SF_FORMAT_RAW, "RAW (header-less)", "raw" },
{ SF_FORMAT_RAW, "RAW (header-less)", "raw" },
{ SF_FORMAT_RF64, "RF64 (RIFF 64)", "rf64" },
{ SF_FORMAT_SD2, "SD2 (Sound Designer II)", "sd2" },
{ SF_FORMAT_SDS, "SDS (Midi Sample Dump Standard)", "sds" },
@ -138,7 +138,7 @@ static SF_FORMAT_INFO const major_formats [] =
{ SF_FORMAT_VOC, "VOC (Creative Labs)", "voc" },
{ SF_FORMAT_W64, "W64 (SoundFoundry WAVE 64)", "w64" },
{ SF_FORMAT_WAV, "WAV (Microsoft)", "wav" },
{ SF_FORMAT_NIST, "WAV (NIST Sphere)", "wav" },
{ SF_FORMAT_NIST, "WAV (NIST Sphere)", "wav" },
{ SF_FORMAT_WAVEX, "WAVEX (Microsoft)", "wav" },
{ SF_FORMAT_WVE, "WVE (Psion Series 3)", "wve" },
{ SF_FORMAT_XI, "XI (FastTracker 2)", "xi" },

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -776,17 +776,17 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
((ptr) [1] << 8) | ((ptr) [0]) )
#define GET_BE_INT(ptr) ( ((ptr) [0] << 24) | ((ptr) [1] << 16) | \
((ptr) [2] << 8) | ((ptr) [3]) )
((ptr) [2] << 8) | ((ptr) [3]) )
#define GET_LE_8BYTE(ptr) ( (((sf_count_t) (ptr) [7]) << 56) | (((sf_count_t) (ptr) [6]) << 48) | \
(((sf_count_t) (ptr) [5]) << 40) | (((sf_count_t) (ptr) [4]) << 32) | \
(((sf_count_t) (ptr) [3]) << 24) | (((sf_count_t) (ptr) [2]) << 16) | \
(((sf_count_t) (ptr) [1]) << 8 ) | ((ptr) [0]))
(((sf_count_t) (ptr) [5]) << 40) | (((sf_count_t) (ptr) [4]) << 32) | \
(((sf_count_t) (ptr) [3]) << 24) | (((sf_count_t) (ptr) [2]) << 16) | \
(((sf_count_t) (ptr) [1]) << 8 ) | ((ptr) [0]))
#define GET_BE_8BYTE(ptr) ( (((sf_count_t) (ptr) [0]) << 56) | (((sf_count_t) (ptr) [1]) << 48) | \
(((sf_count_t) (ptr) [2]) << 40) | (((sf_count_t) (ptr) [3]) << 32) | \
(((sf_count_t) (ptr) [4]) << 24) | (((sf_count_t) (ptr) [5]) << 16) | \
(((sf_count_t) (ptr) [6]) << 8 ) | ((ptr) [7]))
(((sf_count_t) (ptr) [2]) << 40) | (((sf_count_t) (ptr) [3]) << 32) | \
(((sf_count_t) (ptr) [4]) << 24) | (((sf_count_t) (ptr) [5]) << 16) | \
(((sf_count_t) (ptr) [6]) << 8 ) | ((ptr) [7]))

View File

@ -93,20 +93,20 @@
#define NOT(x) (! (x))
#if (COMPILER_IS_GCC == 1)
#define SF_MAX(x,y) ({ \
#define SF_MAX(x, y) ({ \
typeof (x) sf_max_x1 = (x) ; \
typeof (y) sf_max_y1 = (y) ; \
(void) (&sf_max_x1 == &sf_max_y1) ; \
sf_max_x1 > sf_max_y1 ? sf_max_x1 : sf_max_y1 ; })
#define SF_MIN(x,y) ({ \
#define SF_MIN(x, y) ({ \
typeof (x) sf_min_x2 = (x) ; \
typeof (y) sf_min_y2 = (y) ; \
(void) (&sf_min_x2 == &sf_min_y2) ; \
sf_min_x2 < sf_min_y2 ? sf_min_x2 : sf_min_y2 ; })
#else
#define SF_MAX(a,b) ((a) > (b) ? (a) : (b))
#define SF_MIN(a,b) ((a) < (b) ? (a) : (b))
#define SF_MAX(a, b) ((a) > (b) ? (a) : (b))
#define SF_MIN(a, b) ((a) < (b) ? (a) : (b))
#endif

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -150,9 +150,9 @@ dwd_read_header (SF_PRIVATE *psf)
else
psf_log_printf (psf, "None\n") ;
psf_log_printf (psf, " Sample Rate : %d\n Channels : %d\n"
" Bit Width : %d\n",
dwdh.srate, dwdh.channels, dwdh.bitwidth) ;
psf_log_printf (psf, " Sample Rate : %d\n Channels : %d\n"
" Bit Width : %d\n",
dwdh.srate, dwdh.channels, dwdh.bitwidth) ;
switch (dwdh.bitwidth)
{ case 8 :

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -461,9 +461,9 @@ dump_bits (DWVW_PRIVATE *pdwvw)
} /* dump_bits */
#endif
#define HIGHEST_BIT(x,count) \
#define HIGHEST_BIT(x, count) \
{ int y = x ; \
(count) = 0 ; \
(count) = 0 ; \
while (y) \
{ (count) ++ ; \
y >>= 1 ; \

View File

@ -980,7 +980,7 @@ psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
/* USE_WINDOWS_API */ sf_count_t
psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ sf_count_t total = 0 ;
ssize_t count ;
ssize_t count ;
DWORD dwNumberOfBytesWritten ;
if (psf->virtual_io)
@ -1276,7 +1276,7 @@ psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence)
/* Win32 */ sf_count_t
psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ sf_count_t total = 0 ;
ssize_t count ;
ssize_t count ;
if (psf->virtual_io)
return psf->vio.read (ptr, bytes*items, psf->vio_user_data) / bytes ;
@ -1314,7 +1314,7 @@ psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
/* Win32 */ sf_count_t
psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ sf_count_t total = 0 ;
ssize_t count ;
ssize_t count ;
if (psf->virtual_io)
return psf->vio.write (ptr, bytes*items, psf->vio_user_data) / bytes ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -134,7 +134,7 @@ g72x_init (SF_PRIVATE * psf)
psf->read_float = g72x_read_f ;
psf->read_double = g72x_read_d ;
psf->seek = g72x_seek ;
psf->seek = g72x_seek ;
if (psf->datalength % pg72x->blocksize)
{ psf_log_printf (psf, "*** Odd psf->datalength (%D) should be a multiple of %d\n", psf->datalength, pg72x->blocksize) ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2001-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2001-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -95,7 +95,7 @@ ircam_open (SF_PRIVATE *psf)
if (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU)
psf->endian = (CPU_IS_BIG_ENDIAN) ? SF_ENDIAN_BIG : SF_ENDIAN_LITTLE ;
psf->dataoffset = IRCAM_DATA_OFFSET ;
psf->dataoffset = IRCAM_DATA_OFFSET ;
if ((error = ircam_write_header (psf, SF_FALSE)))
return error ;
@ -163,9 +163,10 @@ ircam_read_header (SF_PRIVATE *psf)
psf->sf.samplerate = (int) samplerate ;
psf_log_printf (psf, " Sample Rate : %d\n"
" Channels : %d\n"
" Encoding : %X => %s\n", psf->sf.samplerate, psf->sf.channels, encoding, get_encoding_str (encoding)) ;
psf_log_printf (psf, " Sample Rate : %d\n"
" Channels : %d\n"
" Encoding : %X => %s\n",
psf->sf.samplerate, psf->sf.channels, encoding, get_encoding_str (encoding)) ;
switch (encoding)
{ case IRCAM_PCM_16 :

View File

@ -159,7 +159,7 @@ wav_w64_msadpcm_init (SF_PRIVATE *psf, int blockalign, int samplesperblock)
} ;
if (psf->file.mode == SFM_READ)
{ pms->dataremaining = psf->datalength ;
{ pms->dataremaining = psf->datalength ;
if (psf->datalength % pms->blocksize)
pms->blocks = psf->datalength / pms->blocksize + 1 ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2007 John ffitch
**
** This program is free software ; you can redistribute it and/or modify
@ -106,7 +106,7 @@ ogg_close (SF_PRIVATE *psf)
static int
ogg_stream_classify (SF_PRIVATE *psf, OGG_PRIVATE* odata)
{ char *buffer ;
int bytes, nn ;
int bytes, nn ;
/* Call this here so it only gets called once, so no memory is leaked. */
ogg_sync_init (&odata->osync) ;

View File

@ -132,7 +132,7 @@ vorbis_read_header (SF_PRIVATE *psf, int log_data)
OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
char *buffer ;
int bytes ;
int bytes ;
int i, nn ;
odata->eos = 0 ;
@ -249,7 +249,7 @@ vorbis_read_header (SF_PRIVATE *psf, int log_data)
** header page is the only place where missing data is fatal.
*/
i = 0 ; /* Count of number of packets read */
i = 0 ; /* Count of number of packets read */
while (i < 2)
{ int result = ogg_sync_pageout (&odata->osync, &odata->opage) ;
if (result == 0)
@ -349,10 +349,10 @@ vorbis_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
#if 0
ret = vorbis_encode_init (&vdata->vinfo, psf->sf.channels, psf->sf.samplerate, -1, 128000, -1) ; /* average bitrate mode */
ret = ( vorbis_encode_setup_managed (&vdata->vinfo, psf->sf.channels,
psf->sf.samplerate, -1, 128000, -1) ||
vorbis_encode_ctl (&vdata->vinfo, OV_ECTL_RATEMANAGE_AVG, NULL) ||
vorbis_encode_setup_init (&vdata->vinfo)) ;
ret = ( vorbis_encode_setup_managed (&vdata->vinfo, psf->sf.channels, psf->sf.samplerate, -1, 128000, -1)
|| vorbis_encode_ctl (&vdata->vinfo, OV_ECTL_RATEMANAGE_AVG, NULL)
|| vorbis_encode_setup_init (&vdata->vinfo)
) ;
#endif
if (ret)
return SFE_BAD_OPEN_FORMAT ;
@ -644,7 +644,7 @@ vorbis_read_sample (SF_PRIVATE *psf, void *ptr, sf_count_t lens, convert_func *t
if (len == 0)
return i ; /* Is this necessary */
}
goto start0 ; /* Jump into the nasty nest */
goto start0 ; /* Jump into the nasty nest */
while (len > 0 && !odata->eos)
{
while (len > 0 && !odata->eos)

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -61,9 +61,9 @@ typedef __int64 int64_t ;
*/
#if (CPU_IS_LITTLE_ENDIAN == 1)
#define MAKE_MARKER(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
#define MAKE_MARKER(a, b, c, d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
#elif (CPU_IS_BIG_ENDIAN == 1)
#define MAKE_MARKER(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
#define MAKE_MARKER(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
#else
#error "Target CPU endian-ness unknown. May need to hand edit src/sfconfig.h"
#endif

View File

@ -165,8 +165,7 @@ ErrorStruct SndfileErrors [] =
{ SFE_AU_EMBED_BAD_LEN , "Embedded AU file with unknown length." },
{ SFE_RAW_READ_BAD_SPEC , "Error while opening RAW file for read. Must specify format and channels.\n"
"Possibly trying to open unsupported format."
},
"Possibly trying to open unsupported format." },
{ SFE_RAW_BAD_BITWIDTH , "Error. RAW file bitwidth must be a multiple of 8." },
{ SFE_RAW_BAD_FORMAT , "Error. Bad format field in SF_INFO struct when openning a RAW file for read." },
@ -288,7 +287,7 @@ static char sf_syserr [SF_SYSERR_LEN] = { 0 } ;
/*------------------------------------------------------------------------------
*/
#define VALIDATE_SNDFILE_AND_ASSIGN_PSF(a,b,c) \
#define VALIDATE_SNDFILE_AND_ASSIGN_PSF(a, b, c) \
{ if ((a) == NULL) \
{ sf_errno = SFE_BAD_SNDFILE_PTR ; \
return 0 ; \

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2006-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2006-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -33,7 +33,7 @@
** This is a bit rough, but it is the nicest way to do it.
*/
#define cmp_test(line,ival,tval,str) \
#define cmp_test(line, ival, tval, str) \
if (ival != tval) \
{ printf (str, line, ival, tval) ; \
exit (1) ; \

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2003-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2003-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -28,36 +28,36 @@
#include "test_main.h"
#define CMP_0_ARGS(line,err,fmt) \
#define CMP_0_ARGS(line, err, fmt) \
{ psf->logindex = 0 ; \
snprintf (buffer, sizeof (buffer), (fmt)) ; \
psf_log_printf (psf, (fmt)) ; \
err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \
}
#define CMP_2_ARGS(line,err,fmt,a) \
{ psf->logindex = 0 ; \
#define CMP_2_ARGS(line, err, fmt, a) \
{ psf->logindex = 0 ; \
snprintf (buffer, sizeof (buffer), (fmt), (a), (a)) ; \
psf_log_printf (psf, (fmt), (a), (a)) ; \
err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \
}
#define CMP_4_ARGS(line,err,fmt,a) \
{ psf->logindex = 0 ; \
#define CMP_4_ARGS(line, err, fmt, a) \
{ psf->logindex = 0 ; \
snprintf (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a)) ; \
psf_log_printf (psf, (fmt), (a), (a), (a), (a)) ; \
err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \
}
#define CMP_5_ARGS(line,err,fmt,a) \
{ psf->logindex = 0 ; \
#define CMP_5_ARGS(line, err, fmt, a) \
{ psf->logindex = 0 ; \
snprintf (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a)) ; \
psf_log_printf (psf, (fmt), (a), (a), (a), (a), (a)) ; \
err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \
}
#define CMP_6_ARGS(line,err,fmt,a) \
{ psf->logindex = 0 ; \
#define CMP_6_ARGS(line, err, fmt, a) \
{ psf->logindex = 0 ; \
snprintf (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a), (a)) ; \
psf_log_printf (psf, (fmt), (a), (a), (a), (a), (a), (a)) ; \
err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -51,8 +51,8 @@ txw_open (SF_PRIVATE *psf)
#define TXW_DATA_OFFSET 32
#define TXW_LOOPED 0x49
#define TXW_NO_LOOP 0xC9
#define TXW_LOOPED 0x49
#define TXW_NO_LOOP 0xC9
/*------------------------------------------------------------------------------
** Private static functions.

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -37,13 +37,13 @@
** header.
*/
#define MAKE_HASH16(x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,xa,xb,xc,xd,xe,xf) \
#define MAKE_HASH16(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, xa, xb, xc, xd, xe, xf) \
( (x0) ^ ((x1) << 1) ^ ((x2) << 2) ^ ((x3) << 3) ^ \
((x4) << 4) ^ ((x5) << 5) ^ ((x6) << 6) ^ ((x7) << 7) ^ \
((x8) << 8) ^ ((x9) << 9) ^ ((xa) << 10) ^ ((xb) << 11) ^ \
((xc) << 12) ^ ((xd) << 13) ^ ((xe) << 14) ^ ((xf) << 15) )
#define MAKE_MARKER16(name,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,xa,xb,xc,xd,xe,xf) \
#define MAKE_MARKER16(name, x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, xa, xb, xc, xd, xe, xf) \
static unsigned char name [16] = { (x0), (x1), (x2), (x3), (x4), (x5), \
(x6), (x7), (x8), (x9), (xa), (xb), (xc), (xd), (xe), (xf) }

130
src/wav.c
View File

@ -35,62 +35,62 @@
* Macros to handle big/little endian issues.
*/
#define RIFF_MARKER (MAKE_MARKER ('R', 'I', 'F', 'F'))
#define RIFX_MARKER (MAKE_MARKER ('R', 'I', 'F', 'X'))
#define WAVE_MARKER (MAKE_MARKER ('W', 'A', 'V', 'E'))
#define fmt_MARKER (MAKE_MARKER ('f', 'm', 't', ' '))
#define data_MARKER (MAKE_MARKER ('d', 'a', 't', 'a'))
#define fact_MARKER (MAKE_MARKER ('f', 'a', 'c', 't'))
#define PEAK_MARKER (MAKE_MARKER ('P', 'E', 'A', 'K'))
#define RIFF_MARKER (MAKE_MARKER ('R', 'I', 'F', 'F'))
#define RIFX_MARKER (MAKE_MARKER ('R', 'I', 'F', 'X'))
#define WAVE_MARKER (MAKE_MARKER ('W', 'A', 'V', 'E'))
#define fmt_MARKER (MAKE_MARKER ('f', 'm', 't', ' '))
#define data_MARKER (MAKE_MARKER ('d', 'a', 't', 'a'))
#define fact_MARKER (MAKE_MARKER ('f', 'a', 'c', 't'))
#define PEAK_MARKER (MAKE_MARKER ('P', 'E', 'A', 'K'))
#define cue_MARKER (MAKE_MARKER ('c', 'u', 'e', ' '))
#define LIST_MARKER (MAKE_MARKER ('L', 'I', 'S', 'T'))
#define slnt_MARKER (MAKE_MARKER ('s', 'l', 'n', 't'))
#define wavl_MARKER (MAKE_MARKER ('w', 'a', 'v', 'l'))
#define INFO_MARKER (MAKE_MARKER ('I', 'N', 'F', 'O'))
#define plst_MARKER (MAKE_MARKER ('p', 'l', 's', 't'))
#define adtl_MARKER (MAKE_MARKER ('a', 'd', 't', 'l'))
#define labl_MARKER (MAKE_MARKER ('l', 'a', 'b', 'l'))
#define ltxt_MARKER (MAKE_MARKER ('l', 't', 'x', 't'))
#define note_MARKER (MAKE_MARKER ('n', 'o', 't', 'e'))
#define smpl_MARKER (MAKE_MARKER ('s', 'm', 'p', 'l'))
#define bext_MARKER (MAKE_MARKER ('b', 'e', 'x', 't'))
#define iXML_MARKER (MAKE_MARKER ('i', 'X', 'M', 'L'))
#define levl_MARKER (MAKE_MARKER ('l', 'e', 'v', 'l'))
#define MEXT_MARKER (MAKE_MARKER ('M', 'E', 'X', 'T'))
#define DISP_MARKER (MAKE_MARKER ('D', 'I', 'S', 'P'))
#define acid_MARKER (MAKE_MARKER ('a', 'c', 'i', 'd'))
#define strc_MARKER (MAKE_MARKER ('s', 't', 'r', 'c'))
#define PAD_MARKER (MAKE_MARKER ('P', 'A', 'D', ' '))
#define afsp_MARKER (MAKE_MARKER ('a', 'f', 's', 'p'))
#define clm_MARKER (MAKE_MARKER ('c', 'l', 'm', ' '))
#define elmo_MARKER (MAKE_MARKER ('e', 'l', 'm', 'o'))
#define cart_MARKER (MAKE_MARKER ('c', 'a', 'r', 't'))
#define FLLR_MARKER (MAKE_MARKER ('F', 'L', 'L', 'R'))
#define cue_MARKER (MAKE_MARKER ('c', 'u', 'e', ' '))
#define LIST_MARKER (MAKE_MARKER ('L', 'I', 'S', 'T'))
#define slnt_MARKER (MAKE_MARKER ('s', 'l', 'n', 't'))
#define wavl_MARKER (MAKE_MARKER ('w', 'a', 'v', 'l'))
#define INFO_MARKER (MAKE_MARKER ('I', 'N', 'F', 'O'))
#define plst_MARKER (MAKE_MARKER ('p', 'l', 's', 't'))
#define adtl_MARKER (MAKE_MARKER ('a', 'd', 't', 'l'))
#define labl_MARKER (MAKE_MARKER ('l', 'a', 'b', 'l'))
#define ltxt_MARKER (MAKE_MARKER ('l', 't', 'x', 't'))
#define note_MARKER (MAKE_MARKER ('n', 'o', 't', 'e'))
#define smpl_MARKER (MAKE_MARKER ('s', 'm', 'p', 'l'))
#define bext_MARKER (MAKE_MARKER ('b', 'e', 'x', 't'))
#define iXML_MARKER (MAKE_MARKER ('i', 'X', 'M', 'L'))
#define levl_MARKER (MAKE_MARKER ('l', 'e', 'v', 'l'))
#define MEXT_MARKER (MAKE_MARKER ('M', 'E', 'X', 'T'))
#define DISP_MARKER (MAKE_MARKER ('D', 'I', 'S', 'P'))
#define acid_MARKER (MAKE_MARKER ('a', 'c', 'i', 'd'))
#define strc_MARKER (MAKE_MARKER ('s', 't', 'r', 'c'))
#define PAD_MARKER (MAKE_MARKER ('P', 'A', 'D', ' '))
#define afsp_MARKER (MAKE_MARKER ('a', 'f', 's', 'p'))
#define clm_MARKER (MAKE_MARKER ('c', 'l', 'm', ' '))
#define elmo_MARKER (MAKE_MARKER ('e', 'l', 'm', 'o'))
#define cart_MARKER (MAKE_MARKER ('c', 'a', 'r', 't'))
#define FLLR_MARKER (MAKE_MARKER ('F', 'L', 'L', 'R'))
#define exif_MARKER (MAKE_MARKER ('e', 'x', 'i', 'f'))
#define ever_MARKER (MAKE_MARKER ('e', 'v', 'e', 'r'))
#define etim_MARKER (MAKE_MARKER ('e', 't', 'i', 'm'))
#define ecor_MARKER (MAKE_MARKER ('e', 'c', 'o', 'r'))
#define emdl_MARKER (MAKE_MARKER ('e', 'm', 'd', 'l'))
#define emnt_MARKER (MAKE_MARKER ('e', 'm', 'n', 't'))
#define erel_MARKER (MAKE_MARKER ('e', 'r', 'e', 'l'))
#define eucm_MARKER (MAKE_MARKER ('e', 'u', 'c', 'm'))
#define olym_MARKER (MAKE_MARKER ('o', 'l', 'y', 'm'))
#define exif_MARKER (MAKE_MARKER ('e', 'x', 'i', 'f'))
#define ever_MARKER (MAKE_MARKER ('e', 'v', 'e', 'r'))
#define etim_MARKER (MAKE_MARKER ('e', 't', 'i', 'm'))
#define ecor_MARKER (MAKE_MARKER ('e', 'c', 'o', 'r'))
#define emdl_MARKER (MAKE_MARKER ('e', 'm', 'd', 'l'))
#define emnt_MARKER (MAKE_MARKER ('e', 'm', 'n', 't'))
#define erel_MARKER (MAKE_MARKER ('e', 'r', 'e', 'l'))
#define eucm_MARKER (MAKE_MARKER ('e', 'u', 'c', 'm'))
#define olym_MARKER (MAKE_MARKER ('o', 'l', 'y', 'm'))
#define ISFT_MARKER (MAKE_MARKER ('I', 'S', 'F', 'T'))
#define ICRD_MARKER (MAKE_MARKER ('I', 'C', 'R', 'D'))
#define ICOP_MARKER (MAKE_MARKER ('I', 'C', 'O', 'P'))
#define IARL_MARKER (MAKE_MARKER ('I', 'A', 'R', 'L'))
#define IART_MARKER (MAKE_MARKER ('I', 'A', 'R', 'T'))
#define INAM_MARKER (MAKE_MARKER ('I', 'N', 'A', 'M'))
#define IENG_MARKER (MAKE_MARKER ('I', 'E', 'N', 'G'))
#define IGNR_MARKER (MAKE_MARKER ('I', 'G', 'N', 'R'))
#define ICOP_MARKER (MAKE_MARKER ('I', 'C', 'O', 'P'))
#define IPRD_MARKER (MAKE_MARKER ('I', 'P', 'R', 'D'))
#define ISRC_MARKER (MAKE_MARKER ('I', 'S', 'R', 'C'))
#define ISBJ_MARKER (MAKE_MARKER ('I', 'S', 'B', 'J'))
#define ICMT_MARKER (MAKE_MARKER ('I', 'C', 'M', 'T'))
#define ISFT_MARKER (MAKE_MARKER ('I', 'S', 'F', 'T'))
#define ICRD_MARKER (MAKE_MARKER ('I', 'C', 'R', 'D'))
#define ICOP_MARKER (MAKE_MARKER ('I', 'C', 'O', 'P'))
#define IARL_MARKER (MAKE_MARKER ('I', 'A', 'R', 'L'))
#define IART_MARKER (MAKE_MARKER ('I', 'A', 'R', 'T'))
#define INAM_MARKER (MAKE_MARKER ('I', 'N', 'A', 'M'))
#define IENG_MARKER (MAKE_MARKER ('I', 'E', 'N', 'G'))
#define IGNR_MARKER (MAKE_MARKER ('I', 'G', 'N', 'R'))
#define ICOP_MARKER (MAKE_MARKER ('I', 'C', 'O', 'P'))
#define IPRD_MARKER (MAKE_MARKER ('I', 'P', 'R', 'D'))
#define ISRC_MARKER (MAKE_MARKER ('I', 'S', 'R', 'C'))
#define ISBJ_MARKER (MAKE_MARKER ('I', 'S', 'B', 'J'))
#define ICMT_MARKER (MAKE_MARKER ('I', 'C', 'M', 'T'))
/* Weird WAVPACK marker which can show up at the start of the DATA section. */
#define wvpk_MARKER (MAKE_MARKER ('w', 'v', 'p', 'k'))
@ -158,16 +158,16 @@ static const EXT_SUBFORMAT MSGUID_SUBTYPE_PVOCEX =
** Private static functions.
*/
static int wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock) ;
static int wav_write_header (SF_PRIVATE *psf, int calc_length) ;
static int wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock) ;
static int wav_write_header (SF_PRIVATE *psf, int calc_length) ;
static int wav_write_tailer (SF_PRIVATE *psf) ;
static void wav_write_strings (SF_PRIVATE *psf, int location) ;
static int wav_command (SF_PRIVATE *psf, int command, void *data, int datasize) ;
static int wav_close (SF_PRIVATE *psf) ;
static int wav_subchunk_parse (SF_PRIVATE *psf, int chunk, unsigned length) ;
static int exif_subchunk_parse (SF_PRIVATE *psf, unsigned int length) ;
static int wav_subchunk_parse (SF_PRIVATE *psf, int chunk, unsigned length) ;
static int exif_subchunk_parse (SF_PRIVATE *psf, unsigned int length) ;
static int wav_read_smpl_chunk (SF_PRIVATE *psf, unsigned int chunklen) ;
static int wav_read_acid_chunk (SF_PRIVATE *psf, unsigned int chunklen) ;
@ -180,7 +180,7 @@ static int wav_get_chunk_data (SF_PRIVATE *psf, SF_CHUNK_INFO * chunk_info) ;
*/
int
wav_open (SF_PRIVATE *psf)
wav_open (SF_PRIVATE *psf)
{ WAV_PRIVATE * wpriv ;
int format, subformat, error, blockalign = 0, framesperblock = 0 ;
@ -304,7 +304,7 @@ wav_open (SF_PRIVATE *psf)
*/
static int
wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
{ WAV_PRIVATE *wpriv ;
WAV_FMT *wav_fmt ;
FACT_CHUNK fact_chunk ;
@ -525,10 +525,10 @@ wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
while (cue_count)
{ bytesread += psf_binheader_readf (psf, "444444", &id, &position,
&chunk_id, &chunk_start, &block_start, &offset) ;
psf_log_printf (psf, " Cue ID : %2d"
" Pos : %5u Chunk : %M"
" Chk Start : %d Blk Start : %d"
" Offset : %5d\n",
psf_log_printf (psf, " Cue ID : %2d"
" Pos : %5u Chunk : %M"
" Chk Start : %d Blk Start : %d"
" Offset : %5d\n",
id, position, chunk_id, chunk_start, block_start, offset) ;
cue_count -- ;
} ;
@ -1474,7 +1474,7 @@ wav_read_smpl_chunk (SF_PRIVATE *psf, unsigned int chunklen)
bytesread += psf_binheader_readf (psf, "4", &dword) ;
if (dword != 0)
{ snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%f",
(1.0 * 0x80000000) / ((unsigned int) dword)) ;
(1.0 * 0x80000000) / ((unsigned int) dword)) ;
psf_log_printf (psf, " Pitch Fract. : %s\n", psf->u.cbuf) ;
}
else
@ -1485,7 +1485,7 @@ wav_read_smpl_chunk (SF_PRIVATE *psf, unsigned int chunklen)
bytesread += psf_binheader_readf (psf, "4", &dword) ;
snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%02d:%02d:%02d %02d",
(dword >> 24) & 0x7F, (dword >> 16) & 0x7F, (dword >> 8) & 0x7F, dword & 0x7F) ;
(dword >> 24) & 0x7F, (dword >> 16) & 0x7F, (dword >> 8) & 0x7F, dword & 0x7F) ;
psf_log_printf (psf, " SMPTE Offset : %s\n", psf->u.cbuf) ;
bytesread += psf_binheader_readf (psf, "4", &loop_count) ;

View File

@ -30,7 +30,7 @@ enum
{
/* keep sorted for wav_w64_format_str() */
WAVE_FORMAT_UNKNOWN = 0x0000, /* Microsoft Corporation */
WAVE_FORMAT_PCM = 0x0001, /* Microsoft PCM format */
WAVE_FORMAT_PCM = 0x0001, /* Microsoft PCM format */
WAVE_FORMAT_MS_ADPCM = 0x0002, /* Microsoft ADPCM */
WAVE_FORMAT_IEEE_FLOAT = 0x0003, /* Micrososft 32 bit float format */
WAVE_FORMAT_VSELP = 0x0004, /* Compaq Computer Corporation */

View File

@ -1,16 +1,16 @@
autogen definitions benchmark.tpl;
data_type = {
data_type = {
type_name = short ;
multiplier = "32700.0" ;
};
data_type = {
data_type = {
type_name = int ;
multiplier = "32700.0 * (1<<16)" ;
multiplier = "32700.0 * (1 << 16)" ;
};
data_type = {
data_type = {
type_name = float ;
multiplier = "1.0" ;
};

View File

@ -1,6 +1,6 @@
[+ AutoGen5 template c +]
/*
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -60,7 +60,7 @@
#define WRITE_PERMS (S_IRUSR | S_IWUSR | S_IRGRP)
#endif
#define BUFFER_SIZE (1<<18)
#define BUFFER_SIZE (1 << 18)
#define BLOCK_COUNT (30)
#define TEST_DURATION (5) /* 5 Seconds. */

View File

@ -50,7 +50,7 @@ main (int argc, char *argv [])
exit (1) ;
} ;
do_all =! strcmp (argv [1], "all") ;
do_all = ! strcmp (argv [1], "all") ;
if (do_all || ! strcmp (argv [1], "wav"))
{ chunk_test ("chunks.wav", SF_FORMAT_WAV) ;

View File

@ -81,7 +81,7 @@ main (int argc, char *argv [])
exit (1) ;
} ;
do_all =! strcmp (argv [1], "all") ;
do_all = ! strcmp (argv [1], "all") ;
if (do_all || strcmp (argv [1], "ver") == 0)
{ char buffer [128] ;
@ -699,8 +699,8 @@ instrument_test (const char *filename, int filetype)
}
} ;
SF_INSTRUMENT read_inst ;
SNDFILE *file ;
SF_INFO sfinfo ;
SNDFILE *file ;
SF_INFO sfinfo ;
print_test_name ("instrument_test", filename) ;
@ -851,8 +851,8 @@ current_sf_info_test (const char *filename)
static void
broadcast_test (const char *filename, int filetype)
{ static SF_BROADCAST_INFO bc_write, bc_read ;
SNDFILE *file ;
SF_INFO sfinfo ;
SNDFILE *file ;
SF_INFO sfinfo ;
int errors = 0 ;
print_test_name ("broadcast_test", filename) ;
@ -976,8 +976,8 @@ broadcast_rdwr_test (const char *filename, int filetype)
static void
check_coding_history_newlines (const char *filename)
{ static SF_BROADCAST_INFO bc_write, bc_read ;
SNDFILE *file ;
SF_INFO sfinfo ;
SNDFILE *file ;
SF_INFO sfinfo ;
unsigned k ;
sfinfo.samplerate = 22050 ;
@ -1046,8 +1046,8 @@ check_coding_history_newlines (const char *filename)
static void
broadcast_coding_history_test (const char *filename)
{ static SF_BROADCAST_INFO bc_write, bc_read ;
SNDFILE *file ;
SF_INFO sfinfo ;
SNDFILE *file ;
SF_INFO sfinfo ;
const char *default_history = "A=PCM,F=22050,W=16,M=mono" ;
const char *supplied_history =
"A=PCM,F=44100,W=24,M=mono,T=other\r\n"
@ -1150,8 +1150,8 @@ broadcast_coding_history_size (const char *filename)
{ /* SF_BROADCAST_INFO struct with coding_history field of 1024 bytes. */
static SF_BROADCAST_INFO_VAR (1024) bc_write ;
static SF_BROADCAST_INFO_VAR (1024) bc_read ;
SNDFILE *file ;
SF_INFO sfinfo ;
SNDFILE *file ;
SF_INFO sfinfo ;
int k ;
print_test_name (__func__, filename) ;
@ -1213,8 +1213,8 @@ broadcast_coding_history_size (const char *filename)
static void
channel_map_test (const char *filename, int filetype)
{ SNDFILE *file ;
SF_INFO sfinfo ;
{ SNDFILE *file ;
SF_INFO sfinfo ;
int channel_map_read [4], channel_map_write [4] =
{ SF_CHANNEL_MAP_LEFT, SF_CHANNEL_MAP_RIGHT, SF_CHANNEL_MAP_LFE,
SF_CHANNEL_MAP_REAR_CENTER
@ -1283,8 +1283,8 @@ raw_needs_endswap_test (const char *filename, int filetype)
{ SF_FORMAT_FLOAT, SF_FORMAT_DOUBLE,
SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
} ;
SNDFILE *file ;
SF_INFO sfinfo ;
SNDFILE *file ;
SF_INFO sfinfo ;
unsigned k ;
int needs_endswap ;

View File

@ -52,7 +52,7 @@ main (int argc, char *argv [])
exit (1) ;
} ;
do_all =! strcmp (argv [1], "all") ;
do_all = ! strcmp (argv [1], "all") ;
if (do_all || ! strcmp (argv [1], "wav"))
{ dither_test ("dither.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_U8) ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2007-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2007-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -26,7 +26,7 @@
#include "utils.h"
#include "generate.h"
#define SF_MAX(x,y) ((x) > (y) ? (x) : (y))
#define SF_MAX(x, y) ((x) > (y) ? (x) : (y))
static float crappy_snare (float *output, int len, int offset, float gain, float maxabs) ;

View File

@ -1,6 +1,6 @@
[+ AutoGen5 template c +]
/*
** Copyright (C) 2001-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2001-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software ; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -43,7 +43,7 @@
#include "utils.h"
#define BUFFER_LEN (1<<10)
#define BUFFER_LEN (1 << 10)
#define LOG_BUFFER_SIZE 1024
static void update_header_test (const char *filename, int typemajor) ;
@ -77,7 +77,7 @@ main (int argc, char *argv [])
exit (1) ;
} ;
do_all=!strcmp (argv [1], "all") ;
do_all= !strcmp (argv [1], "all") ;
if (do_all || ! strcmp (argv [1], "wav"))
{ update_header_test ("header.wav", SF_FORMAT_WAV) ;
@ -330,8 +330,8 @@ update_header_test (const char *filename, int typemajor)
update_seek_[+ (get "name") +]_test (const char *filename, int filetype)
{ SNDFILE *outfile, *infile ;
SF_INFO sfinfo ;
sf_count_t frames ;
[+ (get "name") +] buffer [8] ;
sf_count_t frames ;
[+ (get "name") +] buffer [8] ;
int k ;
print_test_name ("update_seek_[+ (get "name") +]_test", filename) ;
@ -354,11 +354,11 @@ update_seek_[+ (get "name") +]_test (const char *filename, int filetype)
/*
** In auto header update mode, seeking to the end of the file with
** SEEK_SET will fail from the 2nd seek on. seeking to 0, SEEK_END
** SEEK_SET will fail from the 2nd seek on. seeking to 0, SEEK_END
** will seek to 0 anyway
*/
if (sf_command (outfile, SFC_SET_UPDATE_HEADER_AUTO, NULL, SF_TRUE) == 0)
{ printf ("\n\nError : sf_command (SFC_SET_UPDATE_HEADER_AUTO) return error : %s\n\n", sf_strerror (outfile)) ;
{ printf ("\n\nError : sf_command (SFC_SET_UPDATE_HEADER_AUTO) return error : %s\n\n", sf_strerror (outfile)) ;
exit (1) ;
} ;
@ -443,8 +443,8 @@ static void
extra_header_test (const char *filename, int filetype)
{ SNDFILE *outfile, *infile ;
SF_INFO sfinfo ;
sf_count_t frames ;
short buffer [8] ;
sf_count_t frames ;
short buffer [8] ;
int k = 0 ;
print_test_name ("extra_header_test", filename) ;
@ -492,11 +492,11 @@ extra_header_test (const char *filename, int filetype)
/*
** In auto header update mode, seeking to the end of the file with
** SEEK_SET will fail from the 2nd seek on. seeking to 0, SEEK_END
** SEEK_SET will fail from the 2nd seek on. seeking to 0, SEEK_END
** will seek to 0 anyway
*/
if (sf_command (outfile, SFC_SET_UPDATE_HEADER_AUTO, NULL, SF_TRUE) == 0)
{ printf ("\n\nError : sf_command (SFC_SET_UPDATE_HEADER_AUTO) return error : %s\n\n", sf_strerror (outfile)) ;
{ printf ("\n\nError : sf_command (SFC_SET_UPDATE_HEADER_AUTO) return error : %s\n\n", sf_strerror (outfile)) ;
exit (1) ;
} ;

View File

@ -38,7 +38,7 @@
#define M_PI 3.14159265358979323846264338
#endif
#define LCT_MAX(x,y) ((x) > (y) ? (x) : (y))
#define LCT_MAX(x, y) ((x) > (y) ? (x) : (y))
static void lcomp_test_short (const char *filename, int filetype, int chan, double margin) ;
static void lcomp_test_int (const char *filename, int filetype, int chan, double margin) ;
@ -1503,10 +1503,10 @@ channels = 1 ;
/* Check that read past end of file returns number of items. */
sf_seek (file, sfinfo.frames, SEEK_SET) ;
if ((k = sf_read_short (file, data, datalen)) != 0)
{ printf ("\n\nLine %d: Return value from sf_read_short past end of file incorrect (%d).\n", __LINE__, k) ;
exit (1) ;
} ;
if ((k = sf_read_short (file, data, datalen)) != 0)
{ printf ("\n\nLine %d: Return value from sf_read_short past end of file incorrect (%d).\n", __LINE__, k) ;
exit (1) ;
} ;
/* Check seek backward from end. */
@ -1710,10 +1710,10 @@ channels = 1 ;
/* Check that read past end of file returns number of items. */
sf_seek (file, sfinfo.frames, SEEK_SET) ;
if ((k = sf_readf_int (file, data, datalen)) != 0)
{ printf ("\n\nLine %d: Return value from sf_readf_int past end of file incorrect (%d).\n", __LINE__, k) ;
exit (1) ;
} ;
if ((k = sf_readf_int (file, data, datalen)) != 0)
{ printf ("\n\nLine %d: Return value from sf_readf_int past end of file incorrect (%d).\n", __LINE__, k) ;
exit (1) ;
} ;
/* Check seek backward from end. */
@ -1907,10 +1907,10 @@ printf ("** fix this ** ") ;
/* Check that read past end of file returns number of items. */
sf_seek (file, sfinfo.frames, SEEK_SET) ;
if ((k = sf_read_float (file, data, datalen)) != 0)
{ printf ("\n\nLine %d: Return value from sf_read_float past end of file incorrect (%d).\n", __LINE__, k) ;
exit (1) ;
} ;
if ((k = sf_read_float (file, data, datalen)) != 0)
{ printf ("\n\nLine %d: Return value from sf_read_float past end of file incorrect (%d).\n", __LINE__, k) ;
exit (1) ;
} ;
/* Check seek backward from end. */
@ -2099,10 +2099,10 @@ channels = 1 ;
/* Check that read past end of file returns number of items. */
sf_seek (file, sfinfo.frames, SEEK_SET) ;
if ((k = sf_read_double (file, data, datalen)) != 0)
{ printf ("\n\nLine %d: Return value from sf_read_double past end of file incorrect (%d).\n", __LINE__, k) ;
exit (1) ;
} ;
if ((k = sf_read_double (file, data, datalen)) != 0)
{ printf ("\n\nLine %d: Return value from sf_read_double past end of file incorrect (%d).\n", __LINE__, k) ;
exit (1) ;
} ;
/* Check seek backward from end. */

View File

@ -65,7 +65,7 @@ main (int argc, char *argv [])
exit (1) ;
} ;
do_all =! strcmp (argv [1], "all") ;
do_all = ! strcmp (argv [1], "all") ;
if (do_all || ! strcmp (argv [1], "wav"))
{ zero_data_test ("zerolen.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2001-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2001-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -43,7 +43,7 @@ main (int argc, char *argv [])
exit (1) ;
} ;
do_all =! strcmp (argv [1], "all") ;
do_all = ! strcmp (argv [1], "all") ;
if (do_all || ! strcmp (argv [1], "raw"))
{ stdout_test (SF_FORMAT_RAW, PIPE_TEST_LEN) ;

View File

@ -62,7 +62,7 @@ main (int argc, char *argv [])
exit (1) ;
} ;
do_all =! strcmp (argv [1], "all") ;
do_all = ! strcmp (argv [1], "all") ;
if (do_all || ! strcmp (argv [1], "wav"))
{ string_start_end_test ("strings.wav", SF_FORMAT_WAV) ;
@ -631,7 +631,7 @@ str_count (const char * haystack, const char * needle)
return count ;
} /* str_count */
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
static void
software_string_test (const char *filename)

View File

@ -405,12 +405,12 @@ main (int argc, char **argv)
static void create_short_file (const char *filename) ;
#define CHAR_ERROR(x,y) (abs ((x) - (y)) > 255)
#define INT_ERROR(x,y) (((x) - (y)) != 0)
#define TRIBYTE_ERROR(x,y) (abs ((x) - (y)) > 255)
#define FLOAT_ERROR(x,y) (fabs ((x) - (y)) > 1e-5)
#define CHAR_ERROR(x, y) (abs ((x) - (y)) > 255)
#define INT_ERROR(x, y) (((x) - (y)) != 0)
#define TRIBYTE_ERROR(x, y) (abs ((x) - (y)) > 255)
#define FLOAT_ERROR(x, y) (fabs ((x) - (y)) > 1e-5)
#define CONVERT_DATA(k,len,new,orig) \
#define CONVERT_DATA(k, len, new, orig) \
{ for ((k) = 0 ; (k) < (len) ; (k) ++) \
(new) [k] = (orig) [k] ; \
}