To support this change, turn on lots more compiler warnings, and fix all the warnings generated.
Unified · Split
| @@ -26,7 +26,7 @@ static void svxwriteheader(ft_t, st_size_t); · 25 unmodified lines | |||
| 26 | /* 8SVXSTARTREAD */ | 26 | /* 8SVXSTARTREAD */ |
| 27 | /*======================================================================*/ | 27 | /*======================================================================*/ |
| 28 | 28 | ||
| 29 | int st_svxstartread(ft_t ft) | 29 | static int st_svxstartread(ft_t ft) |
| 30 | { | 30 | { |
| 31 | svx_t p = (svx_t ) ft->priv; | 31 | svx_t p = (svx_t ) ft->priv; |
| 32 | 32 | ||
| @@ -211,11 +211,10 @@ int st_svxstartread(ft_t ft) · 178 unmodified lines | |||
| 211 | /*======================================================================*/ | 211 | /*======================================================================*/ |
| 212 | /* 8SVXREAD */ | 212 | /* 8SVXREAD */ |
| 213 | /*======================================================================*/ | 213 | /*======================================================================*/ |
| 214 | st_ssize_t st_svxread(ft_t ft, st_sample_t *buf, st_size_t nsamp) | 214 | static st_size_t st_svxread(ft_t ft, st_sample_t *buf, st_size_t nsamp) |
| 215 | { | 215 | { |
| 216 | unsigned char datum; | 216 | unsigned char datum; |
| 217 | int done = 0; | 217 | size_t done = 0, i; |
| 218 | int i; | ||
| 219 | 218 | ||
| 220 | svx_t p = (svx_t ) ft->priv; | 219 | svx_t p = (svx_t ) ft->priv; |
| 221 | 220 | ||
| @@ -236,9 +235,9 @@ st_ssize_t st_svxread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 14 unmodified lines | |||
| 236 | /*======================================================================*/ | 235 | /*======================================================================*/ |
| 237 | /* 8SVXSTOPREAD */ | 236 | /* 8SVXSTOPREAD */ |
| 238 | /*======================================================================*/ | 237 | /*======================================================================*/ |
| 239 | int st_svxstopread(ft_t ft) | 238 | static int st_svxstopread(ft_t ft) |
| 240 | { | 239 | { |
| 241 | int i; | 240 | size_t i; |
| 242 | 241 | ||
| 243 | svx_t p = (svx_t ) ft->priv; | 242 | svx_t p = (svx_t ) ft->priv; |
| 244 | 243 | ||
| @@ -252,10 +251,10 @@ int st_svxstopread(ft_t ft) · 7 unmodified lines | |||
| 252 | /*======================================================================*/ | 251 | /*======================================================================*/ |
| 253 | /* 8SVXSTARTWRITE */ | 252 | /* 8SVXSTARTWRITE */ |
| 254 | /*======================================================================*/ | 253 | /*======================================================================*/ |
| 255 | int st_svxstartwrite(ft_t ft) | 254 | static int st_svxstartwrite(ft_t ft) |
| 256 | { | 255 | { |
| 257 | svx_t p = (svx_t ) ft->priv; | 256 | svx_t p = (svx_t ) ft->priv; |
| 258 | int i; | 257 | size_t i; |
| 259 | 258 | ||
| 260 | /* 8svx is in big endian format. Swaps wahst | 259 | /* 8svx is in big endian format. Swaps wahst |
| 261 | * read in on little endian machines. | 260 | * read in on little endian machines. |
| @@ -288,13 +287,12 @@ int st_svxstartwrite(ft_t ft) · 26 unmodified lines | |||
| 288 | /* 8SVXWRITE */ | 287 | /* 8SVXWRITE */ |
| 289 | /*======================================================================*/ | 288 | /*======================================================================*/ |
| 290 | 289 | ||
| 291 | st_ssize_t st_svxwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 290 | static st_size_t st_svxwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 292 | { | 291 | { |
| 293 | svx_t p = (svx_t ) ft->priv; | 292 | svx_t p = (svx_t ) ft->priv; |
| 294 | 293 | ||
| 295 | unsigned char datum; | 294 | unsigned char datum; |
| 296 | int done = 0; | 295 | size_t done = 0, i; |
| 297 | int i; | ||
| 298 | 296 | ||
| 299 | p->nsamples += len; | 297 | p->nsamples += len; |
| 300 | 298 | ||
| @@ -313,12 +311,11 @@ st_ssize_t st_svxwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 12 unmodified lines | |||
| 313 | /* 8SVXSTOPWRITE */ | 311 | /* 8SVXSTOPWRITE */ |
| 314 | /*======================================================================*/ | 312 | /*======================================================================*/ |
| 315 | 313 | ||
| 316 | int st_svxstopwrite(ft_t ft) | 314 | static int st_svxstopwrite(ft_t ft) |
| 317 | { | 315 | { |
| 318 | svx_t p = (svx_t ) ft->priv; | 316 | svx_t p = (svx_t ) ft->priv; |
| 319 | 317 | ||
| 320 | int i; | 318 | size_t i, len; |
| 321 | int len; | ||
| 322 | char svxbuf[512]; | 319 | char svxbuf[512]; |
| 323 | 320 | ||
| 324 | /* append all channel pieces to channel 0 */ | 321 | /* append all channel pieces to channel 0 */ |
| @@ -62,7 +62,7 @@ const int MaxFastBits = 16; · 61 unmodified lines | |||
| 62 | static int IsPowerOfTwo(int x); | 62 | static int IsPowerOfTwo(int x); |
| 63 | static int NumberOfBitsNeeded(int PowerOfTwo); | 63 | static int NumberOfBitsNeeded(int PowerOfTwo); |
| 64 | static int ReverseBits(int index, int NumBits); | 64 | static int ReverseBits(int index, int NumBits); |
| 65 | static void InitFFT(); | 65 | static void InitFFT(void); |
| 66 | 66 | ||
| 67 | int IsPowerOfTwo(int x) | 67 | int IsPowerOfTwo(int x) |
| 68 | { | 68 | { |
| @@ -103,7 +103,7 @@ int ReverseBits(int index, int NumBits) · 34 unmodified lines | |||
| 103 | * freed, to use as a lookup table for bit-reversal. The good news is that | 103 | * freed, to use as a lookup table for bit-reversal. The good news is that |
| 104 | * we bascially need this until the very end, so the fact that it's not freed | 104 | * we bascially need this until the very end, so the fact that it's not freed |
| 105 | * is OK. */ | 105 | * is OK. */ |
| 106 | void InitFFT() | 106 | void InitFFT(void) |
| 107 | { | 107 | { |
| 108 | int len, b; | 108 | int len, b; |
| 109 | 109 | ||
| @@ -139,6 +139,7 @@ EGREP = @EGREP@ · 138 unmodified lines | |||
| 139 | EXEEXT = @EXEEXT@ | 139 | EXEEXT = @EXEEXT@ |
| 140 | GETOPT_LONG_FALSE = @GETOPT_LONG_FALSE@ | 140 | GETOPT_LONG_FALSE = @GETOPT_LONG_FALSE@ |
| 141 | GETOPT_LONG_TRUE = @GETOPT_LONG_TRUE@ | 141 | GETOPT_LONG_TRUE = @GETOPT_LONG_TRUE@ |
| 142 | GREP = @GREP@ | ||
| 142 | INSTALL_DATA = @INSTALL_DATA@ | 143 | INSTALL_DATA = @INSTALL_DATA@ |
| 143 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | 144 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
| 144 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | 145 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
| @@ -166,9 +167,6 @@ SHELL = @SHELL@ · 21 unmodified lines | |||
| 166 | STRIP = @STRIP@ | 167 | STRIP = @STRIP@ |
| 167 | VERSION = @VERSION@ | 168 | VERSION = @VERSION@ |
| 168 | ac_ct_CC = @ac_ct_CC@ | 169 | ac_ct_CC = @ac_ct_CC@ |
| 169 | ac_ct_RANLIB = @ac_ct_RANLIB@ | ||
| 170 | ac_ct_STRIP = @ac_ct_STRIP@ | ||
| 171 | ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ | ||
| 172 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ | 170 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ |
| 173 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ | 171 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ |
| 174 | am__include = @am__include@ | 172 | am__include = @am__include@ |
| @@ -179,19 +177,26 @@ am__untar = @am__untar@ · 4 unmodified lines | |||
| 179 | bindir = @bindir@ | 177 | bindir = @bindir@ |
| 180 | build_alias = @build_alias@ | 178 | build_alias = @build_alias@ |
| 181 | datadir = @datadir@ | 179 | datadir = @datadir@ |
| 180 | datarootdir = @datarootdir@ | ||
| 181 | docdir = @docdir@ | ||
| 182 | dvidir = @dvidir@ | ||
| 182 | exec_prefix = @exec_prefix@ | 183 | exec_prefix = @exec_prefix@ |
| 183 | host_alias = @host_alias@ | 184 | host_alias = @host_alias@ |
| 185 | htmldir = @htmldir@ | ||
| 184 | includedir = @includedir@ | 186 | includedir = @includedir@ |
| 185 | infodir = @infodir@ | 187 | infodir = @infodir@ |
| 186 | install_sh = @install_sh@ | 188 | install_sh = @install_sh@ |
| 187 | libdir = @libdir@ | 189 | libdir = @libdir@ |
| 188 | libexecdir = @libexecdir@ | 190 | libexecdir = @libexecdir@ |
| 191 | localedir = @localedir@ | ||
| 189 | localstatedir = @localstatedir@ | 192 | localstatedir = @localstatedir@ |
| 190 | mandir = @mandir@ | 193 | mandir = @mandir@ |
| 191 | mkdir_p = @mkdir_p@ | 194 | mkdir_p = @mkdir_p@ |
| 192 | oldincludedir = @oldincludedir@ | 195 | oldincludedir = @oldincludedir@ |
| 196 | pdfdir = @pdfdir@ | ||
| 193 | prefix = @prefix@ | 197 | prefix = @prefix@ |
| 194 | program_transform_name = @program_transform_name@ | 198 | program_transform_name = @program_transform_name@ |
| 199 | psdir = @psdir@ | ||
| 195 | sbindir = @sbindir@ | 200 | sbindir = @sbindir@ |
| 196 | sharedstatedir = @sharedstatedir@ | 201 | sharedstatedir = @sharedstatedir@ |
| 197 | sysconfdir = @sysconfdir@ | 202 | sysconfdir = @sysconfdir@ |
| @@ -230,9 +235,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) · 32 unmodified lines | |||
| 230 | exit 1;; \ | 235 | exit 1;; \ |
| 231 | esac; \ | 236 | esac; \ |
| 232 | done; \ | 237 | done; \ |
| 233 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ | 238 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ |
| 234 | cd $(top_srcdir) && \ | 239 | cd $(top_srcdir) && \ |
| 235 | $(AUTOMAKE) --foreign src/Makefile | 240 | $(AUTOMAKE) --gnu src/Makefile |
| 236 | .PRECIOUS: Makefile | 241 | .PRECIOUS: Makefile |
| 237 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | 242 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
| 238 | @case '$?' in \ | 243 | @case '$?' in \ |
| @@ -72,7 +72,7 @@ const short iCoef[7][2] = { · 71 unmodified lines | |||
| 72 | { 392,-232} | 72 | { 392,-232} |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | inline st_sample_t AdpcmDecode(st_sample_t c, MsState_t *state, | 75 | static inline st_sample_t AdpcmDecode(st_sample_t c, MsState_t *state, |
| 76 | st_sample_t sample1, st_sample_t sample2) | 76 | st_sample_t sample1, st_sample_t sample2) |
| 77 | { | 77 | { |
| 78 | st_sample_t vlin; | 78 | st_sample_t vlin; |
| @@ -248,14 +248,13 @@ static int AdpcmMashS( · 169 unmodified lines | |||
| 248 | return (int) sqrt(d2); | 248 | return (int) sqrt(d2); |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | inline void AdpcmMashChannel( | 251 | static inline void AdpcmMashChannel( |
| 252 | int ch, /* channel number to encode, REQUIRE 0 <= ch < chans */ | 252 | int ch, /* channel number to encode, REQUIRE 0 <= ch < chans */ |
| 253 | int chans, /* total channels */ | 253 | int chans, /* total channels */ |
| 254 | const SAMPL *ip, /* ip[] is interleaved input samples */ | 254 | const SAMPL *ip, /* ip[] is interleaved input samples */ |
| 255 | int n, /* samples to encode PER channel, REQUIRE */ | 255 | int n, /* samples to encode PER channel, REQUIRE */ |
| 256 | int *st, /* input/output steps, 16<=st[i] */ | 256 | int *st, /* input/output steps, 16<=st[i] */ |
| 257 | unsigned char *obuff, /* output buffer[blockAlign] */ | 257 | unsigned char *obuff /* output buffer[blockAlign] */ |
| 258 | int opt /* non-zero allows some cpu-intensive code to improve output */ | ||
| 259 | ) | 258 | ) |
| 260 | { | 259 | { |
| 261 | SAMPL v[2]; | 260 | SAMPL v[2]; |
| @@ -305,8 +304,7 @@ void AdpcmBlockMashI( · 43 unmodified lines | |||
| 305 | int n, /* samples to encode PER channel */ | 304 | int n, /* samples to encode PER channel */ |
| 306 | int *st, /* input/output steps, 16<=st[i] */ | 305 | int *st, /* input/output steps, 16<=st[i] */ |
| 307 | unsigned char *obuff, /* output buffer[blockAlign] */ | 306 | unsigned char *obuff, /* output buffer[blockAlign] */ |
| 308 | int blockAlign, /* >= 7*chans + chans*(n-2)/2.0 */ | 307 | int blockAlign /* >= 7*chans + chans*(n-2)/2.0 */ |
| 309 | int opt /* non-zero allows some cpu-intensive code to improve output */ | ||
| 310 | ) | 308 | ) |
| 311 | { | 309 | { |
| 312 | int ch; | 310 | int ch; |
| @@ -318,7 +316,7 @@ void AdpcmBlockMashI( · 5 unmodified lines | |||
| 318 | for (p=obuff+7*chans; p<obuff+blockAlign; p++) *p=0; | 316 | for (p=obuff+7*chans; p<obuff+blockAlign; p++) *p=0; |
| 319 | 317 | ||
| 320 | for (ch=0; ch<chans; ch++) | 318 | for (ch=0; ch<chans; ch++) |
| 321 | AdpcmMashChannel(ch, chans, ip, n, st+ch, obuff, opt); | 319 | AdpcmMashChannel(ch, chans, ip, n, st+ch, obuff); |
| 322 | } | 320 | } |
| 323 | 321 | ||
| 324 | /* | 322 | /* |
| @@ -334,8 +332,7 @@ st_size_t AdpcmSamplesIn( · 9 unmodified lines | |||
| 334 | unsigned short chans, | 332 | unsigned short chans, |
| 335 | unsigned short blockAlign, | 333 | unsigned short blockAlign, |
| 336 | unsigned short samplesPerBlock | 334 | unsigned short samplesPerBlock |
| 337 | ) | 335 | ){ |
| 338 | { | ||
| 339 | st_size_t m, n; | 336 | st_size_t m, n; |
| 340 | 337 | ||
| 341 | if (samplesPerBlock) { | 338 | if (samplesPerBlock) { |
| @@ -345,7 +342,7 @@ st_size_t AdpcmSamplesIn( · 3 unmodified lines | |||
| 345 | n = 0; | 342 | n = 0; |
| 346 | m = blockAlign; | 343 | m = blockAlign; |
| 347 | } | 344 | } |
| 348 | if (m >= 7*chans) { | 345 | if (m >= (size_t)(7*chans)) { |
| 349 | m -= 7*chans; /* bytes beyond block-header */ | 346 | m -= 7*chans; /* bytes beyond block-header */ |
| 350 | m = (2*m)/chans + 2; /* nibbles/chans + 2 in header */ | 347 | m = (2*m)/chans + 2; /* nibbles/chans + 2 in header */ |
| 351 | if (samplesPerBlock && m > samplesPerBlock) m = samplesPerBlock; | 348 | if (samplesPerBlock && m > samplesPerBlock) m = samplesPerBlock; |
| @@ -26,8 +26,7 @@ extern void AdpcmBlockMashI( · 25 unmodified lines | |||
| 26 | int n, /* samples to encode PER channel, REQUIRE */ | 26 | int n, /* samples to encode PER channel, REQUIRE */ |
| 27 | int *st, /* input/output steps, 16<=st[i] */ | 27 | int *st, /* input/output steps, 16<=st[i] */ |
| 28 | unsigned char *obuff, /* output buffer[blockAlign] */ | 28 | unsigned char *obuff, /* output buffer[blockAlign] */ |
| 29 | int blockAlign, /* >= 7*chans + n/2 */ | 29 | int blockAlign /* >= 7*chans + n/2 */ |
| 30 | int opt /* non-zero allows some cpu-intensive code to improve output */ | ||
| 31 | ); | 30 | ); |
| 32 | 31 | ||
| 33 | /* Some helper functions for computing samples/block and blockalign */ | 32 | /* Some helper functions for computing samples/block and blockalign */ |
| @@ -74,7 +74,7 @@ static int textChunk(char **text, char *chunkDescription, ft_t ft); · 73 unmodified lines | |||
| 74 | static int commentChunk(char **text, char *chunkDescription, ft_t ft); | 74 | static int commentChunk(char **text, char *chunkDescription, ft_t ft); |
| 75 | static void reportInstrument(ft_t ft); | 75 | static void reportInstrument(ft_t ft); |
| 76 | 76 | ||
| 77 | int st_aiffseek(ft_t ft, st_size_t offset) | 77 | static int st_aiffseek(ft_t ft, st_size_t offset) |
| 78 | { | 78 | { |
| 79 | aiff_t aiff = (aiff_t ) ft->priv; | 79 | aiff_t aiff = (aiff_t ) ft->priv; |
| 80 | st_size_t new_offset, channel_block, alignment; | 80 | st_size_t new_offset, channel_block, alignment; |
| @@ -99,7 +99,7 @@ int st_aiffseek(ft_t ft, st_size_t offset) · 18 unmodified lines | |||
| 99 | return(ft->st_errno); | 99 | return(ft->st_errno); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | int st_aiffstartread(ft_t ft) | 102 | static int st_aiffstartread(ft_t ft) |
| 103 | { | 103 | { |
| 104 | aiff_t aiff = (aiff_t ) ft->priv; | 104 | aiff_t aiff = (aiff_t ) ft->priv; |
| 105 | char buf[5]; | 105 | char buf[5]; |
| @@ -408,7 +408,7 @@ int st_aiffstartread(ft_t ft) · 302 unmodified lines | |||
| 408 | if (foundcomm) { | 408 | if (foundcomm) { |
| 409 | ft->info.channels = channels; | 409 | ft->info.channels = channels; |
| 410 | ft->info.rate = rate; | 410 | ft->info.rate = rate; |
| 411 | if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2) | 411 | if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_SIGN2) |
| 412 | st_report("AIFF only supports signed data. Forcing to signed."); | 412 | st_report("AIFF only supports signed data. Forcing to signed."); |
| 413 | ft->info.encoding = ST_ENCODING_SIGN2; | 413 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 414 | if (bits <= 8) | 414 | if (bits <= 8) |
| @@ -441,9 +441,9 @@ int st_aiffstartread(ft_t ft) · 26 unmodified lines | |||
| 441 | return(ST_EOF); | 441 | return(ST_EOF); |
| 442 | } | 442 | } |
| 443 | } else { | 443 | } else { |
| 444 | if ((ft->info.channels == -1) | 444 | if ((ft->info.channels == 0) |
| 445 | || (ft->info.rate == 0) | 445 | || (ft->info.rate == 0) |
| 446 | || (ft->info.encoding == -1) | 446 | || (ft->info.encoding == ST_ENCODING_UNKNOWN) |
| 447 | || (ft->info.size == -1)) { | 447 | || (ft->info.size == -1)) { |
| 448 | st_report("You must specify # channels, sample rate, signed/unsigned,"); | 448 | st_report("You must specify # channels, sample rate, signed/unsigned,"); |
| 449 | st_report("and 8/16 on the command line."); | 449 | st_report("and 8/16 on the command line."); |
| @@ -633,7 +633,7 @@ static int commentChunk(char **text, char *chunkDescription, ft_t ft) · 183 unmodified lines | |||
| 633 | st_debug("%-10s \"%s\"", chunkDescription, *text); | 633 | st_debug("%-10s \"%s\"", chunkDescription, *text); |
| 634 | /* make sure we read the whole chunk */ | 634 | /* make sure we read the whole chunk */ |
| 635 | if (totalReadLength < chunksize) { | 635 | if (totalReadLength < chunksize) { |
| 636 | int i; | 636 | size_t i; |
| 637 | char c; | 637 | char c; |
| 638 | for (i=0; i < chunksize - totalReadLength; i++ ) { | 638 | for (i=0; i < chunksize - totalReadLength; i++ ) { |
| 639 | st_readbuf(ft, &c, 1, 1); | 639 | st_readbuf(ft, &c, 1, 1); |
| @@ -642,14 +642,12 @@ static int commentChunk(char **text, char *chunkDescription, ft_t ft) · 2 unmodified lines | |||
| 642 | return(ST_SUCCESS); | 642 | return(ST_SUCCESS); |
| 643 | } | 643 | } |
| 644 | 644 | ||
| 645 | st_ssize_t st_aiffread(ft_t ft, st_sample_t *buf, st_size_t len) | 645 | static st_size_t st_aiffread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 646 | { | 646 | { |
| 647 | aiff_t aiff = (aiff_t ) ft->priv; | 647 | aiff_t aiff = (aiff_t ) ft->priv; |
| 648 | st_ssize_t done; | 648 | st_ssize_t done; |
| 649 | 649 | ||
| 650 | if (len < 0) | 650 | if ((st_size_t)len > aiff->nsamples) |
| 651 | return ST_EOF; | ||
| 652 | else if ((st_size_t)len > aiff->nsamples) | ||
| 653 | len = aiff->nsamples; | 651 | len = aiff->nsamples; |
| 654 | done = st_rawread(ft, buf, len); | 652 | done = st_rawread(ft, buf, len); |
| 655 | if (done == 0 && aiff->nsamples != 0) | 653 | if (done == 0 && aiff->nsamples != 0) |
| @@ -658,7 +656,7 @@ st_ssize_t st_aiffread(ft_t ft, st_sample_t *buf, st_size_t len) · 2 unmodified lines | |||
| 658 | return done; | 656 | return done; |
| 659 | } | 657 | } |
| 660 | 658 | ||
| 661 | int st_aiffstopread(ft_t ft) | 659 | static int st_aiffstopread(ft_t ft) |
| 662 | { | 660 | { |
| 663 | char buf[5]; | 661 | char buf[5]; |
| 664 | uint32_t chunksize; | 662 | uint32_t chunksize; |
| @@ -701,7 +699,7 @@ int st_aiffstopread(ft_t ft) · 36 unmodified lines | |||
| 701 | Strictly spoken this is not legal, but the playaiff utility | 699 | Strictly spoken this is not legal, but the playaiff utility |
| 702 | will still be able to play the resulting file. */ | 700 | will still be able to play the resulting file. */ |
| 703 | 701 | ||
| 704 | int st_aiffstartwrite(ft_t ft) | 702 | static int st_aiffstartwrite(ft_t ft) |
| 705 | { | 703 | { |
| 706 | aiff_t aiff = (aiff_t ) ft->priv; | 704 | aiff_t aiff = (aiff_t ) ft->priv; |
| 707 | int rc; | 705 | int rc; |
| @@ -726,7 +724,7 @@ int st_aiffstartwrite(ft_t ft) · 18 unmodified lines | |||
| 726 | ft->info.encoding = ST_ENCODING_SIGN2; | 724 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 727 | ft->info.size = ST_SIZE_WORD; | 725 | ft->info.size = ST_SIZE_WORD; |
| 728 | } | 726 | } |
| 729 | if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2) | 727 | if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_SIGN2) |
| 730 | st_report("AIFF only supports signed data. Forcing to signed."); | 728 | st_report("AIFF only supports signed data. Forcing to signed."); |
| 731 | ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */ | 729 | ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */ |
| 732 | 730 | ||
| @@ -739,7 +737,7 @@ int st_aiffstartwrite(ft_t ft) · 6 unmodified lines | |||
| 739 | return(aiffwriteheader(ft, 0x7f000000L / (ft->info.size*ft->info.channels))); | 737 | return(aiffwriteheader(ft, 0x7f000000L / (ft->info.size*ft->info.channels))); |
| 740 | } | 738 | } |
| 741 | 739 | ||
| 742 | st_ssize_t st_aiffwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 740 | static st_size_t st_aiffwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 743 | { | 741 | { |
| 744 | aiff_t aiff = (aiff_t ) ft->priv; | 742 | aiff_t aiff = (aiff_t ) ft->priv; |
| 745 | aiff->nsamples += len; | 743 | aiff->nsamples += len; |
| @@ -747,7 +745,7 @@ st_ssize_t st_aiffwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 1 unmodified line | |||
| 747 | return(len); | 745 | return(len); |
| 748 | } | 746 | } |
| 749 | 747 | ||
| 750 | int st_aiffstopwrite(ft_t ft) | 748 | static int st_aiffstopwrite(ft_t ft) |
| 751 | { | 749 | { |
| 752 | aiff_t aiff = (aiff_t ) ft->priv; | 750 | aiff_t aiff = (aiff_t ) ft->priv; |
| 753 | int rc; | 751 | int rc; |
| @@ -914,7 +912,7 @@ static int aiffwriteheader(ft_t ft, st_size_t nframes) · 160 unmodified lines | |||
| 914 | return(ST_SUCCESS); | 912 | return(ST_SUCCESS); |
| 915 | } | 913 | } |
| 916 | 914 | ||
| 917 | int st_aifcstartwrite(ft_t ft) | 915 | static int st_aifcstartwrite(ft_t ft) |
| 918 | { | 916 | { |
| 919 | aiff_t aiff = (aiff_t ) ft->priv; | 917 | aiff_t aiff = (aiff_t ) ft->priv; |
| 920 | int rc; | 918 | int rc; |
| @@ -939,7 +937,7 @@ int st_aifcstartwrite(ft_t ft) · 18 unmodified lines | |||
| 939 | ft->info.encoding = ST_ENCODING_SIGN2; | 937 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 940 | ft->info.size = ST_SIZE_WORD; | 938 | ft->info.size = ST_SIZE_WORD; |
| 941 | } | 939 | } |
| 942 | if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2) | 940 | if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_SIGN2) |
| 943 | st_report("AIFC only supports signed data. Forcing to signed."); | 941 | st_report("AIFC only supports signed data. Forcing to signed."); |
| 944 | ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */ | 942 | ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */ |
| 945 | 943 | ||
| @@ -952,7 +950,7 @@ int st_aifcstartwrite(ft_t ft) · 6 unmodified lines | |||
| 952 | return(aifcwriteheader(ft, 0x7f000000L / (ft->info.size*ft->info.channels))); | 950 | return(aifcwriteheader(ft, 0x7f000000L / (ft->info.size*ft->info.channels))); |
| 953 | } | 951 | } |
| 954 | 952 | ||
| 955 | int st_aifcstopwrite(ft_t ft) | 953 | static int st_aifcstopwrite(ft_t ft) |
| 956 | { | 954 | { |
| 957 | aiff_t aiff = (aiff_t ) ft->priv; | 955 | aiff_t aiff = (aiff_t ) ft->priv; |
| 958 | int rc; | 956 | int rc; |
| @@ -23,13 +23,13 @@ · 22 unmodified lines | |||
| 23 | typedef struct alsa_priv | 23 | typedef struct alsa_priv |
| 24 | { | 24 | { |
| 25 | snd_pcm_t *pcm_handle; | 25 | snd_pcm_t *pcm_handle; |
| 26 | void *buf; | 26 | char *buf; |
| 27 | st_ssize_t buf_size; | 27 | st_size_t buf_size; |
| 28 | } *alsa_priv_t; | 28 | } *alsa_priv_t; |
| 29 | 29 | ||
| 30 | static int get_format(ft_t ft, snd_pcm_format_mask_t *fmask, int *fmt); | 30 | static int get_format(ft_t ft, snd_pcm_format_mask_t *fmask, int *fmt); |
| 31 | 31 | ||
| 32 | int st_alsasetup(ft_t ft, snd_pcm_stream_t mode) | 32 | static int st_alsasetup(ft_t ft, snd_pcm_stream_t mode) |
| 33 | { | 33 | { |
| 34 | int fmt = SND_PCM_FORMAT_S16; | 34 | int fmt = SND_PCM_FORMAT_S16; |
| 35 | int err; | 35 | int err; |
| @@ -85,7 +85,7 @@ int st_alsasetup(ft_t ft, snd_pcm_stream_t mode) · 49 unmodified lines | |||
| 85 | 85 | ||
| 86 | snd_pcm_hw_params_get_channels_min(hw_params, &min_chan); | 86 | snd_pcm_hw_params_get_channels_min(hw_params, &min_chan); |
| 87 | snd_pcm_hw_params_get_channels_max(hw_params, &max_chan); | 87 | snd_pcm_hw_params_get_channels_max(hw_params, &max_chan); |
| 88 | if (ft->info.channels == -1) | 88 | if (ft->info.channels == 0) |
| 89 | ft->info.channels = min_chan; | 89 | ft->info.channels = min_chan; |
| 90 | else | 90 | else |
| 91 | if (ft->info.channels > max_chan) | 91 | if (ft->info.channels > max_chan) |
| @@ -113,11 +113,8 @@ int st_alsasetup(ft_t ft, snd_pcm_stream_t mode) · 21 unmodified lines | |||
| 113 | snd_pcm_hw_params_get_rate_min(hw_params, &min_rate, &dir); | 113 | snd_pcm_hw_params_get_rate_min(hw_params, &min_rate, &dir); |
| 114 | snd_pcm_hw_params_get_rate_max(hw_params, &max_rate, &dir); | 114 | snd_pcm_hw_params_get_rate_max(hw_params, &max_rate, &dir); |
| 115 | 115 | ||
| 116 | if (min_rate != -1 && rate < min_rate) | 116 | rate = max(rate, min_rate); |
| 117 | rate = min_rate; | 117 | rate = min(rate, max_rate); |
| 118 | else | ||
| 119 | if (max_rate != -1 && rate > max_rate) | ||
| 120 | rate = max_rate; | ||
| 121 | if (rate != ft->info.rate) | 118 | if (rate != ft->info.rate) |
| 122 | { | 119 | { |
| 123 | st_report("alsa: Hardware does not support %d. Forcing sample rate to %d.", ft->info.rate, rate); | 120 | st_report("alsa: Hardware does not support %d. Forcing sample rate to %d.", ft->info.rate, rate); |
| @@ -288,12 +285,12 @@ static int xrun_recovery(snd_pcm_t *handle, int err) · 164 unmodified lines | |||
| 288 | * size and encoding of samples, | 285 | * size and encoding of samples, |
| 289 | * mono/stereo/quad. | 286 | * mono/stereo/quad. |
| 290 | */ | 287 | */ |
| 291 | int st_alsastartread(ft_t ft) | 288 | static int st_alsastartread(ft_t ft) |
| 292 | { | 289 | { |
| 293 | return st_alsasetup(ft, SND_PCM_STREAM_CAPTURE); | 290 | return st_alsasetup(ft, SND_PCM_STREAM_CAPTURE); |
| 294 | } | 291 | } |
| 295 | 292 | ||
| 296 | st_ssize_t st_alsaread(ft_t ft, st_sample_t *buf, st_size_t nsamp) | 293 | static st_size_t st_alsaread(ft_t ft, st_sample_t *buf, st_size_t nsamp) |
| 297 | { | 294 | { |
| 298 | st_size_t len; | 295 | st_size_t len; |
| 299 | int err; | 296 | int err; |
| @@ -364,8 +361,7 @@ st_ssize_t st_alsaread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 64 unmodified lines | |||
| 364 | return len; | 361 | return len; |
| 365 | } | 362 | } |
| 366 | 363 | ||
| 367 | int st_alsastopread(ft) | 364 | static int st_alsastopread(ft_t ft) |
| 368 | ft_t ft; | ||
| 369 | { | 365 | { |
| 370 | alsa_priv_t alsa = (alsa_priv_t)ft->priv; | 366 | alsa_priv_t alsa = (alsa_priv_t)ft->priv; |
| 371 | 367 | ||
| @@ -376,12 +372,12 @@ ft_t ft; · 4 unmodified lines | |||
| 376 | return ST_SUCCESS; | 372 | return ST_SUCCESS; |
| 377 | } | 373 | } |
| 378 | 374 | ||
| 379 | int st_alsastartwrite(ft_t ft) | 375 | static int st_alsastartwrite(ft_t ft) |
| 380 | { | 376 | { |
| 381 | return st_alsasetup(ft, SND_PCM_STREAM_PLAYBACK); | 377 | return st_alsasetup(ft, SND_PCM_STREAM_PLAYBACK); |
| 382 | } | 378 | } |
| 383 | 379 | ||
| 384 | st_ssize_t st_alsawrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) | 380 | static st_size_t st_alsawrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) |
| 385 | { | 381 | { |
| 386 | st_size_t len; | 382 | st_size_t len; |
| 387 | int err; | 383 | int err; |
| @@ -452,8 +448,7 @@ st_ssize_t st_alsawrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) · 64 unmodified lines | |||
| 452 | } | 448 | } |
| 453 | 449 | ||
| 454 | 450 | ||
| 455 | int st_alsastopwrite(ft) | 451 | static int st_alsastopwrite(ft_t ft) |
| 456 | ft_t ft; | ||
| 457 | { | 452 | { |
| 458 | alsa_priv_t alsa = (alsa_priv_t)ft->priv; | 453 | alsa_priv_t alsa = (alsa_priv_t)ft->priv; |
| 459 | 454 | ||
| @@ -472,7 +467,7 @@ static int get_format(ft_t ft, snd_pcm_format_mask_t *fmask, int *fmt) · 12 unmodified lines | |||
| 472 | if (ft->info.size == -1) | 467 | if (ft->info.size == -1) |
| 473 | ft->info.size = ST_SIZE_WORD; | 468 | ft->info.size = ST_SIZE_WORD; |
| 474 | 469 | ||
| 475 | if (ft->info.encoding == -1) | 470 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) |
| 476 | { | 471 | { |
| 477 | if (ft->info.size == ST_SIZE_WORD) | 472 | if (ft->info.size == ST_SIZE_WORD) |
| 478 | ft->info.encoding = ST_ENCODING_SIGN2; | 473 | ft->info.encoding = ST_ENCODING_SIGN2; |
| @@ -107,7 +107,7 @@ static int st_auencodingandsize(int sun_encoding, st_encoding_t * encoding, sign · 106 unmodified lines | |||
| 107 | return(ST_SUCCESS); | 107 | return(ST_SUCCESS); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | int st_auseek(ft_t ft, st_size_t offset) | 110 | static int st_auseek(ft_t ft, st_size_t offset) |
| 111 | { | 111 | { |
| 112 | au_t au = (au_t ) ft->priv; | 112 | au_t au = (au_t ) ft->priv; |
| 113 | 113 | ||
| @@ -137,7 +137,7 @@ int st_auseek(ft_t ft, st_size_t offset) · 23 unmodified lines | |||
| 137 | return(ft->st_errno); | 137 | return(ft->st_errno); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | int st_austartread(ft_t ft) | 140 | static int st_austartread(ft_t ft) |
| 141 | { | 141 | { |
| 142 | /* The following 6 variables represent a Sun sound header on disk. | 142 | /* The following 6 variables represent a Sun sound header on disk. |
| 143 | The numbers are written as big-endians. | 143 | The numbers are written as big-endians. |
| @@ -245,8 +245,8 @@ int st_austartread(ft_t ft) · 101 unmodified lines | |||
| 245 | 245 | ||
| 246 | /* Read the number of channels */ | 246 | /* Read the number of channels */ |
| 247 | st_readdw(ft, &channels); | 247 | st_readdw(ft, &channels); |
| 248 | if (ft->info.channels == -1 || ft->info.channels == (int) channels) | 248 | if (ft->info.channels == 0 || ft->info.channels == channels) |
| 249 | ft->info.channels = (int) channels; | 249 | ft->info.channels = channels; |
| 250 | else | 250 | else |
| 251 | st_report("User options overriding channels read in .au header"); | 251 | st_report("User options overriding channels read in .au header"); |
| 252 | 252 | ||
| @@ -297,7 +297,7 @@ int st_austartread(ft_t ft) · 44 unmodified lines | |||
| 297 | if it is not, the unspecified size remains in the header | 297 | if it is not, the unspecified size remains in the header |
| 298 | (this is legal). */ | 298 | (this is legal). */ |
| 299 | 299 | ||
| 300 | int st_austartwrite(ft_t ft) | 300 | static int st_austartwrite(ft_t ft) |
| 301 | { | 301 | { |
| 302 | au_t p = (au_t ) ft->priv; | 302 | au_t p = (au_t ) ft->priv; |
| 303 | int rc; | 303 | int rc; |
| @@ -344,7 +344,7 @@ static int unpack_input(ft_t ft, unsigned char *code) · 40 unmodified lines | |||
| 344 | return (p->in_bits > 0); | 344 | return (p->in_bits > 0); |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | st_ssize_t st_auread(ft_t ft, st_sample_t *buf, st_size_t samp) | 347 | static st_size_t st_auread(ft_t ft, st_sample_t *buf, st_size_t samp) |
| 348 | { | 348 | { |
| 349 | au_t p = (au_t ) ft->priv; | 349 | au_t p = (au_t ) ft->priv; |
| 350 | unsigned char code; | 350 | unsigned char code; |
| @@ -362,14 +362,14 @@ st_ssize_t st_auread(ft_t ft, st_sample_t *buf, st_size_t samp) · 11 unmodified lines | |||
| 362 | return done; | 362 | return done; |
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | st_ssize_t st_auwrite(ft_t ft, const st_sample_t *buf, st_size_t samp) | 365 | static st_size_t st_auwrite(ft_t ft, const st_sample_t *buf, st_size_t samp) |
| 366 | { | 366 | { |
| 367 | au_t p = (au_t ) ft->priv; | 367 | au_t p = (au_t ) ft->priv; |
| 368 | p->data_size += samp * ft->info.size; | 368 | p->data_size += samp * ft->info.size; |
| 369 | return(st_rawwrite(ft, buf, samp)); | 369 | return(st_rawwrite(ft, buf, samp)); |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | int st_austopwrite(ft_t ft) | 372 | static int st_austopwrite(ft_t ft) |
| 373 | { | 373 | { |
| 374 | au_t p = (au_t ) ft->priv; | 374 | au_t p = (au_t ) ft->priv; |
| 375 | int rc; | 375 | int rc; |
| @@ -411,7 +411,7 @@ static int st_ausunencoding(int size, int encoding) · 35 unmodified lines | |||
| 411 | else if (encoding == ST_ENCODING_FLOAT && size == ST_SIZE_32BIT) | 411 | else if (encoding == ST_ENCODING_FLOAT && size == ST_SIZE_32BIT) |
| 412 | sun_encoding = SUN_FLOAT; | 412 | sun_encoding = SUN_FLOAT; |
| 413 | else | 413 | else |
| 414 | sun_encoding = -1; | 414 | sun_encoding = ST_ENCODING_UNKNOWN; |
| 415 | return sun_encoding; | 415 | return sun_encoding; |
| 416 | } | 416 | } |
| 417 | 417 | ||
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | #define LASTCHAR '/' | 23 | #define LASTCHAR '/' |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | int st_autostartread(ft_t ft) | 26 | static int st_autostartread(ft_t ft) |
| 27 | { | 27 | { |
| 28 | char *type = NULL; | 28 | char *type = NULL; |
| 29 | char header[20]; | 29 | char header[20]; |
| @@ -179,7 +179,7 @@ int st_autostartread(ft_t ft) · 149 unmodified lines | |||
| 179 | return ((* ft->h->startread)(ft)); | 179 | return ((* ft->h->startread)(ft)); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | int st_autostartwrite(ft_t ft) | 182 | static int st_autostartwrite(ft_t ft) |
| 183 | { | 183 | { |
| 184 | st_fail_errno(ft,ST_EFMT,"Type AUTO can only be used for input!"); | 184 | st_fail_errno(ft,ST_EFMT,"Type AUTO can only be used for input!"); |
| 185 | return(ST_EOF); | 185 | return(ST_EOF); |
| @@ -50,7 +50,7 @@ typedef struct avgstuff { · 49 unmodified lines | |||
| 50 | /* | 50 | /* |
| 51 | * Process options | 51 | * Process options |
| 52 | */ | 52 | */ |
| 53 | int st_avg_getopts(eff_t effp, int n, char **argv) | 53 | static int st_avg_getopts(eff_t effp, int n, char **argv) |
| 54 | { | 54 | { |
| 55 | avg_t avg = (avg_t) effp->priv; | 55 | avg_t avg = (avg_t) effp->priv; |
| 56 | double* pans = &avg->sources[0][0]; | 56 | double* pans = &avg->sources[0][0]; |
| @@ -118,7 +118,7 @@ int st_avg_getopts(eff_t effp, int n, char **argv) · 61 unmodified lines | |||
| 118 | /* | 118 | /* |
| 119 | * Start processing | 119 | * Start processing |
| 120 | */ | 120 | */ |
| 121 | int st_avg_start(eff_t effp) | 121 | static int st_avg_start(eff_t effp) |
| 122 | { | 122 | { |
| 123 | /* | 123 | /* |
| 124 | Hmmm, this is tricky. Lemme think: | 124 | Hmmm, this is tricky. Lemme think: |
| @@ -508,7 +508,7 @@ int st_avg_start(eff_t effp) · 383 unmodified lines | |||
| 508 | * Process either isamp or osamp samples, whichever is smaller. | 508 | * Process either isamp or osamp samples, whichever is smaller. |
| 509 | */ | 509 | */ |
| 510 | 510 | ||
| 511 | int st_avg_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 511 | static int st_avg_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 512 | st_size_t *isamp, st_size_t *osamp) | 512 | st_size_t *isamp, st_size_t *osamp) |
| 513 | { | 513 | { |
| 514 | avg_t avg = (avg_t) effp->priv; | 514 | avg_t avg = (avg_t) effp->priv; |
| @@ -542,7 +542,7 @@ int st_avg_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 27 unmodified lines | |||
| 542 | * | 542 | * |
| 543 | * Should have statistics on right, left, and output amplitudes. | 543 | * Should have statistics on right, left, and output amplitudes. |
| 544 | */ | 544 | */ |
| 545 | int st_avg_stop(eff_t effp) | 545 | static int st_avg_stop(eff_t effp UNUSED) |
| 546 | { | 546 | { |
| 547 | return (ST_SUCCESS); /* nothing to do */ | 547 | return (ST_SUCCESS); /* nothing to do */ |
| 548 | } | 548 | } |
| @@ -63,7 +63,7 @@ typedef struct avrstuff { · 62 unmodified lines | |||
| 63 | */ | 63 | */ |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | int st_avrstartread(ft_t ft) | 66 | static int st_avrstartread(ft_t ft) |
| 67 | { | 67 | { |
| 68 | avr_t avr = (avr_t)ft->priv; | 68 | avr_t avr = (avr_t)ft->priv; |
| 69 | int rc; | 69 | int rc; |
| @@ -148,7 +148,7 @@ int st_avrstartread(ft_t ft) · 78 unmodified lines | |||
| 148 | return(ST_SUCCESS); | 148 | return(ST_SUCCESS); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | int st_avrstartwrite(ft_t ft) | 151 | static int st_avrstartwrite(ft_t ft) |
| 152 | { | 152 | { |
| 153 | avr_t avr = (avr_t)ft->priv; | 153 | avr_t avr = (avr_t)ft->priv; |
| 154 | int rc; | 154 | int rc; |
| @@ -260,7 +260,7 @@ int st_avrstartwrite(ft_t ft) · 105 unmodified lines | |||
| 260 | return(ST_SUCCESS); | 260 | return(ST_SUCCESS); |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | st_ssize_t st_avrwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) | 263 | static st_size_t st_avrwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) |
| 264 | { | 264 | { |
| 265 | avr_t avr = (avr_t)ft->priv; | 265 | avr_t avr = (avr_t)ft->priv; |
| 266 | 266 | ||
| @@ -269,7 +269,7 @@ st_ssize_t st_avrwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) · 2 unmodified lines | |||
| 269 | return (st_rawwrite (ft, buf, nsamp)); | 269 | return (st_rawwrite (ft, buf, nsamp)); |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | int st_avrstopwrite(ft_t ft) | 272 | static int st_avrstopwrite(ft_t ft) |
| 273 | { | 273 | { |
| 274 | avr_t avr = (avr_t)ft->priv; | 274 | avr_t avr = (avr_t)ft->priv; |
| 275 | int rc; | 275 | int rc; |
| @@ -61,7 +61,7 @@ typedef struct bandstuff { · 60 unmodified lines | |||
| 61 | /* | 61 | /* |
| 62 | * Process options | 62 | * Process options |
| 63 | */ | 63 | */ |
| 64 | int st_band_getopts(eff_t effp, int n, char **argv) | 64 | static int st_band_getopts(eff_t effp, int n, char **argv) |
| 65 | { | 65 | { |
| 66 | band_t band = (band_t) effp->priv; | 66 | band_t band = (band_t) effp->priv; |
| 67 | 67 | ||
| @@ -88,7 +88,7 @@ int st_band_getopts(eff_t effp, int n, char **argv) · 20 unmodified lines | |||
| 88 | /* | 88 | /* |
| 89 | * Prepare processing. | 89 | * Prepare processing. |
| 90 | */ | 90 | */ |
| 91 | int st_band_start(eff_t effp) | 91 | static int st_band_start(eff_t effp) |
| 92 | { | 92 | { |
| 93 | band_t band = (band_t) effp->priv; | 93 | band_t band = (band_t) effp->priv; |
| 94 | if (band->center > effp->ininfo.rate/2) | 94 | if (band->center > effp->ininfo.rate/2) |
| @@ -135,7 +135,7 @@ int st_band_start(eff_t effp) · 40 unmodified lines | |||
| 135 | * Return number of samples processed. | 135 | * Return number of samples processed. |
| 136 | */ | 136 | */ |
| 137 | 137 | ||
| 138 | int st_band_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 138 | static int st_band_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 139 | st_size_t *isamp, st_size_t *osamp) | 139 | st_size_t *isamp, st_size_t *osamp) |
| 140 | { | 140 | { |
| 141 | band_t band = (band_t) effp->priv; | 141 | band_t band = (band_t) effp->priv; |
| @@ -162,7 +162,7 @@ int st_band_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 20 unmodified lines | |||
| 162 | * Do anything required when you stop reading samples. | 162 | * Do anything required when you stop reading samples. |
| 163 | * Don't close input file! | 163 | * Don't close input file! |
| 164 | */ | 164 | */ |
| 165 | int st_band_stop(eff_t effp) | 165 | static int st_band_stop(eff_t effp UNUSED) |
| 166 | { | 166 | { |
| 167 | return (ST_SUCCESS); /* nothing to do */ | 167 | return (ST_SUCCESS); /* nothing to do */ |
| 168 | } | 168 | } |
| @@ -38,7 +38,7 @@ · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | static st_effect_t st_bandpass_effect; | 39 | static st_effect_t st_bandpass_effect; |
| 40 | 40 | ||
| 41 | int st_bandpass_getopts (eff_t effp, int n, char **argv) | 41 | static int st_bandpass_getopts (eff_t effp, int n, char **argv) |
| 42 | { | 42 | { |
| 43 | butterworth_t butterworth = (butterworth_t)effp->priv; | 43 | butterworth_t butterworth = (butterworth_t)effp->priv; |
| 44 | 44 | ||
| @@ -61,7 +61,7 @@ int st_bandpass_getopts (eff_t effp, int n, char **argv) · 16 unmodified lines | |||
| 61 | return (ST_SUCCESS); | 61 | return (ST_SUCCESS); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | int st_bandpass_start (eff_t effp) | 64 | static int st_bandpass_start(eff_t effp) |
| 65 | { | 65 | { |
| 66 | butterworth_t butterworth = (butterworth_t) effp->priv; | 66 | butterworth_t butterworth = (butterworth_t) effp->priv; |
| 67 | double c; | 67 | double c; |
| @@ -38,7 +38,7 @@ · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | static st_effect_t st_bandreject_effect; | 39 | static st_effect_t st_bandreject_effect; |
| 40 | 40 | ||
| 41 | int st_bandreject_getopts(eff_t effp, int n, char **argv) | 41 | static int st_bandreject_getopts(eff_t effp, int n, char **argv) |
| 42 | { | 42 | { |
| 43 | butterworth_t butterworth = (butterworth_t)effp->priv; | 43 | butterworth_t butterworth = (butterworth_t)effp->priv; |
| 44 | 44 | ||
| @@ -61,7 +61,7 @@ int st_bandreject_getopts(eff_t effp, int n, char **argv) · 16 unmodified lines | |||
| 61 | return (ST_SUCCESS); | 61 | return (ST_SUCCESS); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | int st_bandreject_start(eff_t effp) | 64 | static int st_bandreject_start(eff_t effp) |
| 65 | { | 65 | { |
| 66 | butterworth_t butterworth = (butterworth_t) effp->priv; | 66 | butterworth_t butterworth = (butterworth_t) effp->priv; |
| 67 | double c; | 67 | double c; |
| @@ -39,7 +39,7 @@ typedef struct cdrstuff { · 38 unmodified lines | |||
| 39 | * mono/stereo/quad. | 39 | * mono/stereo/quad. |
| 40 | */ | 40 | */ |
| 41 | 41 | ||
| 42 | int st_cdrstartread(ft_t ft) | 42 | static int st_cdrstartread(ft_t ft) |
| 43 | { | 43 | { |
| 44 | int rc; | 44 | int rc; |
| 45 | 45 | ||
| @@ -78,7 +78,7 @@ int st_cdrstartread(ft_t ft) · 32 unmodified lines | |||
| 78 | * Return number of samples read. | 78 | * Return number of samples read. |
| 79 | */ | 79 | */ |
| 80 | 80 | ||
| 81 | st_ssize_t st_cdrread(ft_t ft, st_sample_t *buf, st_size_t len) | 81 | static st_size_t st_cdrread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 82 | { | 82 | { |
| 83 | 83 | ||
| 84 | return st_rawread(ft, buf, len); | 84 | return st_rawread(ft, buf, len); |
| @@ -88,13 +88,13 @@ st_ssize_t st_cdrread(ft_t ft, st_sample_t *buf, st_size_t len) · 3 unmodified lines | |||
| 88 | * Do anything required when you stop reading samples. | 88 | * Do anything required when you stop reading samples. |
| 89 | * Don't close input file! | 89 | * Don't close input file! |
| 90 | */ | 90 | */ |
| 91 | int st_cdrstopread(ft_t ft) | 91 | static int st_cdrstopread(ft_t ft) |
| 92 | { | 92 | { |
| 93 | /* Needed because of rawread() */ | 93 | /* Needed because of rawread() */ |
| 94 | return st_rawstopread(ft); | 94 | return st_rawstopread(ft); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | int st_cdrstartwrite(ft_t ft) | 97 | static int st_cdrstartwrite(ft_t ft) |
| 98 | { | 98 | { |
| 99 | cdr_t cdr = (cdr_t) ft->priv; | 99 | cdr_t cdr = (cdr_t) ft->priv; |
| 100 | int rc; | 100 | int rc; |
| @@ -121,7 +121,7 @@ int st_cdrstartwrite(ft_t ft) · 20 unmodified lines | |||
| 121 | return(ST_SUCCESS); | 121 | return(ST_SUCCESS); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | st_ssize_t st_cdrwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 124 | static st_size_t st_cdrwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 125 | { | 125 | { |
| 126 | cdr_t cdr = (cdr_t) ft->priv; | 126 | cdr_t cdr = (cdr_t) ft->priv; |
| 127 | 127 | ||
| @@ -135,7 +135,7 @@ st_ssize_t st_cdrwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 7 unmodified lines | |||
| 135 | * samples. We write -32768 for each sample to pad it out. | 135 | * samples. We write -32768 for each sample to pad it out. |
| 136 | */ | 136 | */ |
| 137 | 137 | ||
| 138 | int st_cdrstopwrite(ft_t ft) | 138 | static int st_cdrstopwrite(ft_t ft) |
| 139 | { | 139 | { |
| 140 | cdr_t cdr = (cdr_t) ft->priv; | 140 | cdr_t cdr = (cdr_t) ft->priv; |
| 141 | int padsamps = SECTORSIZE - (cdr->samples % SECTORSIZE); | 141 | int padsamps = SECTORSIZE - (cdr->samples % SECTORSIZE); |
| @@ -92,7 +92,7 @@ typedef struct chorusstuff { · 91 unmodified lines | |||
| 92 | /* | 92 | /* |
| 93 | * Process options | 93 | * Process options |
| 94 | */ | 94 | */ |
| 95 | int st_chorus_getopts(eff_t effp, int n, char **argv) | 95 | static int st_chorus_getopts(eff_t effp, int n, char **argv) |
| 96 | { | 96 | { |
| 97 | chorus_t chorus = (chorus_t) effp->priv; | 97 | chorus_t chorus = (chorus_t) effp->priv; |
| 98 | int i; | 98 | int i; |
| @@ -136,7 +136,7 @@ int st_chorus_getopts(eff_t effp, int n, char **argv) · 37 unmodified lines | |||
| 136 | /* | 136 | /* |
| 137 | * Prepare for processing. | 137 | * Prepare for processing. |
| 138 | */ | 138 | */ |
| 139 | int st_chorus_start(eff_t effp) | 139 | static int st_chorus_start(eff_t effp) |
| 140 | { | 140 | { |
| 141 | chorus_t chorus = (chorus_t) effp->priv; | 141 | chorus_t chorus = (chorus_t) effp->priv; |
| 142 | int i; | 142 | int i; |
| @@ -254,7 +254,7 @@ int st_chorus_start(eff_t effp) · 111 unmodified lines | |||
| 254 | * Processed signed long samples from ibuf to obuf. | 254 | * Processed signed long samples from ibuf to obuf. |
| 255 | * Return number of samples processed. | 255 | * Return number of samples processed. |
| 256 | */ | 256 | */ |
| 257 | int st_chorus_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 257 | static int st_chorus_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 258 | st_size_t *isamp, st_size_t *osamp) | 258 | st_size_t *isamp, st_size_t *osamp) |
| 259 | { | 259 | { |
| 260 | chorus_t chorus = (chorus_t) effp->priv; | 260 | chorus_t chorus = (chorus_t) effp->priv; |
| @@ -293,7 +293,7 @@ int st_chorus_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 32 unmodified lines | |||
| 293 | /* | 293 | /* |
| 294 | * Drain out reverb lines. | 294 | * Drain out reverb lines. |
| 295 | */ | 295 | */ |
| 296 | int st_chorus_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 296 | static int st_chorus_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 297 | { | 297 | { |
| 298 | chorus_t chorus = (chorus_t) effp->priv; | 298 | chorus_t chorus = (chorus_t) effp->priv; |
| 299 | st_size_t done; | 299 | st_size_t done; |
| @@ -336,7 +336,7 @@ int st_chorus_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 36 unmodified lines | |||
| 336 | /* | 336 | /* |
| 337 | * Clean up chorus effect. | 337 | * Clean up chorus effect. |
| 338 | */ | 338 | */ |
| 339 | int st_chorus_stop(eff_t effp) | 339 | static int st_chorus_stop(eff_t effp) |
| 340 | { | 340 | { |
| 341 | chorus_t chorus = (chorus_t) effp->priv; | 341 | chorus_t chorus = (chorus_t) effp->priv; |
| 342 | int i; | 342 | int i; |
| @@ -70,7 +70,7 @@ typedef struct { · 69 unmodified lines | |||
| 70 | * Don't do initialization now. | 70 | * Don't do initialization now. |
| 71 | * The 'info' fields are not yet filled in. | 71 | * The 'info' fields are not yet filled in. |
| 72 | */ | 72 | */ |
| 73 | int st_compand_getopts(eff_t effp, int n, char **argv) | 73 | static int st_compand_getopts(eff_t effp, int n, char **argv) |
| 74 | { | 74 | { |
| 75 | compand_t l = (compand_t) effp->priv; | 75 | compand_t l = (compand_t) effp->priv; |
| 76 | 76 | ||
| @@ -191,7 +191,7 @@ int st_compand_getopts(eff_t effp, int n, char **argv) · 114 unmodified lines | |||
| 191 | * Prepare processing. | 191 | * Prepare processing. |
| 192 | * Do all initializations. | 192 | * Do all initializations. |
| 193 | */ | 193 | */ |
| 194 | int st_compand_start(eff_t effp) | 194 | static int st_compand_start(eff_t effp) |
| 195 | { | 195 | { |
| 196 | compand_t l = (compand_t) effp->priv; | 196 | compand_t l = (compand_t) effp->priv; |
| 197 | int i; | 197 | int i; |
| @@ -264,14 +264,14 @@ static void doVolume(double *v, double samp, compand_t l, int chan) · 66 unmodified lines | |||
| 264 | * Processed signed long samples from ibuf to obuf. | 264 | * Processed signed long samples from ibuf to obuf. |
| 265 | * Return number of samples processed. | 265 | * Return number of samples processed. |
| 266 | */ | 266 | */ |
| 267 | int st_compand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 267 | static int st_compand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 268 | st_size_t *isamp, st_size_t *osamp) | 268 | st_size_t *isamp, st_size_t *osamp) |
| 269 | { | 269 | { |
| 270 | compand_t l = (compand_t) effp->priv; | 270 | compand_t l = (compand_t) effp->priv; |
| 271 | int len = (*isamp > *osamp) ? *osamp : *isamp; | 271 | int len = (*isamp > *osamp) ? *osamp : *isamp; |
| 272 | int filechans = effp->outinfo.channels; | 272 | int filechans = effp->outinfo.channels; |
| 273 | int idone,odone; | 273 | int idone,odone; |
| 274 | int64_t checkbuf; //if st_sample_t of type int32_t | 274 | int64_t checkbuf; /* if st_sample_t of type int32_t */ |
| 275 | 275 | ||
| 276 | for (idone = 0,odone = 0; idone < len; ibuf += filechans) { | 276 | for (idone = 0,odone = 0; idone < len; ibuf += filechans) { |
| 277 | int chan; | 277 | int chan; |
| @@ -326,7 +326,7 @@ int st_compand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 48 unmodified lines | |||
| 326 | { | 326 | { |
| 327 | if (l->delay_buf_cnt >= l->delay_buf_size) | 327 | if (l->delay_buf_cnt >= l->delay_buf_size) |
| 328 | { | 328 | { |
| 329 | l->delay_buf_full=1; //delay buffer is now definetly full | 329 | l->delay_buf_full=1; /* delay buffer is now definetly full */ |
| 330 | checkbuf = l->delay_buf[l->delay_buf_ptr]*(outv/v)*l->outgain; | 330 | checkbuf = l->delay_buf[l->delay_buf_ptr]*(outv/v)*l->outgain; |
| 331 | ST_SAMPLE_CLIP_COUNT(checkbuf, effp->clippedCount); | 331 | ST_SAMPLE_CLIP_COUNT(checkbuf, effp->clippedCount); |
| 332 | obuf[odone] = checkbuf; | 332 | obuf[odone] = checkbuf; |
| @@ -337,7 +337,7 @@ int st_compand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 4 unmodified lines | |||
| 337 | else | 337 | else |
| 338 | { | 338 | { |
| 339 | l->delay_buf_cnt++; | 339 | l->delay_buf_cnt++; |
| 340 | idone++; //no "odone++" because we did not fill obuf[...] | 340 | idone++; /* no "odone++" because we did not fill obuf[...] */ |
| 341 | } | 341 | } |
| 342 | l->delay_buf[l->delay_buf_ptr++] = ibuf[chan]; | 342 | l->delay_buf[l->delay_buf_ptr++] = ibuf[chan]; |
| 343 | l->delay_buf_ptr %= l->delay_buf_size; | 343 | l->delay_buf_ptr %= l->delay_buf_size; |
| @@ -352,7 +352,7 @@ int st_compand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 8 unmodified lines | |||
| 352 | /* | 352 | /* |
| 353 | * Drain out compander delay lines. | 353 | * Drain out compander delay lines. |
| 354 | */ | 354 | */ |
| 355 | int st_compand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 355 | static int st_compand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 356 | { | 356 | { |
| 357 | compand_t l = (compand_t) effp->priv; | 357 | compand_t l = (compand_t) effp->priv; |
| 358 | st_size_t done; | 358 | st_size_t done; |
| @@ -380,7 +380,7 @@ int st_compand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 21 unmodified lines | |||
| 380 | /* | 380 | /* |
| 381 | * Clean up compander effect. | 381 | * Clean up compander effect. |
| 382 | */ | 382 | */ |
| 383 | int st_compand_stop(eff_t effp) | 383 | static int st_compand_stop(eff_t effp) |
| 384 | { | 384 | { |
| 385 | compand_t l = (compand_t) effp->priv; | 385 | compand_t l = (compand_t) effp->priv; |
| 386 | 386 | ||
| @@ -19,7 +19,7 @@ static st_effect_t st_copy_effect; · 18 unmodified lines | |||
| 19 | /* | 19 | /* |
| 20 | * Process options | 20 | * Process options |
| 21 | */ | 21 | */ |
| 22 | int st_copy_getopts(eff_t effp, int n, char **argv) | 22 | static int st_copy_getopts(eff_t effp UNUSED, int n, char **argv UNUSED) |
| 23 | { | 23 | { |
| 24 | if (n) | 24 | if (n) |
| 25 | { | 25 | { |
| @@ -32,11 +32,11 @@ int st_copy_getopts(eff_t effp, int n, char **argv) · 6 unmodified lines | |||
| 32 | /* | 32 | /* |
| 33 | * Start processing | 33 | * Start processing |
| 34 | */ | 34 | */ |
| 35 | int st_copy_start(eff_t effp) | 35 | static int st_copy_start(eff_t effp UNUSED) |
| 36 | { | 36 | { |
| 37 | /* nothing to do */ | 37 | /* nothing to do */ |
| 38 | /* stuff data into delaying effects here */ | 38 | /* stuff data into delaying effects here */ |
| 39 | return (ST_SUCCESS); | 39 | return (ST_SUCCESS); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | /* | 42 | /* |
| @@ -45,7 +45,7 @@ int st_copy_start(eff_t effp) · 2 unmodified lines | |||
| 45 | * Place in buf[]. | 45 | * Place in buf[]. |
| 46 | * Return number of samples read. | 46 | * Return number of samples read. |
| 47 | */ | 47 | */ |
| 48 | int st_copy_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 48 | static int st_copy_flow(eff_t effp UNUSED, const st_sample_t *ibuf, st_sample_t *obuf, |
| 49 | st_size_t *isamp, st_size_t *osamp) | 49 | st_size_t *isamp, st_size_t *osamp) |
| 50 | { | 50 | { |
| 51 | int done; | 51 | int done; |
| @@ -56,16 +56,6 @@ int st_copy_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 4 unmodified lines | |||
| 56 | return (ST_SUCCESS); | 56 | return (ST_SUCCESS); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | /* | ||
| 60 | * Do anything required when you stop reading samples. | ||
| 61 | * Don't close input file! | ||
| 62 | */ | ||
| 63 | int st_copy_stop(eff_t effp) | ||
| 64 | { | ||
| 65 | /* nothing to do */ | ||
| 66 | return (ST_SUCCESS); | ||
| 67 | } | ||
| 68 | |||
| 69 | static st_effect_t st_copy_effect = { | 59 | static st_effect_t st_copy_effect = { |
| 70 | "copy", | 60 | "copy", |
| 71 | "Usage: Copy effect takes no options", | 61 | "Usage: Copy effect takes no options", |
| @@ -153,7 +153,7 @@ static void cvsdstartcommon(ft_t ft) · 152 unmodified lines | |||
| 153 | 153 | ||
| 154 | /* ---------------------------------------------------------------------- */ | 154 | /* ---------------------------------------------------------------------- */ |
| 155 | 155 | ||
| 156 | int st_cvsdstartread(ft_t ft) | 156 | static int st_cvsdstartread(ft_t ft) |
| 157 | { | 157 | { |
| 158 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; | 158 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; |
| 159 | float *fp1; | 159 | float *fp1; |
| @@ -179,7 +179,7 @@ int st_cvsdstartread(ft_t ft) · 19 unmodified lines | |||
| 179 | 179 | ||
| 180 | /* ---------------------------------------------------------------------- */ | 180 | /* ---------------------------------------------------------------------- */ |
| 181 | 181 | ||
| 182 | int st_cvsdstartwrite(ft_t ft) | 182 | static int st_cvsdstartwrite(ft_t ft) |
| 183 | { | 183 | { |
| 184 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; | 184 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; |
| 185 | float *fp1; | 185 | float *fp1; |
| @@ -201,7 +201,7 @@ int st_cvsdstartwrite(ft_t ft) · 15 unmodified lines | |||
| 201 | 201 | ||
| 202 | /* ---------------------------------------------------------------------- */ | 202 | /* ---------------------------------------------------------------------- */ |
| 203 | 203 | ||
| 204 | int st_cvsdstopwrite(ft_t ft) | 204 | static int st_cvsdstopwrite(ft_t ft) |
| 205 | { | 205 | { |
| 206 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; | 206 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; |
| 207 | 207 | ||
| @@ -217,7 +217,7 @@ int st_cvsdstopwrite(ft_t ft) · 9 unmodified lines | |||
| 217 | 217 | ||
| 218 | /* ---------------------------------------------------------------------- */ | 218 | /* ---------------------------------------------------------------------- */ |
| 219 | 219 | ||
| 220 | int st_cvsdstopread(ft_t ft) | 220 | static int st_cvsdstopread(ft_t ft) |
| 221 | { | 221 | { |
| 222 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; | 222 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; |
| 223 | 223 | ||
| @@ -229,10 +229,10 @@ int st_cvsdstopread(ft_t ft) · 5 unmodified lines | |||
| 229 | 229 | ||
| 230 | /* ---------------------------------------------------------------------- */ | 230 | /* ---------------------------------------------------------------------- */ |
| 231 | 231 | ||
| 232 | st_ssize_t st_cvsdread(ft_t ft, st_sample_t *buf, st_size_t nsamp) | 232 | static st_size_t st_cvsdread(ft_t ft, st_sample_t *buf, st_size_t nsamp) |
| 233 | { | 233 | { |
| 234 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; | 234 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; |
| 235 | int done = 0; | 235 | st_size_t done = 0; |
| 236 | float oval; | 236 | float oval; |
| 237 | 237 | ||
| 238 | while (done < nsamp) { | 238 | while (done < nsamp) { |
| @@ -288,10 +288,10 @@ st_ssize_t st_cvsdread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 49 unmodified lines | |||
| 288 | 288 | ||
| 289 | /* ---------------------------------------------------------------------- */ | 289 | /* ---------------------------------------------------------------------- */ |
| 290 | 290 | ||
| 291 | st_ssize_t st_cvsdwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) | 291 | static st_size_t st_cvsdwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) |
| 292 | { | 292 | { |
| 293 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; | 293 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; |
| 294 | int done = 0; | 294 | st_size_t done = 0; |
| 295 | float inval; | 295 | float inval; |
| 296 | 296 | ||
| 297 | for(;;) { | 297 | for(;;) { |
| @@ -519,7 +519,7 @@ static void make_dvms_hdr(ft_t ft, struct dvms_header *hdr) · 221 unmodified lines | |||
| 519 | 519 | ||
| 520 | /* ---------------------------------------------------------------------- */ | 520 | /* ---------------------------------------------------------------------- */ |
| 521 | 521 | ||
| 522 | int st_dvmsstartread(ft_t ft) | 522 | static int st_dvmsstartread(ft_t ft) |
| 523 | { | 523 | { |
| 524 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; | 524 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; |
| 525 | struct dvms_header hdr; | 525 | struct dvms_header hdr; |
| @@ -558,7 +558,7 @@ int st_dvmsstartread(ft_t ft) · 32 unmodified lines | |||
| 558 | 558 | ||
| 559 | /* ---------------------------------------------------------------------- */ | 559 | /* ---------------------------------------------------------------------- */ |
| 560 | 560 | ||
| 561 | int st_dvmsstartwrite(ft_t ft) | 561 | static int st_dvmsstartwrite(ft_t ft) |
| 562 | { | 562 | { |
| 563 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; | 563 | struct cvsdpriv *p = (struct cvsdpriv *) ft->priv; |
| 564 | struct dvms_header hdr; | 564 | struct dvms_header hdr; |
| @@ -584,7 +584,7 @@ int st_dvmsstartwrite(ft_t ft) · 19 unmodified lines | |||
| 584 | 584 | ||
| 585 | /* ---------------------------------------------------------------------- */ | 585 | /* ---------------------------------------------------------------------- */ |
| 586 | 586 | ||
| 587 | int st_dvmsstopwrite(ft_t ft) | 587 | static int st_dvmsstopwrite(ft_t ft) |
| 588 | { | 588 | { |
| 589 | struct dvms_header hdr; | 589 | struct dvms_header hdr; |
| 590 | int rc; | 590 | int rc; |
| @@ -1,27 +1,15 @@ | |||
| 1 | |||
| 2 | /* | 1 | /* |
| 3 | * July 5, 1991 | 2 | * Sound Tools text format file. Tom Littlejohn, March 93. |
| 4 | * Copyright 1991 Lance Norskog And Sundry Contributors | 3 | * |
| 4 | * Reads/writes sound files as text for use with FFT and graph. | ||
| 5 | * | ||
| 6 | * Copyright 1998-2006 Chris Bagwell and SoX Contributors | ||
| 5 | * This source code is freely redistributable and may be used for | 7 | * This source code is freely redistributable and may be used for |
| 6 | * any purpose. This copyright notice must be maintained. | 8 | * any purpose. This copyright notice must be maintained. |
| 7 | * Lance Norskog And Sundry Contributors are not responsible for | 9 | * Lance Norskog And Sundry Contributors are not responsible for |
| 8 | * the consequences of using this software. | 10 | * the consequences of using this software. |
| 9 | */ | 11 | */ |
| 10 | 12 | ||
| 11 | /* | ||
| 12 | * Sound Tools text format file. Tom Littlejohn, March 93. | ||
| 13 | * | ||
| 14 | * Reads/writes sound files as text for use with fft and graph. | ||
| 15 | * | ||
| 16 | * June 28, 93: force output to mono. | ||
| 17 | * | ||
| 18 | * September 24, 1998: cbagwell - Set up extra output format info so that | ||
| 19 | * reports are accurate. Also warn user when forcing to mono. | ||
| 20 | * | ||
| 21 | * November 25, 2005: tomchristie - Work with multiple channels | ||
| 22 | * | ||
| 23 | */ | ||
| 24 | |||
| 25 | #include "st_i.h" | 13 | #include "st_i.h" |
| 26 | #include <string.h> | 14 | #include <string.h> |
| 27 | 15 | ||
| @@ -34,7 +22,7 @@ typedef struct dat { · 6 unmodified lines | |||
| 34 | char prevline[LINEWIDTH]; | 22 | char prevline[LINEWIDTH]; |
| 35 | } *dat_t; | 23 | } *dat_t; |
| 36 | 24 | ||
| 37 | int st_datstartread(ft_t ft) | 25 | static int st_datstartread(ft_t ft) |
| 38 | { | 26 | { |
| 39 | char inpstr[LINEWIDTH]; | 27 | char inpstr[LINEWIDTH]; |
| 40 | long rate; | 28 | long rate; |
| @@ -61,7 +49,7 @@ int st_datstartread(ft_t ft) · 20 unmodified lines | |||
| 61 | } | 49 | } |
| 62 | 50 | ||
| 63 | /* Default channels to 1 if not found */ | 51 | /* Default channels to 1 if not found */ |
| 64 | if (ft->info.channels == -1) | 52 | if (ft->info.channels == 0) |
| 65 | ft->info.channels = 1; | 53 | ft->info.channels = 1; |
| 66 | 54 | ||
| 67 | ft->info.size = ST_SIZE_64BIT; | 55 | ft->info.size = ST_SIZE_64BIT; |
| @@ -70,7 +58,7 @@ int st_datstartread(ft_t ft) · 2 unmodified lines | |||
| 70 | return (ST_SUCCESS); | 58 | return (ST_SUCCESS); |
| 71 | } | 59 | } |
| 72 | 60 | ||
| 73 | int st_datstartwrite(ft_t ft) | 61 | static int st_datstartwrite(ft_t ft) |
| 74 | { | 62 | { |
| 75 | dat_t dat = (dat_t) ft->priv; | 63 | dat_t dat = (dat_t) ft->priv; |
| 76 | char s[LINEWIDTH]; | 64 | char s[LINEWIDTH]; |
| @@ -88,7 +76,7 @@ int st_datstartwrite(ft_t ft) · 11 unmodified lines | |||
| 88 | return (ST_SUCCESS); | 76 | return (ST_SUCCESS); |
| 89 | } | 77 | } |
| 90 | 78 | ||
| 91 | st_ssize_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp) | 79 | static st_size_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp) |
| 92 | { | 80 | { |
| 93 | char inpstr[LINEWIDTH]; | 81 | char inpstr[LINEWIDTH]; |
| 94 | int inpPtr = 0; | 82 | int inpPtr = 0; |
| @@ -96,8 +84,8 @@ st_ssize_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 1 unmodified line | |||
| 96 | double sampval = 0.0; | 84 | double sampval = 0.0; |
| 97 | int retc = 0; | 85 | int retc = 0; |
| 98 | char sc = 0; | 86 | char sc = 0; |
| 99 | int done = 0; | 87 | st_size_t done = 0; |
| 100 | int i=0; | 88 | st_size_t i=0; |
| 101 | 89 | ||
| 102 | /* Always read a complete set of channels */ | 90 | /* Always read a complete set of channels */ |
| 103 | nsamp -= (nsamp % ft->info.channels); | 91 | nsamp -= (nsamp % ft->info.channels); |
| @@ -135,13 +123,13 @@ st_ssize_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 31 unmodified lines | |||
| 135 | return (done); | 123 | return (done); |
| 136 | } | 124 | } |
| 137 | 125 | ||
| 138 | st_ssize_t st_datwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) | 126 | static st_size_t st_datwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) |
| 139 | { | 127 | { |
| 140 | dat_t dat = (dat_t) ft->priv; | 128 | dat_t dat = (dat_t) ft->priv; |
| 141 | int done = 0; | 129 | st_size_t done = 0; |
| 142 | double sampval=0.0; | 130 | double sampval=0.0; |
| 143 | char s[LINEWIDTH]; | 131 | char s[LINEWIDTH]; |
| 144 | int i=0; | 132 | st_size_t i=0; |
| 145 | 133 | ||
| 146 | /* Always write a complete set of channels */ | 134 | /* Always write a complete set of channels */ |
| 147 | nsamp -= (nsamp % ft->info.channels); | 135 | nsamp -= (nsamp % ft->info.channels); |
| @@ -30,7 +30,7 @@ typedef struct { · 29 unmodified lines | |||
| 30 | /* | 30 | /* |
| 31 | * Process options: dcshift (double) type (amplitude, power, dB) | 31 | * Process options: dcshift (double) type (amplitude, power, dB) |
| 32 | */ | 32 | */ |
| 33 | int st_dcshift_getopts(eff_t effp, int n, char **argv) | 33 | static int st_dcshift_getopts(eff_t effp, int n, char **argv) |
| 34 | { | 34 | { |
| 35 | dcs_t dcs = (dcs_t) effp->priv; | 35 | dcs_t dcs = (dcs_t) effp->priv; |
| 36 | dcs->dcshift = 1.0; /* default is no change */ | 36 | dcs->dcshift = 1.0; /* default is no change */ |
| @@ -72,7 +72,7 @@ int st_dcshift_getopts(eff_t effp, int n, char **argv) · 35 unmodified lines | |||
| 72 | /* | 72 | /* |
| 73 | * Start processing | 73 | * Start processing |
| 74 | */ | 74 | */ |
| 75 | int st_dcshift_start(eff_t effp) | 75 | static int st_dcshift_start(eff_t effp) |
| 76 | { | 76 | { |
| 77 | dcs_t dcs = (dcs_t) effp->priv; | 77 | dcs_t dcs = (dcs_t) effp->priv; |
| 78 | 78 | ||
| @@ -99,7 +99,7 @@ int st_dcshift_start(eff_t effp) · 20 unmodified lines | |||
| 99 | /* | 99 | /* |
| 100 | * Process data. | 100 | * Process data. |
| 101 | */ | 101 | */ |
| 102 | int st_dcshift_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 102 | static int st_dcshift_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 103 | st_size_t *isamp, st_size_t *osamp) | 103 | st_size_t *isamp, st_size_t *osamp) |
| 104 | { | 104 | { |
| 105 | dcs_t dcs = (dcs_t) effp->priv; | 105 | dcs_t dcs = (dcs_t) effp->priv; |
| @@ -166,7 +166,7 @@ int st_dcshift_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 60 unmodified lines | |||
| 166 | * Do anything required when you stop reading samples. | 166 | * Do anything required when you stop reading samples. |
| 167 | * Don't close input file! | 167 | * Don't close input file! |
| 168 | */ | 168 | */ |
| 169 | int st_dcshift_stop(eff_t effp) | 169 | static int st_dcshift_stop(eff_t effp) |
| 170 | { | 170 | { |
| 171 | dcs_t dcs = (dcs_t) effp->priv; | 171 | dcs_t dcs = (dcs_t) effp->priv; |
| 172 | 172 | ||
| @@ -112,22 +112,6 @@ typedef struct deemphstuff { · 111 unmodified lines | |||
| 112 | assert_static(sizeof(struct deemphstuff) <= ST_MAX_EFFECT_PRIVSIZE, | 112 | assert_static(sizeof(struct deemphstuff) <= ST_MAX_EFFECT_PRIVSIZE, |
| 113 | /* else */ deemph_PRIVSIZE_too_big); | 113 | /* else */ deemph_PRIVSIZE_too_big); |
| 114 | 114 | ||
| 115 | /* | ||
| 116 | * Process options | ||
| 117 | * | ||
| 118 | * Don't do initialization now. | ||
| 119 | * The 'info' fields are not yet filled in. | ||
| 120 | */ | ||
| 121 | int st_deemph_getopts(eff_t effp, int n, char **argv) | ||
| 122 | { | ||
| 123 | if (n) | ||
| 124 | { | ||
| 125 | st_fail(st_deemph_effect.usage); | ||
| 126 | return (ST_EOF); | ||
| 127 | } | ||
| 128 | return (ST_SUCCESS); | ||
| 129 | } | ||
| 130 | |||
| 131 | /* filter coefficients */ | 115 | /* filter coefficients */ |
| 132 | #define a1 -0.62786881719628784282 | 116 | #define a1 -0.62786881719628784282 |
| 133 | #define b0 0.45995451989513153057 | 117 | #define b0 0.45995451989513153057 |
| @@ -137,7 +121,7 @@ int st_deemph_getopts(eff_t effp, int n, char **argv) · 3 unmodified lines | |||
| 137 | * Prepare processing. | 121 | * Prepare processing. |
| 138 | * Do all initializations. | 122 | * Do all initializations. |
| 139 | */ | 123 | */ |
| 140 | int st_deemph_start(eff_t effp) | 124 | static int st_deemph_start(eff_t effp) |
| 141 | { | 125 | { |
| 142 | /* check the input format */ | 126 | /* check the input format */ |
| 143 | 127 | ||
| @@ -188,7 +172,7 @@ int st_deemph_start(eff_t effp) · 44 unmodified lines | |||
| 188 | * Return number of samples processed. | 172 | * Return number of samples processed. |
| 189 | */ | 173 | */ |
| 190 | 174 | ||
| 191 | int st_deemph_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 175 | static int st_deemph_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 192 | st_size_t *isamp, st_size_t *osamp) | 176 | st_size_t *isamp, st_size_t *osamp) |
| 193 | { | 177 | { |
| 194 | deemph_t deemph = (deemph_t) effp->priv; | 178 | deemph_t deemph = (deemph_t) effp->priv; |
| @@ -208,35 +192,15 @@ int st_deemph_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 13 unmodified lines | |||
| 208 | return (ST_SUCCESS); | 192 | return (ST_SUCCESS); |
| 209 | } | 193 | } |
| 210 | 194 | ||
| 211 | /* | ||
| 212 | * Drain out remaining samples if the effect generates any. | ||
| 213 | */ | ||
| 214 | |||
| 215 | int st_deemph_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | ||
| 216 | { | ||
| 217 | /* nothing to do */ | ||
| 218 | return (ST_EOF); | ||
| 219 | } | ||
| 220 | |||
| 221 | /* | ||
| 222 | * Do anything required when you stop reading samples. | ||
| 223 | * (free allocated memory, etc.) | ||
| 224 | */ | ||
| 225 | int st_deemph_stop(eff_t effp) | ||
| 226 | { | ||
| 227 | /* nothing to do */ | ||
| 228 | return (ST_SUCCESS); | ||
| 229 | } | ||
| 230 | |||
| 231 | static st_effect_t st_deemph_effect = { | 195 | static st_effect_t st_deemph_effect = { |
| 232 | "deemph", | 196 | "deemph", |
| 233 | "Usage: Deemphasis filtering effect takes no options", | 197 | "Usage: Deemphasis filtering effect takes no options", |
| 234 | 0, | 198 | 0, |
| 235 | st_deemph_getopts, | 199 | st_effect_nothing_getopts, |
| 236 | st_deemph_start, | 200 | st_deemph_start, |
| 237 | st_deemph_flow, | 201 | st_deemph_flow, |
| 238 | st_effect_nothing_drain, | 202 | st_effect_nothing_drain, |
| 239 | st_deemph_stop | 203 | st_effect_nothing |
| 240 | }; | 204 | }; |
| 241 | 205 | ||
| 242 | const st_effect_t *st_deemph_effect_fn(void) | 206 | const st_effect_t *st_deemph_effect_fn(void) |
| @@ -1,12 +1,3 @@ | |||
| 1 | /* | ||
| 2 | * November 9, 2000 | ||
| 3 | * Copyright (C) 2000 Edward Beingessner And Sundry Contributors | ||
| 4 | * This source code is freely redistributable and may be used for | ||
| 5 | * any purpose. This copyright notice must be maintained. | ||
| 6 | * Edward Beingessner And Sundry Contributors are not responsible for | ||
| 7 | * the consequences of using this software. | ||
| 8 | */ | ||
| 9 | |||
| 10 | /* | 1 | /* |
| 11 | * earwax - makes listening to headphones easier | 2 | * earwax - makes listening to headphones easier |
| 12 | * | 3 | * |
| @@ -23,7 +14,13 @@ · 10 unmodified lines | |||
| 23 | * Note: | 14 | * Note: |
| 24 | * This filter only works for 44.1 kHz stereo signals (cd format) | 15 | * This filter only works for 44.1 kHz stereo signals (cd format) |
| 25 | * | 16 | * |
| 26 | */ | 17 | * November 9, 2000 |
| 18 | * Copyright (C) 2000 Edward Beingessner And Sundry Contributors | ||
| 19 | * This source code is freely redistributable and may be used for | ||
| 20 | * any purpose. This copyright notice must be maintained. | ||
| 21 | * Edward Beingessner And Sundry Contributors are not responsible for | ||
| 22 | * the consequences of using this software. | ||
| 23 | */ | ||
| 27 | 24 | ||
| 28 | #include "st_i.h" | 25 | #include "st_i.h" |
| 29 | 26 | ||
| @@ -75,23 +72,10 @@ typedef struct earwaxstuff { · 45 unmodified lines | |||
| 75 | st_sample_t *tap; /* taps are z^-1 delays for the FIR filter */ | 72 | st_sample_t *tap; /* taps are z^-1 delays for the FIR filter */ |
| 76 | } *earwax_t; | 73 | } *earwax_t; |
| 77 | 74 | ||
| 78 | /* | ||
| 79 | * Process options | ||
| 80 | */ | ||
| 81 | int st_earwax_getopts(eff_t effp, int n, char **argv) | ||
| 82 | { | ||
| 83 | /* no options */ | ||
| 84 | if (n){ | ||
| 85 | st_fail(st_earwax_effect.usage); | ||
| 86 | return (ST_EOF); | ||
| 87 | } | ||
| 88 | return (ST_SUCCESS); | ||
| 89 | } | ||
| 90 | |||
| 91 | /* | 75 | /* |
| 92 | * Prepare for processing. | 76 | * Prepare for processing. |
| 93 | */ | 77 | */ |
| 94 | int st_earwax_start(eff_t effp) | 78 | static int st_earwax_start(eff_t effp) |
| 95 | { | 79 | { |
| 96 | earwax_t earwax = (earwax_t) effp->priv; | 80 | earwax_t earwax = (earwax_t) effp->priv; |
| 97 | int i; | 81 | int i; |
| @@ -125,7 +109,7 @@ int st_earwax_start(eff_t effp) · 27 unmodified lines | |||
| 125 | * Return number of samples processed. | 109 | * Return number of samples processed. |
| 126 | */ | 110 | */ |
| 127 | 111 | ||
| 128 | int st_earwax_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 112 | static int st_earwax_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 129 | st_size_t *isamp, st_size_t *osamp) | 113 | st_size_t *isamp, st_size_t *osamp) |
| 130 | { | 114 | { |
| 131 | earwax_t earwax = (earwax_t) effp->priv; | 115 | earwax_t earwax = (earwax_t) effp->priv; |
| @@ -157,7 +141,7 @@ int st_earwax_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 25 unmodified lines | |||
| 157 | /* | 141 | /* |
| 158 | * Drain out taps. | 142 | * Drain out taps. |
| 159 | */ | 143 | */ |
| 160 | int st_earwax_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 144 | static int st_earwax_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 161 | { | 145 | { |
| 162 | earwax_t earwax = (earwax_t) effp->priv; | 146 | earwax_t earwax = (earwax_t) effp->priv; |
| 163 | int i,j; | 147 | int i,j; |
| @@ -178,7 +162,7 @@ int st_earwax_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 14 unmodified lines | |||
| 178 | /* | 162 | /* |
| 179 | * Clean up taps. | 163 | * Clean up taps. |
| 180 | */ | 164 | */ |
| 181 | int st_earwax_stop(eff_t effp) | 165 | static int st_earwax_stop(eff_t effp) |
| 182 | { | 166 | { |
| 183 | earwax_t earwax = (earwax_t) effp->priv; | 167 | earwax_t earwax = (earwax_t) effp->priv; |
| 184 | 168 | ||
| @@ -191,7 +175,7 @@ static st_effect_t st_earwax_effect = { · 6 unmodified lines | |||
| 191 | "earwax", | 175 | "earwax", |
| 192 | "Usage: The earwax filtering effect takes no options", | 176 | "Usage: The earwax filtering effect takes no options", |
| 193 | ST_EFF_MCHAN, | 177 | ST_EFF_MCHAN, |
| 194 | st_earwax_getopts, | 178 | st_effect_nothing_getopts, |
| 195 | st_earwax_start, | 179 | st_earwax_start, |
| 196 | st_earwax_flow, | 180 | st_earwax_flow, |
| 197 | st_earwax_drain, | 181 | st_earwax_drain, |
| @@ -82,7 +82,7 @@ typedef struct echostuff { · 81 unmodified lines | |||
| 82 | /* | 82 | /* |
| 83 | * Process options | 83 | * Process options |
| 84 | */ | 84 | */ |
| 85 | int st_echo_getopts(eff_t effp, int n, char **argv) | 85 | static int st_echo_getopts(eff_t effp, int n, char **argv) |
| 86 | { | 86 | { |
| 87 | echo_t echo = (echo_t) effp->priv; | 87 | echo_t echo = (echo_t) effp->priv; |
| 88 | int i; | 88 | int i; |
| @@ -113,7 +113,7 @@ int st_echo_getopts(eff_t effp, int n, char **argv) · 24 unmodified lines | |||
| 113 | /* | 113 | /* |
| 114 | * Prepare for processing. | 114 | * Prepare for processing. |
| 115 | */ | 115 | */ |
| 116 | int st_echo_start(eff_t effp) | 116 | static int st_echo_start(eff_t effp) |
| 117 | { | 117 | { |
| 118 | echo_t echo = (echo_t) effp->priv; | 118 | echo_t echo = (echo_t) effp->priv; |
| 119 | int i; | 119 | int i; |
| @@ -143,7 +143,7 @@ int st_echo_start(eff_t effp) · 23 unmodified lines | |||
| 143 | st_fail("echo: delay must be positive!"); | 143 | st_fail("echo: delay must be positive!"); |
| 144 | return (ST_EOF); | 144 | return (ST_EOF); |
| 145 | } | 145 | } |
| 146 | if ( echo->samples[i] > DELAY_BUFSIZ ) | 146 | if ( echo->samples[i] > (st_ssize_t)DELAY_BUFSIZ ) |
| 147 | { | 147 | { |
| 148 | st_fail("echo: delay must be less than %g seconds!", | 148 | st_fail("echo: delay must be less than %g seconds!", |
| 149 | DELAY_BUFSIZ / (float) effp->ininfo.rate ); | 149 | DELAY_BUFSIZ / (float) effp->ininfo.rate ); |
| @@ -185,7 +185,7 @@ int st_echo_start(eff_t effp) · 35 unmodified lines | |||
| 185 | * Processed signed long samples from ibuf to obuf. | 185 | * Processed signed long samples from ibuf to obuf. |
| 186 | * Return number of samples processed. | 186 | * Return number of samples processed. |
| 187 | */ | 187 | */ |
| 188 | int st_echo_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 188 | static int st_echo_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 189 | st_size_t *isamp, st_size_t *osamp) | 189 | st_size_t *isamp, st_size_t *osamp) |
| 190 | { | 190 | { |
| 191 | echo_t echo = (echo_t) effp->priv; | 191 | echo_t echo = (echo_t) effp->priv; |
| @@ -222,7 +222,7 @@ int st_echo_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 30 unmodified lines | |||
| 222 | /* | 222 | /* |
| 223 | * Drain out reverb lines. | 223 | * Drain out reverb lines. |
| 224 | */ | 224 | */ |
| 225 | int st_echo_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 225 | static int st_echo_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 226 | { | 226 | { |
| 227 | echo_t echo = (echo_t) effp->priv; | 227 | echo_t echo = (echo_t) effp->priv; |
| 228 | double d_in, d_out; | 228 | double d_in, d_out; |
| @@ -262,7 +262,7 @@ int st_echo_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 33 unmodified lines | |||
| 262 | /* | 262 | /* |
| 263 | * Clean up reverb effect. | 263 | * Clean up reverb effect. |
| 264 | */ | 264 | */ |
| 265 | int st_echo_stop(eff_t effp) | 265 | static int st_echo_stop(eff_t effp) |
| 266 | { | 266 | { |
| 267 | echo_t echo = (echo_t) effp->priv; | 267 | echo_t echo = (echo_t) effp->priv; |
| 268 | 268 | ||
| @@ -52,7 +52,7 @@ · 51 unmodified lines | |||
| 52 | 52 | ||
| 53 | static st_effect_t st_echos_effect; | 53 | static st_effect_t st_echos_effect; |
| 54 | 54 | ||
| 55 | #define DELAY_BUFSIZ ( 50L * ST_MAXRATE ) | 55 | #define DELAY_BUFSIZ ( 50 * ST_MAXRATE ) |
| 56 | #define MAX_ECHOS 7 /* 24 bit x ( 1 + MAX_ECHOS ) = */ | 56 | #define MAX_ECHOS 7 /* 24 bit x ( 1 + MAX_ECHOS ) = */ |
| 57 | /* 24 bit x 8 = 32 bit !!! */ | 57 | /* 24 bit x 8 = 32 bit !!! */ |
| 58 | 58 | ||
| @@ -72,7 +72,7 @@ typedef struct echosstuff { · 13 unmodified lines | |||
| 72 | /* | 72 | /* |
| 73 | * Process options | 73 | * Process options |
| 74 | */ | 74 | */ |
| 75 | int st_echos_getopts(eff_t effp, int n, char **argv) | 75 | static int st_echos_getopts(eff_t effp, int n, char **argv) |
| 76 | { | 76 | { |
| 77 | echos_t echos = (echos_t) effp->priv; | 77 | echos_t echos = (echos_t) effp->priv; |
| 78 | int i; | 78 | int i; |
| @@ -107,7 +107,7 @@ int st_echos_getopts(eff_t effp, int n, char **argv) · 28 unmodified lines | |||
| 107 | /* | 107 | /* |
| 108 | * Prepare for processing. | 108 | * Prepare for processing. |
| 109 | */ | 109 | */ |
| 110 | int st_echos_start(eff_t effp) | 110 | static int st_echos_start(eff_t effp) |
| 111 | { | 111 | { |
| 112 | echos_t echos = (echos_t) effp->priv; | 112 | echos_t echos = (echos_t) effp->priv; |
| 113 | int i; | 113 | int i; |
| @@ -136,7 +136,7 @@ int st_echos_start(eff_t effp) · 22 unmodified lines | |||
| 136 | st_fail("echos: delay must be positive!"); | 136 | st_fail("echos: delay must be positive!"); |
| 137 | return (ST_EOF); | 137 | return (ST_EOF); |
| 138 | } | 138 | } |
| 139 | if ( echos->samples[i] > DELAY_BUFSIZ ) | 139 | if ( echos->samples[i] > (st_ssize_t)DELAY_BUFSIZ ) |
| 140 | { | 140 | { |
| 141 | st_fail("echos: delay must be less than %g seconds!", | 141 | st_fail("echos: delay must be less than %g seconds!", |
| 142 | DELAY_BUFSIZ / (float) effp->ininfo.rate ); | 142 | DELAY_BUFSIZ / (float) effp->ininfo.rate ); |
| @@ -177,7 +177,7 @@ int st_echos_start(eff_t effp) · 34 unmodified lines | |||
| 177 | * Processed signed long samples from ibuf to obuf. | 177 | * Processed signed long samples from ibuf to obuf. |
| 178 | * Return number of samples processed. | 178 | * Return number of samples processed. |
| 179 | */ | 179 | */ |
| 180 | int st_echos_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 180 | static int st_echos_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 181 | st_size_t *isamp, st_size_t *osamp) | 181 | st_size_t *isamp, st_size_t *osamp) |
| 182 | { | 182 | { |
| 183 | echos_t echos = (echos_t) effp->priv; | 183 | echos_t echos = (echos_t) effp->priv; |
| @@ -220,7 +220,7 @@ int st_echos_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 36 unmodified lines | |||
| 220 | /* | 220 | /* |
| 221 | * Drain out reverb lines. | 221 | * Drain out reverb lines. |
| 222 | */ | 222 | */ |
| 223 | int st_echos_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 223 | static int st_echos_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 224 | { | 224 | { |
| 225 | echos_t echos = (echos_t) effp->priv; | 225 | echos_t echos = (echos_t) effp->priv; |
| 226 | double d_in, d_out; | 226 | double d_in, d_out; |
| @@ -266,7 +266,7 @@ int st_echos_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 39 unmodified lines | |||
| 266 | /* | 266 | /* |
| 267 | * Clean up echos effect. | 267 | * Clean up echos effect. |
| 268 | */ | 268 | */ |
| 269 | int st_echos_stop(eff_t effp) | 269 | static int st_echos_stop(eff_t effp) |
| 270 | { | 270 | { |
| 271 | echos_t echos = (echos_t) effp->priv; | 271 | echos_t echos = (echos_t) effp->priv; |
| 272 | 272 | ||
| @@ -55,17 +55,17 @@ static st_effect_t st_equalizer_effect; · 54 unmodified lines | |||
| 55 | 55 | ||
| 56 | /* Filter parameters */ | 56 | /* Filter parameters */ |
| 57 | typedef struct filterparams { | 57 | typedef struct filterparams { |
| 58 | float rate; // Sample rate | 58 | float rate; /* Sample rate */ |
| 59 | float Q; // Q-factor | 59 | float Q; /* Q-factor */ |
| 60 | float cfreq; // Central frequency (Hz) | 60 | float cfreq; /* Central frequency (Hz) */ |
| 61 | float gain; // Gain (dB) | 61 | float gain; /* Gain (dB) */ |
| 62 | double x[3]; // In where x[2] <=> x[ n - 2 ] | 62 | double x[3]; /* In where x[2] <=> x[ n - 2 ] */ |
| 63 | double y[3]; // Out | 63 | double y[3]; /* Out */ |
| 64 | double b[3]; // From this point, equation constants... | 64 | double b[3]; /* From this point, equation constants... */ |
| 65 | double a[3]; | 65 | double a[3]; |
| 66 | } *equalizer_t; | 66 | } *equalizer_t; |
| 67 | 67 | ||
| 68 | int st_equalizer_getopts(eff_t effp, int n, char **argv) | 68 | static int st_equalizer_getopts(eff_t effp, int n, char **argv) |
| 69 | { | 69 | { |
| 70 | equalizer_t eq = (equalizer_t) effp->priv; | 70 | equalizer_t eq = (equalizer_t) effp->priv; |
| 71 | int i; | 71 | int i; |
| @@ -81,20 +81,20 @@ int st_equalizer_getopts(eff_t effp, int n, char **argv) · 9 unmodified lines | |||
| 81 | sscanf(argv[i++], "%f", &eq->Q); | 81 | sscanf(argv[i++], "%f", &eq->Q); |
| 82 | sscanf(argv[i++], "%f", &eq->gain); | 82 | sscanf(argv[i++], "%f", &eq->gain); |
| 83 | 83 | ||
| 84 | // TODO: Would be nice to validate the params.. | 84 | /* FIXME: Would be nice to validate the params.. */ |
| 85 | 85 | ||
| 86 | return (ST_SUCCESS); | 86 | return (ST_SUCCESS); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | // Set the filter constants | 89 | /* Set the filter constants */ |
| 90 | int st_equalizer_start(eff_t effp) | 90 | static int st_equalizer_start(eff_t effp) |
| 91 | { | 91 | { |
| 92 | equalizer_t eq = (equalizer_t) effp->priv; | 92 | equalizer_t eq = (equalizer_t) effp->priv; |
| 93 | double w0; | 93 | double w0; |
| 94 | double amp; | 94 | double amp; |
| 95 | double alpha; | 95 | double alpha; |
| 96 | 96 | ||
| 97 | // Sample rate | 97 | /* Sample rate */ |
| 98 | eq->rate = effp->ininfo.rate; | 98 | eq->rate = effp->ininfo.rate; |
| 99 | 99 | ||
| 100 | w0 = 2*M_PI*eq->cfreq/eq->rate; | 100 | w0 = 2*M_PI*eq->cfreq/eq->rate; |
| @@ -109,7 +109,7 @@ int st_equalizer_start(eff_t effp) · 8 unmodified lines | |||
| 109 | st_debug("amp: %f", amp); | 109 | st_debug("amp: %f", amp); |
| 110 | st_debug("alpha: %f", alpha); | 110 | st_debug("alpha: %f", alpha); |
| 111 | 111 | ||
| 112 | // Initialisation | 112 | /* Initialisation */ |
| 113 | eq->b[0] = 1 + alpha*amp; | 113 | eq->b[0] = 1 + alpha*amp; |
| 114 | eq->b[1] = -2*cos(w0); | 114 | eq->b[1] = -2*cos(w0); |
| 115 | eq->b[2] = 1 - alpha*amp; | 115 | eq->b[2] = 1 - alpha*amp; |
| @@ -117,12 +117,12 @@ int st_equalizer_start(eff_t effp) · 1 unmodified line | |||
| 117 | eq->a[1] = -2*cos(w0); | 117 | eq->a[1] = -2*cos(w0); |
| 118 | eq->a[2] = 1 - alpha/amp; | 118 | eq->a[2] = 1 - alpha/amp; |
| 119 | 119 | ||
| 120 | eq->x[0] = 0; // x[n] | 120 | eq->x[0] = 0; /* x[n] */ |
| 121 | eq->x[1] = 0; // x[n-1] | 121 | eq->x[1] = 0; /* x[n-1] */ |
| 122 | eq->x[2] = 0; // x[n-2] | 122 | eq->x[2] = 0; /* x[n-2] */ |
| 123 | eq->y[0] = 0; // y[n] | 123 | eq->y[0] = 0; /* y[n] */ |
| 124 | eq->y[1] = 0; // y[n-1] | 124 | eq->y[1] = 0; /* y[n-1] */ |
| 125 | eq->y[2] = 0; // y[n-2] | 125 | eq->y[2] = 0; /* y[n-2] */ |
| 126 | 126 | ||
| 127 | if (effp->globalinfo.octave_plot_effect) | 127 | if (effp->globalinfo.octave_plot_effect) |
| 128 | { | 128 | { |
| @@ -147,7 +147,7 @@ int st_equalizer_start(eff_t effp) · 18 unmodified lines | |||
| 147 | return (ST_SUCCESS); | 147 | return (ST_SUCCESS); |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | int st_equalizer_flow(eff_t effp, const st_sample_t *ibuf, | 150 | static int st_equalizer_flow(eff_t effp, const st_sample_t *ibuf, |
| 151 | st_sample_t *obuf, st_size_t *isamp, | 151 | st_sample_t *obuf, st_size_t *isamp, |
| 152 | st_size_t *osamp) | 152 | st_size_t *osamp) |
| 153 | { | 153 | { |
| @@ -29,7 +29,7 @@ static st_effect_t st_fade_effect; · 28 unmodified lines | |||
| 29 | /* Private data for fade file */ | 29 | /* Private data for fade file */ |
| 30 | typedef struct fadestuff | 30 | typedef struct fadestuff |
| 31 | { /* These are measured as samples */ | 31 | { /* These are measured as samples */ |
| 32 | st_size_t in_start, in_stop, out_start, out_stop, samplesdone; | 32 | st_size_t in_start, in_stop, out_start, out_stop, samplesdone; |
| 33 | char *in_stop_str, *out_start_str, *out_stop_str; | 33 | char *in_stop_str, *out_start_str, *out_stop_str; |
| 34 | char in_fadetype, out_fadetype; | 34 | char in_fadetype, out_fadetype; |
| 35 | char do_out; | 35 | char do_out; |
| @@ -46,7 +46,7 @@ static double fade_gain(st_size_t index, st_size_t range, char fadetype); · 10 unmodified lines | |||
| 46 | * The 'info' fields are not yet filled in. | 46 | * The 'info' fields are not yet filled in. |
| 47 | */ | 47 | */ |
| 48 | 48 | ||
| 49 | int st_fade_getopts(eff_t effp, int n, char **argv) | 49 | static int st_fade_getopts(eff_t effp, int n, char **argv) |
| 50 | { | 50 | { |
| 51 | 51 | ||
| 52 | fade_t fade = (fade_t) effp->priv; | 52 | fade_t fade = (fade_t) effp->priv; |
| @@ -143,7 +143,7 @@ int st_fade_getopts(eff_t effp, int n, char **argv) · 90 unmodified lines | |||
| 143 | * Prepare processing. | 143 | * Prepare processing. |
| 144 | * Do all initializations. | 144 | * Do all initializations. |
| 145 | */ | 145 | */ |
| 146 | int st_fade_start(eff_t effp) | 146 | static int st_fade_start(eff_t effp) |
| 147 | { | 147 | { |
| 148 | fade_t fade = (fade_t) effp->priv; | 148 | fade_t fade = (fade_t) effp->priv; |
| 149 | 149 | ||
| @@ -201,12 +201,11 @@ int st_fade_start(eff_t effp) · 51 unmodified lines | |||
| 201 | return(ST_EOF); | 201 | return(ST_EOF); |
| 202 | } /* endif fade time sanity */ | 202 | } /* endif fade time sanity */ |
| 203 | 203 | ||
| 204 | /* If lead-in is required it is handled as negative sample numbers */ | 204 | fade->samplesdone = fade->in_start; |
| 205 | fade->samplesdone = (fade->in_start < 0 ? fade->in_start :0); | ||
| 206 | 205 | ||
| 207 | fade->endpadwarned = 0; | 206 | fade->endpadwarned = 0; |
| 208 | 207 | ||
| 209 | /* st_debug("fade: in_start = %d in_stop = %d out_start = %d out_stop = %d", fade->in_start, fade->in_stop, fade->out_start, fade->out_stop); */ | 208 | st_debug("fade: in_start = %d in_stop = %d out_start = %d out_stop = %d", fade->in_start, fade->in_stop, fade->out_start, fade->out_stop); |
| 210 | 209 | ||
| 211 | return(ST_SUCCESS); | 210 | return(ST_SUCCESS); |
| 212 | } | 211 | } |
| @@ -215,13 +214,14 @@ int st_fade_start(eff_t effp) · 2 unmodified lines | |||
| 215 | * Processed signed long samples from ibuf to obuf. | 214 | * Processed signed long samples from ibuf to obuf. |
| 216 | * Return number of samples processed. | 215 | * Return number of samples processed. |
| 217 | */ | 216 | */ |
| 218 | int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 217 | static int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 219 | st_size_t *isamp, st_size_t *osamp) | 218 | st_size_t *isamp, st_size_t *osamp) |
| 220 | { | 219 | { |
| 221 | fade_t fade = (fade_t) effp->priv; | 220 | fade_t fade = (fade_t) effp->priv; |
| 222 | /* len is total samples, chcnt counts channels */ | 221 | /* len is total samples, chcnt counts channels */ |
| 223 | int len = 0, chcnt = 0, t_output = 1, more_output = 1; | 222 | int len = 0, t_output = 1, more_output = 1; |
| 224 | st_sample_t t_ibuf; | 223 | st_sample_t t_ibuf; |
| 224 | st_size_t chcnt = 0; | ||
| 225 | 225 | ||
| 226 | len = ((*isamp > *osamp) ? *osamp : *isamp); | 226 | len = ((*isamp > *osamp) ? *osamp : *isamp); |
| 227 | 227 | ||
| @@ -230,7 +230,7 @@ int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 2 unmodified lines | |||
| 230 | 230 | ||
| 231 | for(; len && more_output; len--) | 231 | for(; len && more_output; len--) |
| 232 | { | 232 | { |
| 233 | t_ibuf = (fade->samplesdone < 0 ? 0 : *ibuf); | 233 | t_ibuf = *ibuf; |
| 234 | 234 | ||
| 235 | if ((fade->samplesdone >= fade->in_start) && | 235 | if ((fade->samplesdone >= fade->in_start) && |
| 236 | (!fade->do_out || fade->samplesdone < fade->out_stop)) | 236 | (!fade->do_out || fade->samplesdone < fade->out_stop)) |
| @@ -265,14 +265,8 @@ int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 28 unmodified lines | |||
| 265 | t_output = 0; | 265 | t_output = 0; |
| 266 | } /* endif something to output */ | 266 | } /* endif something to output */ |
| 267 | 267 | ||
| 268 | /* samplesdone < 0 means we are inventing samples right now | 268 | *isamp += 1; |
| 269 | * and so not consuming (happens when in_start < 0). | 269 | ibuf++; |
| 270 | */ | ||
| 271 | if (fade->samplesdone >= 0 ) | ||
| 272 | { /* Something to input */ | ||
| 273 | *isamp += 1; | ||
| 274 | ibuf++; | ||
| 275 | } /* endif something accepted as input */ | ||
| 276 | 270 | ||
| 277 | if (t_output) | 271 | if (t_output) |
| 278 | { /* Output generated, update pointers and counters */ | 272 | { /* Output generated, update pointers and counters */ |
| @@ -301,10 +295,11 @@ int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 22 unmodified lines | |||
| 301 | /* | 295 | /* |
| 302 | * Drain out remaining samples if the effect generates any. | 296 | * Drain out remaining samples if the effect generates any. |
| 303 | */ | 297 | */ |
| 304 | int st_fade_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 298 | static int st_fade_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 305 | { | 299 | { |
| 306 | fade_t fade = (fade_t) effp->priv; | 300 | fade_t fade = (fade_t) effp->priv; |
| 307 | int len, t_chan = 0; | 301 | int len; |
| 302 | st_size_t t_chan = 0; | ||
| 308 | 303 | ||
| 309 | len = *osamp; | 304 | len = *osamp; |
| 310 | *osamp = 0; | 305 | *osamp = 0; |
| @@ -341,7 +336,7 @@ int st_fade_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 30 unmodified lines | |||
| 341 | * Do anything required when you stop reading samples. | 336 | * Do anything required when you stop reading samples. |
| 342 | * (free allocated memory, etc.) | 337 | * (free allocated memory, etc.) |
| 343 | */ | 338 | */ |
| 344 | int st_fade_stop(eff_t effp) | 339 | static int st_fade_stop(eff_t effp) |
| 345 | { | 340 | { |
| 346 | fade_t fade = (fade_t) effp->priv; | 341 | fade_t fade = (fade_t) effp->priv; |
| 347 | 342 | ||
| @@ -54,7 +54,7 @@ static void FiltWin(filter_t f, long Nx); · 53 unmodified lines | |||
| 54 | /* | 54 | /* |
| 55 | * Process options | 55 | * Process options |
| 56 | */ | 56 | */ |
| 57 | int st_filter_getopts(eff_t effp, int n, char **argv) | 57 | static int st_filter_getopts(eff_t effp, int n, char **argv) |
| 58 | { | 58 | { |
| 59 | filter_t f = (filter_t) effp->priv; | 59 | filter_t f = (filter_t) effp->priv; |
| 60 | 60 | ||
| @@ -104,7 +104,7 @@ int st_filter_getopts(eff_t effp, int n, char **argv) · 43 unmodified lines | |||
| 104 | /* | 104 | /* |
| 105 | * Prepare processing. | 105 | * Prepare processing. |
| 106 | */ | 106 | */ |
| 107 | int st_filter_start(eff_t effp) | 107 | static int st_filter_start(eff_t effp) |
| 108 | { | 108 | { |
| 109 | filter_t f = (filter_t) effp->priv; | 109 | filter_t f = (filter_t) effp->priv; |
| 110 | double *Fp0, *Fp1; | 110 | double *Fp0, *Fp1; |
| @@ -114,7 +114,7 @@ int st_filter_start(eff_t effp) · 3 unmodified lines | |||
| 114 | f->rate = effp->ininfo.rate; | 114 | f->rate = effp->ininfo.rate; |
| 115 | 115 | ||
| 116 | /* adjust upper frequency to Nyquist if necessary */ | 116 | /* adjust upper frequency to Nyquist if necessary */ |
| 117 | if (f->freq1 > f->rate/2 || f->freq1 <= 0) | 117 | if (f->freq1 > (st_sample_t)f->rate/2 || f->freq1 <= 0) |
| 118 | f->freq1 = f->rate/2; | 118 | f->freq1 = f->rate/2; |
| 119 | 119 | ||
| 120 | if ((f->freq0 < 0) || (f->freq0 > f->freq1)) | 120 | if ((f->freq0 < 0) || (f->freq0 > f->freq1)) |
| @@ -126,7 +126,7 @@ int st_filter_start(eff_t effp) · 5 unmodified lines | |||
| 126 | 126 | ||
| 127 | Xh = f->Nwin/2; | 127 | Xh = f->Nwin/2; |
| 128 | Fp0 = (double *) malloc(sizeof(double) * (Xh + 2)) + 1; | 128 | Fp0 = (double *) malloc(sizeof(double) * (Xh + 2)) + 1; |
| 129 | if (f->freq0 > f->rate/200) { | 129 | if (f->freq0 > (st_sample_t)f->rate/200) { |
| 130 | Xh0 = makeFilter(Fp0, Xh, 2.0*(double)f->freq0/f->rate, f->beta, 1, 0); | 130 | Xh0 = makeFilter(Fp0, Xh, 2.0*(double)f->freq0/f->rate, f->beta, 1, 0); |
| 131 | if (Xh0 <= 1) | 131 | if (Xh0 <= 1) |
| 132 | { | 132 | { |
| @@ -138,7 +138,7 @@ int st_filter_start(eff_t effp) · 5 unmodified lines | |||
| 138 | } | 138 | } |
| 139 | Fp1 = (double *) malloc(sizeof(double) * (Xh + 2)) + 1; | 139 | Fp1 = (double *) malloc(sizeof(double) * (Xh + 2)) + 1; |
| 140 | /* need Fp[-1] and Fp[Xh] for makeFilter */ | 140 | /* need Fp[-1] and Fp[Xh] for makeFilter */ |
| 141 | if (f->freq1 < f->rate/2) { | 141 | if (f->freq1 < (st_sample_t)f->rate/2) { |
| 142 | Xh1 = makeFilter(Fp1, Xh, 2.0*(double)f->freq1/f->rate, f->beta, 1, 0); | 142 | Xh1 = makeFilter(Fp1, Xh, 2.0*(double)f->freq1/f->rate, f->beta, 1, 0); |
| 143 | if (Xh1 <= 1) | 143 | if (Xh1 <= 1) |
| 144 | { | 144 | { |
| @@ -182,11 +182,11 @@ int st_filter_start(eff_t effp) · 37 unmodified lines | |||
| 182 | * Processed signed long samples from ibuf to obuf. | 182 | * Processed signed long samples from ibuf to obuf. |
| 183 | * Return number of samples processed. | 183 | * Return number of samples processed. |
| 184 | */ | 184 | */ |
| 185 | int st_filter_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 185 | static int st_filter_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 186 | st_size_t *isamp, st_size_t *osamp) | 186 | st_size_t *isamp, st_size_t *osamp) |
| 187 | { | 187 | { |
| 188 | filter_t f = (filter_t) effp->priv; | 188 | filter_t f = (filter_t) effp->priv; |
| 189 | long i, Nx, Nproc; | 189 | st_size_t i, Nx, Nproc; |
| 190 | 190 | ||
| 191 | /* constrain amount we actually process */ | 191 | /* constrain amount we actually process */ |
| 192 | /* st_debug("Xh %d, Xt %d, isamp %d, ",f->Xh, f->Xt, *isamp); */ | 192 | /* st_debug("Xh %d, Xt %d, isamp %d, ",f->Xh, f->Xt, *isamp); */ |
| @@ -234,7 +234,7 @@ int st_filter_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 41 unmodified lines | |||
| 234 | /* | 234 | /* |
| 235 | * Process tail of input samples. | 235 | * Process tail of input samples. |
| 236 | */ | 236 | */ |
| 237 | int st_filter_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 237 | static int st_filter_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 238 | { | 238 | { |
| 239 | filter_t f = (filter_t) effp->priv; | 239 | filter_t f = (filter_t) effp->priv; |
| 240 | long isamp_res, osamp_res; | 240 | long isamp_res, osamp_res; |
| @@ -271,7 +271,7 @@ int st_filter_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 30 unmodified lines | |||
| 271 | * Do anything required when you stop reading samples. | 271 | * Do anything required when you stop reading samples. |
| 272 | * Don't close input file! | 272 | * Don't close input file! |
| 273 | */ | 273 | */ |
| 274 | int st_filter_stop(eff_t effp) | 274 | static int st_filter_stop(eff_t effp) |
| 275 | { | 275 | { |
| 276 | filter_t f = (filter_t) effp->priv; | 276 | filter_t f = (filter_t) effp->priv; |
| 277 | 277 | ||
| @@ -58,8 +58,7 @@ static void FLAC__decoder_metadata_callback(FLAC__FileDecoder const * const flac · 57 unmodified lines | |||
| 58 | } | 58 | } |
| 59 | else if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) | 59 | else if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) |
| 60 | { | 60 | { |
| 61 | int i; | 61 | size_t i, comment_size = 0; |
| 62 | int comment_size = 0; | ||
| 63 | 62 | ||
| 64 | if (metadata->data.vorbis_comment.num_comments == 0) | 63 | if (metadata->data.vorbis_comment.num_comments == 0) |
| 65 | { | 64 | { |
| @@ -176,10 +175,10 @@ static int st_format_start_read(ft_t const format) · 110 unmodified lines | |||
| 176 | } | 175 | } |
| 177 | 176 | ||
| 178 | 177 | ||
| 179 | static st_ssize_t st_format_read(ft_t const format, st_sample_t * sampleBuffer, st_size_t const requested) | 178 | static st_size_t st_format_read(ft_t const format, st_sample_t * sampleBuffer, st_size_t const requested) |
| 180 | { | 179 | { |
| 181 | Decoder * decoder = (Decoder *) format->priv; | 180 | Decoder * decoder = (Decoder *) format->priv; |
| 182 | int actual = 0; | 181 | size_t actual = 0; |
| 183 | 182 | ||
| 184 | while (!decoder->eof && actual < requested) | 183 | while (!decoder->eof && actual < requested) |
| 185 | { | 184 | { |
| @@ -247,7 +246,7 @@ assert_static(sizeof(Encoder) <= ST_MAX_FILE_PRIVSIZE, /* else */ Encoder__PRIVS · 61 unmodified lines | |||
| 247 | 246 | ||
| 248 | 247 | ||
| 249 | 248 | ||
| 250 | FLAC__StreamEncoderWriteStatus flac_stream_encoder_write_callback(FLAC__StreamEncoder const * const flac, const FLAC__byte buffer[], unsigned const bytes, unsigned const samples, unsigned const current_frame, void * const client_data) | 249 | static FLAC__StreamEncoderWriteStatus flac_stream_encoder_write_callback(FLAC__StreamEncoder const * const flac, const FLAC__byte buffer[], unsigned const bytes, unsigned const samples, unsigned const current_frame, void * const client_data) |
| 251 | { | 250 | { |
| 252 | ft_t const format = (ft_t) client_data; | 251 | ft_t const format = (ft_t) client_data; |
| 253 | (void) flac, (void) samples, (void) current_frame; | 252 | (void) flac, (void) samples, (void) current_frame; |
| @@ -257,7 +256,7 @@ FLAC__StreamEncoderWriteStatus flac_stream_encoder_write_callback(FLAC__StreamEn · 3 unmodified lines | |||
| 257 | 256 | ||
| 258 | 257 | ||
| 259 | 258 | ||
| 260 | void flac_stream_encoder_metadata_callback(FLAC__StreamEncoder const * encoder, FLAC__StreamMetadata const * metadata, void * client_data) | 259 | static void flac_stream_encoder_metadata_callback(FLAC__StreamEncoder const * encoder, FLAC__StreamMetadata const * metadata, void * client_data) |
| 261 | { | 260 | { |
| 262 | (void) encoder, (void) metadata, (void) client_data; | 261 | (void) encoder, (void) metadata, (void) client_data; |
| 263 | } | 262 | } |
| @@ -341,7 +340,7 @@ static int st_format_start_write(ft_t const format) · 77 unmodified lines | |||
| 341 | { /* Check if rate is streamable: */ | 340 | { /* Check if rate is streamable: */ |
| 342 | static const unsigned streamable_rates[] = | 341 | static const unsigned streamable_rates[] = |
| 343 | {8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000}; | 342 | {8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000}; |
| 344 | int i; | 343 | size_t i; |
| 345 | bool streamable = false; | 344 | bool streamable = false; |
| 346 | for (i = 0; !streamable && i < array_length(streamable_rates); ++i) | 345 | for (i = 0; !streamable && i < array_length(streamable_rates); ++i) |
| 347 | { | 346 | { |
| @@ -356,7 +355,7 @@ static int st_format_start_write(ft_t const format) · 8 unmodified lines | |||
| 356 | 355 | ||
| 357 | if (format->length != 0) | 356 | if (format->length != 0) |
| 358 | { | 357 | { |
| 359 | FLAC__stream_encoder_set_total_samples_estimate(encoder->flac, format->length); | 358 | FLAC__stream_encoder_set_total_samples_estimate(encoder->flac, (FLAC__uint64)format->length); |
| 360 | } | 359 | } |
| 361 | 360 | ||
| 362 | if (format->comment != NULL && * format->comment != '\0') | 361 | if (format->comment != NULL && * format->comment != '\0') |
| @@ -423,7 +422,7 @@ static int st_format_start_write(ft_t const format) · 60 unmodified lines | |||
| 423 | 422 | ||
| 424 | 423 | ||
| 425 | 424 | ||
| 426 | static st_ssize_t st_format_write(ft_t const format, st_sample_t const * const sampleBuffer, st_size_t const len) | 425 | static st_size_t st_format_write(ft_t const format, st_sample_t const * const sampleBuffer, st_size_t const len) |
| 427 | { | 426 | { |
| 428 | Encoder * encoder = (Encoder *) format->priv; | 427 | Encoder * encoder = (Encoder *) format->priv; |
| 429 | unsigned i; | 428 | unsigned i; |
| @@ -439,7 +438,7 @@ static st_ssize_t st_format_write(ft_t const format, st_sample_t const * const s · 9 unmodified lines | |||
| 439 | } | 438 | } |
| 440 | } | 439 | } |
| 441 | FLAC__stream_encoder_process_interleaved(encoder->flac, encoder->decoded_samples, len / format->info.channels); | 440 | FLAC__stream_encoder_process_interleaved(encoder->flac, encoder->decoded_samples, len / format->info.channels); |
| 442 | return FLAC__stream_encoder_get_state(encoder->flac) == FLAC__STREAM_ENCODER_OK ? len : -1; | 441 | return FLAC__stream_encoder_get_state(encoder->flac) == FLAC__STREAM_ENCODER_OK ? len : 0; |
| 443 | } | 442 | } |
| 444 | 443 | ||
| 445 | 444 | ||
| @@ -5,38 +5,38 @@ · 4 unmodified lines | |||
| 5 | * See LICENSE file for further copyright information. | 5 | * See LICENSE file for further copyright information. |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | static char const st_flanger_usage[] = | 8 | #define st_flanger_usage \ |
| 9 | "Usage: \n" | 9 | "Usage: \n" \ |
| 10 | " .\n" | 10 | " .\n" \ |
| 11 | " /|regen\n" | 11 | " /|regen\n" \ |
| 12 | " / |\n" | 12 | " / |\n" \ |
| 13 | " +--( |------------+\n" | 13 | " +--( |------------+\n" \ |
| 14 | " | \\ | | .\n" | 14 | " | \\ | | .\n" \ |
| 15 | " _V_ \\| _______ | |\\ width ___\n" | 15 | " _V_ \\| _______ | |\\ width ___\n" \ |
| 16 | " | | ' | | | | \\ | |\n" | 16 | " | | ' | | | | \\ | |\n" \ |
| 17 | " +-->| + |---->| DELAY |--+-->| )----->| |\n" | 17 | " +-->| + |---->| DELAY |--+-->| )----->| |\n" \ |
| 18 | " | |___| |_______| | / | |\n" | 18 | " | |___| |_______| | / | |\n" \ |
| 19 | " | delay : depth |/ | |\n" | 19 | " | delay : depth |/ | |\n" \ |
| 20 | " In | : interp ' | | Out\n" | 20 | " In | : interp ' | | Out\n" \ |
| 21 | " --->+ __:__ | + |--->\n" | 21 | " --->+ __:__ | + |--->\n" \ |
| 22 | " | | |speed | |\n" | 22 | " | | |speed | |\n" \ |
| 23 | " | | ~ |shape | |\n" | 23 | " | | ~ |shape | |\n" \ |
| 24 | " | |_____|phase | |\n" | 24 | " | |_____|phase | |\n" \ |
| 25 | " +------------------------------------->| |\n" | 25 | " +------------------------------------->| |\n" \ |
| 26 | " |___|\n" | 26 | " |___|\n" \ |
| 27 | "\n" | 27 | "\n" \ |
| 28 | "Usage: flanger [delay depth regen width speed shape phase interp]\n" | 28 | "Usage: flanger [delay depth regen width speed shape phase interp]\n" \ |
| 29 | "\n" | 29 | "\n" \ |
| 30 | " RANGE DEFAULT DESCRIPTION\n" | 30 | " RANGE DEFAULT DESCRIPTION\n" \ |
| 31 | "delay 0 10 0 base delay in milliseconds\n" | 31 | "delay 0 10 0 base delay in milliseconds\n" \ |
| 32 | "depth 0 10 2 added swept delay in milliseconds\n" | 32 | "depth 0 10 2 added swept delay in milliseconds\n" \ |
| 33 | "regen -95 +95 0 percentage regeneration (delayed signal feedback)\n" | 33 | "regen -95 +95 0 percentage regeneration (delayed signal feedback)\n" \ |
| 34 | "width 0 100 71 percentage of delayed signal mixed with original\n" | 34 | "width 0 100 71 percentage of delayed signal mixed with original\n" \ |
| 35 | "speed 0.1 10 0.5 sweeps per second (Hz) \n" | 35 | "speed 0.1 10 0.5 sweeps per second (Hz) \n" \ |
| 36 | "shape -- sin swept wave shape: sine|triangle\n" | 36 | "shape -- sin swept wave shape: sine|triangle\n" \ |
| 37 | "phase 0 100 25 swept wave percentage phase-shift for multi-channel\n" | 37 | "phase 0 100 25 swept wave percentage phase-shift for multi-channel\n" \ |
| 38 | " (e.g. stereo) flange; 0 = 100 = same phase on each channel\n" | 38 | " (e.g. stereo) flange; 0 = 100 = same phase on each channel\n" \ |
| 39 | "interp -- lin delay-line interpolation: linear|quadratic"; | 39 | "interp -- lin delay-line interpolation: linear|quadratic" |
| 40 | 40 | ||
| 41 | /* TODO: Slide in the delay at the start? */ | 41 | /* TODO: Slide in the delay at the start? */ |
| 42 | 42 | ||
| @@ -88,7 +88,7 @@ assert_static(sizeof(struct flanger) <= ST_MAX_EFFECT_PRIVSIZE, · 45 unmodified lines | |||
| 88 | static enum_item const interp_enum[] = { | 88 | static enum_item const interp_enum[] = { |
| 89 | ENUM_ITEM(INTERP_,LINEAR) | 89 | ENUM_ITEM(INTERP_,LINEAR) |
| 90 | ENUM_ITEM(INTERP_,QUADRATIC) | 90 | ENUM_ITEM(INTERP_,QUADRATIC) |
| 91 | {0}}; | 91 | {0, 0}}; |
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | 94 | ||
| @@ -121,7 +121,7 @@ static enum_item const interp_enum[] = { · 26 unmodified lines | |||
| 121 | 121 | ||
| 122 | 122 | ||
| 123 | 123 | ||
| 124 | static int st_flanger_getopts(eff_t effp, int argc, char const * const * argv) | 124 | static int st_flanger_getopts(eff_t effp, int argc, char *argv[]) |
| 125 | { | 125 | { |
| 126 | flanger_t f = (flanger_t) effp->priv; | 126 | flanger_t f = (flanger_t) effp->priv; |
| 127 | 127 | ||
| @@ -373,7 +373,7 @@ void update(int code_size, int y, int wi, int fi, int dq, int sr, · 372 unmodified lines | |||
| 373 | state_ptr->dq[cnt] = state_ptr->dq[cnt-1]; | 373 | state_ptr->dq[cnt] = state_ptr->dq[cnt-1]; |
| 374 | /* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */ | 374 | /* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */ |
| 375 | if (mag == 0) { | 375 | if (mag == 0) { |
| 376 | state_ptr->dq[0] = (dq >= 0) ? 0x20 : 0xFC20; | 376 | state_ptr->dq[0] = (dq >= 0) ? 0x20 : (short)0xFC20; |
| 377 | } else { | 377 | } else { |
| 378 | exp = quan(mag, power2, 15); | 378 | exp = quan(mag, power2, 15); |
| 379 | state_ptr->dq[0] = (dq >= 0) ? | 379 | state_ptr->dq[0] = (dq >= 0) ? |
| @@ -393,7 +393,7 @@ void update(int code_size, int y, int wi, int fi, int dq, int sr, · 13 unmodified lines | |||
| 393 | exp = quan(mag, power2, 15); | 393 | exp = quan(mag, power2, 15); |
| 394 | state_ptr->sr[0] = (exp << 6) + ((mag << 6) >> exp) - 0x400; | 394 | state_ptr->sr[0] = (exp << 6) + ((mag << 6) >> exp) - 0x400; |
| 395 | } else | 395 | } else |
| 396 | state_ptr->sr[0] = 0xFC20; | 396 | state_ptr->sr[0] = (short)(0xFC20); |
| 397 | 397 | ||
| 398 | /* DELAY A */ | 398 | /* DELAY A */ |
| 399 | state_ptr->pk[1] = state_ptr->pk[0]; | 399 | state_ptr->pk[1] = state_ptr->pk[0]; |
| @@ -63,7 +63,7 @@ static int gsmstart_rw(ft_t ft, int w) · 62 unmodified lines | |||
| 63 | if (!ft->info.rate) | 63 | if (!ft->info.rate) |
| 64 | ft->info.rate = 8000; | 64 | ft->info.rate = 8000; |
| 65 | 65 | ||
| 66 | if (ft->info.channels == -1) | 66 | if (ft->info.channels == 0) |
| 67 | ft->info.channels = 1; | 67 | ft->info.channels = 1; |
| 68 | 68 | ||
| 69 | p->channels = ft->info.channels; | 69 | p->channels = ft->info.channels; |
| @@ -88,12 +88,12 @@ static int gsmstart_rw(ft_t ft, int w) · 18 unmodified lines | |||
| 88 | return (ST_SUCCESS); | 88 | return (ST_SUCCESS); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | int st_gsmstartread(ft_t ft) | 91 | static int st_gsmstartread(ft_t ft) |
| 92 | { | 92 | { |
| 93 | return gsmstart_rw(ft,0); | 93 | return gsmstart_rw(ft,0); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | int st_gsmstartwrite(ft_t ft) | 96 | static int st_gsmstartwrite(ft_t ft) |
| 97 | { | 97 | { |
| 98 | return gsmstart_rw(ft,1); | 98 | return gsmstart_rw(ft,1); |
| 99 | } | 99 | } |
| @@ -105,9 +105,9 @@ int st_gsmstartwrite(ft_t ft) · 5 unmodified lines | |||
| 105 | * Return number of samples read. | 105 | * Return number of samples read. |
| 106 | */ | 106 | */ |
| 107 | 107 | ||
| 108 | st_ssize_t st_gsmread(ft_t ft, st_sample_t *buf, st_size_t samp) | 108 | static st_size_t st_gsmread(ft_t ft, st_sample_t *buf, st_size_t samp) |
| 109 | { | 109 | { |
| 110 | int done = 0; | 110 | size_t done = 0; |
| 111 | int r, ch, chans; | 111 | int r, ch, chans; |
| 112 | gsm_signal *gbuff; | 112 | gsm_signal *gbuff; |
| 113 | struct gsmpriv *p = (struct gsmpriv *) ft->priv; | 113 | struct gsmpriv *p = (struct gsmpriv *) ft->priv; |
| @@ -183,9 +183,9 @@ static int gsmflush(ft_t ft) · 69 unmodified lines | |||
| 183 | return (ST_SUCCESS); | 183 | return (ST_SUCCESS); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | st_ssize_t st_gsmwrite(ft_t ft, const st_sample_t *buf, st_size_t samp) | 186 | static st_size_t st_gsmwrite(ft_t ft, const st_sample_t *buf, st_size_t samp) |
| 187 | { | 187 | { |
| 188 | int done = 0; | 188 | size_t done = 0; |
| 189 | struct gsmpriv *p = (struct gsmpriv *) ft->priv; | 189 | struct gsmpriv *p = (struct gsmpriv *) ft->priv; |
| 190 | 190 | ||
| 191 | while (done < samp) | 191 | while (done < samp) |
| @@ -206,7 +206,7 @@ st_ssize_t st_gsmwrite(ft_t ft, const st_sample_t *buf, st_size_t samp) · 14 unmodified lines | |||
| 206 | return done; | 206 | return done; |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | int st_gsmstopread(ft_t ft) | 209 | static int st_gsmstopread(ft_t ft) |
| 210 | { | 210 | { |
| 211 | struct gsmpriv *p = (struct gsmpriv *) ft->priv; | 211 | struct gsmpriv *p = (struct gsmpriv *) ft->priv; |
| 212 | int ch; | 212 | int ch; |
| @@ -219,7 +219,7 @@ int st_gsmstopread(ft_t ft) · 6 unmodified lines | |||
| 219 | return (ST_SUCCESS); | 219 | return (ST_SUCCESS); |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | int st_gsmstopwrite(ft_t ft) | 222 | static int st_gsmstopwrite(ft_t ft) |
| 223 | { | 223 | { |
| 224 | int rc; | 224 | int rc; |
| 225 | struct gsmpriv *p = (struct gsmpriv *) ft->priv; | 225 | struct gsmpriv *p = (struct gsmpriv *) ft->priv; |
| @@ -37,7 +37,7 @@ st_format_fn_t st_format_fns[] = { · 36 unmodified lines | |||
| 37 | st_la_format_fn, | 37 | st_la_format_fn, |
| 38 | st_lu_format_fn, | 38 | st_lu_format_fn, |
| 39 | st_maud_format_fn, | 39 | st_maud_format_fn, |
| 40 | #if defined(HAVE_LIBMAD) || defined(HAVE_LAME) | 40 | #if defined(HAVE_LIBMAD) || defined(HAVE_LIBMP3LAME) |
| 41 | st_mp3_format_fn, | 41 | st_mp3_format_fn, |
| 42 | #endif | 42 | #endif |
| 43 | st_nul_format_fn, | 43 | st_nul_format_fn, |
| @@ -50,7 +50,7 @@ struct readpriv { · 49 unmodified lines | |||
| 50 | 50 | ||
| 51 | static int skipbytes(ft_t, int); | 51 | static int skipbytes(ft_t, int); |
| 52 | 52 | ||
| 53 | int st_hcomstartread(ft_t ft) | 53 | static int st_hcomstartread(ft_t ft) |
| 54 | { | 54 | { |
| 55 | struct readpriv *p = (struct readpriv *) ft->priv; | 55 | struct readpriv *p = (struct readpriv *) ft->priv; |
| 56 | int i; | 56 | int i; |
| @@ -174,7 +174,7 @@ static int skipbytes(ft_t ft, int n) · 117 unmodified lines | |||
| 174 | return(ST_SUCCESS); | 174 | return(ST_SUCCESS); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | st_ssize_t st_hcomread(ft_t ft, st_sample_t *buf, st_size_t len) | 177 | static st_size_t st_hcomread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 178 | { | 178 | { |
| 179 | register struct readpriv *p = (struct readpriv *) ft->priv; | 179 | register struct readpriv *p = (struct readpriv *) ft->priv; |
| 180 | int done = 0; | 180 | int done = 0; |
| @@ -238,7 +238,7 @@ st_ssize_t st_hcomread(ft_t ft, st_sample_t *buf, st_size_t len) · 57 unmodified lines | |||
| 238 | return done; | 238 | return done; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | int st_hcomstopread(ft_t ft) | 241 | static int st_hcomstopread(ft_t ft) |
| 242 | { | 242 | { |
| 243 | register struct readpriv *p = (struct readpriv *) ft->priv; | 243 | register struct readpriv *p = (struct readpriv *) ft->priv; |
| 244 | 244 | ||
| @@ -265,7 +265,7 @@ struct writepriv { · 20 unmodified lines | |||
| 265 | 265 | ||
| 266 | #define BUFINCR (10*BUFSIZ) | 266 | #define BUFINCR (10*BUFSIZ) |
| 267 | 267 | ||
| 268 | int st_hcomstartwrite(ft_t ft) | 268 | static int st_hcomstartwrite(ft_t ft) |
| 269 | { | 269 | { |
| 270 | register struct writepriv *p = (struct writepriv *) ft->priv; | 270 | register struct writepriv *p = (struct writepriv *) ft->priv; |
| 271 | 271 | ||
| @@ -302,7 +302,7 @@ int st_hcomstartwrite(ft_t ft) · 30 unmodified lines | |||
| 302 | return (ST_SUCCESS); | 302 | return (ST_SUCCESS); |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | st_ssize_t st_hcomwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 305 | static st_size_t st_hcomwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 306 | { | 306 | { |
| 307 | register struct writepriv *p = (struct writepriv *) ft->priv; | 307 | register struct writepriv *p = (struct writepriv *) ft->priv; |
| 308 | st_sample_t datum; | 308 | st_sample_t datum; |
| @@ -514,7 +514,7 @@ static void padbytes(ft_t ft, int n) · 205 unmodified lines | |||
| 514 | 514 | ||
| 515 | /* End of hcom utility routines */ | 515 | /* End of hcom utility routines */ |
| 516 | 516 | ||
| 517 | int st_hcomstopwrite(ft_t ft) | 517 | static int st_hcomstopwrite(ft_t ft) |
| 518 | { | 518 | { |
| 519 | register struct writepriv *p = (struct writepriv *) ft->priv; | 519 | register struct writepriv *p = (struct writepriv *) ft->priv; |
| 520 | unsigned char *compressed_data = p->data; | 520 | unsigned char *compressed_data = p->data; |
| @@ -44,7 +44,7 @@ typedef struct highpstuff { · 43 unmodified lines | |||
| 44 | /* | 44 | /* |
| 45 | * Process options | 45 | * Process options |
| 46 | */ | 46 | */ |
| 47 | int st_highp_getopts(eff_t effp, int n, char **argv) | 47 | static int st_highp_getopts(eff_t effp, int n, char **argv) |
| 48 | { | 48 | { |
| 49 | highp_t highp = (highp_t) effp->priv; | 49 | highp_t highp = (highp_t) effp->priv; |
| 50 | 50 | ||
| @@ -59,7 +59,7 @@ int st_highp_getopts(eff_t effp, int n, char **argv) · 8 unmodified lines | |||
| 59 | /* | 59 | /* |
| 60 | * Prepare processing. | 60 | * Prepare processing. |
| 61 | */ | 61 | */ |
| 62 | int st_highp_start(eff_t effp) | 62 | static int st_highp_start(eff_t effp) |
| 63 | { | 63 | { |
| 64 | highp_t highp = (highp_t) effp->priv; | 64 | highp_t highp = (highp_t) effp->priv; |
| 65 | if (highp->cutoff > effp->ininfo.rate/2) | 65 | if (highp->cutoff > effp->ininfo.rate/2) |
| @@ -100,7 +100,7 @@ int st_highp_start(eff_t effp) · 34 unmodified lines | |||
| 100 | * Processed signed long samples from ibuf to obuf. | 100 | * Processed signed long samples from ibuf to obuf. |
| 101 | * Return number of samples processed. | 101 | * Return number of samples processed. |
| 102 | */ | 102 | */ |
| 103 | int st_highp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 103 | static int st_highp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 104 | st_size_t *isamp, st_size_t *osamp) | 104 | st_size_t *isamp, st_size_t *osamp) |
| 105 | { | 105 | { |
| 106 | highp_t highp = (highp_t) effp->priv; | 106 | highp_t highp = (highp_t) effp->priv; |
| @@ -125,16 +125,6 @@ int st_highp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 18 unmodified lines | |||
| 125 | return (ST_SUCCESS); | 125 | return (ST_SUCCESS); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | /* | ||
| 129 | * Do anything required when you stop reading samples. | ||
| 130 | * Don't close input file! | ||
| 131 | */ | ||
| 132 | int st_highp_stop(eff_t effp) | ||
| 133 | { | ||
| 134 | /* nothing to do */ | ||
| 135 | return (ST_SUCCESS); | ||
| 136 | } | ||
| 137 | |||
| 138 | static st_effect_t st_highp_effect = { | 128 | static st_effect_t st_highp_effect = { |
| 139 | "highp", | 129 | "highp", |
| 140 | "Usage: highp cutoff", | 130 | "Usage: highp cutoff", |
| @@ -143,7 +133,7 @@ static st_effect_t st_highp_effect = { · 2 unmodified lines | |||
| 143 | st_highp_start, | 133 | st_highp_start, |
| 144 | st_highp_flow, | 134 | st_highp_flow, |
| 145 | st_effect_nothing_drain, | 135 | st_effect_nothing_drain, |
| 146 | st_highp_stop | 136 | st_effect_nothing |
| 147 | }; | 137 | }; |
| 148 | 138 | ||
| 149 | const st_effect_t *st_highp_effect_fn(void) | 139 | const st_effect_t *st_highp_effect_fn(void) |
| @@ -1,5 +1,4 @@ | |||
| 1 | /* | 1 | /* |
| 2 | |||
| 3 | High-pass effect file for SoX | 2 | High-pass effect file for SoX |
| 4 | Copyright (C) 1999 Jan Paul Schmidt <jps@fundament.org> | 3 | Copyright (C) 1999 Jan Paul Schmidt <jps@fundament.org> |
| 5 | 4 | ||
| @@ -38,7 +37,7 @@ · 32 unmodified lines | |||
| 38 | 37 | ||
| 39 | static st_effect_t st_highpass_effect; | 38 | static st_effect_t st_highpass_effect; |
| 40 | 39 | ||
| 41 | int st_highpass_getopts(eff_t effp, int n, char **argv) | 40 | static int st_highpass_getopts(eff_t effp, int n, char **argv) |
| 42 | { | 41 | { |
| 43 | butterworth_t butterworth = (butterworth_t)effp->priv; | 42 | butterworth_t butterworth = (butterworth_t)effp->priv; |
| 44 | 43 | ||
| @@ -56,9 +55,7 @@ int st_highpass_getopts(eff_t effp, int n, char **argv) · 11 unmodified lines | |||
| 56 | return (ST_SUCCESS); | 55 | return (ST_SUCCESS); |
| 57 | } | 56 | } |
| 58 | 57 | ||
| 59 | 58 | static int st_highpass_start(eff_t effp) | |
| 60 | |||
| 61 | int st_highpass_start(eff_t effp) | ||
| 62 | { | 59 | { |
| 63 | butterworth_t butterworth = (butterworth_t) effp->priv; | 60 | butterworth_t butterworth = (butterworth_t) effp->priv; |
| 64 | double c; | 61 | double c; |
| @@ -164,8 +164,7 @@ static int ImaMashS( · 163 unmodified lines | |||
| 164 | const SAMPL *ibuff, /* ibuff[] is interleaved input samples */ | 164 | const SAMPL *ibuff, /* ibuff[] is interleaved input samples */ |
| 165 | int n, /* samples to encode PER channel, REQUIRE n % 8 == 1 */ | 165 | int n, /* samples to encode PER channel, REQUIRE n % 8 == 1 */ |
| 166 | int *st, /* input/output state, REQUIRE 0 <= *st <= ISSTMAX */ | 166 | int *st, /* input/output state, REQUIRE 0 <= *st <= ISSTMAX */ |
| 167 | unsigned char *obuff, /* output buffer[blockAlign], or NULL for no output */ | 167 | unsigned char *obuff /* output buffer[blockAlign], or NULL for no output */ |
| 168 | int sho /* nonzero for debug printout */ | ||
| 169 | ) | 168 | ) |
| 170 | { | 169 | { |
| 171 | const SAMPL *ip, *itop; | 170 | const SAMPL *ip, *itop; |
| @@ -258,14 +257,13 @@ inline static void ImaMashChannel( · 86 unmodified lines | |||
| 258 | int snext,d; | 257 | int snext,d; |
| 259 | int s0,d0; | 258 | int s0,d0; |
| 260 | int s32,d32; | 259 | int s32,d32; |
| 261 | int sho = 0; | ||
| 262 | 260 | ||
| 263 | s32 = s0 = *st; | 261 | s32 = s0 = *st; |
| 264 | if (opt>0) { | 262 | if (opt>0) { |
| 265 | int low,hi,w; | 263 | int low,hi,w; |
| 266 | int low0,hi0; | 264 | int low0,hi0; |
| 267 | snext = s0; | 265 | snext = s0; |
| 268 | d32 = d0 = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL, sho); | 266 | d32 = d0 = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL); |
| 269 | 267 | ||
| 270 | w = 0; | 268 | w = 0; |
| 271 | low=hi=s0; | 269 | low=hi=s0; |
| @@ -275,7 +273,7 @@ inline static void ImaMashChannel( · 3 unmodified lines | |||
| 275 | if (!w && low>low0) { | 273 | if (!w && low>low0) { |
| 276 | int d; | 274 | int d; |
| 277 | snext = --low; | 275 | snext = --low; |
| 278 | d = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL, sho); | 276 | d = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL); |
| 279 | if (d<d0) { | 277 | if (d<d0) { |
| 280 | d0=d; s0=low; | 278 | d0=d; s0=low; |
| 281 | low0 = low-opt; if (low0<0) low0=0; | 279 | low0 = low-opt; if (low0<0) low0=0; |
| @@ -285,7 +283,7 @@ inline static void ImaMashChannel( · 3 unmodified lines | |||
| 285 | if (w && hi<hi0) { | 283 | if (w && hi<hi0) { |
| 286 | int d; | 284 | int d; |
| 287 | snext = ++hi; | 285 | snext = ++hi; |
| 288 | d = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL, sho); | 286 | d = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL); |
| 289 | if (d<d0) { | 287 | if (d<d0) { |
| 290 | d0=d; s0=hi; | 288 | d0=d; s0=hi; |
| 291 | low0 = hi-opt; if (low0<0) low0=0; | 289 | low0 = hi-opt; if (low0<0) low0=0; |
| @@ -296,7 +294,7 @@ inline static void ImaMashChannel( · 4 unmodified lines | |||
| 296 | } | 294 | } |
| 297 | *st = s0; | 295 | *st = s0; |
| 298 | } | 296 | } |
| 299 | d = ImaMashS(ch, chans, ip[0], ip,n,st, obuff, 0); | 297 | d = ImaMashS(ch, chans, ip[0], ip,n,st, obuff); |
| 300 | } | 298 | } |
| 301 | 299 | ||
| 302 | /* mash one block. if you want to use opt>0, 9 is a reasonable value */ | 300 | /* mash one block. if you want to use opt>0, 9 is a reasonable value */ |
| @@ -101,6 +101,7 @@ EGREP = @EGREP@ · 100 unmodified lines | |||
| 101 | EXEEXT = @EXEEXT@ | 101 | EXEEXT = @EXEEXT@ |
| 102 | GETOPT_LONG_FALSE = @GETOPT_LONG_FALSE@ | 102 | GETOPT_LONG_FALSE = @GETOPT_LONG_FALSE@ |
| 103 | GETOPT_LONG_TRUE = @GETOPT_LONG_TRUE@ | 103 | GETOPT_LONG_TRUE = @GETOPT_LONG_TRUE@ |
| 104 | GREP = @GREP@ | ||
| 104 | INSTALL_DATA = @INSTALL_DATA@ | 105 | INSTALL_DATA = @INSTALL_DATA@ |
| 105 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | 106 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
| 106 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | 107 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
| @@ -128,9 +129,6 @@ SHELL = @SHELL@ · 21 unmodified lines | |||
| 128 | STRIP = @STRIP@ | 129 | STRIP = @STRIP@ |
| 129 | VERSION = @VERSION@ | 130 | VERSION = @VERSION@ |
| 130 | ac_ct_CC = @ac_ct_CC@ | 131 | ac_ct_CC = @ac_ct_CC@ |
| 131 | ac_ct_RANLIB = @ac_ct_RANLIB@ | ||
| 132 | ac_ct_STRIP = @ac_ct_STRIP@ | ||
| 133 | ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ | ||
| 134 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ | 132 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ |
| 135 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ | 133 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ |
| 136 | am__include = @am__include@ | 134 | am__include = @am__include@ |
| @@ -141,19 +139,26 @@ am__untar = @am__untar@ · 4 unmodified lines | |||
| 141 | bindir = @bindir@ | 139 | bindir = @bindir@ |
| 142 | build_alias = @build_alias@ | 140 | build_alias = @build_alias@ |
| 143 | datadir = @datadir@ | 141 | datadir = @datadir@ |
| 142 | datarootdir = @datarootdir@ | ||
| 143 | docdir = @docdir@ | ||
| 144 | dvidir = @dvidir@ | ||
| 144 | exec_prefix = @exec_prefix@ | 145 | exec_prefix = @exec_prefix@ |
| 145 | host_alias = @host_alias@ | 146 | host_alias = @host_alias@ |
| 147 | htmldir = @htmldir@ | ||
| 146 | includedir = @includedir@ | 148 | includedir = @includedir@ |
| 147 | infodir = @infodir@ | 149 | infodir = @infodir@ |
| 148 | install_sh = @install_sh@ | 150 | install_sh = @install_sh@ |
| 149 | libdir = @libdir@ | 151 | libdir = @libdir@ |
| 150 | libexecdir = @libexecdir@ | 152 | libexecdir = @libexecdir@ |
| 153 | localedir = @localedir@ | ||
| 151 | localstatedir = @localstatedir@ | 154 | localstatedir = @localstatedir@ |
| 152 | mandir = @mandir@ | 155 | mandir = @mandir@ |
| 153 | mkdir_p = @mkdir_p@ | 156 | mkdir_p = @mkdir_p@ |
| 154 | oldincludedir = @oldincludedir@ | 157 | oldincludedir = @oldincludedir@ |
| 158 | pdfdir = @pdfdir@ | ||
| 155 | prefix = @prefix@ | 159 | prefix = @prefix@ |
| 156 | program_transform_name = @program_transform_name@ | 160 | program_transform_name = @program_transform_name@ |
| 161 | psdir = @psdir@ | ||
| 157 | sbindir = @sbindir@ | 162 | sbindir = @sbindir@ |
| 158 | sharedstatedir = @sharedstatedir@ | 163 | sharedstatedir = @sharedstatedir@ |
| 159 | sysconfdir = @sysconfdir@ | 164 | sysconfdir = @sysconfdir@ |
| @@ -178,9 +183,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) · 18 unmodified lines | |||
| 178 | exit 1;; \ | 183 | exit 1;; \ |
| 179 | esac; \ | 184 | esac; \ |
| 180 | done; \ | 185 | done; \ |
| 181 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libgsm/Makefile'; \ | 186 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libgsm/Makefile'; \ |
| 182 | cd $(top_srcdir) && \ | 187 | cd $(top_srcdir) && \ |
| 183 | $(AUTOMAKE) --foreign src/libgsm/Makefile | 188 | $(AUTOMAKE) --gnu src/libgsm/Makefile |
| 184 | .PRECIOUS: Makefile | 189 | .PRECIOUS: Makefile |
| 185 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | 190 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
| 186 | @case '$?' in \ | 191 | @case '$?' in \ |
| @@ -54,21 +54,19 @@ void Gsm_Coder ( · 53 unmodified lines | |||
| 54 | word so[160]; | 54 | word so[160]; |
| 55 | 55 | ||
| 56 | Gsm_Preprocess (S, s, so); | 56 | Gsm_Preprocess (S, s, so); |
| 57 | Gsm_LPC_Analysis (S, so, LARc); | 57 | Gsm_LPC_Analysis (so, LARc); |
| 58 | Gsm_Short_Term_Analysis_Filter (S, LARc, so); | 58 | Gsm_Short_Term_Analysis_Filter (S, LARc, so); |
| 59 | 59 | ||
| 60 | for (k = 0; k <= 3; k++, xMc += 13) { | 60 | for (k = 0; k <= 3; k++, xMc += 13) { |
| 61 | 61 | ||
| 62 | Gsm_Long_Term_Predictor ( S, | 62 | Gsm_Long_Term_Predictor (so+k*40, /* d [0..39] IN */ |
| 63 | so+k*40, /* d [0..39] IN */ | ||
| 64 | dp, /* dp [-120..-1] IN */ | 63 | dp, /* dp [-120..-1] IN */ |
| 65 | e + 5, /* e [0..39] OUT */ | 64 | e + 5, /* e [0..39] OUT */ |
| 66 | dpp, /* dpp [0..39] OUT */ | 65 | dpp, /* dpp [0..39] OUT */ |
| 67 | Nc++, | 66 | Nc++, |
| 68 | bc++); | 67 | bc++); |
| 69 | 68 | ||
| 70 | Gsm_RPE_Encoding ( S, | 69 | Gsm_RPE_Encoding ( e + 5, /* e ][0..39][ IN/OUT */ |
| 71 | e + 5, /* e ][0..39][ IN/OUT */ | ||
| 72 | xmaxc++, Mc++, xMc ); | 70 | xmaxc++, Mc++, xMc ); |
| 73 | /* | 71 | /* |
| 74 | * Gsm_Update_of_reconstructed_short_time_residual_signal | 72 | * Gsm_Update_of_reconstructed_short_time_residual_signal |
| @@ -49,7 +49,7 @@ void Gsm_Decoder ( · 48 unmodified lines | |||
| 49 | 49 | ||
| 50 | for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) { | 50 | for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) { |
| 51 | 51 | ||
| 52 | Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp ); | 52 | Gsm_RPE_Decoding( *xmaxcr, *Mcr, xMcr, erp ); |
| 53 | Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp ); | 53 | Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp ); |
| 54 | 54 | ||
| 55 | for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ]; | 55 | for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ]; |
| @@ -198,9 +198,6 @@ static void Long_term_analysis_filtering ( · 197 unmodified lines | |||
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */ | 200 | void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */ |
| 201 | |||
| 202 | struct gsm_state * S, | ||
| 203 | |||
| 204 | word * d, /* [0..39] residual signal IN */ | 201 | word * d, /* [0..39] residual signal IN */ |
| 205 | word * dp, /* [-120..-1] d' IN */ | 202 | word * dp, /* [-120..-1] d' IN */ |
| 206 | 203 | ||
| @@ -269,7 +269,6 @@ static void Quantization_and_coding ( · 268 unmodified lines | |||
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | void Gsm_LPC_Analysis ( | 271 | void Gsm_LPC_Analysis ( |
| 272 | struct gsm_state *S, | ||
| 273 | word * s, /* 0..159 signals IN/OUT */ | 272 | word * s, /* 0..159 signals IN/OUT */ |
| 274 | word * LARc) /* 0..7 LARc's OUT */ | 273 | word * LARc) /* 0..7 LARc's OUT */ |
| 275 | { | 274 | { |
| @@ -90,7 +90,7 @@ void Gsm_Preprocess ( · 89 unmodified lines | |||
| 90 | 90 | ||
| 91 | L_s2 += GSM_MULT_R( lsp, 32735 ); | 91 | L_s2 += GSM_MULT_R( lsp, 32735 ); |
| 92 | L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/ | 92 | L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/ |
| 93 | L_z2 = GSM_L_ADD( L_temp, L_s2 ); | 93 | L_z2 = GSM_L_ADD( L_temp, L_s2 ); |
| 94 | 94 | ||
| 95 | /* Compute sof[k] with rounding | 95 | /* Compute sof[k] with rounding |
| 96 | */ | 96 | */ |
| @@ -86,7 +86,7 @@ extern word gsm_asr (word a, int n); · 85 unmodified lines | |||
| 86 | >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \ | 86 | >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \ |
| 87 | : ((b) <= 0 ? (a) + (b) \ | 87 | : ((b) <= 0 ? (a) + (b) \ |
| 88 | : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \ | 88 | : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \ |
| 89 | ? MAX_LONGWORD : utmp)) | 89 | ? MAX_LONGWORD : (longword)utmp)) |
| 90 | 90 | ||
| 91 | #define GSM_ADD(a, b) \ | 91 | #define GSM_ADD(a, b) \ |
| 92 | ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \ | 92 | ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \ |
| @@ -112,7 +112,6 @@ extern void Gsm_Coder ( · 19 unmodified lines | |||
| 112 | word * xMc /* [13*4] normalized RPE samples OUT */); | 112 | word * xMc /* [13*4] normalized RPE samples OUT */); |
| 113 | 113 | ||
| 114 | extern void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */ | 114 | extern void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */ |
| 115 | struct gsm_state * S, | ||
| 116 | word * d, /* [0..39] residual signal IN */ | 115 | word * d, /* [0..39] residual signal IN */ |
| 117 | word * dp, /* [-120..-1] d' IN */ | 116 | word * dp, /* [-120..-1] d' IN */ |
| 118 | word * e, /* [0..40] OUT */ | 117 | word * e, /* [0..40] OUT */ |
| @@ -121,7 +120,6 @@ extern void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */ · 2 unmodified lines | |||
| 121 | word * bc /* gain factor OUT */); | 120 | word * bc /* gain factor OUT */); |
| 122 | 121 | ||
| 123 | extern void Gsm_LPC_Analysis ( | 122 | extern void Gsm_LPC_Analysis ( |
| 124 | struct gsm_state * S, | ||
| 125 | word * s, /* 0..159 signals IN/OUT */ | 123 | word * s, /* 0..159 signals IN/OUT */ |
| 126 | word * LARc); /* 0..7 LARc's OUT */ | 124 | word * LARc); /* 0..7 LARc's OUT */ |
| 127 | 125 | ||
| @@ -167,14 +165,12 @@ extern void Gsm_Long_Term_Synthesis_Filtering ( · 39 unmodified lines | |||
| 167 | word * drp); /* [-120..-1] IN, [0..40] OUT */ | 165 | word * drp); /* [-120..-1] IN, [0..40] OUT */ |
| 168 | 166 | ||
| 169 | void Gsm_RPE_Decoding ( | 167 | void Gsm_RPE_Decoding ( |
| 170 | struct gsm_state *S, | ||
| 171 | word xmaxcr, | 168 | word xmaxcr, |
| 172 | word Mcr, | 169 | word Mcr, |
| 173 | word * xMcr, /* [0..12], 3 bits IN */ | 170 | word * xMcr, /* [0..12], 3 bits IN */ |
| 174 | word * erp); /* [0..39] OUT */ | 171 | word * erp); /* [0..39] OUT */ |
| 175 | 172 | ||
| 176 | void Gsm_RPE_Encoding ( | 173 | void Gsm_RPE_Encoding ( |
| 177 | struct gsm_state * S, | ||
| 178 | word * e, /* -5..-1][0..39][40..44 IN/OUT */ | 174 | word * e, /* -5..-1][0..39][40..44 IN/OUT */ |
| 179 | word * xmaxc, /* OUT */ | 175 | word * xmaxc, /* OUT */ |
| 180 | word * Mc, /* OUT */ | 176 | word * Mc, /* OUT */ |
| @@ -430,9 +430,6 @@ void Gsm_Update_of_reconstructed_short_time_residual_signal P3((dpp, ep, dp), · 429 unmodified lines | |||
| 430 | #endif /* Has been inlined in code.c */ | 430 | #endif /* Has been inlined in code.c */ |
| 431 | 431 | ||
| 432 | void Gsm_RPE_Encoding ( | 432 | void Gsm_RPE_Encoding ( |
| 433 | |||
| 434 | struct gsm_state * S, | ||
| 435 | |||
| 436 | word * e, /* -5..-1][0..39][40..44 IN/OUT */ | 433 | word * e, /* -5..-1][0..39][40..44 IN/OUT */ |
| 437 | word * xmaxc, /* OUT */ | 434 | word * xmaxc, /* OUT */ |
| 438 | word * Mc, /* OUT */ | 435 | word * Mc, /* OUT */ |
| @@ -453,8 +450,6 @@ void Gsm_RPE_Encoding ( · 14 unmodified lines | |||
| 453 | } | 450 | } |
| 454 | 451 | ||
| 455 | void Gsm_RPE_Decoding ( | 452 | void Gsm_RPE_Decoding ( |
| 456 | struct gsm_state * S, | ||
| 457 | |||
| 458 | word xmaxcr, | 453 | word xmaxcr, |
| 459 | word Mcr, | 454 | word Mcr, |
| 460 | word * xMcr, /* [0..12], 3 bits IN */ | 455 | word * xMcr, /* [0..12], 3 bits IN */ |
| @@ -42,7 +42,7 @@ typedef struct lowpstuff { · 41 unmodified lines | |||
| 42 | /* | 42 | /* |
| 43 | * Process options | 43 | * Process options |
| 44 | */ | 44 | */ |
| 45 | int st_lowp_getopts(eff_t effp, int n, char **argv) | 45 | static int st_lowp_getopts(eff_t effp, int n, char **argv) |
| 46 | { | 46 | { |
| 47 | lowp_t lowp = (lowp_t) effp->priv; | 47 | lowp_t lowp = (lowp_t) effp->priv; |
| 48 | 48 | ||
| @@ -57,7 +57,7 @@ int st_lowp_getopts(eff_t effp, int n, char **argv) · 8 unmodified lines | |||
| 57 | /* | 57 | /* |
| 58 | * Prepare processing. | 58 | * Prepare processing. |
| 59 | */ | 59 | */ |
| 60 | int st_lowp_start(eff_t effp) | 60 | static int st_lowp_start(eff_t effp) |
| 61 | { | 61 | { |
| 62 | lowp_t lowp = (lowp_t) effp->priv; | 62 | lowp_t lowp = (lowp_t) effp->priv; |
| 63 | if (lowp->cutoff > effp->ininfo.rate / 2) | 63 | if (lowp->cutoff > effp->ininfo.rate / 2) |
| @@ -96,7 +96,7 @@ int st_lowp_start(eff_t effp) · 32 unmodified lines | |||
| 96 | * Processed signed long samples from ibuf to obuf. | 96 | * Processed signed long samples from ibuf to obuf. |
| 97 | * Return number of samples processed. | 97 | * Return number of samples processed. |
| 98 | */ | 98 | */ |
| 99 | int st_lowp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 99 | static int st_lowp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 100 | st_size_t *isamp, st_size_t *osamp) | 100 | st_size_t *isamp, st_size_t *osamp) |
| 101 | { | 101 | { |
| 102 | lowp_t lowp = (lowp_t) effp->priv; | 102 | lowp_t lowp = (lowp_t) effp->priv; |
| @@ -118,16 +118,6 @@ int st_lowp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 15 unmodified lines | |||
| 118 | return (ST_SUCCESS); | 118 | return (ST_SUCCESS); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | /* | ||
| 122 | * Do anything required when you stop reading samples. | ||
| 123 | * Don't close input file! | ||
| 124 | */ | ||
| 125 | int st_lowp_stop(eff_t effp) | ||
| 126 | { | ||
| 127 | /* nothing to do */ | ||
| 128 | return (ST_SUCCESS); | ||
| 129 | } | ||
| 130 | |||
| 131 | static st_effect_t st_lowp_effect = { | 121 | static st_effect_t st_lowp_effect = { |
| 132 | "lowp", | 122 | "lowp", |
| 133 | "Usage: lowp cutoff", | 123 | "Usage: lowp cutoff", |
| @@ -136,7 +126,7 @@ static st_effect_t st_lowp_effect = { · 2 unmodified lines | |||
| 136 | st_lowp_start, | 126 | st_lowp_start, |
| 137 | st_lowp_flow, | 127 | st_lowp_flow, |
| 138 | st_effect_nothing_drain, | 128 | st_effect_nothing_drain, |
| 139 | st_lowp_stop | 129 | st_effect_nothing |
| 140 | }; | 130 | }; |
| 141 | 131 | ||
| 142 | const st_effect_t *st_lowp_effect_fn(void) | 132 | const st_effect_t *st_lowp_effect_fn(void) |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | static st_effect_t st_lowpass_effect; | 27 | static st_effect_t st_lowpass_effect; |
| 28 | 28 | ||
| 29 | int st_lowpass_getopts(eff_t effp, int n, char **argv) | 29 | static int st_lowpass_getopts(eff_t effp, int n, char **argv) |
| 30 | { | 30 | { |
| 31 | butterworth_t butterworth = (butterworth_t)effp->priv; | 31 | butterworth_t butterworth = (butterworth_t)effp->priv; |
| 32 | 32 | ||
| @@ -44,7 +44,7 @@ int st_lowpass_getopts(eff_t effp, int n, char **argv) · 11 unmodified lines | |||
| 44 | return (ST_SUCCESS); | 44 | return (ST_SUCCESS); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | int st_lowpass_start(eff_t effp) | 47 | static int st_lowpass_start(eff_t effp) |
| 48 | { | 48 | { |
| 49 | butterworth_t butterworth = (butterworth_t) effp->priv; | 49 | butterworth_t butterworth = (butterworth_t) effp->priv; |
| 50 | double c; | 50 | double c; |
| @@ -29,7 +29,7 @@ static st_effect_t st_mask_effect; · 28 unmodified lines | |||
| 29 | /* | 29 | /* |
| 30 | * Process options | 30 | * Process options |
| 31 | */ | 31 | */ |
| 32 | int st_mask_getopts(eff_t effp, int n, char **argv) | 32 | static int st_mask_getopts(eff_t effp UNUSED, int n, char **argv UNUSED) |
| 33 | { | 33 | { |
| 34 | if (n) | 34 | if (n) |
| 35 | { | 35 | { |
| @@ -46,7 +46,7 @@ int st_mask_getopts(eff_t effp, int n, char **argv) · 10 unmodified lines | |||
| 46 | * Processed signed long samples from ibuf to obuf. | 46 | * Processed signed long samples from ibuf to obuf. |
| 47 | * Return number of samples processed. | 47 | * Return number of samples processed. |
| 48 | */ | 48 | */ |
| 49 | int st_mask_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 49 | static int st_mask_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 50 | st_size_t *isamp, st_size_t *osamp) | 50 | st_size_t *isamp, st_size_t *osamp) |
| 51 | { | 51 | { |
| 52 | int len, done; | 52 | int len, done; |
| @@ -1,20 +1,13 @@ | |||
| 1 | /* | ||
| 2 | * July 5, 1991 | ||
| 3 | * Copyright 1991 Lance Norskog And Sundry Contributors | ||
| 4 | * This source code is freely redistributable and may be used for | ||
| 5 | * any purpose. This copyright notice must be maintained. | ||
| 6 | * Lance Norskog And Sundry Contributors are not responsible for | ||
| 7 | * the consequences of using this software. | ||
| 8 | */ | ||
| 9 | |||
| 10 | /* | 1 | /* |
| 11 | * Sound Tools MAUD file format driver, by Lutz Vieweg 1993 | 2 | * Sound Tools MAUD file format driver, by Lutz Vieweg 1993 |
| 12 | * | 3 | * |
| 13 | * supports: mono and stereo, linear, a-law and u-law reading and writing | 4 | * supports: mono and stereo, linear, a-law and u-law reading and writing |
| 14 | * | 5 | * |
| 15 | * March 3, 1999 - cbagwell | 6 | * Copyright 1998-2006 Chris Bagwell and SoX Contributors |
| 16 | * Changed to use rawread for reading. | 7 | * This source code is freely redistributable and may be used for |
| 17 | * | 8 | * any purpose. This copyright notice must be maintained. |
| 9 | * Lance Norskog And Sundry Contributors are not responsible for | ||
| 10 | * the consequences of using this software. | ||
| 18 | */ | 11 | */ |
| 19 | 12 | ||
| 20 | #include "st_i.h" | 13 | #include "st_i.h" |
| @@ -40,7 +33,7 @@ static void maudwriteheader(ft_t); · 19 unmodified lines | |||
| 40 | * size and encoding of samples, | 33 | * size and encoding of samples, |
| 41 | * mono/stereo/quad. | 34 | * mono/stereo/quad. |
| 42 | */ | 35 | */ |
| 43 | int st_maudstartread(ft_t ft) | 36 | static int st_maudstartread(ft_t ft) |
| 44 | { | 37 | { |
| 45 | struct maudstuff * p = (struct maudstuff *) ft->priv; | 38 | struct maudstuff * p = (struct maudstuff *) ft->priv; |
| 46 | 39 | ||
| @@ -218,29 +211,7 @@ int st_maudstartread(ft_t ft) · 171 unmodified lines | |||
| 218 | return(ST_SUCCESS); | 211 | return(ST_SUCCESS); |
| 219 | } | 212 | } |
| 220 | 213 | ||
| 221 | /* | 214 | static int st_maudstartwrite(ft_t ft) |
| 222 | * Read up to len samples from file. | ||
| 223 | * Convert to signed longs. | ||
| 224 | * Place in buf[]. | ||
| 225 | * Return number of samples read. | ||
| 226 | */ | ||
| 227 | |||
| 228 | st_ssize_t st_maudread(ft_t ft, st_sample_t *buf, st_size_t len) | ||
| 229 | { | ||
| 230 | return (st_rawread(ft, buf, len)); | ||
| 231 | } | ||
| 232 | |||
| 233 | /* | ||
| 234 | * Do anything required when you stop reading samples. | ||
| 235 | * Don't close input file! | ||
| 236 | */ | ||
| 237 | int st_maudstopread(ft_t ft) | ||
| 238 | { | ||
| 239 | /* Needed because of rawread() */ | ||
| 240 | return st_rawstopread(ft); | ||
| 241 | } | ||
| 242 | |||
| 243 | int st_maudstartwrite(ft_t ft) | ||
| 244 | { | 215 | { |
| 245 | struct maudstuff * p = (struct maudstuff *) ft->priv; | 216 | struct maudstuff * p = (struct maudstuff *) ft->priv; |
| 246 | int rc; | 217 | int rc; |
| @@ -282,7 +253,7 @@ int st_maudstartwrite(ft_t ft) · 35 unmodified lines | |||
| 282 | return (ST_SUCCESS); | 253 | return (ST_SUCCESS); |
| 283 | } | 254 | } |
| 284 | 255 | ||
| 285 | st_ssize_t st_maudwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 256 | static st_size_t st_maudwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 286 | { | 257 | { |
| 287 | struct maudstuff * p = (struct maudstuff *) ft->priv; | 258 | struct maudstuff * p = (struct maudstuff *) ft->priv; |
| 288 | 259 | ||
| @@ -291,7 +262,7 @@ st_ssize_t st_maudwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 2 unmodified lines | |||
| 291 | return st_rawwrite(ft, buf, len); | 262 | return st_rawwrite(ft, buf, len); |
| 292 | } | 263 | } |
| 293 | 264 | ||
| 294 | int st_maudstopwrite(ft_t ft) | 265 | static int st_maudstopwrite(ft_t ft) |
| 295 | { | 266 | { |
| 296 | int rc; | 267 | int rc; |
| 297 | 268 | ||
| @@ -401,8 +372,8 @@ static st_format_t st_maud_format = { · 103 unmodified lines | |||
| 401 | NULL, | 372 | NULL, |
| 402 | ST_FILE_STEREO, | 373 | ST_FILE_STEREO, |
| 403 | st_maudstartread, | 374 | st_maudstartread, |
| 404 | st_maudread, | 375 | st_rawread, |
| 405 | st_maudstopread, | 376 | st_rawstopread, |
| 406 | st_maudstartwrite, | 377 | st_maudstartwrite, |
| 407 | st_maudwrite, | 378 | st_maudwrite, |
| 408 | st_maudstopwrite, | 379 | st_maudstopwrite, |
| @@ -199,7 +199,7 @@ static int lowpass_flow(eff_t effp, butterworth_crossover_t butterworth, int nCh · 198 unmodified lines | |||
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | typedef struct comp_band { | 201 | typedef struct comp_band { |
| 202 | int expectedChannels; /* Also flags that channels aren't to be treated | 202 | st_size_t expectedChannels; /* Also flags that channels aren't to be treated |
| 203 | individually when = 1 and input not mono */ | 203 | individually when = 1 and input not mono */ |
| 204 | int transferPoints; /* Number of points specified on the transfer | 204 | int transferPoints; /* Number of points specified on the transfer |
| 205 | function */ | 205 | function */ |
| @@ -213,9 +213,9 @@ typedef struct comp_band { · 7 unmodified lines | |||
| 213 | double topfreq; /* upper bound crossover frequency */ | 213 | double topfreq; /* upper bound crossover frequency */ |
| 214 | struct butterworth_crossover filter; | 214 | struct butterworth_crossover filter; |
| 215 | st_sample_t *delay_buf; /* Old samples, used for delay processing */ | 215 | st_sample_t *delay_buf; /* Old samples, used for delay processing */ |
| 216 | st_ssize_t delay_size; /* lookahead for this band (in samples) - function of delay, above */ | 216 | st_size_t delay_size; /* lookahead for this band (in samples) - function of delay, above */ |
| 217 | st_ssize_t delay_buf_ptr; /* Index into delay_buf */ | 217 | st_ssize_t delay_buf_ptr; /* Index into delay_buf */ |
| 218 | st_ssize_t delay_buf_cnt; /* No. of active entries in delay_buf */ | 218 | st_size_t delay_buf_cnt; /* No. of active entries in delay_buf */ |
| 219 | } *comp_band_t; | 219 | } *comp_band_t; |
| 220 | 220 | ||
| 221 | typedef struct { | 221 | typedef struct { |
| @@ -235,7 +235,7 @@ typedef struct { · 13 unmodified lines | |||
| 235 | static int st_mcompand_getopts_1(comp_band_t l, int n, char **argv) | 235 | static int st_mcompand_getopts_1(comp_band_t l, int n, char **argv) |
| 236 | { | 236 | { |
| 237 | char *s; | 237 | char *s; |
| 238 | int rates, tfers, i, commas; | 238 | st_size_t rates, tfers, i, commas; |
| 239 | 239 | ||
| 240 | /* Start by checking the attack and decay rates */ | 240 | /* Start by checking the attack and decay rates */ |
| 241 | 241 | ||
| @@ -379,7 +379,7 @@ static int parse_subarg(char *s, char **subargv, int *subargc) { · 137 unmodified lines | |||
| 379 | return ST_SUCCESS; | 379 | return ST_SUCCESS; |
| 380 | } | 380 | } |
| 381 | 381 | ||
| 382 | int st_mcompand_getopts(eff_t effp, int n, char **argv) | 382 | static int st_mcompand_getopts(eff_t effp, int n, char **argv) |
| 383 | { | 383 | { |
| 384 | char *subargv[6], *cp; | 384 | char *subargv[6], *cp; |
| 385 | int subargc, i, len; | 385 | int subargc, i, len; |
| @@ -431,11 +431,12 @@ int st_mcompand_getopts(eff_t effp, int n, char **argv) · 45 unmodified lines | |||
| 431 | * Prepare processing. | 431 | * Prepare processing. |
| 432 | * Do all initializations. | 432 | * Do all initializations. |
| 433 | */ | 433 | */ |
| 434 | int st_mcompand_start(eff_t effp) | 434 | static int st_mcompand_start(eff_t effp) |
| 435 | { | 435 | { |
| 436 | compand_t c = (compand_t) effp->priv; | 436 | compand_t c = (compand_t) effp->priv; |
| 437 | comp_band_t l; | 437 | comp_band_t l; |
| 438 | int band, i; | 438 | st_size_t i; |
| 439 | int band; | ||
| 439 | 440 | ||
| 440 | for (band=0;band<c->nBands;++band) { | 441 | for (band=0;band<c->nBands;++band) { |
| 441 | l = &c->bands[band]; | 442 | l = &c->bands[band]; |
| @@ -573,7 +574,7 @@ static int st_mcompand_flow_1(compand_t c, comp_band_t l, const st_sample_t *ibu · 131 unmodified lines | |||
| 573 | * Processed signed long samples from ibuf to obuf. | 574 | * Processed signed long samples from ibuf to obuf. |
| 574 | * Return number of samples processed. | 575 | * Return number of samples processed. |
| 575 | */ | 576 | */ |
| 576 | int st_mcompand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 577 | static int st_mcompand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 577 | st_size_t *isamp, st_size_t *osamp) { | 578 | st_size_t *isamp, st_size_t *osamp) { |
| 578 | compand_t c = (compand_t) effp->priv; | 579 | compand_t c = (compand_t) effp->priv; |
| 579 | comp_band_t l; | 580 | comp_band_t l; |
| @@ -628,7 +629,7 @@ int st_mcompand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 48 unmodified lines | |||
| 628 | return ST_SUCCESS; | 629 | return ST_SUCCESS; |
| 629 | } | 630 | } |
| 630 | 631 | ||
| 631 | static int st_mcompand_drain_1(eff_t effp, compand_t c, comp_band_t l, st_sample_t *obuf, int maxdrain, int band) | 632 | static int st_mcompand_drain_1(eff_t effp, compand_t c, comp_band_t l, st_sample_t *obuf, int maxdrain) |
| 632 | { | 633 | { |
| 633 | int done; | 634 | int done; |
| 634 | double out; | 635 | double out; |
| @@ -652,7 +653,7 @@ static int st_mcompand_drain_1(eff_t effp, compand_t c, comp_band_t l, st_sample · 17 unmodified lines | |||
| 652 | /* | 653 | /* |
| 653 | * Drain out compander delay lines. | 654 | * Drain out compander delay lines. |
| 654 | */ | 655 | */ |
| 655 | int st_mcompand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 656 | static int st_mcompand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 656 | { | 657 | { |
| 657 | int band, drained, mostdrained = 0; | 658 | int band, drained, mostdrained = 0; |
| 658 | compand_t c = (compand_t)effp->priv; | 659 | compand_t c = (compand_t)effp->priv; |
| @@ -661,7 +662,7 @@ int st_mcompand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 2 unmodified lines | |||
| 661 | memset(obuf,0,*osamp * sizeof *obuf); | 662 | memset(obuf,0,*osamp * sizeof *obuf); |
| 662 | for (band=0;band<c->nBands;++band) { | 663 | for (band=0;band<c->nBands;++band) { |
| 663 | l = &c->bands[band]; | 664 | l = &c->bands[band]; |
| 664 | drained = st_mcompand_drain_1(effp, c,l,obuf,*osamp,0); | 665 | drained = st_mcompand_drain_1(effp, c,l,obuf,*osamp); |
| 665 | if (drained > mostdrained) | 666 | if (drained > mostdrained) |
| 666 | mostdrained = drained; | 667 | mostdrained = drained; |
| 667 | } | 668 | } |
| @@ -677,7 +678,7 @@ int st_mcompand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 9 unmodified lines | |||
| 677 | /* | 678 | /* |
| 678 | * Clean up compander effect. | 679 | * Clean up compander effect. |
| 679 | */ | 680 | */ |
| 680 | int st_mcompand_stop(eff_t effp) | 681 | static int st_mcompand_stop(eff_t effp) |
| 681 | { | 682 | { |
| 682 | compand_t c = (compand_t) effp->priv; | 683 | compand_t c = (compand_t) effp->priv; |
| 683 | comp_band_t l; | 684 | comp_band_t l; |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | |||
| 15 | #include <math.h> | 15 | #include <math.h> |
| 16 | #include <stdio.h> | 16 | #include <stdio.h> |
| 17 | #include <stdlib.h> | 17 | #include <stdlib.h> |
| 18 | #include <stddef.h> | ||
| 18 | #include <time.h> | 19 | #include <time.h> |
| 19 | #include <string.h> | 20 | #include <string.h> |
| 20 | #include <ctype.h> | 21 | #include <ctype.h> |
| @@ -83,16 +84,16 @@ static const char writerr[] = "Error writing sample file. You are probably out · 62 unmodified lines | |||
| 83 | * Returns number of elements read, not bytes read. | 84 | * Returns number of elements read, not bytes read. |
| 84 | */ | 85 | */ |
| 85 | 86 | ||
| 86 | st_ssize_t st_readbuf(ft_t ft, void *buf, size_t size, st_size_t len) | 87 | size_t st_readbuf(ft_t ft, void *buf, size_t size, st_size_t len) |
| 87 | { | 88 | { |
| 88 | return fread(buf, size, len, ft->fp); | 89 | return fread(buf, size, len, ft->fp); |
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | /* Write a buffer of data of length len and each element is size bytes. | 92 | /* Write a buffer of data of length len and each element is size bytes. |
| 92 | * Returns number of elements writen, not bytes writen. | 93 | * Returns number of elements writen, not bytes written. |
| 93 | */ | 94 | */ |
| 94 | 95 | ||
| 95 | st_ssize_t st_writebuf(ft_t ft, void const *buf, size_t size, st_size_t len) | 96 | size_t st_writebuf(ft_t ft, void const *buf, size_t size, st_size_t len) |
| 96 | { | 97 | { |
| 97 | return fwrite(buf, size, len, ft->fp); | 98 | return fwrite(buf, size, len, ft->fp); |
| 98 | } | 99 | } |
| @@ -157,13 +158,11 @@ int st_reads(ft_t ft, char *c, st_size_t len) · 58 unmodified lines | |||
| 157 | return (ST_EOF); | 158 | return (ST_EOF); |
| 158 | } | 159 | } |
| 159 | if (in == 0 || in == '\n') | 160 | if (in == 0 || in == '\n') |
| 160 | { | ||
| 161 | break; | 161 | break; |
| 162 | } | ||
| 163 | 162 | ||
| 164 | *sc = in; | 163 | *sc = in; |
| 165 | sc++; | 164 | sc++; |
| 166 | } while (sc - c < len); | 165 | } while (sc - c < (ptrdiff_t)len); |
| 167 | *sc = 0; | 166 | *sc = 0; |
| 168 | return(ST_SUCCESS); | 167 | return(ST_SUCCESS); |
| 169 | } | 168 | } |
| @@ -306,7 +305,7 @@ int st_writedf(ft_t ft, double d) · 136 unmodified lines | |||
| 306 | } | 305 | } |
| 307 | 306 | ||
| 308 | /* generic swap routine. Swap l and place in to f (datatype length = n) */ | 307 | /* generic swap routine. Swap l and place in to f (datatype length = n) */ |
| 309 | void st_swapb(char *l, char *f, int n) | 308 | static void st_swapb(char *l, char *f, int n) |
| 310 | { | 309 | { |
| 311 | register int i; | 310 | register int i; |
| 312 | 311 | ||
| @@ -358,18 +357,28 @@ double st_swapd(double df) · 45 unmodified lines | |||
| 358 | 357 | ||
| 359 | 358 | ||
| 360 | /* dummy format routines for do-nothing functions */ | 359 | /* dummy format routines for do-nothing functions */ |
| 361 | int st_format_nothing(ft_t ft) { return(ST_SUCCESS); } | 360 | int st_format_nothing(ft_t ft UNUSED) { return(ST_SUCCESS); } |
| 362 | st_ssize_t st_format_nothing_read_io(ft_t ft, st_sample_t *buf, st_size_t len) { return(0); } | 361 | st_size_t st_format_nothing_read_io(ft_t ft UNUSED, st_sample_t *buf UNUSED, st_size_t len UNUSED) { return(0); } |
| 363 | st_ssize_t st_format_nothing_write_io(ft_t ft, const st_sample_t *buf, st_size_t len) { return(0); } | 362 | st_size_t st_format_nothing_write_io(ft_t ft UNUSED, const st_sample_t *buf UNUSED, st_size_t len UNUSED) { return(0); } |
| 364 | int st_format_nothing_seek(ft_t ft, st_size_t offset) { st_fail_errno(ft, ST_ENOTSUP, "operation not supported"); return(ST_EOF); } | 363 | int st_format_nothing_seek(ft_t ft UNUSED, st_size_t offset UNUSED) { st_fail_errno(ft, ST_ENOTSUP, "operation not supported"); return(ST_EOF); } |
| 365 | 364 | ||
| 366 | /* dummy effect routine for do-nothing functions */ | 365 | /* dummy effect routine for do-nothing functions */ |
| 367 | int st_effect_nothing(eff_t effp) { return(ST_SUCCESS); } | 366 | int st_effect_nothing(eff_t effp UNUSED) { return(ST_SUCCESS); } |
| 368 | int st_effect_nothing_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 367 | int st_effect_nothing_drain(eff_t effp UNUSED, st_sample_t *obuf UNUSED, st_size_t *osamp) |
| 369 | { /* Inform no more samples to drain */ *osamp = 0; return(ST_EOF); } | 368 | { /* Inform no more samples to drain */ *osamp = 0; return(ST_EOF); } |
| 370 | 369 | ||
| 370 | int st_effect_nothing_getopts(eff_t effp, int n, char **argv UNUSED) | ||
| 371 | { | ||
| 372 | if (n) { | ||
| 373 | st_fail(effp->h->usage); | ||
| 374 | return (ST_EOF); | ||
| 375 | } | ||
| 376 | return (ST_SUCCESS); | ||
| 377 | } | ||
| 378 | |||
| 379 | |||
| 371 | /* here for linear interp. might be useful for other things */ | 380 | /* here for linear interp. might be useful for other things */ |
| 372 | st_sample_t st_gcd(st_sample_t a, st_sample_t b) | 381 | REGPARM(2) st_sample_t st_gcd(st_sample_t a, st_sample_t b) |
| 373 | { | 382 | { |
| 374 | if (b == 0) | 383 | if (b == 0) |
| 375 | return a; | 384 | return a; |
| @@ -377,7 +386,7 @@ st_sample_t st_gcd(st_sample_t a, st_sample_t b) · 1 unmodified line | |||
| 377 | return st_gcd(b, a % b); | 386 | return st_gcd(b, a % b); |
| 378 | } | 387 | } |
| 379 | 388 | ||
| 380 | st_sample_t st_lcm(st_sample_t a, st_sample_t b) | 389 | REGPARM(2) st_sample_t st_lcm(st_sample_t a, st_sample_t b) |
| 381 | { | 390 | { |
| 382 | /* parenthesize this way to avoid st_sample_t overflow in product term */ | 391 | /* parenthesize this way to avoid st_sample_t overflow in product term */ |
| 383 | return a * (b / st_gcd(a, b)); | 392 | return a * (b / st_gcd(a, b)); |
| @@ -429,7 +438,7 @@ void st_initrand(void) { · 45 unmodified lines | |||
| 429 | void st_generate_wave_table( | 438 | void st_generate_wave_table( |
| 430 | st_wave_t wave_type, | 439 | st_wave_t wave_type, |
| 431 | st_data_t data_type, | 440 | st_data_t data_type, |
| 432 | void * table, | 441 | void *table, |
| 433 | uint32_t table_size, | 442 | uint32_t table_size, |
| 434 | double min, | 443 | double min, |
| 435 | double max, | 444 | double max, |
| @@ -457,19 +466,47 @@ void st_generate_wave_table( · 21 unmodified lines | |||
| 457 | case 3: d = d - 1.5; break; | 466 | case 3: d = d - 1.5; break; |
| 458 | } | 467 | } |
| 459 | break; | 468 | break; |
| 469 | |||
| 470 | default: /* Oops! FIXME */ | ||
| 471 | d = 0.0; /* Make sure we have a value */ | ||
| 472 | break; | ||
| 460 | } | 473 | } |
| 461 | d = d * (max - min) + min; | 474 | d = d * (max - min) + min; |
| 462 | switch (data_type) | 475 | switch (data_type) |
| 463 | { | 476 | { |
| 464 | case ST_FLOAT : *(float *)table = d; table += sizeof(float ); continue; | 477 | case ST_FLOAT: |
| 465 | case ST_DOUBLE: *(double *)table = d; table += sizeof(double); continue; | 478 | { |
| 479 | float *fp = (float *)table; | ||
| 480 | *fp++ = (float)d; | ||
| 481 | table = fp; | ||
| 482 | continue; | ||
| 483 | } | ||
| 484 | case ST_DOUBLE: | ||
| 485 | { | ||
| 486 | double *dp = (double *)table; | ||
| 487 | *dp++ = d; | ||
| 488 | table = dp; | ||
| 489 | continue; | ||
| 490 | } | ||
| 466 | default: break; | 491 | default: break; |
| 467 | } | 492 | } |
| 468 | d += d < 0? -0.5 : +0.5; | 493 | d += d < 0? -0.5 : +0.5; |
| 469 | switch (data_type) | 494 | switch (data_type) |
| 470 | { | 495 | { |
| 471 | case ST_SHORT : *(short *)table = d; table += sizeof(short ); continue; | 496 | case ST_SHORT: |
| 472 | case ST_INT : *(int *)table = d; table += sizeof(int ); continue; | 497 | { |
| 498 | short *sp = table; | ||
| 499 | *sp++ = (short)d; | ||
| 500 | table = sp; | ||
| 501 | continue; | ||
| 502 | } | ||
| 503 | case ST_INT: | ||
| 504 | { | ||
| 505 | int *ip = table; | ||
| 506 | *ip++ = (int)d; | ||
| 507 | table = ip; | ||
| 508 | continue; | ||
| 509 | } | ||
| 473 | default: break; | 510 | default: break; |
| 474 | } | 511 | } |
| 475 | } | 512 | } |
| @@ -542,5 +579,5 @@ enum_item const * find_enum_text(char const * text, enum_item const * enum_items · 66 unmodified lines | |||
| 542 | enum_item const st_wave_enum[] = { | 579 | enum_item const st_wave_enum[] = { |
| 543 | ENUM_ITEM(ST_WAVE_,SINE) | 580 | ENUM_ITEM(ST_WAVE_,SINE) |
| 544 | ENUM_ITEM(ST_WAVE_,TRIANGLE) | 581 | ENUM_ITEM(ST_WAVE_,TRIANGLE) |
| 545 | {0}}; | 582 | {0, 0}}; |
| 546 | 583 | ||
| @@ -14,13 +14,13 @@ · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | #include <string.h> | 15 | #include <string.h> |
| 16 | 16 | ||
| 17 | #if defined(HAVE_LIBMAD) || defined(HAVE_LAME) | 17 | #if defined(HAVE_LIBMAD) || defined(HAVE_LIBMP3LAME) |
| 18 | 18 | ||
| 19 | #ifdef HAVE_LIBMAD | 19 | #ifdef HAVE_LIBMAD |
| 20 | #include <mad.h> | 20 | #include <mad.h> |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | #ifdef HAVE_LAME | 23 | #ifdef HAVE_LIBMP3LAME |
| 24 | #include <lame/lame.h> | 24 | #include <lame/lame.h> |
| 25 | #include <math.h> | 25 | #include <math.h> |
| 26 | #endif | 26 | #endif |
| @@ -38,9 +38,9 @@ struct mp3priv { · 11 unmodified lines | |||
| 38 | st_ssize_t cursamp; | 38 | st_ssize_t cursamp; |
| 39 | st_size_t FrameCount; | 39 | st_size_t FrameCount; |
| 40 | #endif /*HAVE_LIBMAD*/ | 40 | #endif /*HAVE_LIBMAD*/ |
| 41 | #ifdef HAVE_LAME | 41 | #ifdef HAVE_LIBMP3LAME |
| 42 | lame_global_flags *gfp; | 42 | lame_global_flags *gfp; |
| 43 | #endif /*HAVE_LAME*/ | 43 | #endif /*HAVE_LIBMP3LAME*/ |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | #ifdef HAVE_LIBMAD | 46 | #ifdef HAVE_LIBMAD |
| @@ -159,7 +159,7 @@ static int st_mp3_inputtag(ft_t ft) · 112 unmodified lines | |||
| 159 | return rc; | 159 | return rc; |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | int st_mp3startread(ft_t ft) | 162 | static int st_mp3startread(ft_t ft) |
| 163 | { | 163 | { |
| 164 | struct mp3priv *p = (struct mp3priv *) ft->priv; | 164 | struct mp3priv *p = (struct mp3priv *) ft->priv; |
| 165 | size_t ReadSize; | 165 | size_t ReadSize; |
| @@ -279,12 +279,12 @@ error: · 113 unmodified lines | |||
| 279 | * Place in buf[]. | 279 | * Place in buf[]. |
| 280 | * Return number of samples read. | 280 | * Return number of samples read. |
| 281 | */ | 281 | */ |
| 282 | st_ssize_t st_mp3read(ft_t ft, st_sample_t *buf, st_size_t len) | 282 | static st_size_t st_mp3read(ft_t ft, st_sample_t *buf, st_size_t len) |
| 283 | { | 283 | { |
| 284 | struct mp3priv *p = (struct mp3priv *) ft->priv; | 284 | struct mp3priv *p = (struct mp3priv *) ft->priv; |
| 285 | st_ssize_t donow,i,done=0; | 285 | st_size_t donow,i,done=0; |
| 286 | mad_fixed_t sample; | 286 | mad_fixed_t sample; |
| 287 | int chan; | 287 | size_t chan; |
| 288 | 288 | ||
| 289 | do { | 289 | do { |
| 290 | donow=min(len,(p->Synth->pcm.length - p->cursamp)*ft->info.channels); | 290 | donow=min(len,(p->Synth->pcm.length - p->cursamp)*ft->info.channels); |
| @@ -342,7 +342,7 @@ st_ssize_t st_mp3read(ft_t ft, st_sample_t *buf, st_size_t len) · 51 unmodified lines | |||
| 342 | return done; | 342 | return done; |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | int st_mp3stopread(ft_t ft) | 345 | static int st_mp3stopread(ft_t ft) |
| 346 | { | 346 | { |
| 347 | struct mp3priv *p=(struct mp3priv*) ft->priv; | 347 | struct mp3priv *p=(struct mp3priv*) ft->priv; |
| 348 | 348 | ||
| @@ -359,7 +359,7 @@ int st_mp3stopread(ft_t ft) · 10 unmodified lines | |||
| 359 | return ST_SUCCESS; | 359 | return ST_SUCCESS; |
| 360 | } | 360 | } |
| 361 | #else /*HAVE_LIBMAD*/ | 361 | #else /*HAVE_LIBMAD*/ |
| 362 | int st_mp3startread(ft_t ft) | 362 | static int st_mp3startread(ft_t ft) |
| 363 | { | 363 | { |
| 364 | st_fail_errno(ft,ST_EOF,"SoX was compiled without MP3 decoding support"); | 364 | st_fail_errno(ft,ST_EOF,"SoX was compiled without MP3 decoding support"); |
| 365 | return ST_EOF; | 365 | return ST_EOF; |
| @@ -378,17 +378,18 @@ int st_mp3stopread(ft_t ft) · 12 unmodified lines | |||
| 378 | } | 378 | } |
| 379 | #endif /*HAVE_LIBMAD*/ | 379 | #endif /*HAVE_LIBMAD*/ |
| 380 | 380 | ||
| 381 | #ifdef HAVE_LAME | 381 | #ifdef HAVE_LIBMP3LAME |
| 382 | void null_error_func(const char* string, va_list va){ | 382 | static void null_error_func(const char* string UNUSED, va_list va UNUSED) |
| 383 | { | ||
| 383 | return; | 384 | return; |
| 384 | } | 385 | } |
| 385 | 386 | ||
| 386 | int st_mp3startwrite(ft_t ft) | 387 | static int st_mp3startwrite(ft_t ft) |
| 387 | { | 388 | { |
| 388 | struct mp3priv *p = (struct mp3priv *) ft->priv; | 389 | struct mp3priv *p = (struct mp3priv *) ft->priv; |
| 389 | 390 | ||
| 390 | if (ft->info.encoding != ST_ENCODING_MP3){ | 391 | if (ft->info.encoding != ST_ENCODING_MP3) { |
| 391 | if(ft->info.encoding != -1) | 392 | if(ft->info.encoding != ST_ENCODING_UNKNOWN) |
| 392 | st_report("Encoding forced to MP3"); | 393 | st_report("Encoding forced to MP3"); |
| 393 | ft->info.encoding = ST_ENCODING_MP3; | 394 | ft->info.encoding = ST_ENCODING_MP3; |
| 394 | } | 395 | } |
| @@ -399,7 +400,7 @@ int st_mp3startwrite(ft_t ft) · 4 unmodified lines | |||
| 399 | return(ST_EOF); | 400 | return(ST_EOF); |
| 400 | } | 401 | } |
| 401 | 402 | ||
| 402 | if (ft->info.channels != -1){ | 403 | if (ft->info.channels != ST_ENCODING_UNKNOWN) { |
| 403 | if ( (lame_set_num_channels(p->gfp,ft->info.channels)) < 0) { | 404 | if ( (lame_set_num_channels(p->gfp,ft->info.channels)) < 0) { |
| 404 | st_fail_errno(ft,ST_EOF,"Unsupported number of channels"); | 405 | st_fail_errno(ft,ST_EOF,"Unsupported number of channels"); |
| 405 | return(ST_EOF); | 406 | return(ST_EOF); |
| @@ -431,16 +432,16 @@ int st_mp3startwrite(ft_t ft) · 25 unmodified lines | |||
| 431 | return(ST_SUCCESS); | 432 | return(ST_SUCCESS); |
| 432 | } | 433 | } |
| 433 | 434 | ||
| 434 | st_ssize_t st_mp3write(ft_t ft, const st_sample_t *buf, st_size_t samp) | 435 | static st_size_t st_mp3write(ft_t ft, const st_sample_t *buf, st_size_t samp) |
| 435 | { | 436 | { |
| 436 | struct mp3priv *p = (struct mp3priv *)ft->priv; | 437 | struct mp3priv *p = (struct mp3priv *)ft->priv; |
| 437 | char *mp3buffer; | 438 | char *mp3buffer; |
| 438 | int mp3buffer_size; | 439 | st_size_t mp3buffer_size; |
| 439 | short signed int *buffer_l, *buffer_r = NULL; | 440 | short signed int *buffer_l, *buffer_r = NULL; |
| 440 | int nsamples = samp/ft->info.channels; | 441 | int nsamples = samp/ft->info.channels; |
| 441 | int i,j; | 442 | int i,j; |
| 442 | st_ssize_t done = 0; | 443 | st_ssize_t done = 0; |
| 443 | int written; | 444 | st_size_t written; |
| 444 | 445 | ||
| 445 | /* NOTE: This logic assumes that "short int" is 16-bits | 446 | /* NOTE: This logic assumes that "short int" is 16-bits |
| 446 | * on all platforms. It happens to be for all that I know | 447 | * on all platforms. It happens to be for all that I know |
| @@ -504,7 +505,7 @@ st_ssize_t st_mp3write(ft_t ft, const st_sample_t *buf, st_size_t samp) · 57 unmodified lines | |||
| 504 | 505 | ||
| 505 | if ((written = lame_encode_buffer(p->gfp,buffer_l, buffer_r, | 506 | if ((written = lame_encode_buffer(p->gfp,buffer_l, buffer_r, |
| 506 | nsamples, (unsigned char *)mp3buffer, | 507 | nsamples, (unsigned char *)mp3buffer, |
| 507 | mp3buffer_size)) < 0){ | 508 | mp3buffer_size)) < mp3buffer_size){ |
| 508 | st_fail_errno(ft,ST_EOF,"Encoding failed"); | 509 | st_fail_errno(ft,ST_EOF,"Encoding failed"); |
| 509 | goto end; | 510 | goto end; |
| 510 | } | 511 | } |
| @@ -528,7 +529,7 @@ end4: · 17 unmodified lines | |||
| 528 | return done; | 529 | return done; |
| 529 | } | 530 | } |
| 530 | 531 | ||
| 531 | int st_mp3stopwrite(ft_t ft) | 532 | static int st_mp3stopwrite(ft_t ft) |
| 532 | { | 533 | { |
| 533 | struct mp3priv *p = (struct mp3priv *) ft->priv; | 534 | struct mp3priv *p = (struct mp3priv *) ft->priv; |
| 534 | char mp3buffer[7200]; | 535 | char mp3buffer[7200]; |
| @@ -537,7 +538,7 @@ int st_mp3stopwrite(ft_t ft) · 2 unmodified lines | |||
| 537 | if ( (written=lame_encode_flush(p->gfp, (unsigned char *)mp3buffer, 7200)) <0){ | 538 | if ( (written=lame_encode_flush(p->gfp, (unsigned char *)mp3buffer, 7200)) <0){ |
| 538 | st_fail_errno(ft,ST_EOF,"Encoding failed"); | 539 | st_fail_errno(ft,ST_EOF,"Encoding failed"); |
| 539 | } | 540 | } |
| 540 | else if (st_writebuf(ft, mp3buffer, 1, written) < written){ | 541 | else if ((int)st_writebuf(ft, mp3buffer, 1, written) < written){ |
| 541 | st_fail_errno(ft,ST_EOF,"File write failed"); | 542 | st_fail_errno(ft,ST_EOF,"File write failed"); |
| 542 | } | 543 | } |
| 543 | 544 | ||
| @@ -545,25 +546,25 @@ int st_mp3stopwrite(ft_t ft) · 1 unmodified line | |||
| 545 | return ST_SUCCESS; | 546 | return ST_SUCCESS; |
| 546 | } | 547 | } |
| 547 | 548 | ||
| 548 | #else /* HAVE_LAME */ | 549 | #else /* HAVE_LIBMP3LAME */ |
| 549 | int st_mp3startwrite(ft_t ft) | 550 | static int st_mp3startwrite(ft_t ft UNUSED) |
| 550 | { | 551 | { |
| 551 | st_fail_errno(ft,ST_EOF,"Sorry, no MP3 encoding support"); | 552 | st_fail_errno(ft,ST_EOF,"SoX was compiled without MP3 encoding support"); |
| 552 | return ST_EOF; | 553 | return ST_EOF; |
| 553 | } | 554 | } |
| 554 | 555 | ||
| 555 | st_ssize_t st_mp3write(ft_t ft, const st_sample_t *buf, st_size_t samp) | 556 | static st_size_t st_mp3write(ft_t ft UNUSED, const st_sample_t *buf UNUSED, st_size_t samp UNUSED) |
| 556 | { | 557 | { |
| 557 | st_fail_errno(ft,ST_EOF,"Sorry, no MP3 encoding support"); | 558 | st_fail_errno(ft,ST_EOF,"SoX was compiled without MP3 encoding support"); |
| 558 | return ST_EOF; | 559 | return 0; |
| 559 | } | 560 | } |
| 560 | 561 | ||
| 561 | int st_mp3stopwrite(ft_t ft) | 562 | static int st_mp3stopwrite(ft_t ft) |
| 562 | { | 563 | { |
| 563 | st_fail_errno(ft,ST_EOF,"Sorry, no MP3 encoding support"); | 564 | st_fail_errno(ft,ST_EOF,"SoX was compiled without MP3 encoding support"); |
| 564 | return ST_EOF; | 565 | return ST_EOF; |
| 565 | } | 566 | } |
| 566 | #endif /* HAVE_LAME */ | 567 | #endif /* HAVE_LIBMP3LAME */ |
| 567 | 568 | ||
| 568 | /* MP3 */ | 569 | /* MP3 */ |
| 569 | static const char *mp3names[] = { | 570 | static const char *mp3names[] = { |
| @@ -39,7 +39,7 @@ typedef struct profdata { · 38 unmodified lines | |||
| 39 | /* | 39 | /* |
| 40 | * Get the filename, if any. We don't open it until st_noiseprof_start. | 40 | * Get the filename, if any. We don't open it until st_noiseprof_start. |
| 41 | */ | 41 | */ |
| 42 | int st_noiseprof_getopts(eff_t effp, int n, char **argv) | 42 | static int st_noiseprof_getopts(eff_t effp, int n, char **argv) |
| 43 | { | 43 | { |
| 44 | profdata_t data = (profdata_t) effp->priv; | 44 | profdata_t data = (profdata_t) effp->priv; |
| 45 | 45 | ||
| @@ -57,7 +57,7 @@ int st_noiseprof_getopts(eff_t effp, int n, char **argv) · 11 unmodified lines | |||
| 57 | * Prepare processing. | 57 | * Prepare processing. |
| 58 | * Do all initializations. | 58 | * Do all initializations. |
| 59 | */ | 59 | */ |
| 60 | int st_noiseprof_start(eff_t effp) | 60 | static int st_noiseprof_start(eff_t effp) |
| 61 | { | 61 | { |
| 62 | profdata_t data = (profdata_t) effp->priv; | 62 | profdata_t data = (profdata_t) effp->priv; |
| 63 | int channels = effp->ininfo.channels; | 63 | int channels = effp->ininfo.channels; |
| @@ -88,7 +88,7 @@ int st_noiseprof_start(eff_t effp) · 24 unmodified lines | |||
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | /* Collect statistics from the complete window on channel chan. */ | 90 | /* Collect statistics from the complete window on channel chan. */ |
| 91 | static void collect_data(profdata_t data, chandata_t* chan) { | 91 | static void collect_data(chandata_t* chan) { |
| 92 | float *out = (float*)calloc(FREQCOUNT, sizeof(float)); | 92 | float *out = (float*)calloc(FREQCOUNT, sizeof(float)); |
| 93 | 93 | ||
| 94 | int i; | 94 | int i; |
| @@ -109,13 +109,13 @@ static void collect_data(profdata_t data, chandata_t* chan) { · 14 unmodified lines | |||
| 109 | /* | 109 | /* |
| 110 | * Grab what we can from ibuf, and process if we have a whole window. | 110 | * Grab what we can from ibuf, and process if we have a whole window. |
| 111 | */ | 111 | */ |
| 112 | int st_noiseprof_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 112 | static int st_noiseprof_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 113 | st_size_t *isamp, st_size_t *osamp) | 113 | st_size_t *isamp, st_size_t *osamp) |
| 114 | { | 114 | { |
| 115 | profdata_t data = (profdata_t) effp->priv; | 115 | profdata_t data = (profdata_t) effp->priv; |
| 116 | int samp = min(*isamp, *osamp); | 116 | int samp = min(*isamp, *osamp); |
| 117 | int tracks = effp->ininfo.channels; | 117 | int tracks = effp->ininfo.channels; |
| 118 | int track_samples = samp / tracks; | 118 | st_size_t track_samples = samp / tracks; |
| 119 | int ncopy = 0; | 119 | int ncopy = 0; |
| 120 | int i; | 120 | int i; |
| 121 | 121 | ||
| @@ -133,7 +133,7 @@ int st_noiseprof_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 11 unmodified lines | |||
| 133 | ST_SAMPLE_TO_FLOAT_DWORD(ibuf[i+j*tracks], effp->clippedCount); | 133 | ST_SAMPLE_TO_FLOAT_DWORD(ibuf[i+j*tracks], effp->clippedCount); |
| 134 | } | 134 | } |
| 135 | if (ncopy + data->bufdata == WINDOWSIZE) { | 135 | if (ncopy + data->bufdata == WINDOWSIZE) { |
| 136 | collect_data(data, chan); | 136 | collect_data(chan); |
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 | ||
| @@ -152,7 +152,7 @@ int st_noiseprof_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 12 unmodified lines | |||
| 152 | * Finish off the last window. | 152 | * Finish off the last window. |
| 153 | */ | 153 | */ |
| 154 | 154 | ||
| 155 | int st_noiseprof_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 155 | static int st_noiseprof_drain(eff_t effp, st_sample_t *obuf UNUSED, st_size_t *osamp) |
| 156 | { | 156 | { |
| 157 | profdata_t data = (profdata_t) effp->priv; | 157 | profdata_t data = (profdata_t) effp->priv; |
| 158 | int tracks = effp->ininfo.channels; | 158 | int tracks = effp->ininfo.channels; |
| @@ -169,7 +169,7 @@ int st_noiseprof_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 10 unmodified lines | |||
| 169 | for (j = data->bufdata+1; j < WINDOWSIZE; j ++) { | 169 | for (j = data->bufdata+1; j < WINDOWSIZE; j ++) { |
| 170 | data->chandata[i].window[j] = 0; | 170 | data->chandata[i].window[j] = 0; |
| 171 | } | 171 | } |
| 172 | collect_data(data, &(data->chandata[i])); | 172 | collect_data(&(data->chandata[i])); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | if (data->bufdata == WINDOWSIZE || data->bufdata == 0) | 175 | if (data->bufdata == WINDOWSIZE || data->bufdata == 0) |
| @@ -181,10 +181,10 @@ int st_noiseprof_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 5 unmodified lines | |||
| 181 | /* | 181 | /* |
| 182 | * Print profile and clean up. | 182 | * Print profile and clean up. |
| 183 | */ | 183 | */ |
| 184 | int st_noiseprof_stop(eff_t effp) | 184 | static int st_noiseprof_stop(eff_t effp) |
| 185 | { | 185 | { |
| 186 | profdata_t data = (profdata_t) effp->priv; | 186 | profdata_t data = (profdata_t) effp->priv; |
| 187 | int i; | 187 | st_size_t i; |
| 188 | 188 | ||
| 189 | for (i = 0; i < effp->ininfo.channels; i ++) { | 189 | for (i = 0; i < effp->ininfo.channels; i ++) { |
| 190 | int j; | 190 | int j; |
| @@ -38,7 +38,7 @@ typedef struct reddata { · 37 unmodified lines | |||
| 38 | * Get the options. Filename is mandatory, though a reasonable default would | 38 | * Get the options. Filename is mandatory, though a reasonable default would |
| 39 | * be stdin (if the input file isn't coming from there, of course!) | 39 | * be stdin (if the input file isn't coming from there, of course!) |
| 40 | */ | 40 | */ |
| 41 | int st_noisered_getopts(eff_t effp, int n, char **argv) | 41 | static int st_noisered_getopts(eff_t effp, int n, char **argv) |
| 42 | { | 42 | { |
| 43 | reddata_t data = (reddata_t) effp->priv; | 43 | reddata_t data = (reddata_t) effp->priv; |
| 44 | 44 | ||
| @@ -67,7 +67,7 @@ int st_noisered_getopts(eff_t effp, int n, char **argv) · 22 unmodified lines | |||
| 67 | * Prepare processing. | 67 | * Prepare processing. |
| 68 | * Do all initializations. | 68 | * Do all initializations. |
| 69 | */ | 69 | */ |
| 70 | int st_noisered_start(eff_t effp) | 70 | static int st_noisered_start(eff_t effp) |
| 71 | { | 71 | { |
| 72 | reddata_t data = (reddata_t) effp->priv; | 72 | reddata_t data = (reddata_t) effp->priv; |
| 73 | int fchannels = 0; | 73 | int fchannels = 0; |
| @@ -245,17 +245,17 @@ static int process_window(eff_t effp, reddata_t data, int chan_num, int num_chan · 171 unmodified lines | |||
| 245 | /* | 245 | /* |
| 246 | * Read in windows, and call process_window once we get a whole one. | 246 | * Read in windows, and call process_window once we get a whole one. |
| 247 | */ | 247 | */ |
| 248 | int st_noisered_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 248 | static int st_noisered_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 249 | st_size_t *isamp, st_size_t *osamp) | 249 | st_size_t *isamp, st_size_t *osamp) |
| 250 | { | 250 | { |
| 251 | reddata_t data = (reddata_t) effp->priv; | 251 | reddata_t data = (reddata_t) effp->priv; |
| 252 | int samp = min(*isamp, *osamp); | 252 | st_size_t samp = min(*isamp, *osamp); |
| 253 | int tracks = effp->ininfo.channels; | 253 | st_size_t tracks = effp->ininfo.channels; |
| 254 | int track_samples = samp / tracks; | 254 | st_size_t track_samples = samp / tracks; |
| 255 | int ncopy = min(track_samples, WINDOWSIZE-data->bufdata); | 255 | st_size_t ncopy = min(track_samples, WINDOWSIZE-data->bufdata); |
| 256 | int whole_window = (ncopy + data->bufdata == WINDOWSIZE); | 256 | st_size_t whole_window = (ncopy + data->bufdata == WINDOWSIZE); |
| 257 | int oldbuf = data->bufdata; | 257 | int oldbuf = data->bufdata; |
| 258 | int i; | 258 | st_size_t i; |
| 259 | assert(effp->ininfo.channels == effp->outinfo.channels); | 259 | assert(effp->ininfo.channels == effp->outinfo.channels); |
| 260 | 260 | ||
| 261 | if (whole_window) { | 261 | if (whole_window) { |
| @@ -267,7 +267,7 @@ int st_noisered_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 5 unmodified lines | |||
| 267 | /* Reduce noise on every channel. */ | 267 | /* Reduce noise on every channel. */ |
| 268 | for (i = 0; i < tracks; i ++) { | 268 | for (i = 0; i < tracks; i ++) { |
| 269 | chandata_t* chan = &(data->chandata[i]); | 269 | chandata_t* chan = &(data->chandata[i]); |
| 270 | int j; | 270 | st_size_t j; |
| 271 | if (chan->window == NULL) { | 271 | if (chan->window == NULL) { |
| 272 | chan->window = (float*)calloc(WINDOWSIZE, sizeof(float)); | 272 | chan->window = (float*)calloc(WINDOWSIZE, sizeof(float)); |
| 273 | } | 273 | } |
| @@ -298,7 +298,7 @@ int st_noisered_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 24 unmodified lines | |||
| 298 | * We have up to half a window left to dump. | 298 | * We have up to half a window left to dump. |
| 299 | */ | 299 | */ |
| 300 | 300 | ||
| 301 | int st_noisered_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 301 | static int st_noisered_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 302 | { | 302 | { |
| 303 | reddata_t data = (reddata_t)effp->priv; | 303 | reddata_t data = (reddata_t)effp->priv; |
| 304 | int i; | 304 | int i; |
| @@ -315,10 +315,10 @@ int st_noisered_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 10 unmodified lines | |||
| 315 | /* | 315 | /* |
| 316 | * Clean up. | 316 | * Clean up. |
| 317 | */ | 317 | */ |
| 318 | int st_noisered_stop(eff_t effp) | 318 | static int st_noisered_stop(eff_t effp) |
| 319 | { | 319 | { |
| 320 | reddata_t data = (reddata_t) effp->priv; | 320 | reddata_t data = (reddata_t) effp->priv; |
| 321 | int i; | 321 | st_size_t i; |
| 322 | 322 | ||
| 323 | for (i = 0; i < effp->ininfo.channels; i ++) { | 323 | for (i = 0; i < effp->ininfo.channels; i ++) { |
| 324 | chandata_t* chan = &(data->chandata[i]); | 324 | chandata_t* chan = &(data->chandata[i]); |
| @@ -17,26 +17,26 @@ · 16 unmodified lines | |||
| 17 | #include "st_i.h" | 17 | #include "st_i.h" |
| 18 | #include <string.h> | 18 | #include <string.h> |
| 19 | 19 | ||
| 20 | int st_nulstartread(ft_t ft) | 20 | static int st_nulstartread(ft_t ft) |
| 21 | { | 21 | { |
| 22 | /* If format parameters are not given, set somewhat arbitrary | 22 | /* If format parameters are not given, set somewhat arbitrary |
| 23 | * (but commonly used) defaults: */ | 23 | * (but commonly used) defaults: */ |
| 24 | if (ft->info.rate == 0) ft->info.rate = 44100; | 24 | if (ft->info.rate == 0) ft->info.rate = 44100; |
| 25 | if (ft->info.channels == -1) ft->info.channels = 2; | 25 | if (ft->info.channels == 0) ft->info.channels = 2; |
| 26 | if (ft->info.size == -1) ft->info.size = ST_SIZE_WORD; | 26 | if (ft->info.size == -1) ft->info.size = ST_SIZE_WORD; |
| 27 | if (ft->info.encoding == -1) ft->info.encoding = ST_ENCODING_SIGN2; | 27 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) ft->info.encoding = ST_ENCODING_SIGN2; |
| 28 | 28 | ||
| 29 | return ST_SUCCESS; | 29 | return ST_SUCCESS; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | st_ssize_t st_nulread(ft_t ft, st_sample_t *buf, st_size_t len) | 32 | static st_size_t st_nulread(ft_t ft UNUSED, st_sample_t *buf, st_size_t len) |
| 33 | { | 33 | { |
| 34 | /* Reading from null generates silence i.e. (st_sample_t)0. */ | 34 | /* Reading from null generates silence i.e. (st_sample_t)0. */ |
| 35 | memset(buf, 0, sizeof(st_sample_t) * len); | 35 | memset(buf, 0, sizeof(st_sample_t) * len); |
| 36 | return len; /* Return number of samples "read". */ | 36 | return len; /* Return number of samples "read". */ |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | st_ssize_t st_nulwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 39 | static st_size_t st_nulwrite(ft_t ft UNUSED, const st_sample_t *buf UNUSED, st_size_t len) |
| 40 | { | 40 | { |
| 41 | /* Writing to null just discards the samples */ | 41 | /* Writing to null just discards the samples */ |
| 42 | return len; /* Return number of samples "written". */ | 42 | return len; /* Return number of samples "written". */ |
| @@ -51,7 +51,7 @@ static int ossdspinit(ft_t ft) · 50 unmodified lines | |||
| 51 | if (ft->info.size == ST_SIZE_BYTE) { | 51 | if (ft->info.size == ST_SIZE_BYTE) { |
| 52 | sampletype = AFMT_U8; | 52 | sampletype = AFMT_U8; |
| 53 | samplesize = 8; | 53 | samplesize = 8; |
| 54 | if (ft->info.encoding == -1) | 54 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) |
| 55 | ft->info.encoding = ST_ENCODING_UNSIGNED; | 55 | ft->info.encoding = ST_ENCODING_UNSIGNED; |
| 56 | if (ft->info.encoding != ST_ENCODING_UNSIGNED) { | 56 | if (ft->info.encoding != ST_ENCODING_UNSIGNED) { |
| 57 | st_report("OSS driver only supports unsigned with bytes"); | 57 | st_report("OSS driver only supports unsigned with bytes"); |
| @@ -62,7 +62,7 @@ static int ossdspinit(ft_t ft) · 4 unmodified lines | |||
| 62 | else if (ft->info.size == ST_SIZE_WORD) { | 62 | else if (ft->info.size == ST_SIZE_WORD) { |
| 63 | sampletype = (ST_IS_BIGENDIAN) ? AFMT_S16_BE : AFMT_S16_LE; | 63 | sampletype = (ST_IS_BIGENDIAN) ? AFMT_S16_BE : AFMT_S16_LE; |
| 64 | samplesize = 16; | 64 | samplesize = 16; |
| 65 | if (ft->info.encoding == -1) | 65 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) |
| 66 | ft->info.encoding = ST_ENCODING_SIGN2; | 66 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 67 | if (ft->info.encoding != ST_ENCODING_SIGN2) { | 67 | if (ft->info.encoding != ST_ENCODING_SIGN2) { |
| 68 | st_report("OSS driver only supports signed with words"); | 68 | st_report("OSS driver only supports signed with words"); |
| @@ -79,7 +79,7 @@ static int ossdspinit(ft_t ft) · 10 unmodified lines | |||
| 79 | st_report("Forcing to signed linear word"); | 79 | st_report("Forcing to signed linear word"); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | if (ft->info.channels == -1) ft->info.channels = 1; | 82 | if (ft->info.channels == 0) ft->info.channels = 1; |
| 83 | else if (ft->info.channels > 2) ft->info.channels = 2; | 83 | else if (ft->info.channels > 2) ft->info.channels = 2; |
| 84 | 84 | ||
| 85 | if (ioctl(fileno(ft->fp), SNDCTL_DSP_RESET, 0) < 0) | 85 | if (ioctl(fileno(ft->fp), SNDCTL_DSP_RESET, 0) < 0) |
| @@ -204,14 +204,14 @@ static int ossdspinit(ft_t ft) · 118 unmodified lines | |||
| 204 | * size and encoding of samples, | 204 | * size and encoding of samples, |
| 205 | * mono/stereo/quad. | 205 | * mono/stereo/quad. |
| 206 | */ | 206 | */ |
| 207 | int st_ossdspstartread(ft_t ft) | 207 | static int st_ossdspstartread(ft_t ft) |
| 208 | { | 208 | { |
| 209 | int rc; | 209 | int rc; |
| 210 | rc = ossdspinit(ft); | 210 | rc = ossdspinit(ft); |
| 211 | return rc; | 211 | return rc; |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | int st_ossdspstartwrite(ft_t ft) | 214 | static int st_ossdspstartwrite(ft_t ft) |
| 215 | { | 215 | { |
| 216 | return ossdspinit(ft); | 216 | return ossdspinit(ft); |
| 217 | } | 217 | } |
| @@ -30,7 +30,7 @@ typedef struct { · 29 unmodified lines | |||
| 30 | /* | 30 | /* |
| 31 | * Process options | 31 | * Process options |
| 32 | */ | 32 | */ |
| 33 | int st_pan_getopts(eff_t effp, int n, char **argv) | 33 | static int st_pan_getopts(eff_t effp, int n, char **argv) |
| 34 | { | 34 | { |
| 35 | pan_t pan = (pan_t) effp->priv; | 35 | pan_t pan = (pan_t) effp->priv; |
| 36 | 36 | ||
| @@ -49,7 +49,7 @@ int st_pan_getopts(eff_t effp, int n, char **argv) · 12 unmodified lines | |||
| 49 | /* | 49 | /* |
| 50 | * Start processing | 50 | * Start processing |
| 51 | */ | 51 | */ |
| 52 | int st_pan_start(eff_t effp) | 52 | static int st_pan_start(eff_t effp) |
| 53 | { | 53 | { |
| 54 | if (effp->outinfo.channels==1) | 54 | if (effp->outinfo.channels==1) |
| 55 | st_warn("PAN onto a mono channel..."); | 55 | st_warn("PAN onto a mono channel..."); |
| @@ -73,7 +73,7 @@ int st_pan_start(eff_t effp) · 17 unmodified lines | |||
| 73 | /* | 73 | /* |
| 74 | * Process either isamp or osamp samples, whichever is smaller. | 74 | * Process either isamp or osamp samples, whichever is smaller. |
| 75 | */ | 75 | */ |
| 76 | int st_pan_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 76 | static int st_pan_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 77 | st_size_t *isamp, st_size_t *osamp) | 77 | st_size_t *isamp, st_size_t *osamp) |
| 78 | { | 78 | { |
| 79 | pan_t pan = (pan_t) effp->priv; | 79 | pan_t pan = (pan_t) effp->priv; |
| @@ -408,15 +408,8 @@ int st_pan_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 328 unmodified lines | |||
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | /* | 410 | /* |
| 411 | * Do anything required when you stop reading samples. | 411 | * FIXME: Add a stop function with statistics on right, left, and output amplitudes. |
| 412 | * Don't close input file! | ||
| 413 | * | ||
| 414 | * Should have statistics on right, left, and output amplitudes. | ||
| 415 | */ | 412 | */ |
| 416 | int st_pan_stop(eff_t effp) | ||
| 417 | { | ||
| 418 | return ST_SUCCESS; | ||
| 419 | } | ||
| 420 | 413 | ||
| 421 | static st_effect_t st_pan_effect = { | 414 | static st_effect_t st_pan_effect = { |
| 422 | "pan", | 415 | "pan", |
| @@ -426,7 +419,7 @@ static st_effect_t st_pan_effect = { · 3 unmodified lines | |||
| 426 | st_pan_start, | 419 | st_pan_start, |
| 427 | st_pan_flow, | 420 | st_pan_flow, |
| 428 | st_effect_nothing_drain, | 421 | st_effect_nothing_drain, |
| 429 | st_pan_stop | 422 | st_effect_nothing |
| 430 | }; | 423 | }; |
| 431 | 424 | ||
| 432 | const st_effect_t *st_pan_effect_fn(void) | 425 | const st_effect_t *st_pan_effect_fn(void) |
| @@ -81,7 +81,7 @@ typedef struct phaserstuff { · 80 unmodified lines | |||
| 81 | /* | 81 | /* |
| 82 | * Process options | 82 | * Process options |
| 83 | */ | 83 | */ |
| 84 | int st_phaser_getopts(eff_t effp, int n, char **argv) | 84 | static int st_phaser_getopts(eff_t effp, int n, char **argv) |
| 85 | { | 85 | { |
| 86 | phaser_t phaser = (phaser_t) effp->priv; | 86 | phaser_t phaser = (phaser_t) effp->priv; |
| 87 | 87 | ||
| @@ -114,7 +114,7 @@ int st_phaser_getopts(eff_t effp, int n, char **argv) · 26 unmodified lines | |||
| 114 | /* | 114 | /* |
| 115 | * Prepare for processing. | 115 | * Prepare for processing. |
| 116 | */ | 116 | */ |
| 117 | int st_phaser_start(eff_t effp) | 117 | static int st_phaser_start(eff_t effp) |
| 118 | { | 118 | { |
| 119 | phaser_t phaser = (phaser_t) effp->priv; | 119 | phaser_t phaser = (phaser_t) effp->priv; |
| 120 | unsigned int i; | 120 | unsigned int i; |
| @@ -192,7 +192,7 @@ int st_phaser_start(eff_t effp) · 71 unmodified lines | |||
| 192 | * Processed signed long samples from ibuf to obuf. | 192 | * Processed signed long samples from ibuf to obuf. |
| 193 | * Return number of samples processed. | 193 | * Return number of samples processed. |
| 194 | */ | 194 | */ |
| 195 | int st_phaser_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 195 | static int st_phaser_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 196 | st_size_t *isamp, st_size_t *osamp) | 196 | st_size_t *isamp, st_size_t *osamp) |
| 197 | { | 197 | { |
| 198 | phaser_t phaser = (phaser_t) effp->priv; | 198 | phaser_t phaser = (phaser_t) effp->priv; |
| @@ -227,7 +227,7 @@ int st_phaser_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 28 unmodified lines | |||
| 227 | /* | 227 | /* |
| 228 | * Drain out reverb lines. | 228 | * Drain out reverb lines. |
| 229 | */ | 229 | */ |
| 230 | int st_phaser_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 230 | static int st_phaser_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 231 | { | 231 | { |
| 232 | phaser_t phaser = (phaser_t) effp->priv; | 232 | phaser_t phaser = (phaser_t) effp->priv; |
| 233 | st_size_t done; | 233 | st_size_t done; |
| @@ -266,7 +266,7 @@ int st_phaser_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 32 unmodified lines | |||
| 266 | /* | 266 | /* |
| 267 | * Clean up phaser effect. | 267 | * Clean up phaser effect. |
| 268 | */ | 268 | */ |
| 269 | int st_phaser_stop(eff_t effp) | 269 | static int st_phaser_stop(eff_t effp) |
| 270 | { | 270 | { |
| 271 | phaser_t phaser = (phaser_t) effp->priv; | 271 | phaser_t phaser = (phaser_t) effp->priv; |
| 272 | 272 | ||
| @@ -246,7 +246,7 @@ static void process_intput_buffer(pitch_t pitch) · 245 unmodified lines | |||
| 246 | /* | 246 | /* |
| 247 | * Process options | 247 | * Process options |
| 248 | */ | 248 | */ |
| 249 | int st_pitch_getopts(eff_t effp, int n, char **argv) | 249 | static int st_pitch_getopts(eff_t effp, int n, char **argv) |
| 250 | { | 250 | { |
| 251 | pitch_t pitch = (pitch_t) effp->priv; | 251 | pitch_t pitch = (pitch_t) effp->priv; |
| 252 | 252 | ||
| @@ -329,7 +329,7 @@ int st_pitch_getopts(eff_t effp, int n, char **argv) · 76 unmodified lines | |||
| 329 | /* | 329 | /* |
| 330 | * Start processing | 330 | * Start processing |
| 331 | */ | 331 | */ |
| 332 | int st_pitch_start(eff_t effp) | 332 | static int st_pitch_start(eff_t effp) |
| 333 | { | 333 | { |
| 334 | pitch_t pitch = (pitch_t) effp->priv; | 334 | pitch_t pitch = (pitch_t) effp->priv; |
| 335 | register int sample_rate = effp->outinfo.rate; | 335 | register int sample_rate = effp->outinfo.rate; |
| @@ -445,7 +445,7 @@ int st_pitch_start(eff_t effp) · 109 unmodified lines | |||
| 445 | 445 | ||
| 446 | /* Processes input. | 446 | /* Processes input. |
| 447 | */ | 447 | */ |
| 448 | int st_pitch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 448 | static int st_pitch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 449 | st_size_t *isamp, st_size_t *osamp) | 449 | st_size_t *isamp, st_size_t *osamp) |
| 450 | { | 450 | { |
| 451 | pitch_t pitch = (pitch_t) effp->priv; | 451 | pitch_t pitch = (pitch_t) effp->priv; |
| @@ -522,7 +522,7 @@ int st_pitch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 70 unmodified lines | |||
| 522 | 522 | ||
| 523 | /* at the end... | 523 | /* at the end... |
| 524 | */ | 524 | */ |
| 525 | int st_pitch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 525 | static int st_pitch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 526 | { | 526 | { |
| 527 | pitch_t pitch = (pitch_t) effp->priv; | 527 | pitch_t pitch = (pitch_t) effp->priv; |
| 528 | st_size_t i; | 528 | st_size_t i; |
| @@ -566,7 +566,7 @@ int st_pitch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 37 unmodified lines | |||
| 566 | * Do anything required when you stop reading samples. | 566 | * Do anything required when you stop reading samples. |
| 567 | * Don't close input file! | 567 | * Don't close input file! |
| 568 | */ | 568 | */ |
| 569 | int st_pitch_stop(eff_t effp) | 569 | static int st_pitch_stop(eff_t effp) |
| 570 | { | 570 | { |
| 571 | pitch_t pitch = (pitch_t) effp->priv; | 571 | pitch_t pitch = (pitch_t) effp->priv; |
| 572 | 572 | ||
| @@ -80,7 +80,7 @@ static int win_type = 0; · 79 unmodified lines | |||
| 80 | static int win_width = 1024; | 80 | static int win_width = 1024; |
| 81 | static Float cutoff = 0.95; | 81 | static Float cutoff = 0.95; |
| 82 | 82 | ||
| 83 | int st_poly_getopts(eff_t effp, int n, char **argv) | 83 | static int st_poly_getopts(eff_t effp UNUSED, int n, char **argv) |
| 84 | { | 84 | { |
| 85 | /* 0: nuttall | 85 | /* 0: nuttall |
| 86 | 1: hamming */ | 86 | 1: hamming */ |
| @@ -179,9 +179,9 @@ static int prime(int n, int *q0) · 92 unmodified lines | |||
| 179 | return (q-q0); | 179 | return (q-q0); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | static int permute(int *m, int *l, int ct, int ct1, int amalg) | 182 | static int permute(int *m, int *l, int ct, int ct1, size_t amalg) |
| 183 | { | 183 | { |
| 184 | int k, n; | 184 | size_t k, n; |
| 185 | int *p; | 185 | int *p; |
| 186 | int *q; | 186 | int *q; |
| 187 | 187 | ||
| @@ -221,7 +221,7 @@ static int permute(int *m, int *l, int ct, int ct1, int amalg) · 33 unmodified lines | |||
| 221 | static int optimize_factors(int numer, int denom, int *l1, int *l2) | 221 | static int optimize_factors(int numer, int denom, int *l1, int *l2) |
| 222 | { | 222 | { |
| 223 | int f_min,c_min,u_min,ct1,ct2; | 223 | int f_min,c_min,u_min,ct1,ct2; |
| 224 | int amalg; | 224 | size_t amalg; |
| 225 | int k; | 225 | int k; |
| 226 | static int m1[MF],m2[MF]; | 226 | static int m1[MF],m2[MF]; |
| 227 | static int b1[MF],b2[MF]; | 227 | static int b1[MF],b2[MF]; |
| @@ -239,7 +239,7 @@ static int optimize_factors(int numer, int denom, int *l1, int *l2) · 11 unmodified lines | |||
| 239 | ct1 = prime(numer,l1); | 239 | ct1 = prime(numer,l1); |
| 240 | ct2 = prime(denom,l2); | 240 | ct2 = prime(denom,l2); |
| 241 | 241 | ||
| 242 | for (amalg = max(9,l2[0]); amalg<= 9+l2[ct2-1]; amalg++) { | 242 | for (amalg = max(9,l2[0]); amalg <= (size_t)(9+l2[ct2-1]); amalg++) { |
| 243 | for (k = 0; k<100000; k++) { | 243 | for (k = 0; k<100000; k++) { |
| 244 | int u,u1,u2,j,f,cost; | 244 | int u,u1,u2,j,f,cost; |
| 245 | cost = 0; | 245 | cost = 0; |
| @@ -369,7 +369,7 @@ static void fir_design(Float *buffer, int length, Float cutoff) · 123 unmodified lines | |||
| 369 | 369 | ||
| 370 | #define RIBLEN 2048 | 370 | #define RIBLEN 2048 |
| 371 | 371 | ||
| 372 | int st_poly_start(eff_t effp) | 372 | static int st_poly_start(eff_t effp) |
| 373 | { | 373 | { |
| 374 | poly_t rate = (poly_t) effp->priv; | 374 | poly_t rate = (poly_t) effp->priv; |
| 375 | static int l1[MF], l2[MF]; | 375 | static int l1[MF], l2[MF]; |
| @@ -523,7 +523,7 @@ static void update_hist(Float *hist, int hist_size, int in_size) · 147 unmodified lines | |||
| 523 | 523 | ||
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 526 | static int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 527 | st_size_t *isamp, st_size_t *osamp) | 527 | st_size_t *isamp, st_size_t *osamp) |
| 528 | { | 528 | { |
| 529 | poly_t rate = (poly_t) effp->priv; | 529 | poly_t rate = (poly_t) effp->priv; |
| @@ -534,7 +534,7 @@ int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 4 unmodified lines | |||
| 534 | s0 = rate->stage[0]; /* the first stage */ | 534 | s0 = rate->stage[0]; /* the first stage */ |
| 535 | s1 = rate->stage[rate->total]; /* the 'last' stage is output buffer */ | 535 | s1 = rate->stage[rate->total]; /* the 'last' stage is output buffer */ |
| 536 | { | 536 | { |
| 537 | int in_size, gap, k; | 537 | st_size_t in_size, gap, k; |
| 538 | 538 | ||
| 539 | in_size = *isamp; | 539 | in_size = *isamp; |
| 540 | gap = s0->size - s0->held; /* space available in this 'input' buffer */ | 540 | gap = s0->size - s0->held; /* space available in this 'input' buffer */ |
| @@ -558,7 +558,7 @@ int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 17 unmodified lines | |||
| 558 | } | 558 | } |
| 559 | 559 | ||
| 560 | if (s0->held == s0->size && s1->held == 0) { | 560 | if (s0->held == s0->size && s1->held == 0) { |
| 561 | int k; | 561 | st_size_t k; |
| 562 | /* input buffer full, output buffer empty, so do process */ | 562 | /* input buffer full, output buffer empty, so do process */ |
| 563 | 563 | ||
| 564 | for(k=0; k<rate->total; k++) { | 564 | for(k=0; k<rate->total; k++) { |
| @@ -587,7 +587,7 @@ int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 22 unmodified lines | |||
| 587 | st_size_t out_size; | 587 | st_size_t out_size; |
| 588 | st_size_t oskip; | 588 | st_size_t oskip; |
| 589 | Float *out_buf; | 589 | Float *out_buf; |
| 590 | int k; | 590 | st_size_t k; |
| 591 | 591 | ||
| 592 | oskip = rate->oskip; | 592 | oskip = rate->oskip; |
| 593 | out_size = s1->held; | 593 | out_size = s1->held; |
| @@ -626,7 +626,7 @@ int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 32 unmodified lines | |||
| 626 | /* | 626 | /* |
| 627 | * Process tail of input samples. | 627 | * Process tail of input samples. |
| 628 | */ | 628 | */ |
| 629 | int st_poly_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 629 | static int st_poly_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 630 | { | 630 | { |
| 631 | st_size_t in_size; | 631 | st_size_t in_size; |
| 632 | /* Call "flow" with NULL input. */ | 632 | /* Call "flow" with NULL input. */ |
| @@ -638,11 +638,11 @@ int st_poly_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 5 unmodified lines | |||
| 638 | * Do anything required when you stop reading samples. | 638 | * Do anything required when you stop reading samples. |
| 639 | * Don't close input file! | 639 | * Don't close input file! |
| 640 | */ | 640 | */ |
| 641 | int st_poly_stop(eff_t effp) | 641 | static int st_poly_stop(eff_t effp) |
| 642 | { | 642 | { |
| 643 | poly_t rate = (poly_t) effp->priv; | 643 | poly_t rate = (poly_t) effp->priv; |
| 644 | polystage *s; | 644 | polystage *s; |
| 645 | int k; | 645 | st_size_t k; |
| 646 | 646 | ||
| 647 | for(k = 0; k <= rate->total; k++) { | 647 | for(k = 0; k <= rate->total; k++) { |
| 648 | s = rate->stage[k]; | 648 | s = rate->stage[k]; |
| @@ -40,8 +40,8 @@ typedef struct prcpriv · 39 unmodified lines | |||
| 40 | /* 16 bytes header = 3 UIDs plus checksum, standard Symbian/EPOC file | 40 | /* 16 bytes header = 3 UIDs plus checksum, standard Symbian/EPOC file |
| 41 | header */ | 41 | header */ |
| 42 | static const char prc_header[]={ | 42 | static const char prc_header[]={ |
| 43 | 0x37,0x00,0x00,0x10,0x6d,0x00,0x00,0x10, | 43 | '\x37','\x00','\x00','\x10','\x6d','\x00','\x00','\x10', |
| 44 | 0x7e,0x00,0x00,0x10,0xcf,0xac,0x08,0x55 | 44 | '\x7e','\x00','\x00','\x10','\xcf','\xac','\x08','\x55' |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | int prc_checkheader(ft_t ft, char *head) | 47 | int prc_checkheader(ft_t ft, char *head) |
| @@ -52,7 +52,7 @@ int prc_checkheader(ft_t ft, char *head) · 4 unmodified lines | |||
| 52 | 52 | ||
| 53 | static void prcwriteheader(ft_t ft); | 53 | static void prcwriteheader(ft_t ft); |
| 54 | 54 | ||
| 55 | int st_prcseek(ft_t ft, st_size_t offset) | 55 | static int st_prcseek(ft_t ft, st_size_t offset) |
| 56 | { | 56 | { |
| 57 | prc_t prc = (prc_t ) ft->priv; | 57 | prc_t prc = (prc_t ) ft->priv; |
| 58 | st_size_t new_offset, channel_block, alignment; | 58 | st_size_t new_offset, channel_block, alignment; |
| @@ -72,7 +72,7 @@ int st_prcseek(ft_t ft, st_size_t offset) · 13 unmodified lines | |||
| 72 | return st_seeki(ft, new_offset, SEEK_SET); | 72 | return st_seeki(ft, new_offset, SEEK_SET); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | int st_prcstartread(ft_t ft) | 75 | static int st_prcstartread(ft_t ft) |
| 76 | { | 76 | { |
| 77 | prc_t p = (prc_t ) ft->priv; | 77 | prc_t p = (prc_t ) ft->priv; |
| 78 | char head[sizeof(prc_header)]; | 78 | char head[sizeof(prc_header)]; |
| @@ -116,7 +116,7 @@ int st_prcstartread(ft_t ft) · 37 unmodified lines | |||
| 116 | st_report("PRC must use 8000 sample rate. Overriding"); | 116 | st_report("PRC must use 8000 sample rate. Overriding"); |
| 117 | ft->info.rate = 8000; | 117 | ft->info.rate = 8000; |
| 118 | 118 | ||
| 119 | if (ft->info.channels != -1 && ft->info.channels != 1) | 119 | if (ft->info.channels != ST_ENCODING_UNKNOWN && ft->info.channels != 0) |
| 120 | st_report("PRC must only supports 1 channel. Overriding"); | 120 | st_report("PRC must only supports 1 channel. Overriding"); |
| 121 | ft->info.channels = 1; | 121 | ft->info.channels = 1; |
| 122 | 122 | ||
| @@ -135,7 +135,7 @@ int st_prcstartread(ft_t ft) · 12 unmodified lines | |||
| 135 | if it is not, the unspecified size remains in the header | 135 | if it is not, the unspecified size remains in the header |
| 136 | (this is illegal). */ | 136 | (this is illegal). */ |
| 137 | 137 | ||
| 138 | int st_prcstartwrite(ft_t ft) | 138 | static int st_prcstartwrite(ft_t ft) |
| 139 | { | 139 | { |
| 140 | prc_t p = (prc_t ) ft->priv; | 140 | prc_t p = (prc_t ) ft->priv; |
| 141 | int rc; | 141 | int rc; |
| @@ -160,7 +160,7 @@ int st_prcstartwrite(ft_t ft) · 18 unmodified lines | |||
| 160 | if (ft->info.rate != 0) | 160 | if (ft->info.rate != 0) |
| 161 | st_report("PRC must use 8000 sample rate. Overriding"); | 161 | st_report("PRC must use 8000 sample rate. Overriding"); |
| 162 | 162 | ||
| 163 | if (ft->info.channels != -1 && ft->info.channels != 1) | 163 | if (ft->info.channels != ST_ENCODING_UNKNOWN && ft->info.channels != 0) |
| 164 | st_report("PRC must only supports 1 channel. Overriding"); | 164 | st_report("PRC must only supports 1 channel. Overriding"); |
| 165 | 165 | ||
| 166 | ft->info.encoding = ST_ENCODING_ALAW; | 166 | ft->info.encoding = ST_ENCODING_ALAW; |
| @@ -171,12 +171,7 @@ int st_prcstartwrite(ft_t ft) · 4 unmodified lines | |||
| 171 | return ST_SUCCESS; | 171 | return ST_SUCCESS; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | st_ssize_t st_prcread(ft_t ft, st_sample_t *buf, st_size_t samp) | 174 | static st_size_t st_prcwrite(ft_t ft, const st_sample_t *buf, st_size_t samp) |
| 175 | { | ||
| 176 | return st_rawread(ft, buf, samp); | ||
| 177 | } | ||
| 178 | |||
| 179 | st_ssize_t st_prcwrite(ft_t ft, const st_sample_t *buf, st_size_t samp) | ||
| 180 | { | 175 | { |
| 181 | prc_t p = (prc_t ) ft->priv; | 176 | prc_t p = (prc_t ) ft->priv; |
| 182 | p->length += samp * ft->info.size; | 177 | p->length += samp * ft->info.size; |
| @@ -184,7 +179,7 @@ st_ssize_t st_prcwrite(ft_t ft, const st_sample_t *buf, st_size_t samp) · 1 unmodified line | |||
| 184 | return st_rawwrite(ft, buf, samp); | 179 | return st_rawwrite(ft, buf, samp); |
| 185 | } | 180 | } |
| 186 | 181 | ||
| 187 | int st_prcstopwrite(ft_t ft) | 182 | static int st_prcstopwrite(ft_t ft) |
| 188 | { | 183 | { |
| 189 | /* Call before seeking to flush buffer */ | 184 | /* Call before seeking to flush buffer */ |
| 190 | st_rawstopwrite(ft); | 185 | st_rawstopwrite(ft); |
| @@ -229,7 +224,7 @@ static st_format_t st_prc_format = { · 38 unmodified lines | |||
| 229 | NULL, | 224 | NULL, |
| 230 | ST_FILE_SEEK, | 225 | ST_FILE_SEEK, |
| 231 | st_prcstartread, | 226 | st_prcstartread, |
| 232 | st_prcread, | 227 | st_rawread, |
| 233 | st_rawstopread, | 228 | st_rawstopread, |
| 234 | st_prcstartwrite, | 229 | st_prcstartwrite, |
| 235 | st_prcwrite, | 230 | st_prcwrite, |
| @@ -134,7 +134,7 @@ int st_rawstartwrite(ft_t ft) · 133 unmodified lines | |||
| 134 | return ST_SUCCESS; | 134 | return ST_SUCCESS; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 137 | void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 138 | { | 138 | { |
| 139 | while (len) | 139 | while (len) |
| 140 | { | 140 | { |
| @@ -148,7 +148,7 @@ void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 7 unmodified lines | |||
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 151 | void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 152 | { | 152 | { |
| 153 | while (len) | 153 | while (len) |
| 154 | { | 154 | { |
| @@ -162,7 +162,7 @@ void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 7 unmodified lines | |||
| 162 | } | 162 | } |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | void st_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 165 | static void st_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 166 | { | 166 | { |
| 167 | while (len) | 167 | while (len) |
| 168 | { | 168 | { |
| @@ -176,7 +176,7 @@ void st_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char · 7 unmodified lines | |||
| 176 | } | 176 | } |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | void st_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 179 | static void st_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 180 | { | 180 | { |
| 181 | while (len) | 181 | while (len) |
| 182 | { | 182 | { |
| @@ -190,7 +190,7 @@ void st_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char · 7 unmodified lines | |||
| 190 | } | 190 | } |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | void st_inv_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 193 | static void st_inv_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 194 | { | 194 | { |
| 195 | while (len) | 195 | while (len) |
| 196 | { | 196 | { |
| @@ -204,7 +204,7 @@ void st_inv_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, c · 7 unmodified lines | |||
| 204 | } | 204 | } |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | void st_inv_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 207 | static void st_inv_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 208 | { | 208 | { |
| 209 | while (len) | 209 | while (len) |
| 210 | { | 210 | { |
| @@ -219,7 +219,7 @@ void st_inv_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, c · 8 unmodified lines | |||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | 221 | ||
| 222 | void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 222 | void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED) |
| 223 | { | 223 | { |
| 224 | while (len) | 224 | while (len) |
| 225 | { | 225 | { |
| @@ -235,7 +235,7 @@ void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 9 unmodified lines | |||
| 235 | } | 235 | } |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | void st_sw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 238 | void st_sw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED) |
| 239 | { | 239 | { |
| 240 | while (len) | 240 | while (len) |
| 241 | { | 241 | { |
| @@ -266,12 +266,12 @@ static int24_t st_24_read_one(char const * * buffer, char swap) · 24 unmodified lines | |||
| 266 | datum >>= 8; | 266 | datum >>= 8; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | return swap? st_swap24(datum) : datum; | 269 | return swap ? (int24_t)(st_swap24(datum)) : datum; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | 272 | ||
| 273 | 273 | ||
| 274 | void st_u24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) | 274 | static void st_u24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount UNUSED) |
| 275 | { | 275 | { |
| 276 | while (len--) | 276 | while (len--) |
| 277 | { | 277 | { |
| @@ -282,7 +282,7 @@ void st_u24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char · 4 unmodified lines | |||
| 282 | 282 | ||
| 283 | 283 | ||
| 284 | 284 | ||
| 285 | void st_s24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) | 285 | static void st_s24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount UNUSED) |
| 286 | { | 286 | { |
| 287 | while (len--) | 287 | while (len--) |
| 288 | { | 288 | { |
| @@ -293,7 +293,7 @@ void st_s24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char · 4 unmodified lines | |||
| 293 | 293 | ||
| 294 | 294 | ||
| 295 | 295 | ||
| 296 | void st_udw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 296 | static void st_udw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED) |
| 297 | { | 297 | { |
| 298 | while (len) | 298 | while (len) |
| 299 | { | 299 | { |
| @@ -309,7 +309,7 @@ void st_udw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char s · 9 unmodified lines | |||
| 309 | } | 309 | } |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | void st_dw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 312 | static void st_dw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED) |
| 313 | { | 313 | { |
| 314 | while (len) | 314 | while (len) |
| 315 | { | 315 | { |
| @@ -325,7 +325,7 @@ void st_dw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 9 unmodified lines | |||
| 325 | } | 325 | } |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | void st_f32_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 328 | static void st_f32_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) |
| 329 | { | 329 | { |
| 330 | while (len) | 330 | while (len) |
| 331 | { | 331 | { |
| @@ -341,7 +341,7 @@ void st_f32_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char s · 9 unmodified lines | |||
| 341 | } | 341 | } |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | void st_f64_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 344 | static void st_f64_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) |
| 345 | { | 345 | { |
| 346 | while (len) | 346 | while (len) |
| 347 | { | 347 | { |
| @@ -366,18 +366,12 @@ void st_f64_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char s · 18 unmodified lines | |||
| 366 | * functions will cause a loss of data! Need to have sox implement | 366 | * functions will cause a loss of data! Need to have sox implement |
| 367 | * a consistent buffering protocol. | 367 | * a consistent buffering protocol. |
| 368 | */ | 368 | */ |
| 369 | st_ssize_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp) | 369 | st_size_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp) |
| 370 | { | 370 | { |
| 371 | st_size_t len, done = 0; | 371 | st_size_t len, done = 0; |
| 372 | void (*read_buf)(st_sample_t *, char const *, st_size_t, char, st_size_t *) = 0; | 372 | void (*read_buf)(st_sample_t *, char const *, st_size_t, char, st_size_t *) = 0; |
| 373 | size_t i; | 373 | size_t i; |
| 374 | 374 | ||
| 375 | if (nsamp < 0) | ||
| 376 | { | ||
| 377 | st_fail_errno(ft,ST_EINVAL,"st_rawread requires positive sizes"); | ||
| 378 | return ST_EOF; | ||
| 379 | } | ||
| 380 | |||
| 381 | switch(ft->info.size) { | 375 | switch(ft->info.size) { |
| 382 | case ST_SIZE_BYTE: | 376 | case ST_SIZE_BYTE: |
| 383 | switch(ft->info.encoding) | 377 | switch(ft->info.encoding) |
| @@ -527,7 +521,7 @@ int st_rawstopread(ft_t ft) · 143 unmodified lines | |||
| 527 | return ST_SUCCESS; | 521 | return ST_SUCCESS; |
| 528 | } | 522 | } |
| 529 | 523 | ||
| 530 | void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 524 | void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount) |
| 531 | { | 525 | { |
| 532 | while (len) | 526 | while (len) |
| 533 | { | 527 | { |
| @@ -536,7 +530,7 @@ void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char s · 2 unmodified lines | |||
| 536 | } | 530 | } |
| 537 | } | 531 | } |
| 538 | 532 | ||
| 539 | void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 533 | void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount) |
| 540 | { | 534 | { |
| 541 | while (len) | 535 | while (len) |
| 542 | { | 536 | { |
| @@ -545,8 +539,8 @@ void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char s · 2 unmodified lines | |||
| 545 | } | 539 | } |
| 546 | } | 540 | } |
| 547 | 541 | ||
| 548 | void st_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, | 542 | static void st_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, |
| 549 | char swap, st_size_t * clippedCount) | 543 | char swap UNUSED, st_size_t * clippedCount) |
| 550 | { | 544 | { |
| 551 | while (len) | 545 | while (len) |
| 552 | { | 546 | { |
| @@ -555,8 +549,8 @@ void st_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, · 2 unmodified lines | |||
| 555 | } | 549 | } |
| 556 | } | 550 | } |
| 557 | 551 | ||
| 558 | void st_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, | 552 | static void st_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, |
| 559 | char swap, st_size_t * clippedCount) | 553 | char swap UNUSED, st_size_t * clippedCount) |
| 560 | { | 554 | { |
| 561 | while (len) | 555 | while (len) |
| 562 | { | 556 | { |
| @@ -565,8 +559,8 @@ void st_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, · 2 unmodified lines | |||
| 565 | } | 559 | } |
| 566 | } | 560 | } |
| 567 | 561 | ||
| 568 | void st_inv_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, | 562 | static void st_inv_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, |
| 569 | char swap, st_size_t * clippedCount) | 563 | char swap UNUSED, st_size_t * clippedCount) |
| 570 | { | 564 | { |
| 571 | while (len) | 565 | while (len) |
| 572 | { | 566 | { |
| @@ -575,8 +569,8 @@ void st_inv_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, · 2 unmodified lines | |||
| 575 | } | 569 | } |
| 576 | } | 570 | } |
| 577 | 571 | ||
| 578 | void st_inv_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, | 572 | static void st_inv_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, |
| 579 | char swap, st_size_t * clippedCount) | 573 | char swap UNUSED, st_size_t * clippedCount) |
| 580 | { | 574 | { |
| 581 | while (len) | 575 | while (len) |
| 582 | { | 576 | { |
| @@ -639,7 +633,7 @@ static void st_24_write_one(char * * const buf1, int24_t datum, char const swap) · 56 unmodified lines | |||
| 639 | 633 | ||
| 640 | 634 | ||
| 641 | 635 | ||
| 642 | void st_u24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) | 636 | static void st_u24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) |
| 643 | { | 637 | { |
| 644 | while (len--) | 638 | while (len--) |
| 645 | { | 639 | { |
| @@ -650,7 +644,7 @@ void st_u24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char · 4 unmodified lines | |||
| 650 | 644 | ||
| 651 | 645 | ||
| 652 | 646 | ||
| 653 | void st_s24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) | 647 | static void st_s24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) |
| 654 | { | 648 | { |
| 655 | while (len--) | 649 | while (len--) |
| 656 | { | 650 | { |
| @@ -661,7 +655,7 @@ void st_s24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char · 4 unmodified lines | |||
| 661 | 655 | ||
| 662 | 656 | ||
| 663 | 657 | ||
| 664 | void st_udw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 658 | static void st_udw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED) |
| 665 | { | 659 | { |
| 666 | while (len) | 660 | while (len) |
| 667 | { | 661 | { |
| @@ -677,7 +671,7 @@ void st_udw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char · 9 unmodified lines | |||
| 677 | } | 671 | } |
| 678 | } | 672 | } |
| 679 | 673 | ||
| 680 | void st_dw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 674 | static void st_dw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 681 | { | 675 | { |
| 682 | while (len) | 676 | while (len) |
| 683 | { | 677 | { |
| @@ -693,7 +687,7 @@ void st_dw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char s · 9 unmodified lines | |||
| 693 | } | 687 | } |
| 694 | } | 688 | } |
| 695 | 689 | ||
| 696 | void st_f32_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 690 | static void st_f32_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) |
| 697 | { | 691 | { |
| 698 | while (len) | 692 | while (len) |
| 699 | { | 693 | { |
| @@ -709,7 +703,7 @@ void st_f32_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char · 9 unmodified lines | |||
| 709 | } | 703 | } |
| 710 | } | 704 | } |
| 711 | 705 | ||
| 712 | void st_f64_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 706 | static void st_f64_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) |
| 713 | { | 707 | { |
| 714 | while (len) | 708 | while (len) |
| 715 | { | 709 | { |
| @@ -744,7 +738,7 @@ static void writeflush(ft_t ft) · 28 unmodified lines | |||
| 744 | * functions will cause a loss of data! Need to have sox implement | 738 | * functions will cause a loss of data! Need to have sox implement |
| 745 | * a consistent buffering protocol. | 739 | * a consistent buffering protocol. |
| 746 | */ | 740 | */ |
| 747 | st_ssize_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) | 741 | st_size_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) |
| 748 | { | 742 | { |
| 749 | st_size_t len, done = 0; | 743 | st_size_t len, done = 0; |
| 750 | void (*write_buf)(char *, st_sample_t const *, st_size_t, char, st_size_t *) = 0; | 744 | void (*write_buf)(char *, st_sample_t const *, st_size_t, char, st_size_t *) = 0; |
| @@ -873,7 +867,7 @@ int st_rawstopwrite(ft_t ft) · 122 unmodified lines | |||
| 873 | */ | 867 | */ |
| 874 | 868 | ||
| 875 | #define STARTREAD(NAME,SIZE,STYLE) \ | 869 | #define STARTREAD(NAME,SIZE,STYLE) \ |
| 876 | int NAME(ft_t ft) \ | 870 | static int NAME(ft_t ft) \ |
| 877 | { \ | 871 | { \ |
| 878 | ft->info.size = SIZE; \ | 872 | ft->info.size = SIZE; \ |
| 879 | ft->info.encoding = STYLE; \ | 873 | ft->info.encoding = STYLE; \ |
| @@ -882,7 +876,7 @@ int NAME(ft_t ft) \ · 2 unmodified lines | |||
| 882 | } | 876 | } |
| 883 | 877 | ||
| 884 | #define STARTWRITE(NAME,SIZE,STYLE)\ | 878 | #define STARTWRITE(NAME,SIZE,STYLE)\ |
| 885 | int NAME(ft_t ft) \ | 879 | static int NAME(ft_t ft) \ |
| 886 | { \ | 880 | { \ |
| 887 | ft->info.size = SIZE; \ | 881 | ft->info.size = SIZE; \ |
| 888 | ft->info.encoding = STYLE; \ | 882 | ft->info.encoding = STYLE; \ |
| @@ -930,7 +924,7 @@ void rawdefaults(ft_t ft) · 41 unmodified lines | |||
| 930 | { | 924 | { |
| 931 | if (ft->info.rate == 0) | 925 | if (ft->info.rate == 0) |
| 932 | ft->info.rate = 8000; | 926 | ft->info.rate = 8000; |
| 933 | if (ft->info.channels == -1) | 927 | if (ft->info.channels == 0) |
| 934 | ft->info.channels = 1; | 928 | ft->info.channels = 1; |
| 935 | } | 929 | } |
| 936 | 930 | ||
| @@ -33,7 +33,7 @@ typedef struct repeatstuff { · 32 unmodified lines | |||
| 33 | int repeats; | 33 | int repeats; |
| 34 | } *repeat_t; | 34 | } *repeat_t; |
| 35 | 35 | ||
| 36 | int st_repeat_getopts(eff_t effp, int n, char **argv) | 36 | static int st_repeat_getopts(eff_t effp, int n, char **argv) |
| 37 | { | 37 | { |
| 38 | repeat_t repeat = (repeat_t)effp->priv; | 38 | repeat_t repeat = (repeat_t)effp->priv; |
| 39 | 39 | ||
| @@ -55,7 +55,7 @@ int st_repeat_getopts(eff_t effp, int n, char **argv) · 15 unmodified lines | |||
| 55 | return (ST_SUCCESS); | 55 | return (ST_SUCCESS); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | int st_repeat_start(eff_t effp) | 58 | static int st_repeat_start(eff_t effp) |
| 59 | { | 59 | { |
| 60 | repeat_t repeat = (repeat_t)effp->priv; | 60 | repeat_t repeat = (repeat_t)effp->priv; |
| 61 | 61 | ||
| @@ -69,7 +69,7 @@ int st_repeat_start(eff_t effp) · 7 unmodified lines | |||
| 69 | return (ST_SUCCESS); | 69 | return (ST_SUCCESS); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | int st_repeat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 72 | static int st_repeat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf UNUSED, |
| 73 | st_size_t *isamp, st_size_t *osamp) | 73 | st_size_t *isamp, st_size_t *osamp) |
| 74 | { | 74 | { |
| 75 | repeat_t repeat = (repeat_t)effp->priv; | 75 | repeat_t repeat = (repeat_t)effp->priv; |
| @@ -85,7 +85,7 @@ int st_repeat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 9 unmodified lines | |||
| 85 | return (ST_SUCCESS); | 85 | return (ST_SUCCESS); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | int st_repeat_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 88 | static int st_repeat_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 89 | { | 89 | { |
| 90 | size_t read = 0; | 90 | size_t read = 0; |
| 91 | st_sample_t *buf; | 91 | st_sample_t *buf; |
| @@ -187,7 +187,7 @@ int st_repeat_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 95 unmodified lines | |||
| 187 | return ST_SUCCESS; | 187 | return ST_SUCCESS; |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | int st_repeat_stop(eff_t effp) | 190 | static int st_repeat_stop(eff_t effp) |
| 191 | { | 191 | { |
| 192 | repeat_t repeat = (repeat_t)effp->priv; | 192 | repeat_t repeat = (repeat_t)effp->priv; |
| 193 | 193 | ||
| @@ -158,7 +158,7 @@ static long SrcEX(resample_t r, long Nx); · 157 unmodified lines | |||
| 158 | /* | 158 | /* |
| 159 | * Process options | 159 | * Process options |
| 160 | */ | 160 | */ |
| 161 | int st_resample_getopts(eff_t effp, int n, char **argv) | 161 | int st_resample_getopts(eff_t effp, int n, char **argv) |
| 162 | { | 162 | { |
| 163 | resample_t r = (resample_t) effp->priv; | 163 | resample_t r = (resample_t) effp->priv; |
| 164 | 164 | ||
| @@ -392,7 +392,6 @@ int st_resample_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 227 unmodified lines | |||
| 392 | r->Xp = r->Xoff; | 392 | r->Xp = r->Xoff; |
| 393 | 393 | ||
| 394 | for(i=0; i < Nout; i++) { | 394 | for(i=0; i < Nout; i++) { |
| 395 | // orig: *obuf++ = r->Y[i] * ISCALE; | ||
| 396 | double ftemp = r->Y[i] * ISCALE; | 395 | double ftemp = r->Y[i] * ISCALE; |
| 397 | 396 | ||
| 398 | ST_SAMPLE_CLIP_COUNT(ftemp, effp->clippedCount); | 397 | ST_SAMPLE_CLIP_COUNT(ftemp, effp->clippedCount); |
| @@ -104,18 +104,18 @@ static st_effect_t st_reverb_effect; · 103 unmodified lines | |||
| 104 | /* Private data for SKEL file */ | 104 | /* Private data for SKEL file */ |
| 105 | typedef struct reverbstuff { | 105 | typedef struct reverbstuff { |
| 106 | int counter; | 106 | int counter; |
| 107 | int numdelays; | 107 | size_t numdelays; |
| 108 | float *reverbbuf; | 108 | float *reverbbuf; |
| 109 | float in_gain, out_gain, time; | 109 | float in_gain, out_gain, time; |
| 110 | float delay[MAXREVERBS], decay[MAXREVERBS]; | 110 | float delay[MAXREVERBS], decay[MAXREVERBS]; |
| 111 | long samples[MAXREVERBS], maxsamples; | 111 | size_t samples[MAXREVERBS], maxsamples; |
| 112 | st_sample_t pl, ppl, pppl; | 112 | st_sample_t pl, ppl, pppl; |
| 113 | } *reverb_t; | 113 | } *reverb_t; |
| 114 | 114 | ||
| 115 | /* | 115 | /* |
| 116 | * Process options | 116 | * Process options |
| 117 | */ | 117 | */ |
| 118 | int st_reverb_getopts(eff_t effp, int n, char **argv) | 118 | static int st_reverb_getopts(eff_t effp, int n, char **argv) |
| 119 | { | 119 | { |
| 120 | reverb_t reverb = (reverb_t) effp->priv; | 120 | reverb_t reverb = (reverb_t) effp->priv; |
| 121 | int i; | 121 | int i; |
| @@ -150,10 +150,10 @@ int st_reverb_getopts(eff_t effp, int n, char **argv) · 28 unmodified lines | |||
| 150 | /* | 150 | /* |
| 151 | * Prepare for processing. | 151 | * Prepare for processing. |
| 152 | */ | 152 | */ |
| 153 | int st_reverb_start(eff_t effp) | 153 | static int st_reverb_start(eff_t effp) |
| 154 | { | 154 | { |
| 155 | reverb_t reverb = (reverb_t) effp->priv; | 155 | reverb_t reverb = (reverb_t) effp->priv; |
| 156 | int i; | 156 | size_t i; |
| 157 | 157 | ||
| 158 | reverb->in_gain = 1.0; | 158 | reverb->in_gain = 1.0; |
| 159 | 159 | ||
| @@ -208,12 +208,12 @@ int st_reverb_start(eff_t effp) · 48 unmodified lines | |||
| 208 | * Processed signed long samples from ibuf to obuf. | 208 | * Processed signed long samples from ibuf to obuf. |
| 209 | * Return number of samples processed. | 209 | * Return number of samples processed. |
| 210 | */ | 210 | */ |
| 211 | int st_reverb_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 211 | static int st_reverb_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 212 | st_size_t *isamp, st_size_t *osamp) | 212 | st_size_t *isamp, st_size_t *osamp) |
| 213 | { | 213 | { |
| 214 | reverb_t reverb = (reverb_t) effp->priv; | 214 | reverb_t reverb = (reverb_t) effp->priv; |
| 215 | int len, done; | 215 | size_t len, done; |
| 216 | int i, j; | 216 | size_t i, j; |
| 217 | 217 | ||
| 218 | float d_in, d_out; | 218 | float d_in, d_out; |
| 219 | st_sample_t out; | 219 | st_sample_t out; |
| @@ -243,12 +243,12 @@ reverb->reverbbuf[(i + reverb->maxsamples - reverb->samples[j]) % reverb->maxsam · 23 unmodified lines | |||
| 243 | /* | 243 | /* |
| 244 | * Drain out reverb lines. | 244 | * Drain out reverb lines. |
| 245 | */ | 245 | */ |
| 246 | int st_reverb_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 246 | static int st_reverb_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 247 | { | 247 | { |
| 248 | reverb_t reverb = (reverb_t) effp->priv; | 248 | reverb_t reverb = (reverb_t) effp->priv; |
| 249 | float d_in, d_out; | 249 | float d_in, d_out; |
| 250 | st_sample_t out, l; | 250 | st_sample_t out, l; |
| 251 | int i, j; | 251 | size_t i, j; |
| 252 | st_size_t done; | 252 | st_size_t done; |
| 253 | 253 | ||
| 254 | i = reverb->counter; | 254 | i = reverb->counter; |
| @@ -280,7 +280,7 @@ reverb->reverbbuf[(i + reverb->maxsamples - reverb->samples[j]) % reverb->maxsam · 25 unmodified lines | |||
| 280 | /* | 280 | /* |
| 281 | * Clean up reverb effect. | 281 | * Clean up reverb effect. |
| 282 | */ | 282 | */ |
| 283 | int st_reverb_stop(eff_t effp) | 283 | static int st_reverb_stop(eff_t effp) |
| 284 | { | 284 | { |
| 285 | reverb_t reverb = (reverb_t) effp->priv; | 285 | reverb_t reverb = (reverb_t) effp->priv; |
| 286 | 286 | ||
| @@ -32,25 +32,11 @@ typedef struct reversestuff { · 31 unmodified lines | |||
| 32 | #define WRITING 0 | 32 | #define WRITING 0 |
| 33 | #define READING 1 | 33 | #define READING 1 |
| 34 | 34 | ||
| 35 | /* | ||
| 36 | * Process options: none in our case. | ||
| 37 | */ | ||
| 38 | |||
| 39 | int st_reverse_getopts(eff_t effp, int n, char **argv) | ||
| 40 | { | ||
| 41 | if (n) | ||
| 42 | { | ||
| 43 | st_fail(st_reverse_effect.usage); | ||
| 44 | return (ST_EOF); | ||
| 45 | } | ||
| 46 | return(ST_SUCCESS); | ||
| 47 | } | ||
| 48 | |||
| 49 | /* | 35 | /* |
| 50 | * Prepare processing: open temporary file. | 36 | * Prepare processing: open temporary file. |
| 51 | */ | 37 | */ |
| 52 | 38 | ||
| 53 | int st_reverse_start(eff_t effp) | 39 | static int st_reverse_start(eff_t effp) |
| 54 | { | 40 | { |
| 55 | reverse_t reverse = (reverse_t) effp->priv; | 41 | reverse_t reverse = (reverse_t) effp->priv; |
| 56 | reverse->fp = tmpfile(); | 42 | reverse->fp = tmpfile(); |
| @@ -67,7 +53,7 @@ int st_reverse_start(eff_t effp) · 10 unmodified lines | |||
| 67 | * Effect flow: a degenerate case: write input samples on temporary file, | 53 | * Effect flow: a degenerate case: write input samples on temporary file, |
| 68 | * don't generate any output samples. | 54 | * don't generate any output samples. |
| 69 | */ | 55 | */ |
| 70 | int st_reverse_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 56 | static int st_reverse_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf UNUSED, |
| 71 | st_size_t *isamp, st_size_t *osamp) | 57 | st_size_t *isamp, st_size_t *osamp) |
| 72 | { | 58 | { |
| 73 | reverse_t reverse = (reverse_t) effp->priv; | 59 | reverse_t reverse = (reverse_t) effp->priv; |
| @@ -91,7 +77,7 @@ int st_reverse_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 17 unmodified lines | |||
| 91 | * Effect drain: generate the actual samples in reverse order. | 77 | * Effect drain: generate the actual samples in reverse order. |
| 92 | */ | 78 | */ |
| 93 | 79 | ||
| 94 | int st_reverse_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 80 | static int st_reverse_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 95 | { | 81 | { |
| 96 | reverse_t reverse = (reverse_t) effp->priv; | 82 | reverse_t reverse = (reverse_t) effp->priv; |
| 97 | st_size_t len, nbytes; | 83 | st_size_t len, nbytes; |
| @@ -137,7 +123,7 @@ int st_reverse_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 39 unmodified lines | |||
| 137 | /* | 123 | /* |
| 138 | * Close and unlink the temporary file. | 124 | * Close and unlink the temporary file. |
| 139 | */ | 125 | */ |
| 140 | int st_reverse_stop(eff_t effp) | 126 | static int st_reverse_stop(eff_t effp) |
| 141 | { | 127 | { |
| 142 | reverse_t reverse = (reverse_t) effp->priv; | 128 | reverse_t reverse = (reverse_t) effp->priv; |
| 143 | 129 | ||
| @@ -149,7 +135,7 @@ static st_effect_t st_reverse_effect = { · 5 unmodified lines | |||
| 149 | "reverse", | 135 | "reverse", |
| 150 | "Usage: Reverse effect takes no options", | 136 | "Usage: Reverse effect takes no options", |
| 151 | 0, | 137 | 0, |
| 152 | st_reverse_getopts, | 138 | st_effect_nothing_getopts, |
| 153 | st_reverse_start, | 139 | st_reverse_start, |
| 154 | st_reverse_flow, | 140 | st_reverse_flow, |
| 155 | st_reverse_drain, | 141 | st_reverse_drain, |
| @@ -64,7 +64,7 @@ static void readcodes(ft_t ft, SFHEADER *sfhead) · 63 unmodified lines | |||
| 64 | ft->comment = commentbuf; | 64 | ft->comment = commentbuf; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | int st_sfseek(ft_t ft, st_size_t offset) | 67 | static int st_sfseek(ft_t ft, st_size_t offset) |
| 68 | { | 68 | { |
| 69 | st_size_t new_offset, channel_block, alignment; | 69 | st_size_t new_offset, channel_block, alignment; |
| 70 | 70 | ||
| @@ -91,7 +91,7 @@ int st_sfseek(ft_t ft, st_size_t offset) · 20 unmodified lines | |||
| 91 | * size and encoding of samples, | 91 | * size and encoding of samples, |
| 92 | * mono/stereo/quad. | 92 | * mono/stereo/quad. |
| 93 | */ | 93 | */ |
| 94 | int st_sfstartread(ft_t ft) | 94 | static int st_sfstartread(ft_t ft) |
| 95 | { | 95 | { |
| 96 | sf_t sf = (sf_t) ft->priv; | 96 | sf_t sf = (sf_t) ft->priv; |
| 97 | SFHEADER sfhead; | 97 | SFHEADER sfhead; |
| @@ -139,7 +139,7 @@ int st_sfstartread(ft_t ft) · 41 unmodified lines | |||
| 139 | } | 139 | } |
| 140 | ft->info.channels = (int) sf->info.sf_chans; | 140 | ft->info.channels = (int) sf->info.sf_chans; |
| 141 | 141 | ||
| 142 | if (ft->info.channels == -1) | 142 | if (ft->info.channels == 0) |
| 143 | ft->info.channels = 1; | 143 | ft->info.channels = 1; |
| 144 | 144 | ||
| 145 | /* Read codes and print as comments. */ | 145 | /* Read codes and print as comments. */ |
| @@ -159,7 +159,7 @@ int st_sfstartread(ft_t ft) · 13 unmodified lines | |||
| 159 | return(rc); | 159 | return(rc); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | int st_sfstartwrite(ft_t ft) | 162 | static int st_sfstartwrite(ft_t ft) |
| 163 | { | 163 | { |
| 164 | sf_t sf = (sf_t) ft->priv; | 164 | sf_t sf = (sf_t) ft->priv; |
| 165 | SFHEADER sfhead; | 165 | SFHEADER sfhead; |
| @@ -78,7 +78,7 @@ static void clear_rms(eff_t effp) · 77 unmodified lines | |||
| 78 | silence->rms_sum = 0; | 78 | silence->rms_sum = 0; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | int st_silence_getopts(eff_t effp, int n, char **argv) | 81 | static int st_silence_getopts(eff_t effp, int n, char **argv) |
| 82 | { | 82 | { |
| 83 | silence_t silence = (silence_t) effp->priv; | 83 | silence_t silence = (silence_t) effp->priv; |
| 84 | int parse_count; | 84 | int parse_count; |
| @@ -250,7 +250,7 @@ int st_silence_getopts(eff_t effp, int n, char **argv) · 165 unmodified lines | |||
| 250 | return(ST_SUCCESS); | 250 | return(ST_SUCCESS); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | int st_silence_start(eff_t effp) | 253 | static int st_silence_start(eff_t effp) |
| 254 | { | 254 | { |
| 255 | silence_t silence = (silence_t) effp->priv; | 255 | silence_t silence = (silence_t) effp->priv; |
| 256 | 256 | ||
| @@ -321,7 +321,7 @@ int st_silence_start(eff_t effp) · 64 unmodified lines | |||
| 321 | return(ST_SUCCESS); | 321 | return(ST_SUCCESS); |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | int aboveThreshold(eff_t effp, st_sample_t value, double threshold, char unit) | 324 | static int aboveThreshold(eff_t effp, st_sample_t value, double threshold, char unit) |
| 325 | { | 325 | { |
| 326 | double ratio; | 326 | double ratio; |
| 327 | int rc; | 327 | int rc; |
| @@ -390,12 +390,12 @@ static void update_rms(eff_t effp, st_sample_t sample) · 62 unmodified lines | |||
| 390 | 390 | ||
| 391 | /* Process signed long samples from ibuf to obuf. */ | 391 | /* Process signed long samples from ibuf to obuf. */ |
| 392 | /* Return number of samples processed in isamp and osamp. */ | 392 | /* Return number of samples processed in isamp and osamp. */ |
| 393 | int st_silence_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 393 | static int st_silence_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 394 | st_size_t *isamp, st_size_t *osamp) | 394 | st_size_t *isamp, st_size_t *osamp) |
| 395 | { | 395 | { |
| 396 | silence_t silence = (silence_t) effp->priv; | 396 | silence_t silence = (silence_t) effp->priv; |
| 397 | int threshold, j; | 397 | int threshold; |
| 398 | st_size_t i; | 398 | st_size_t i, j; |
| 399 | st_size_t nrOfTicks, nrOfInSamplesRead, nrOfOutSamplesWritten; | 399 | st_size_t nrOfTicks, nrOfInSamplesRead, nrOfOutSamplesWritten; |
| 400 | 400 | ||
| 401 | nrOfInSamplesRead = 0; | 401 | nrOfInSamplesRead = 0; |
| @@ -640,7 +640,7 @@ silence_copy_flush: · 238 unmodified lines | |||
| 640 | return (ST_SUCCESS); | 640 | return (ST_SUCCESS); |
| 641 | } | 641 | } |
| 642 | 642 | ||
| 643 | int st_silence_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 643 | static int st_silence_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 644 | { | 644 | { |
| 645 | silence_t silence = (silence_t) effp->priv; | 645 | silence_t silence = (silence_t) effp->priv; |
| 646 | st_size_t i; | 646 | st_size_t i; |
| @@ -676,7 +676,7 @@ int st_silence_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 29 unmodified lines | |||
| 676 | return ST_SUCCESS; | 676 | return ST_SUCCESS; |
| 677 | } | 677 | } |
| 678 | 678 | ||
| 679 | int st_silence_stop(eff_t effp) | 679 | static int st_silence_stop(eff_t effp) |
| 680 | { | 680 | { |
| 681 | silence_t silence = (silence_t) effp->priv; | 681 | silence_t silence = (silence_t) effp->priv; |
| 682 | 682 | ||
| @@ -169,7 +169,7 @@ static int writetrailer(ft_t ft, struct smptrailer *trailer) · 168 unmodified lines | |||
| 169 | return(ST_SUCCESS); | 169 | return(ST_SUCCESS); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | int st_smpseek(ft_t ft, st_size_t offset) | 172 | static int st_smpseek(ft_t ft, st_size_t offset) |
| 173 | { | 173 | { |
| 174 | int new_offset, channel_block, alignment; | 174 | int new_offset, channel_block, alignment; |
| 175 | smp_t smp = (smp_t) ft->priv; | 175 | smp_t smp = (smp_t) ft->priv; |
| @@ -200,7 +200,7 @@ int st_smpseek(ft_t ft, st_size_t offset) · 24 unmodified lines | |||
| 200 | * size and encoding of samples, | 200 | * size and encoding of samples, |
| 201 | * mono/stereo/quad. | 201 | * mono/stereo/quad. |
| 202 | */ | 202 | */ |
| 203 | int st_smpstartread(ft_t ft) | 203 | static int st_smpstartread(ft_t ft) |
| 204 | { | 204 | { |
| 205 | smp_t smp = (smp_t) ft->priv; | 205 | smp_t smp = (smp_t) ft->priv; |
| 206 | int i; | 206 | int i; |
| @@ -326,11 +326,11 @@ int st_smpstartread(ft_t ft) · 119 unmodified lines | |||
| 326 | * Place in buf[]. | 326 | * Place in buf[]. |
| 327 | * Return number of samples read. | 327 | * Return number of samples read. |
| 328 | */ | 328 | */ |
| 329 | st_ssize_t st_smpread(ft_t ft, st_sample_t *buf, st_size_t len) | 329 | static st_size_t st_smpread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 330 | { | 330 | { |
| 331 | smp_t smp = (smp_t) ft->priv; | 331 | smp_t smp = (smp_t) ft->priv; |
| 332 | unsigned short datum; | 332 | unsigned short datum; |
| 333 | int done = 0; | 333 | st_size_t done = 0; |
| 334 | 334 | ||
| 335 | for(; done < len && smp->NoOfSamps; done++, smp->NoOfSamps--) { | 335 | for(; done < len && smp->NoOfSamps; done++, smp->NoOfSamps--) { |
| 336 | st_readw(ft, &datum); | 336 | st_readw(ft, &datum); |
| @@ -340,16 +340,7 @@ st_ssize_t st_smpread(ft_t ft, st_sample_t *buf, st_size_t len) · 3 unmodified lines | |||
| 340 | return done; | 340 | return done; |
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | /* | 343 | static int st_smpstartwrite(ft_t ft) |
| 344 | * Do anything required when you stop reading samples. | ||
| 345 | * Don't close input file! | ||
| 346 | */ | ||
| 347 | int st_smpstopread(ft_t ft) | ||
| 348 | { | ||
| 349 | return(ST_SUCCESS); | ||
| 350 | } | ||
| 351 | |||
| 352 | int st_smpstartwrite(ft_t ft) | ||
| 353 | { | 344 | { |
| 354 | smp_t smp = (smp_t) ft->priv; | 345 | smp_t smp = (smp_t) ft->priv; |
| 355 | struct smpheader header; | 346 | struct smpheader header; |
| @@ -390,11 +381,11 @@ int st_smpstartwrite(ft_t ft) · 34 unmodified lines | |||
| 390 | return(ST_SUCCESS); | 381 | return(ST_SUCCESS); |
| 391 | } | 382 | } |
| 392 | 383 | ||
| 393 | st_ssize_t st_smpwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 384 | static st_size_t st_smpwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 394 | { | 385 | { |
| 395 | smp_t smp = (smp_t) ft->priv; | 386 | smp_t smp = (smp_t) ft->priv; |
| 396 | register int datum; | 387 | int datum; |
| 397 | st_ssize_t done = 0; | 388 | st_size_t done = 0; |
| 398 | 389 | ||
| 399 | while(done < len) { | 390 | while(done < len) { |
| 400 | datum = (int) ST_SAMPLE_TO_SIGNED_WORD(*buf++, ft->clippedCount); | 391 | datum = (int) ST_SAMPLE_TO_SIGNED_WORD(*buf++, ft->clippedCount); |
| @@ -406,7 +397,7 @@ st_ssize_t st_smpwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 5 unmodified lines | |||
| 406 | return(done); | 397 | return(done); |
| 407 | } | 398 | } |
| 408 | 399 | ||
| 409 | int st_smpstopwrite(ft_t ft) | 400 | static int st_smpstopwrite(ft_t ft) |
| 410 | { | 401 | { |
| 411 | smp_t smp = (smp_t) ft->priv; | 402 | smp_t smp = (smp_t) ft->priv; |
| 412 | struct smptrailer trailer; | 403 | struct smptrailer trailer; |
| @@ -436,7 +427,7 @@ static st_format_t st_smp_format = { · 23 unmodified lines | |||
| 436 | ST_FILE_STEREO | ST_FILE_LOOPS | ST_FILE_SEEK, | 427 | ST_FILE_STEREO | ST_FILE_LOOPS | ST_FILE_SEEK, |
| 437 | st_smpstartread, | 428 | st_smpstartread, |
| 438 | st_smpread, | 429 | st_smpread, |
| 439 | st_smpstopread, | 430 | st_format_nothing, |
| 440 | st_smpstartwrite, | 431 | st_smpstartwrite, |
| 441 | st_smpwrite, | 432 | st_smpwrite, |
| 442 | st_smpstopwrite, | 433 | st_smpstopwrite, |
| @@ -20,9 +20,27 @@ typedef struct sndpriv { · 19 unmodified lines | |||
| 20 | st_size_t dataStart; | 20 | st_size_t dataStart; |
| 21 | } *snd_t; | 21 | } *snd_t; |
| 22 | 22 | ||
| 23 | static void sndtwriteheader(ft_t ft, st_size_t nsamples); | 23 | static void sndtwriteheader(ft_t ft, st_size_t nsamples) |
| 24 | { | ||
| 25 | char name_buf[97]; | ||
| 24 | 26 | ||
| 25 | int st_sndseek(ft_t ft, st_size_t offset) | 27 | /* sndtool header */ |
| 28 | st_writes(ft, "SOUND"); /* magic */ | ||
| 29 | st_writeb(ft, 0x1a); | ||
| 30 | st_writew (ft,0); /* hGSound */ | ||
| 31 | st_writedw (ft,nsamples); | ||
| 32 | st_writedw (ft,0); | ||
| 33 | st_writedw (ft,nsamples); | ||
| 34 | st_writew (ft,(int) ft->info.rate); | ||
| 35 | st_writew (ft,0); | ||
| 36 | st_writew (ft,10); | ||
| 37 | st_writew (ft,4); | ||
| 38 | memset (name_buf, 0, 96); | ||
| 39 | sprintf (name_buf,"%.62s - File created by SoX",ft->filename); | ||
| 40 | st_writebuf(ft, name_buf, 1, 96); | ||
| 41 | } | ||
| 42 | |||
| 43 | static int st_sndseek(ft_t ft, st_size_t offset) | ||
| 26 | { | 44 | { |
| 27 | st_size_t new_offset, channel_block, alignment; | 45 | st_size_t new_offset, channel_block, alignment; |
| 28 | snd_t snd = (snd_t ) ft->priv; | 46 | snd_t snd = (snd_t ) ft->priv; |
| @@ -41,11 +59,8 @@ int st_sndseek(ft_t ft, st_size_t offset) · 12 unmodified lines | |||
| 41 | 59 | ||
| 42 | return st_seeki(ft, new_offset, SEEK_SET); | 60 | return st_seeki(ft, new_offset, SEEK_SET); |
| 43 | } | 61 | } |
| 44 | /*======================================================================*/ | ||
| 45 | /* SNDSTARTREAD */ | ||
| 46 | /*======================================================================*/ | ||
| 47 | 62 | ||
| 48 | int st_sndtstartread(ft_t ft) | 63 | static int st_sndtstartread(ft_t ft) |
| 49 | { | 64 | { |
| 50 | snd_t snd = (snd_t ) ft->priv; | 65 | snd_t snd = (snd_t ) ft->priv; |
| 51 | 66 | ||
| @@ -122,10 +137,7 @@ int st_sndtstartread(ft_t ft) · 70 unmodified lines | |||
| 122 | return (ST_SUCCESS); | 137 | return (ST_SUCCESS); |
| 123 | } | 138 | } |
| 124 | 139 | ||
| 125 | /*======================================================================*/ | 140 | static int st_sndtstartwrite(ft_t ft) |
| 126 | /* SNDTSTARTWRITE */ | ||
| 127 | /*======================================================================*/ | ||
| 128 | int st_sndtstartwrite(ft_t ft) | ||
| 129 | { | 141 | { |
| 130 | snd_t p = (snd_t ) ft->priv; | 142 | snd_t p = (snd_t ) ft->priv; |
| 131 | int rc; | 143 | int rc; |
| @@ -143,66 +155,24 @@ int st_sndtstartwrite(ft_t ft) · 11 unmodified lines | |||
| 143 | ft->swap = ft->swap ? 0 : 1; | 155 | ft->swap = ft->swap ? 0 : 1; |
| 144 | } | 156 | } |
| 145 | 157 | ||
| 146 | /* write header */ | 158 | /* write header */ |
| 147 | ft->info.channels = 1; | 159 | ft->info.channels = 1; |
| 148 | ft->info.encoding = ST_ENCODING_UNSIGNED; | 160 | ft->info.encoding = ST_ENCODING_UNSIGNED; |
| 149 | ft->info.size = ST_SIZE_BYTE; | 161 | ft->info.size = ST_SIZE_BYTE; |
| 150 | p->nsamples = 0; | 162 | p->nsamples = 0; |
| 151 | sndtwriteheader(ft, 0); | 163 | sndtwriteheader(ft, 0); |
| 152 | |||
| 153 | return(ST_SUCCESS); | ||
| 154 | } | ||
| 155 | |||
| 156 | /*======================================================================*/ | ||
| 157 | /* SNDRSTARTWRITE */ | ||
| 158 | /*======================================================================*/ | ||
| 159 | int st_sndrstartwrite(ft_t ft) | ||
| 160 | { | ||
| 161 | int rc; | ||
| 162 | |||
| 163 | /* Needed for rawread() */ | ||
| 164 | rc = st_rawstartread(ft); | ||
| 165 | if (rc) | ||
| 166 | return rc; | ||
| 167 | |||
| 168 | /* sndr is in little endian format so | ||
| 169 | * swap bytes on big endian machines | ||
| 170 | */ | ||
| 171 | if (ST_IS_BIGENDIAN) | ||
| 172 | { | ||
| 173 | ft->swap = ft->swap ? 0 : 1; | ||
| 174 | } | ||
| 175 | |||
| 176 | /* write header */ | ||
| 177 | ft->info.channels = 1; | ||
| 178 | ft->info.encoding = ST_ENCODING_UNSIGNED; | ||
| 179 | ft->info.size = ST_SIZE_BYTE; | ||
| 180 | |||
| 181 | /* sounder header */ | ||
| 182 | st_writew (ft,0); /* sample size code */ | ||
| 183 | st_writew (ft,(int) ft->info.rate); /* sample rate */ | ||
| 184 | st_writew (ft,10); /* volume */ | ||
| 185 | st_writew (ft,4); /* shift */ | ||
| 186 | 164 | ||
| 187 | return(ST_SUCCESS); | 165 | return(ST_SUCCESS); |
| 188 | } | 166 | } |
| 189 | 167 | ||
| 190 | /*======================================================================*/ | 168 | static st_size_t st_sndtwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 191 | /* SNDTWRITE */ | ||
| 192 | /*======================================================================*/ | ||
| 193 | |||
| 194 | st_ssize_t st_sndtwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | ||
| 195 | { | 169 | { |
| 196 | snd_t p = (snd_t ) ft->priv; | 170 | snd_t p = (snd_t ) ft->priv; |
| 197 | p->nsamples += len; | 171 | p->nsamples += len; |
| 198 | return st_rawwrite(ft, buf, len); | 172 | return st_rawwrite(ft, buf, len); |
| 199 | } | 173 | } |
| 200 | 174 | ||
| 201 | /*======================================================================*/ | 175 | static int st_sndtstopwrite(ft_t ft) |
| 202 | /* SNDTSTOPWRITE */ | ||
| 203 | /*======================================================================*/ | ||
| 204 | |||
| 205 | int st_sndtstopwrite(ft_t ft) | ||
| 206 | { | 176 | { |
| 207 | snd_t p = (snd_t ) ft->priv; | 177 | snd_t p = (snd_t ) ft->priv; |
| 208 | int rc; | 178 | int rc; |
| @@ -224,29 +194,6 @@ int st_sndtstopwrite(ft_t ft) · 15 unmodified lines | |||
| 224 | return(ST_SUCCESS); | 194 | return(ST_SUCCESS); |
| 225 | } | 195 | } |
| 226 | 196 | ||
| 227 | /*======================================================================*/ | ||
| 228 | /* SNDTWRITEHEADER */ | ||
| 229 | /*======================================================================*/ | ||
| 230 | static void sndtwriteheader(ft_t ft, st_size_t nsamples) | ||
| 231 | { | ||
| 232 | char name_buf[97]; | ||
| 233 | |||
| 234 | /* sndtool header */ | ||
| 235 | st_writes(ft, "SOUND"); /* magic */ | ||
| 236 | st_writeb(ft, 0x1a); | ||
| 237 | st_writew (ft,0); /* hGSound */ | ||
| 238 | st_writedw (ft,nsamples); | ||
| 239 | st_writedw (ft,0); | ||
| 240 | st_writedw (ft,nsamples); | ||
| 241 | st_writew (ft,(int) ft->info.rate); | ||
| 242 | st_writew (ft,0); | ||
| 243 | st_writew (ft,10); | ||
| 244 | st_writew (ft,4); | ||
| 245 | memset (name_buf, 0, 96); | ||
| 246 | sprintf (name_buf,"%.62s - File created by Sound Exchange",ft->filename); | ||
| 247 | st_writebuf(ft, name_buf, 1, 96); | ||
| 248 | } | ||
| 249 | |||
| 250 | /* Sndtool Sound File */ | 197 | /* Sndtool Sound File */ |
| 251 | static const char *sndtnames[] = { | 198 | static const char *sndtnames[] = { |
| 252 | "sndt", | 199 | "sndt", |
| @@ -128,8 +128,8 @@ static void sigint(int s); · 127 unmodified lines | |||
| 128 | /* Array's tracking input and output files */ | 128 | /* Array's tracking input and output files */ |
| 129 | static file_options_t *file_opts[MAX_FILES]; | 129 | static file_options_t *file_opts[MAX_FILES]; |
| 130 | static ft_t file_desc[MAX_FILES]; | 130 | static ft_t file_desc[MAX_FILES]; |
| 131 | static int file_count = 0; | 131 | static size_t file_count = 0; |
| 132 | static int input_count = 0; | 132 | static size_t input_count = 0; |
| 133 | 133 | ||
| 134 | /* We parse effects into a temporary effects table and then place into | 134 | /* We parse effects into a temporary effects table and then place into |
| 135 | * the real effects table. This makes it easier to reorder some effects | 135 | * the real effects table. This makes it easier to reorder some effects |
| @@ -179,7 +179,7 @@ static void sox_output_message(int level, st_output_message_t m) · 43 unmodified lines | |||
| 179 | int main(int argc, char **argv) | 179 | int main(int argc, char **argv) |
| 180 | { | 180 | { |
| 181 | file_options_t *fo; | 181 | file_options_t *fo; |
| 182 | int i; | 182 | size_t i; |
| 183 | 183 | ||
| 184 | myname = argv[0]; | 184 | myname = argv[0]; |
| 185 | 185 | ||
| @@ -202,8 +202,8 @@ int main(int argc, char **argv) · 16 unmodified lines | |||
| 202 | 202 | ||
| 203 | fo = (file_options_t *)calloc(sizeof(file_options_t), 1); | 203 | fo = (file_options_t *)calloc(sizeof(file_options_t), 1); |
| 204 | fo->info.size = -1; | 204 | fo->info.size = -1; |
| 205 | fo->info.encoding = -1; | 205 | fo->info.encoding = ST_ENCODING_UNKNOWN; |
| 206 | fo->info.channels = -1; | 206 | fo->info.channels = 0; |
| 207 | fo->info.compression = HUGE_VAL; | 207 | fo->info.compression = HUGE_VAL; |
| 208 | fo->volume = 1.0; | 208 | fo->volume = 1.0; |
| 209 | file_opts[file_count++] = fo; | 209 | file_opts[file_count++] = fo; |
| @@ -551,7 +551,7 @@ static int compare_input(ft_t ft1, ft_t ft2) · 341 unmodified lines | |||
| 551 | return ST_SUCCESS; | 551 | return ST_SUCCESS; |
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | void optimize_trim(void) | 554 | static void optimize_trim(void) |
| 555 | { | 555 | { |
| 556 | /* Speed hack. If the "trim" effect is the first effect then | 556 | /* Speed hack. If the "trim" effect is the first effect then |
| 557 | * peak inside its "effect descriptor" and see what the | 557 | * peak inside its "effect descriptor" and see what the |
| @@ -585,9 +585,9 @@ void optimize_trim(void) · 27 unmodified lines | |||
| 585 | */ | 585 | */ |
| 586 | 586 | ||
| 587 | static void process(void) { | 587 | static void process(void) { |
| 588 | int e, f, flowstatus = ST_SUCCESS; | 588 | int e, flowstatus = ST_SUCCESS; |
| 589 | int current_input; | 589 | size_t current_input; |
| 590 | st_size_t s; | 590 | st_size_t s, f; |
| 591 | st_ssize_t ilen[MAX_INPUT_FILES]; | 591 | st_ssize_t ilen[MAX_INPUT_FILES]; |
| 592 | st_sample_t *ibuf[MAX_INPUT_FILES]; | 592 | st_sample_t *ibuf[MAX_INPUT_FILES]; |
| 593 | 593 | ||
| @@ -626,9 +626,9 @@ static void process(void) { · 32 unmodified lines | |||
| 626 | options->info.rate = file_desc[0]->info.rate; | 626 | options->info.rate = file_desc[0]->info.rate; |
| 627 | if (options->info.size == -1) | 627 | if (options->info.size == -1) |
| 628 | options->info.size = file_desc[0]->info.size; | 628 | options->info.size = file_desc[0]->info.size; |
| 629 | if (options->info.encoding == -1) | 629 | if (options->info.encoding == ST_ENCODING_UNKNOWN) |
| 630 | options->info.encoding = file_desc[0]->info.encoding; | 630 | options->info.encoding = file_desc[0]->info.encoding; |
| 631 | if (options->info.channels == -1) | 631 | if (options->info.channels == 0) |
| 632 | options->info.channels = file_desc[0]->info.channels; | 632 | options->info.channels = file_desc[0]->info.channels; |
| 633 | 633 | ||
| 634 | if (options->comment != NULL) | 634 | if (options->comment != NULL) |
| @@ -1263,7 +1263,7 @@ static void reserve_effect_buf(void) · 628 unmodified lines | |||
| 1263 | static int flow_effect_out(void) | 1263 | static int flow_effect_out(void) |
| 1264 | { | 1264 | { |
| 1265 | int e, havedata, flowstatus = 0; | 1265 | int e, havedata, flowstatus = 0; |
| 1266 | int len, total; | 1266 | size_t len, total; |
| 1267 | 1267 | ||
| 1268 | do { | 1268 | do { |
| 1269 | /* run entire chain BACKWARDS: pull, don't push.*/ | 1269 | /* run entire chain BACKWARDS: pull, don't push.*/ |
| @@ -1330,9 +1330,9 @@ static int flow_effect_out(void) · 60 unmodified lines | |||
| 1330 | 1330 | ||
| 1331 | len = st_write(file_desc[file_count-1], | 1331 | len = st_write(file_desc[file_count-1], |
| 1332 | &efftab[neffects-1].obuf[total], | 1332 | &efftab[neffects-1].obuf[total], |
| 1333 | (st_ssize_t)efftab[neffects-1].olen-total); | 1333 | efftab[neffects-1].olen-total); |
| 1334 | 1334 | ||
| 1335 | if (len < 0 || file_desc[file_count-1]->file.eof) | 1335 | if (len != efftab[neffects-1].olen-total || file_desc[file_count-1]->file.eof) |
| 1336 | { | 1336 | { |
| 1337 | st_warn("Error writing: %s", | 1337 | st_warn("Error writing: %s", |
| 1338 | file_desc[file_count-1]->st_errstr); | 1338 | file_desc[file_count-1]->st_errstr); |
| @@ -1877,7 +1877,7 @@ static void usage_effect(char *effect) · 538 unmodified lines | |||
| 1877 | 1877 | ||
| 1878 | void cleanup(void) | 1878 | void cleanup(void) |
| 1879 | { | 1879 | { |
| 1880 | int i; | 1880 | size_t i; |
| 1881 | struct stat st; | 1881 | struct stat st; |
| 1882 | char *fn; | 1882 | char *fn; |
| 1883 | 1883 | ||
| @@ -76,7 +76,7 @@ static double cub( · 75 unmodified lines | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | /* get options. */ | 78 | /* get options. */ |
| 79 | int st_speed_getopts(eff_t effp, int n, char **argv) | 79 | static int st_speed_getopts(eff_t effp, int n, char **argv) |
| 80 | { | 80 | { |
| 81 | speed_t speed = (speed_t) effp->priv; | 81 | speed_t speed = (speed_t) effp->priv; |
| 82 | int cent = 0; | 82 | int cent = 0; |
| @@ -106,7 +106,7 @@ int st_speed_getopts(eff_t effp, int n, char **argv) · 23 unmodified lines | |||
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | /* start processing. */ | 108 | /* start processing. */ |
| 109 | int st_speed_start(eff_t effp) | 109 | static int st_speed_start(eff_t effp) |
| 110 | { | 110 | { |
| 111 | speed_t speed = (speed_t) effp->priv; | 111 | speed_t speed = (speed_t) effp->priv; |
| 112 | 112 | ||
| @@ -192,7 +192,7 @@ static st_size_t compute(eff_t effp, speed_t speed, st_sample_t *obuf, st_size_t · 79 unmodified lines | |||
| 192 | 192 | ||
| 193 | /* handle a flow. | 193 | /* handle a flow. |
| 194 | */ | 194 | */ |
| 195 | int st_speed_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 195 | static int st_speed_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 196 | st_size_t *isamp, st_size_t *osamp) | 196 | st_size_t *isamp, st_size_t *osamp) |
| 197 | { | 197 | { |
| 198 | speed_t speed; | 198 | speed_t speed; |
| @@ -237,7 +237,7 @@ int st_speed_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 38 unmodified lines | |||
| 237 | 237 | ||
| 238 | /* end of stuff. | 238 | /* end of stuff. |
| 239 | */ | 239 | */ |
| 240 | int st_speed_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 240 | static int st_speed_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 241 | { | 241 | { |
| 242 | speed_t speed = (speed_t) effp->priv; | 242 | speed_t speed = (speed_t) effp->priv; |
| 243 | st_size_t i, oindex; | 243 | st_size_t i, oindex; |
| @@ -274,7 +274,7 @@ int st_speed_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 30 unmodified lines | |||
| 274 | 274 | ||
| 275 | /* stop processing. report overflows. | 275 | /* stop processing. report overflows. |
| 276 | */ | 276 | */ |
| 277 | int st_speed_stop(eff_t effp) | 277 | static int st_speed_stop(eff_t effp) |
| 278 | { | 278 | { |
| 279 | speed_t speed = (speed_t) effp->priv; | 279 | speed_t speed = (speed_t) effp->priv; |
| 280 | 280 | ||
| @@ -1,8 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * NIST Sphere file format handler. | 2 | * NIST Sphere file format handler. |
| 3 | */ | 3 | * |
| 4 | |||
| 5 | /* | ||
| 6 | * August 7, 2000 | 4 | * August 7, 2000 |
| 7 | * | 5 | * |
| 8 | * Copyright (C) 2000 Chris Bagwell (cbagwell@sprynet.com) | 6 | * Copyright (C) 2000 Chris Bagwell (cbagwell@sprynet.com) |
| @@ -28,7 +26,7 @@ typedef struct spherestuff { · 19 unmodified lines | |||
| 28 | * size and encoding of samples, | 26 | * size and encoding of samples, |
| 29 | * mono/stereo/quad. | 27 | * mono/stereo/quad. |
| 30 | */ | 28 | */ |
| 31 | int st_spherestartread(ft_t ft) | 29 | static int st_spherestartread(ft_t ft) |
| 32 | { | 30 | { |
| 33 | sphere_t sphere = (sphere_t) ft->priv; | 31 | sphere_t sphere = (sphere_t) ft->priv; |
| 34 | int rc; | 32 | int rc; |
| @@ -85,7 +83,7 @@ int st_spherestartread(ft_t ft) · 50 unmodified lines | |||
| 85 | ft->info.size = i; | 83 | ft->info.size = i; |
| 86 | } | 84 | } |
| 87 | if (strncmp(buf, "channel_count", 13) == 0 && | 85 | if (strncmp(buf, "channel_count", 13) == 0 && |
| 88 | ft->info.channels == -1) | 86 | ft->info.channels == 0) |
| 89 | { | 87 | { |
| 90 | sscanf(buf, "%63s %15s %d", fldname, fldtype, &i); | 88 | sscanf(buf, "%63s %15s %d", fldname, fldtype, &i); |
| 91 | ft->info.channels = i; | 89 | ft->info.channels = i; |
| @@ -96,7 +94,7 @@ int st_spherestartread(ft_t ft) · 4 unmodified lines | |||
| 96 | /* Only bother looking for ulaw flag. All others | 94 | /* Only bother looking for ulaw flag. All others |
| 97 | * should be caught below by default PCM check | 95 | * should be caught below by default PCM check |
| 98 | */ | 96 | */ |
| 99 | if (ft->info.encoding == -1 && | 97 | if (ft->info.encoding == ST_ENCODING_UNKNOWN && |
| 100 | strncmp(fldsval,"ulaw",4) == 0) | 98 | strncmp(fldsval,"ulaw",4) == 0) |
| 101 | { | 99 | { |
| 102 | ft->info.encoding = ST_ENCODING_ULAW; | 100 | ft->info.encoding = ST_ENCODING_ULAW; |
| @@ -146,7 +144,7 @@ int st_spherestartread(ft_t ft) · 43 unmodified lines | |||
| 146 | * This means encoding is signed if size = word or | 144 | * This means encoding is signed if size = word or |
| 147 | * unsigned if size = byte. | 145 | * unsigned if size = byte. |
| 148 | */ | 146 | */ |
| 149 | if (ft->info.encoding == -1) | 147 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) |
| 150 | { | 148 | { |
| 151 | if (ft->info.size == 1) | 149 | if (ft->info.size == 1) |
| 152 | ft->info.encoding = ST_ENCODING_UNSIGNED; | 150 | ft->info.encoding = ST_ENCODING_UNSIGNED; |
| @@ -190,7 +188,7 @@ int st_spherestartread(ft_t ft) · 37 unmodified lines | |||
| 190 | * Return number of samples read. | 188 | * Return number of samples read. |
| 191 | */ | 189 | */ |
| 192 | 190 | ||
| 193 | st_ssize_t st_sphereread(ft_t ft, st_sample_t *buf, st_size_t len) | 191 | static st_size_t st_sphereread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 194 | { | 192 | { |
| 195 | sphere_t sphere = (sphere_t) ft->priv; | 193 | sphere_t sphere = (sphere_t) ft->priv; |
| 196 | 194 | ||
| @@ -204,7 +202,7 @@ st_ssize_t st_sphereread(ft_t ft, st_sample_t *buf, st_size_t len) · 7 unmodified lines | |||
| 204 | return st_rawread(ft, buf, len); | 202 | return st_rawread(ft, buf, len); |
| 205 | } | 203 | } |
| 206 | 204 | ||
| 207 | int st_spherestartwrite(ft_t ft) | 205 | static int st_spherestartwrite(ft_t ft) |
| 208 | { | 206 | { |
| 209 | int rc; | 207 | int rc; |
| 210 | int x; | 208 | int x; |
| @@ -243,7 +241,7 @@ int st_spherestartwrite(ft_t ft) · 32 unmodified lines | |||
| 243 | 241 | ||
| 244 | } | 242 | } |
| 245 | 243 | ||
| 246 | st_ssize_t st_spherewrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 244 | static st_size_t st_spherewrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 247 | { | 245 | { |
| 248 | sphere_t sphere = (sphere_t) ft->priv; | 246 | sphere_t sphere = (sphere_t) ft->priv; |
| 249 | 247 | ||
| @@ -251,7 +249,7 @@ st_ssize_t st_spherewrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 1 unmodified line | |||
| 251 | return st_rawwrite(ft, buf, len); | 249 | return st_rawwrite(ft, buf, len); |
| 252 | } | 250 | } |
| 253 | 251 | ||
| 254 | int st_spherestopwrite(ft_t ft) | 252 | static int st_spherestopwrite(ft_t ft) |
| 255 | { | 253 | { |
| 256 | int rc; | 254 | int rc; |
| 257 | char buf[128]; | 255 | char buf[128]; |
| @@ -19,6 +19,9 @@ · 18 unmodified lines | |||
| 19 | # define __attribute__(x) /*NOTHING*/ | 19 | # define __attribute__(x) /*NOTHING*/ |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | /* Avoid warnings about unused parameters. */ | ||
| 23 | #define UNUSED __attribute__ ((unused)) | ||
| 24 | |||
| 22 | /* C language enhancements: */ | 25 | /* C language enhancements: */ |
| 23 | 26 | ||
| 24 | /* Boolean type, compatible with C++ */ | 27 | /* Boolean type, compatible with C++ */ |
| @@ -85,8 +88,8 @@ typedef int32_t st_sample_t; · 60 unmodified lines | |||
| 85 | */ | 88 | */ |
| 86 | 89 | ||
| 87 | /* Temporary variables to prevent multiple evaluation of macro arguments: */ | 90 | /* Temporary variables to prevent multiple evaluation of macro arguments: */ |
| 88 | static st_sample_t st_macro_temp_sample __attribute__((unused)); | 91 | static st_sample_t st_macro_temp_sample UNUSED; |
| 89 | static double st_macro_temp_double __attribute__((unused)); | 92 | static double st_macro_temp_double UNUSED; |
| 90 | 93 | ||
| 91 | #define ST_SAMPLE_NEG ST_INT_MIN(32) | 94 | #define ST_SAMPLE_NEG ST_INT_MIN(32) |
| 92 | #define ST_SAMPLE_TO_UNSIGNED(bits,d,clips) \ | 95 | #define ST_SAMPLE_TO_UNSIGNED(bits,d,clips) \ |
| @@ -199,7 +202,7 @@ typedef struct st_signalinfo · 106 unmodified lines | |||
| 199 | st_rate_t rate; /* sampling rate */ | 202 | st_rate_t rate; /* sampling rate */ |
| 200 | signed char size; /* word length of data */ | 203 | signed char size; /* word length of data */ |
| 201 | st_encoding_t encoding; /* format of sample numbers */ | 204 | st_encoding_t encoding; /* format of sample numbers */ |
| 202 | signed char channels; /* number of sound channels */ | 205 | unsigned channels; /* number of sound channels */ |
| 203 | char swap; /* do byte- or word-swap */ | 206 | char swap; /* do byte- or word-swap */ |
| 204 | double compression; /* compression factor (where applicable) */ | 207 | double compression; /* compression factor (where applicable) */ |
| 205 | } st_signalinfo_t; | 208 | } st_signalinfo_t; |
| @@ -263,13 +266,13 @@ typedef struct st_soundstream *ft_t; · 57 unmodified lines | |||
| 263 | 266 | ||
| 264 | typedef struct st_format { | 267 | typedef struct st_format { |
| 265 | const char * const *names; | 268 | const char * const *names; |
| 266 | char *usage; | 269 | const char *usage; |
| 267 | unsigned int flags; | 270 | unsigned int flags; |
| 268 | int (*startread)(ft_t ft); | 271 | int (*startread)(ft_t ft); |
| 269 | st_ssize_t (*read)(ft_t ft, st_sample_t *buf, st_size_t len); | 272 | st_size_t (*read)(ft_t ft, st_sample_t *buf, st_size_t len); |
| 270 | int (*stopread)(ft_t ft); | 273 | int (*stopread)(ft_t ft); |
| 271 | int (*startwrite)(ft_t ft); | 274 | int (*startwrite)(ft_t ft); |
| 272 | st_ssize_t (*write)(ft_t ft, const st_sample_t *buf, st_size_t len); | 275 | st_size_t (*write)(ft_t ft, const st_sample_t *buf, st_size_t len); |
| 273 | int (*stopwrite)(ft_t ft); | 276 | int (*stopwrite)(ft_t ft); |
| 274 | int (*seek)(ft_t ft, st_size_t offset); | 277 | int (*seek)(ft_t ft, st_size_t offset); |
| 275 | } st_format_t; | 278 | } st_format_t; |
| @@ -344,7 +347,7 @@ typedef struct · 68 unmodified lines | |||
| 344 | char *usage; | 347 | char *usage; |
| 345 | unsigned int flags; | 348 | unsigned int flags; |
| 346 | 349 | ||
| 347 | int (*getopts)(eff_t effp, int argc, char **argv); | 350 | int (*getopts)(eff_t effp, int argc, char *argv[]); |
| 348 | int (*start)(eff_t effp); | 351 | int (*start)(eff_t effp); |
| 349 | int (*flow)(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 352 | int (*flow)(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 350 | st_size_t *isamp, st_size_t *osamp); | 353 | st_size_t *isamp, st_size_t *osamp); |
| @@ -363,7 +366,7 @@ struct st_effect · 12 unmodified lines | |||
| 363 | st_size_t odone, olen; /* consumed, total length */ | 366 | st_size_t odone, olen; /* consumed, total length */ |
| 364 | st_size_t clippedCount; /* increment if clipping occurs */ | 367 | st_size_t clippedCount; /* increment if clipping occurs */ |
| 365 | /* The following is a portable trick to align this variable on | 368 | /* The following is a portable trick to align this variable on |
| 366 | * an 8-byte bounder. Once this is done, the buffer alloced | 369 | * an 8-byte boundary. Once this is done, the buffer alloced |
| 367 | * after it should be align on an 8-byte boundery as well. | 370 | * after it should be align on an 8-byte boundery as well. |
| 368 | * This lets you cast any structure over the private area | 371 | * This lets you cast any structure over the private area |
| 369 | * without concerns of alignment. | 372 | * without concerns of alignment. |
| @@ -380,8 +383,8 @@ extern ft_t st_open_write_instr(const char *path, const st_signalinfo_t *info, · 10 unmodified lines | |||
| 380 | const char *filetype, const char *comment, | 383 | const char *filetype, const char *comment, |
| 381 | const st_instrinfo_t *instr, | 384 | const st_instrinfo_t *instr, |
| 382 | const st_loopinfo_t *loops); | 385 | const st_loopinfo_t *loops); |
| 383 | extern st_ssize_t st_read(ft_t ft, st_sample_t *buf, st_size_t len); | 386 | extern st_size_t st_read(ft_t ft, st_sample_t *buf, st_size_t len); |
| 384 | extern st_ssize_t st_write(ft_t ft, const st_sample_t *buf, st_size_t len); | 387 | extern st_size_t st_write(ft_t ft, const st_sample_t *buf, st_size_t len); |
| 385 | extern int st_close(ft_t ft); | 388 | extern int st_close(ft_t ft); |
| 386 | 389 | ||
| 387 | #define ST_SEEK_SET 0 | 390 | #define ST_SEEK_SET 0 |
| @@ -21,17 +21,8 @@ · 20 unmodified lines | |||
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | /* various gcc optimizations and portablity defines */ | 23 | /* various gcc optimizations and portablity defines */ |
| 24 | #ifdef __GNUC__ | ||
| 25 | #define NORET __attribute__((noreturn)) | 24 | #define NORET __attribute__((noreturn)) |
| 26 | #else | ||
| 27 | #define NORET | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #ifdef USE_REGPARM | ||
| 31 | #define REGPARM(n) __attribute__((regparm(n))) | 25 | #define REGPARM(n) __attribute__((regparm(n))) |
| 32 | #else | ||
| 33 | #define REGPARM(n) | ||
| 34 | #endif | ||
| 35 | 26 | ||
| 36 | /* declared in misc.c */ | 27 | /* declared in misc.c */ |
| 37 | typedef struct {char const *text; int value;} enum_item; | 28 | typedef struct {char const *text; int value;} enum_item; |
| @@ -45,14 +36,14 @@ extern enum_item const st_wave_enum[]; · 7 unmodified lines | |||
| 45 | void st_generate_wave_table( | 36 | void st_generate_wave_table( |
| 46 | st_wave_t wave_type, | 37 | st_wave_t wave_type, |
| 47 | st_data_t data_type, | 38 | st_data_t data_type, |
| 48 | void * table, | 39 | void *table, |
| 49 | uint32_t table_size, | 40 | uint32_t table_size, |
| 50 | double min, | 41 | double min, |
| 51 | double max, | 42 | double max, |
| 52 | double phase); | 43 | double phase); |
| 53 | 44 | ||
| 54 | st_sample_t st_gcd(st_sample_t a, st_sample_t b) REGPARM(2); | 45 | REGPARM(2) st_sample_t st_gcd(st_sample_t a, st_sample_t b); |
| 55 | st_sample_t st_lcm(st_sample_t a, st_sample_t b) REGPARM(2); | 46 | REGPARM(2) st_sample_t st_lcm(st_sample_t a, st_sample_t b); |
| 56 | 47 | ||
| 57 | #ifndef HAVE_STRCASECMP | 48 | #ifndef HAVE_STRCASECMP |
| 58 | int strcasecmp(const char *s1, const char *s2); | 49 | int strcasecmp(const char *s1, const char *s2); |
| @@ -69,8 +60,8 @@ void st_initrand(void); · 10 unmodified lines | |||
| 69 | * possible byte swapping. | 60 | * possible byte swapping. |
| 70 | */ | 61 | */ |
| 71 | /* declared in misc.c */ | 62 | /* declared in misc.c */ |
| 72 | st_ssize_t st_readbuf(ft_t ft, void *buf, size_t size, st_size_t len); | 63 | size_t st_readbuf(ft_t ft, void *buf, size_t size, st_size_t len); |
| 73 | st_ssize_t st_writebuf(ft_t ft, void const *buf, size_t size, st_size_t len); | 64 | size_t st_writebuf(ft_t ft, void const *buf, size_t size, st_size_t len); |
| 74 | int st_reads(ft_t ft, char *c, st_size_t len); | 65 | int st_reads(ft_t ft, char *c, st_size_t len); |
| 75 | int st_writes(ft_t ft, char *c); | 66 | int st_writes(ft_t ft, char *c); |
| 76 | int st_readb(ft_t ft, uint8_t *ub); | 67 | int st_readb(ft_t ft, uint8_t *ub); |
| @@ -232,10 +223,10 @@ extern const st_format_t *st_xa_format_fn(void); · 155 unmodified lines | |||
| 232 | /* Raw I/O | 223 | /* Raw I/O |
| 233 | */ | 224 | */ |
| 234 | int st_rawstartread(ft_t ft); | 225 | int st_rawstartread(ft_t ft); |
| 235 | st_ssize_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp); | 226 | st_size_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp); |
| 236 | int st_rawstopread(ft_t ft); | 227 | int st_rawstopread(ft_t ft); |
| 237 | int st_rawstartwrite(ft_t ft); | 228 | int st_rawstartwrite(ft_t ft); |
| 238 | st_ssize_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp); | 229 | st_size_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp); |
| 239 | int st_rawstopwrite(ft_t ft); | 230 | int st_rawstopwrite(ft_t ft); |
| 240 | int st_rawseek(ft_t ft, st_size_t offset); | 231 | int st_rawseek(ft_t ft, st_size_t offset); |
| 241 | 232 | ||
| @@ -243,11 +234,12 @@ int st_rawseek(ft_t ft, st_size_t offset); · 1 unmodified line | |||
| 243 | * a file handler or effect doesn't need to do anything special | 234 | * a file handler or effect doesn't need to do anything special |
| 244 | */ | 235 | */ |
| 245 | int st_format_nothing(ft_t ft); | 236 | int st_format_nothing(ft_t ft); |
| 246 | st_ssize_t st_format_nothing_read_io(ft_t ft, st_sample_t *buf, st_size_t len); | 237 | st_size_t st_format_nothing_read_io(ft_t ft, st_sample_t *buf, st_size_t len); |
| 247 | st_ssize_t st_format_nothing_write_io(ft_t ft, const st_sample_t *buf, st_size_t len); | 238 | st_size_t st_format_nothing_write_io(ft_t ft, const st_sample_t *buf, st_size_t len); |
| 248 | int st_format_nothing_seek(ft_t ft, st_size_t offset); | 239 | int st_format_nothing_seek(ft_t ft, st_size_t offset); |
| 249 | int st_effect_nothing(eff_t effp); | 240 | int st_effect_nothing(eff_t effp); |
| 250 | int st_effect_nothing_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp); | 241 | int st_effect_nothing_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp); |
| 242 | int st_effect_nothing_getopts(eff_t effp, int n, char **argv UNUSED); | ||
| 251 | 243 | ||
| 252 | /*============================================================================= | 244 | /*============================================================================= |
| 253 | * Effects | 245 | * Effects |
| @@ -307,9 +299,15 @@ extern const st_effect_t *st_trim_effect_fn(void); · 53 unmodified lines | |||
| 307 | extern const st_effect_t *st_vibro_effect_fn(void); | 299 | extern const st_effect_t *st_vibro_effect_fn(void); |
| 308 | extern const st_effect_t *st_vol_effect_fn(void); | 300 | extern const st_effect_t *st_vol_effect_fn(void); |
| 309 | 301 | ||
| 310 | /* Needed in sox.c | 302 | /* Needed in sox.c */ |
| 311 | */ | ||
| 312 | st_size_t st_trim_get_start(eff_t effp); | 303 | st_size_t st_trim_get_start(eff_t effp); |
| 313 | void st_trim_clear_start(eff_t effp); | 304 | void st_trim_clear_start(eff_t effp); |
| 314 | 305 | ||
| 306 | /* Needed in rate.c */ | ||
| 307 | int st_resample_start(eff_t effp); | ||
| 308 | int st_resample_getopts(eff_t effp, int n, char **argv); | ||
| 309 | int st_resample_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, st_size_t *isamp, st_size_t *osamp); | ||
| 310 | int st_resample_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp); | ||
| 311 | int st_resample_stop(eff_t effp); | ||
| 312 | |||
| 315 | #endif | 313 | #endif |
| @@ -45,7 +45,7 @@ typedef struct statstuff { · 44 unmodified lines | |||
| 45 | /* | 45 | /* |
| 46 | * Process options | 46 | * Process options |
| 47 | */ | 47 | */ |
| 48 | int st_stat_getopts(eff_t effp, int n, char **argv) | 48 | static int st_stat_getopts(eff_t effp, int n, char **argv) |
| 49 | { | 49 | { |
| 50 | stat_t stat = (stat_t) effp->priv; | 50 | stat_t stat = (stat_t) effp->priv; |
| 51 | 51 | ||
| @@ -96,7 +96,7 @@ int st_stat_getopts(eff_t effp, int n, char **argv) · 44 unmodified lines | |||
| 96 | /* | 96 | /* |
| 97 | * Prepare processing. | 97 | * Prepare processing. |
| 98 | */ | 98 | */ |
| 99 | int st_stat_start(eff_t effp) | 99 | static int st_stat_start(eff_t effp) |
| 100 | { | 100 | { |
| 101 | stat_t stat = (stat_t) effp->priv; | 101 | stat_t stat = (stat_t) effp->priv; |
| 102 | int i; | 102 | int i; |
| @@ -152,7 +152,7 @@ static void print_power_spectrum(unsigned samples, float rate, float *re_in, flo · 49 unmodified lines | |||
| 152 | * Return number of samples processed. | 152 | * Return number of samples processed. |
| 153 | */ | 153 | */ |
| 154 | 154 | ||
| 155 | int st_stat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 155 | static int st_stat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 156 | st_size_t *isamp, st_size_t *osamp) | 156 | st_size_t *isamp, st_size_t *osamp) |
| 157 | { | 157 | { |
| 158 | stat_t stat = (stat_t) effp->priv; | 158 | stat_t stat = (stat_t) effp->priv; |
| @@ -231,7 +231,7 @@ int st_stat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 72 unmodified lines | |||
| 231 | /* | 231 | /* |
| 232 | * Process tail of input samples. | 232 | * Process tail of input samples. |
| 233 | */ | 233 | */ |
| 234 | int st_stat_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 234 | static int st_stat_drain(eff_t effp, st_sample_t *obuf UNUSED, st_size_t *osamp) |
| 235 | { | 235 | { |
| 236 | stat_t stat = (stat_t) effp->priv; | 236 | stat_t stat = (stat_t) effp->priv; |
| 237 | 237 | ||
| @@ -256,7 +256,7 @@ int st_stat_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 18 unmodified lines | |||
| 256 | * Do anything required when you stop reading samples. | 256 | * Do anything required when you stop reading samples. |
| 257 | * Don't close input file! | 257 | * Don't close input file! |
| 258 | */ | 258 | */ |
| 259 | int st_stat_stop(eff_t effp) | 259 | static int st_stat_stop(eff_t effp) |
| 260 | { | 260 | { |
| 261 | stat_t stat = (stat_t) effp->priv; | 261 | stat_t stat = (stat_t) effp->priv; |
| 262 | double amp, scale, rms = 0, freq; | 262 | double amp, scale, rms = 0, freq; |
| @@ -111,19 +111,19 @@ · 110 unmodified lines | |||
| 111 | /* Define to the version of this package. */ | 111 | /* Define to the version of this package. */ |
| 112 | #undef PACKAGE_VERSION | 112 | #undef PACKAGE_VERSION |
| 113 | 113 | ||
| 114 | /* The size of a `char', as computed by sizeof. */ | 114 | /* The size of `char', as computed by sizeof. */ |
| 115 | #undef SIZEOF_CHAR | 115 | #undef SIZEOF_CHAR |
| 116 | 116 | ||
| 117 | /* The size of a `int', as computed by sizeof. */ | 117 | /* The size of `int', as computed by sizeof. */ |
| 118 | #undef SIZEOF_INT | 118 | #undef SIZEOF_INT |
| 119 | 119 | ||
| 120 | /* The size of a `long', as computed by sizeof. */ | 120 | /* The size of `long', as computed by sizeof. */ |
| 121 | #undef SIZEOF_LONG | 121 | #undef SIZEOF_LONG |
| 122 | 122 | ||
| 123 | /* The size of a `short', as computed by sizeof. */ | 123 | /* The size of `short', as computed by sizeof. */ |
| 124 | #undef SIZEOF_SHORT | 124 | #undef SIZEOF_SHORT |
| 125 | 125 | ||
| 126 | /* The size of a `void*', as computed by sizeof. */ | 126 | /* The size of `void*', as computed by sizeof. */ |
| 127 | #undef SIZEOF_VOIDP | 127 | #undef SIZEOF_VOIDP |
| 128 | 128 | ||
| 129 | /* Define to 1 if you have the ANSI C header files. */ | 129 | /* Define to 1 if you have the ANSI C header files. */ |
| @@ -54,7 +54,7 @@ static int st_checkformat(ft_t ft) · 53 unmodified lines | |||
| 54 | return ST_EOF; | 54 | return ST_EOF; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | if (ft->info.encoding == -1) | 57 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) |
| 58 | { | 58 | { |
| 59 | st_fail_errno(ft,ST_EFMT,"data encoding was not specified"); | 59 | st_fail_errno(ft,ST_EFMT,"data encoding was not specified"); |
| 60 | return ST_EOF; | 60 | return ST_EOF; |
| @@ -105,8 +105,8 @@ ft_t st_open_read(const char *path, const st_signalinfo_t *info, · 44 unmodified lines | |||
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | ft->info.size = -1; | 107 | ft->info.size = -1; |
| 108 | ft->info.encoding = -1; | 108 | ft->info.encoding = ST_ENCODING_UNKNOWN; |
| 109 | ft->info.channels = -1; | 109 | ft->info.channels = 0; |
| 110 | if (info) | 110 | if (info) |
| 111 | ft->info = *info; | 111 | ft->info = *info; |
| 112 | /* FIXME: Remove ft->swap from code */ | 112 | /* FIXME: Remove ft->swap from code */ |
| @@ -145,7 +145,7 @@ ft_t st_open_read(const char *path, const st_signalinfo_t *info, · 32 unmodified lines | |||
| 145 | * This is because libst usually doesn't set this for mono file | 145 | * This is because libst usually doesn't set this for mono file |
| 146 | * formats (for historical reasons). | 146 | * formats (for historical reasons). |
| 147 | */ | 147 | */ |
| 148 | if (ft->info.channels == -1) | 148 | if (ft->info.channels == 0) |
| 149 | ft->info.channels = 1; | 149 | ft->info.channels = 1; |
| 150 | 150 | ||
| 151 | if (st_checkformat(ft) ) | 151 | if (st_checkformat(ft) ) |
| @@ -229,8 +229,8 @@ ft_t st_open_write_instr(const char *path, const st_signalinfo_t *info, · 77 unmodified lines | |||
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | ft->info.size = -1; | 231 | ft->info.size = -1; |
| 232 | ft->info.encoding = -1; | 232 | ft->info.encoding = ST_ENCODING_UNKNOWN; |
| 233 | ft->info.channels = -1; | 233 | ft->info.channels = 0; |
| 234 | if (info) | 234 | if (info) |
| 235 | ft->info = *info; | 235 | ft->info = *info; |
| 236 | ft->mode = 'w'; | 236 | ft->mode = 'w'; |
| @@ -314,12 +314,12 @@ ft_t st_open_write(const char *path, const st_signalinfo_t *info, · 77 unmodified lines | |||
| 314 | return st_open_write_instr(path, info, filetype, comment, NULL, NULL); | 314 | return st_open_write_instr(path, info, filetype, comment, NULL, NULL); |
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | st_ssize_t st_read(ft_t ft, st_sample_t *buf, st_size_t len) | 317 | st_size_t st_read(ft_t ft, st_sample_t *buf, st_size_t len) |
| 318 | { | 318 | { |
| 319 | return (*ft->h->read)(ft, buf, len); | 319 | return (*ft->h->read)(ft, buf, len); |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | st_ssize_t st_write(ft_t ft, const st_sample_t *buf, st_size_t len) | 322 | st_size_t st_write(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 323 | { | 323 | { |
| 324 | return (*ft->h->write)(ft, buf, len); | 324 | return (*ft->h->write)(ft, buf, len); |
| 325 | } | 325 | } |
| @@ -55,36 +55,24 @@ typedef struct · 54 unmodified lines | |||
| 55 | */ | 55 | */ |
| 56 | stretch_status_t state; /* automaton status */ | 56 | stretch_status_t state; /* automaton status */ |
| 57 | 57 | ||
| 58 | int size; /* buffer size */ | 58 | st_size_t size; /* buffer size */ |
| 59 | int index; /* next available element */ | 59 | st_size_t index; /* next available element */ |
| 60 | st_sample_t *ibuf; /* input buffer */ | 60 | st_sample_t *ibuf; /* input buffer */ |
| 61 | int ishift; /* input shift */ | 61 | int ishift; /* input shift */ |
| 62 | 62 | ||
| 63 | int oindex; /* next evailable element */ | 63 | st_size_t oindex; /* next evailable element */ |
| 64 | double * obuf; /* output buffer */ | 64 | double * obuf; /* output buffer */ |
| 65 | int oshift; /* output shift */ | 65 | st_size_t oshift; /* output shift */ |
| 66 | 66 | ||
| 67 | int fsize; /* fading size */ | 67 | st_size_t fsize; /* fading size */ |
| 68 | double * fbuf; /* fading, 1.0 -> 0.0 */ | 68 | double * fbuf; /* fading, 1.0 -> 0.0 */ |
| 69 | 69 | ||
| 70 | } * stretch_t; | 70 | } * stretch_t; |
| 71 | 71 | ||
| 72 | /* | ||
| 73 | static void debug(stretch_t s, char * where) | ||
| 74 | { | ||
| 75 | st_debug( | ||
| 76 | "%s: (f=%.2f w=%.2f r=%.2f f=%.2f)" | ||
| 77 | " st=%d s=%d ii=%d is=%d oi=%d os=%d fs=%d\n", | ||
| 78 | where, s->factor, s->window, s->shift, s->fading, | ||
| 79 | s->state, s->size, s->index, s->ishift, | ||
| 80 | s->oindex, s->oshift, s->fsize); | ||
| 81 | } | ||
| 82 | */ | ||
| 83 | |||
| 84 | /* | 72 | /* |
| 85 | * Process options | 73 | * Process options |
| 86 | */ | 74 | */ |
| 87 | int st_stretch_getopts(eff_t effp, int n, char **argv) | 75 | static int st_stretch_getopts(eff_t effp, int n, char **argv) |
| 88 | { | 76 | { |
| 89 | char usage[1024]; | 77 | char usage[1024]; |
| 90 | stretch_t stretch = (stretch_t) effp->priv; | 78 | stretch_t stretch = (stretch_t) effp->priv; |
| @@ -170,10 +158,10 @@ int st_stretch_getopts(eff_t effp, int n, char **argv) · 79 unmodified lines | |||
| 170 | /* | 158 | /* |
| 171 | * Start processing | 159 | * Start processing |
| 172 | */ | 160 | */ |
| 173 | int st_stretch_start(eff_t effp) | 161 | static int st_stretch_start(eff_t effp) |
| 174 | { | 162 | { |
| 175 | stretch_t stretch = (stretch_t) effp->priv; | 163 | stretch_t stretch = (stretch_t) effp->priv; |
| 176 | register int i; | 164 | st_size_t i; |
| 177 | 165 | ||
| 178 | /* not necessary. taken care by effect processing? */ | 166 | /* not necessary. taken care by effect processing? */ |
| 179 | if (effp->outinfo.channels != effp->ininfo.channels) | 167 | if (effp->outinfo.channels != effp->ininfo.channels) |
| @@ -199,7 +187,7 @@ int st_stretch_start(eff_t effp) · 19 unmodified lines | |||
| 199 | sizeof(st_sample_t)); | 187 | sizeof(st_sample_t)); |
| 200 | 188 | ||
| 201 | /* the shift ratio deal with the longest of ishift/oshift | 189 | /* the shift ratio deal with the longest of ishift/oshift |
| 202 | hence ishift<=size and oshift<=size. should be asserted. | 190 | hence ishift<=size and oshift<=size. FIXME: should be asserted. |
| 203 | */ | 191 | */ |
| 204 | if (stretch->factor < 1.0) | 192 | if (stretch->factor < 1.0) |
| 205 | { | 193 | { |
| @@ -246,7 +234,11 @@ int st_stretch_start(eff_t effp) · 40 unmodified lines | |||
| 246 | } else if (stretch->fsize==1) | 234 | } else if (stretch->fsize==1) |
| 247 | stretch->fbuf[0] = 1.0; | 235 | stretch->fbuf[0] = 1.0; |
| 248 | 236 | ||
| 249 | /* debug(stretch, "start"); */ | 237 | st_debug("start: (f=%.2f w=%.2f r=%.2f f=%.2f)" |
| 238 | " st=%d s=%d ii=%d is=%d oi=%d os=%d fs=%d\n", | ||
| 239 | stretch->factor, stretch->window, stretch->shift, stretch->fading, | ||
| 240 | stretch->state, stretch->size, stretch->index, stretch->ishift, | ||
| 241 | stretch->oindex, stretch->oshift, stretch->fsize); | ||
| 250 | 242 | ||
| 251 | return ST_SUCCESS; | 243 | return ST_SUCCESS; |
| 252 | } | 244 | } |
| @@ -276,12 +268,12 @@ static void combine(stretch_t stretch) · 23 unmodified lines | |||
| 276 | /* | 268 | /* |
| 277 | * Processes flow. | 269 | * Processes flow. |
| 278 | */ | 270 | */ |
| 279 | int st_stretch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 271 | static int st_stretch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 280 | st_size_t *isamp, st_size_t *osamp) | 272 | st_size_t *isamp, st_size_t *osamp) |
| 281 | { | 273 | { |
| 282 | stretch_t stretch = (stretch_t) effp->priv; | 274 | stretch_t stretch = (stretch_t) effp->priv; |
| 283 | st_size_t iindex, oindex; | 275 | st_size_t iindex, oindex; |
| 284 | int i; | 276 | st_size_t i; |
| 285 | 277 | ||
| 286 | iindex = 0; | 278 | iindex = 0; |
| 287 | oindex = 0; | 279 | oindex = 0; |
| @@ -353,10 +345,10 @@ int st_stretch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 65 unmodified lines | |||
| 353 | * Drain buffer at the end | 345 | * Drain buffer at the end |
| 354 | * maybe not correct ? end might be artificially faded? | 346 | * maybe not correct ? end might be artificially faded? |
| 355 | */ | 347 | */ |
| 356 | int st_stretch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | 348 | static int st_stretch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) |
| 357 | { | 349 | { |
| 358 | stretch_t stretch = (stretch_t) effp->priv; | 350 | stretch_t stretch = (stretch_t) effp->priv; |
| 359 | register int i; | 351 | st_size_t i; |
| 360 | st_size_t oindex; | 352 | st_size_t oindex; |
| 361 | 353 | ||
| 362 | oindex = 0; | 354 | oindex = 0; |
| @@ -393,7 +385,7 @@ int st_stretch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 30 unmodified lines | |||
| 393 | * Do anything required when you stop reading samples. | 385 | * Do anything required when you stop reading samples. |
| 394 | * Don't close input file! | 386 | * Don't close input file! |
| 395 | */ | 387 | */ |
| 396 | int st_stretch_stop(eff_t effp) | 388 | static int st_stretch_stop(eff_t effp) |
| 397 | { | 389 | { |
| 398 | stretch_t stretch = (stretch_t) effp->priv; | 390 | stretch_t stretch = (stretch_t) effp->priv; |
| 399 | 391 | ||
| @@ -63,7 +63,7 @@ int st_sunstartread(ft_t ft) · 62 unmodified lines | |||
| 63 | 63 | ||
| 64 | if (ft->info.rate == 0.0) ft->info.rate = 8000; | 64 | if (ft->info.rate == 0.0) ft->info.rate = 8000; |
| 65 | if (ft->info.size == -1) ft->info.size = ST_SIZE_BYTE; | 65 | if (ft->info.size == -1) ft->info.size = ST_SIZE_BYTE; |
| 66 | if (ft->info.encoding == -1) ft->info.encoding = ST_ENCODING_ULAW; | 66 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) ft->info.encoding = ST_ENCODING_ULAW; |
| 67 | 67 | ||
| 68 | #ifdef __SVR4 | 68 | #ifdef __SVR4 |
| 69 | /* Read in old values, change to what we need and then send back */ | 69 | /* Read in old values, change to what we need and then send back */ |
| @@ -78,7 +78,7 @@ int st_sunstartread(ft_t ft) · 8 unmodified lines | |||
| 78 | } | 78 | } |
| 79 | #endif | 79 | #endif |
| 80 | 80 | ||
| 81 | // If simple hardware detected in force data to ulaw. | 81 | /* If simple hardware detected in force data to ulaw. */ |
| 82 | if (simple_hw) | 82 | if (simple_hw) |
| 83 | { | 83 | { |
| 84 | if (ft->info.size == ST_SIZE_BYTE) | 84 | if (ft->info.size == ST_SIZE_BYTE) |
| @@ -125,7 +125,7 @@ int st_sunstartread(ft_t ft) · 40 unmodified lines | |||
| 125 | return(ST_EOF); | 125 | return(ST_EOF); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | if (ft->info.channels == -1) ft->info.channels = 1; | 128 | if (ft->info.channels == 0) ft->info.channels = 1; |
| 129 | else if (ft->info.channels > 1) { | 129 | else if (ft->info.channels > 1) { |
| 130 | st_report("Warning: some Sun audio devices can not play stereo"); | 130 | st_report("Warning: some Sun audio devices can not play stereo"); |
| 131 | st_report("at all or sometimes only with signed words. If the"); | 131 | st_report("at all or sometimes only with signed words. If the"); |
| @@ -233,7 +233,7 @@ int st_sunstartwrite(ft_t ft) · 101 unmodified lines | |||
| 233 | 233 | ||
| 234 | if (ft->info.rate == 0.0) ft->info.rate = 8000; | 234 | if (ft->info.rate == 0.0) ft->info.rate = 8000; |
| 235 | if (ft->info.size == -1) ft->info.size = ST_SIZE_BYTE; | 235 | if (ft->info.size == -1) ft->info.size = ST_SIZE_BYTE; |
| 236 | if (ft->info.encoding == -1) ft->info.encoding = ST_ENCODING_ULAW; | 236 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) ft->info.encoding = ST_ENCODING_ULAW; |
| 237 | 237 | ||
| 238 | if (ft->info.size == ST_SIZE_BYTE) { | 238 | if (ft->info.size == ST_SIZE_BYTE) { |
| 239 | samplesize = 8; | 239 | samplesize = 8; |
| @@ -266,7 +266,7 @@ int st_sunstartwrite(ft_t ft) · 26 unmodified lines | |||
| 266 | samplesize = 16; | 266 | samplesize = 16; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | if (ft->info.channels == -1) ft->info.channels = 1; | 269 | if (ft->info.channels == 0) ft->info.channels = 1; |
| 270 | else if (ft->info.channels > 1) ft->info.channels = 2; | 270 | else if (ft->info.channels > 1) ft->info.channels = 2; |
| 271 | 271 | ||
| 272 | /* Read in old values, change to what we need and then send back */ | 272 | /* Read in old values, change to what we need and then send back */ |
| @@ -26,7 +26,7 @@ typedef struct swapstuff { · 25 unmodified lines | |||
| 26 | * Don't do initialization now. | 26 | * Don't do initialization now. |
| 27 | * The 'info' fields are not yet filled in. | 27 | * The 'info' fields are not yet filled in. |
| 28 | */ | 28 | */ |
| 29 | int st_swap_getopts(eff_t effp, int n, char **argv) | 29 | static int st_swap_getopts(eff_t effp, int n, char **argv) |
| 30 | { | 30 | { |
| 31 | swap_t swap = (swap_t) effp->priv; | 31 | swap_t swap = (swap_t) effp->priv; |
| 32 | 32 | ||
| @@ -62,7 +62,7 @@ int st_swap_getopts(eff_t effp, int n, char **argv) · 29 unmodified lines | |||
| 62 | * Prepare processing. | 62 | * Prepare processing. |
| 63 | * Do all initializations. | 63 | * Do all initializations. |
| 64 | */ | 64 | */ |
| 65 | int st_swap_start(eff_t effp) | 65 | static int st_swap_start(eff_t effp) |
| 66 | { | 66 | { |
| 67 | swap_t swap = (swap_t) effp->priv; | 67 | swap_t swap = (swap_t) effp->priv; |
| 68 | 68 | ||
| @@ -128,7 +128,7 @@ int st_swap_start(eff_t effp) · 59 unmodified lines | |||
| 128 | * Processed signed long samples from ibuf to obuf. | 128 | * Processed signed long samples from ibuf to obuf. |
| 129 | * Return number of samples processed. | 129 | * Return number of samples processed. |
| 130 | */ | 130 | */ |
| 131 | int st_swap_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 131 | static int st_swap_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 132 | st_size_t *isamp, st_size_t *osamp) | 132 | st_size_t *isamp, st_size_t *osamp) |
| 133 | { | 133 | { |
| 134 | swap_t swap = (swap_t) effp->priv; | 134 | swap_t swap = (swap_t) effp->priv; |
| @@ -178,26 +178,6 @@ int st_swap_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 43 unmodified lines | |||
| 178 | return (ST_SUCCESS); | 178 | return (ST_SUCCESS); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | /* | ||
| 182 | * Drain out remaining samples if the effect generates any. | ||
| 183 | */ | ||
| 184 | |||
| 185 | int st_swap_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | ||
| 186 | { | ||
| 187 | *osamp = 0; | ||
| 188 | return ST_EOF; | ||
| 189 | } | ||
| 190 | |||
| 191 | /* | ||
| 192 | * Do anything required when you stop reading samples. | ||
| 193 | * (free allocated memory, etc.) | ||
| 194 | */ | ||
| 195 | int st_swap_stop(eff_t effp) | ||
| 196 | { | ||
| 197 | /* nothing to do */ | ||
| 198 | return (ST_SUCCESS); | ||
| 199 | } | ||
| 200 | |||
| 201 | static st_effect_t st_swap_effect = { | 181 | static st_effect_t st_swap_effect = { |
| 202 | "swap", | 182 | "swap", |
| 203 | "Usage: swap [1 2 | 1 2 3 4]", | 183 | "Usage: swap [1 2 | 1 2 3 4]", |
| @@ -205,8 +185,8 @@ static st_effect_t st_swap_effect = { · 1 unmodified line | |||
| 205 | st_swap_getopts, | 185 | st_swap_getopts, |
| 206 | st_swap_start, | 186 | st_swap_start, |
| 207 | st_swap_flow, | 187 | st_swap_flow, |
| 208 | st_swap_drain, | 188 | st_effect_nothing_drain, |
| 209 | st_swap_stop | 189 | st_effect_nothing |
| 210 | }; | 190 | }; |
| 211 | 191 | ||
| 212 | const st_effect_t *st_swap_effect_fn(void) | 192 | const st_effect_t *st_swap_effect_fn(void) |
| @@ -49,14 +49,14 @@ enum_item const synth_type[] = { · 48 unmodified lines | |||
| 49 | ENUM_ITEM(SYNTH_,PINKNOISE ) | 49 | ENUM_ITEM(SYNTH_,PINKNOISE ) |
| 50 | ENUM_ITEM(SYNTH_,BROWNNOISE) | 50 | ENUM_ITEM(SYNTH_,BROWNNOISE) |
| 51 | ENUM_ITEM(SYNTH_,EXP ) | 51 | ENUM_ITEM(SYNTH_,EXP ) |
| 52 | {0}}; | 52 | {0, 0}}; |
| 53 | 53 | ||
| 54 | enum_item const combine_type[] = { | 54 | enum_item const combine_type[] = { |
| 55 | ENUM_ITEM(SYNTH_,CREATE) | 55 | ENUM_ITEM(SYNTH_,CREATE) |
| 56 | ENUM_ITEM(SYNTH_,MIX ) | 56 | ENUM_ITEM(SYNTH_,MIX ) |
| 57 | ENUM_ITEM(SYNTH_,AMOD ) | 57 | ENUM_ITEM(SYNTH_,AMOD ) |
| 58 | ENUM_ITEM(SYNTH_,FMOD ) | 58 | ENUM_ITEM(SYNTH_,FMOD ) |
| 59 | {0}}; | 59 | {0, 0}}; |
| 60 | 60 | ||
| 61 | /* do not ask me for the colored noise, i copied the | 61 | /* do not ask me for the colored noise, i copied the |
| 62 | * algorithm somewhere... | 62 | * algorithm somewhere... |
| @@ -97,7 +97,7 @@ typedef struct{ · 34 unmodified lines | |||
| 97 | } PinkNoise; | 97 | } PinkNoise; |
| 98 | 98 | ||
| 99 | /* Setup PinkNoise structure for N rows of generators. */ | 99 | /* Setup PinkNoise structure for N rows of generators. */ |
| 100 | void InitializePinkNoise( PinkNoise *pink, int numRows ) | 100 | static void InitializePinkNoise( PinkNoise *pink, int numRows ) |
| 101 | { | 101 | { |
| 102 | int i; | 102 | int i; |
| 103 | long pmax; | 103 | long pmax; |
| @@ -112,7 +112,7 @@ void InitializePinkNoise( PinkNoise *pink, int numRows ) · 8 unmodified lines | |||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | /* Generate Pink noise values between -1.0 and +1.0 */ | 114 | /* Generate Pink noise values between -1.0 and +1.0 */ |
| 115 | float GeneratePinkNoise( PinkNoise *pink ) | 115 | static float GeneratePinkNoise( PinkNoise *pink ) |
| 116 | { | 116 | { |
| 117 | long newRandom; | 117 | long newRandom; |
| 118 | long sum; | 118 | long sum; |
| @@ -238,7 +238,7 @@ static void parmcopy(synth_t sy, int s, int d){ · 119 unmodified lines | |||
| 238 | * Don't do initialization now. | 238 | * Don't do initialization now. |
| 239 | * The 'info' fields are not yet filled in. | 239 | * The 'info' fields are not yet filled in. |
| 240 | */ | 240 | */ |
| 241 | int st_synth_getopts(eff_t effp, int n, char **argv) | 241 | static int st_synth_getopts(eff_t effp, int n, char **argv) |
| 242 | { | 242 | { |
| 243 | int argn; | 243 | int argn; |
| 244 | char *hlp; | 244 | char *hlp; |
| @@ -372,7 +372,7 @@ int st_synth_getopts(eff_t effp, int n, char **argv) · 127 unmodified lines | |||
| 372 | * Prepare processing. | 372 | * Prepare processing. |
| 373 | * Do all initializations. | 373 | * Do all initializations. |
| 374 | */ | 374 | */ |
| 375 | int st_synth_start(eff_t effp) | 375 | static int st_synth_start(eff_t effp) |
| 376 | { | 376 | { |
| 377 | int i; | 377 | int i; |
| 378 | int c; | 378 | int c; |
| @@ -664,7 +664,7 @@ static st_sample_t do_synth(st_sample_t iv, synth_t synth, int c){ · 285 unmodified lines | |||
| 664 | /* | 664 | /* |
| 665 | * Processed signed long samples from ibuf to obuf. | 665 | * Processed signed long samples from ibuf to obuf. |
| 666 | */ | 666 | */ |
| 667 | int st_synth_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 667 | static int st_synth_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 668 | st_size_t *isamp, st_size_t *osamp) | 668 | st_size_t *isamp, st_size_t *osamp) |
| 669 | { | 669 | { |
| 670 | synth_t synth = (synth_t) effp->priv; | 670 | synth_t synth = (synth_t) effp->priv; |
| @@ -701,26 +701,6 @@ int st_synth_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 30 unmodified lines | |||
| 701 | return result; | 701 | return result; |
| 702 | } | 702 | } |
| 703 | 703 | ||
| 704 | /* | ||
| 705 | * Drain out remaining samples if the effect generates any. | ||
| 706 | */ | ||
| 707 | |||
| 708 | int st_synth_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) | ||
| 709 | { | ||
| 710 | *osamp = 0; | ||
| 711 | return ST_EOF; | ||
| 712 | } | ||
| 713 | |||
| 714 | /* | ||
| 715 | * Do anything required when you stop reading samples. | ||
| 716 | * (free allocated memory, etc.) | ||
| 717 | */ | ||
| 718 | int st_synth_stop(eff_t effp) | ||
| 719 | { | ||
| 720 | /* nothing to do */ | ||
| 721 | return (ST_SUCCESS); | ||
| 722 | } | ||
| 723 | |||
| 724 | static st_effect_t st_synth_effect = { | 704 | static st_effect_t st_synth_effect = { |
| 725 | "synth", | 705 | "synth", |
| 726 | "Usage: synth [len] {[type] [combine] [freq[-freq2]] [off] [ph] [p1] [p2] [p3]}\n" | 706 | "Usage: synth [len] {[type] [combine] [freq[-freq2]] [off] [ph] [p1] [p2] [p3]}\n" |
| @@ -741,8 +721,8 @@ static st_effect_t st_synth_effect = { · 14 unmodified lines | |||
| 741 | st_synth_getopts, | 721 | st_synth_getopts, |
| 742 | st_synth_start, | 722 | st_synth_start, |
| 743 | st_synth_flow, | 723 | st_synth_flow, |
| 744 | st_synth_drain, | 724 | st_effect_nothing_drain, |
| 745 | st_synth_stop | 725 | st_effect_nothing |
| 746 | }; | 726 | }; |
| 747 | 727 | ||
| 748 | const st_effect_t *st_synth_effect_fn(void) | 728 | const st_effect_t *st_synth_effect_fn(void) |
| @@ -37,7 +37,7 @@ typedef struct · 36 unmodified lines | |||
| 37 | /* | 37 | /* |
| 38 | * Process options | 38 | * Process options |
| 39 | */ | 39 | */ |
| 40 | int st_trim_getopts(eff_t effp, int n, char **argv) | 40 | static int st_trim_getopts(eff_t effp, int n, char **argv) |
| 41 | { | 41 | { |
| 42 | trim_t trim = (trim_t) effp->priv; | 42 | trim_t trim = (trim_t) effp->priv; |
| 43 | 43 | ||
| @@ -88,7 +88,7 @@ int st_trim_getopts(eff_t effp, int n, char **argv) · 44 unmodified lines | |||
| 88 | /* | 88 | /* |
| 89 | * Start processing | 89 | * Start processing |
| 90 | */ | 90 | */ |
| 91 | int st_trim_start(eff_t effp) | 91 | static int st_trim_start(eff_t effp) |
| 92 | { | 92 | { |
| 93 | trim_t trim = (trim_t) effp->priv; | 93 | trim_t trim = (trim_t) effp->priv; |
| 94 | 94 | ||
| @@ -128,7 +128,7 @@ int st_trim_start(eff_t effp) · 33 unmodified lines | |||
| 128 | * Place in buf[]. | 128 | * Place in buf[]. |
| 129 | * Return number of samples read. | 129 | * Return number of samples read. |
| 130 | */ | 130 | */ |
| 131 | int st_trim_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 131 | static int st_trim_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 132 | st_size_t *isamp, st_size_t *osamp) | 132 | st_size_t *isamp, st_size_t *osamp) |
| 133 | { | 133 | { |
| 134 | int finished = 0; | 134 | int finished = 0; |
| @@ -195,7 +195,7 @@ int st_trim_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 60 unmodified lines | |||
| 195 | * Do anything required when you stop reading samples. | 195 | * Do anything required when you stop reading samples. |
| 196 | * Don't close input file! | 196 | * Don't close input file! |
| 197 | */ | 197 | */ |
| 198 | int st_trim_stop(eff_t effp) | 198 | static int st_trim_stop(eff_t effp) |
| 199 | { | 199 | { |
| 200 | trim_t trim = (trim_t) effp->priv; | 200 | trim_t trim = (trim_t) effp->priv; |
| 201 | 201 | ||
| @@ -227,7 +227,7 @@ static st_effect_t st_trim_effect = { · 25 unmodified lines | |||
| 227 | st_trim_start, | 227 | st_trim_start, |
| 228 | st_trim_flow, | 228 | st_trim_flow, |
| 229 | st_effect_nothing_drain, | 229 | st_effect_nothing_drain, |
| 230 | st_effect_nothing | 230 | st_trim_stop |
| 231 | }; | 231 | }; |
| 232 | 232 | ||
| 233 | const st_effect_t *st_trim_effect_fn(void) | 233 | const st_effect_t *st_trim_effect_fn(void) |
| @@ -74,7 +74,7 @@ static st_size_t writedone=0; · 73 unmodified lines | |||
| 74 | * size and encoding of samples, | 74 | * size and encoding of samples, |
| 75 | * mono/stereo/quad. | 75 | * mono/stereo/quad. |
| 76 | */ | 76 | */ |
| 77 | int st_txwstartread(ft_t ft) | 77 | static int st_txwstartread(ft_t ft) |
| 78 | { | 78 | { |
| 79 | int c; | 79 | int c; |
| 80 | char filetype[7]; | 80 | char filetype[7]; |
| @@ -186,10 +186,10 @@ int st_txwstartread(ft_t ft) · 105 unmodified lines | |||
| 186 | * Return number of samples read. | 186 | * Return number of samples read. |
| 187 | */ | 187 | */ |
| 188 | 188 | ||
| 189 | st_ssize_t st_txwread(ft_t ft, st_sample_t *buf, st_size_t len) | 189 | static st_size_t st_txwread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 190 | { | 190 | { |
| 191 | txw_t sk = (txw_t) ft->priv; | 191 | txw_t sk = (txw_t) ft->priv; |
| 192 | int done = 0; | 192 | st_size_t done = 0; |
| 193 | unsigned char uc1,uc2,uc3; | 193 | unsigned char uc1,uc2,uc3; |
| 194 | unsigned short s1,s2; | 194 | unsigned short s1,s2; |
| 195 | 195 | ||
| @@ -236,16 +236,7 @@ st_ssize_t st_txwread(ft_t ft, st_sample_t *buf, st_size_t len) · 40 unmodified lines | |||
| 236 | return done; | 236 | return done; |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | /* | 239 | static int st_txwstartwrite(ft_t ft) |
| 240 | * Do anything required when you stop reading samples. | ||
| 241 | * Don't close input file! | ||
| 242 | */ | ||
| 243 | int st_txwstopread(ft_t ft) | ||
| 244 | { | ||
| 245 | return(ST_SUCCESS); | ||
| 246 | } | ||
| 247 | |||
| 248 | int st_txwstartwrite(ft_t ft) | ||
| 249 | { | 240 | { |
| 250 | struct WaveHeader_ WH; | 241 | struct WaveHeader_ WH; |
| 251 | 242 | ||
| @@ -276,9 +267,9 @@ int st_txwstartwrite(ft_t ft) · 24 unmodified lines | |||
| 276 | return(ST_SUCCESS); | 267 | return(ST_SUCCESS); |
| 277 | } | 268 | } |
| 278 | 269 | ||
| 279 | st_ssize_t st_txwwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 270 | static st_size_t st_txwwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 280 | { | 271 | { |
| 281 | int i; | 272 | st_size_t i; |
| 282 | unsigned int w1,w2; | 273 | unsigned int w1,w2; |
| 283 | 274 | ||
| 284 | tx16w_len += len; | 275 | tx16w_len += len; |
| @@ -299,7 +290,7 @@ st_ssize_t st_txwwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 14 unmodified lines | |||
| 299 | return(len); | 290 | return(len); |
| 300 | } | 291 | } |
| 301 | 292 | ||
| 302 | int st_txwstopwrite(ft_t ft) | 293 | static int st_txwstopwrite(ft_t ft) |
| 303 | { | 294 | { |
| 304 | struct WaveHeader_ WH; | 295 | struct WaveHeader_ WH; |
| 305 | int AttackLength, LoopLength, i; | 296 | int AttackLength, LoopLength, i; |
| @@ -388,7 +379,7 @@ static st_format_t st_txw_format = { · 82 unmodified lines | |||
| 388 | 0, | 379 | 0, |
| 389 | st_txwstartread, | 380 | st_txwstartread, |
| 390 | st_txwread, | 381 | st_txwread, |
| 391 | st_txwstopread, | 382 | st_format_nothing, |
| 392 | st_txwstartwrite, | 383 | st_txwstartwrite, |
| 393 | st_txwwrite, | 384 | st_txwwrite, |
| 394 | st_txwstopwrite, | 385 | st_txwstopwrite, |
| @@ -16,9 +16,9 @@ · 15 unmodified lines | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include "st_i.h" | 18 | #include "st_i.h" |
| 19 | #include <stddef.h> | ||
| 19 | #include <string.h> | 20 | #include <string.h> |
| 20 | #include <ctype.h> | 21 | #include <ctype.h> |
| 21 | |||
| 22 | #include <stdarg.h> | 22 | #include <stdarg.h> |
| 23 | 23 | ||
| 24 | struct st_output_message_s | 24 | struct st_output_message_s |
| @@ -49,8 +49,8 @@ void st_output_message(FILE * file, st_output_message_t message) · 24 unmodified lines | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | dot_pos = strrchr(drivername, '.'); | 51 | dot_pos = strrchr(drivername, '.'); |
| 52 | if (dot_pos != NULL && dot_pos - drivername <= sizeof(buffer) - 1) { | 52 | if (dot_pos != NULL && dot_pos - drivername <= (ptrdiff_t)(sizeof(buffer) - 1)) { |
| 53 | strncpy(buffer, drivername, dot_pos - drivername); | 53 | strncpy(buffer, drivername, (size_t)(dot_pos - drivername)); |
| 54 | buffer[dot_pos - drivername] = '\0'; | 54 | buffer[dot_pos - drivername] = '\0'; |
| 55 | drivername = buffer; | 55 | drivername = buffer; |
| 56 | } | 56 | } |
| @@ -43,7 +43,7 @@ typedef struct vibrostuff { · 42 unmodified lines | |||
| 43 | /* | 43 | /* |
| 44 | * Process options | 44 | * Process options |
| 45 | */ | 45 | */ |
| 46 | int st_vibro_getopts(eff_t effp, int n, char **argv) | 46 | static int st_vibro_getopts(eff_t effp, int n, char **argv) |
| 47 | { | 47 | { |
| 48 | vibro_t vibro = (vibro_t) effp->priv; | 48 | vibro_t vibro = (vibro_t) effp->priv; |
| 49 | 49 | ||
| @@ -66,7 +66,7 @@ int st_vibro_getopts(eff_t effp, int n, char **argv) · 16 unmodified lines | |||
| 66 | /* | 66 | /* |
| 67 | * Prepare processing. | 67 | * Prepare processing. |
| 68 | */ | 68 | */ |
| 69 | int st_vibro_start(eff_t effp) | 69 | static int st_vibro_start(eff_t effp) |
| 70 | { | 70 | { |
| 71 | vibro_t vibro = (vibro_t) effp->priv; | 71 | vibro_t vibro = (vibro_t) effp->priv; |
| 72 | 72 | ||
| @@ -89,7 +89,7 @@ int st_vibro_start(eff_t effp) · 16 unmodified lines | |||
| 89 | * Return number of samples processed. | 89 | * Return number of samples processed. |
| 90 | */ | 90 | */ |
| 91 | 91 | ||
| 92 | int st_vibro_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 92 | static int st_vibro_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 93 | st_size_t *isamp, st_size_t *osamp) | 93 | st_size_t *isamp, st_size_t *osamp) |
| 94 | { | 94 | { |
| 95 | vibro_t vibro = (vibro_t) effp->priv; | 95 | vibro_t vibro = (vibro_t) effp->priv; |
| @@ -114,16 +114,6 @@ int st_vibro_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 18 unmodified lines | |||
| 114 | return (ST_SUCCESS); | 114 | return (ST_SUCCESS); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | /* | ||
| 118 | * Do anything required when you stop reading samples. | ||
| 119 | * Don't close input file! | ||
| 120 | */ | ||
| 121 | int st_vibro_stop(eff_t effp) | ||
| 122 | { | ||
| 123 | /* nothing to do */ | ||
| 124 | return (ST_SUCCESS); | ||
| 125 | } | ||
| 126 | |||
| 127 | static st_effect_t st_vibro_effect = { | 117 | static st_effect_t st_vibro_effect = { |
| 128 | "vibro", | 118 | "vibro", |
| 129 | "Usage: vibro speed [ depth ]", | 119 | "Usage: vibro speed [ depth ]", |
| @@ -200,7 +200,6 @@ typedef struct vocstuff { · 199 unmodified lines | |||
| 200 | /* Prototypes for internal functions */ | 200 | /* Prototypes for internal functions */ |
| 201 | static int getblock(ft_t); | 201 | static int getblock(ft_t); |
| 202 | static void blockstart(ft_t); | 202 | static void blockstart(ft_t); |
| 203 | static void blockstop(ft_t); | ||
| 204 | 203 | ||
| 205 | /* Conversion macros (from raw.c) */ | 204 | /* Conversion macros (from raw.c) */ |
| 206 | #define ST_ALAW_BYTE_TO_SAMPLE(d) ((st_sample_t)(st_alaw2linear16(d)) << 16) | 205 | #define ST_ALAW_BYTE_TO_SAMPLE(d) ((st_sample_t)(st_alaw2linear16(d)) << 16) |
| @@ -210,7 +209,7 @@ static void blockstop(ft_t); · 3 unmodified lines | |||
| 210 | /*----------------------------------------------------------------- | 209 | /*----------------------------------------------------------------- |
| 211 | * st_vocstartread() -- start reading a VOC file | 210 | * st_vocstartread() -- start reading a VOC file |
| 212 | *-----------------------------------------------------------------*/ | 211 | *-----------------------------------------------------------------*/ |
| 213 | int st_vocstartread(ft_t ft) | 212 | static int st_vocstartread(ft_t ft) |
| 214 | { | 213 | { |
| 215 | int rtn = ST_SUCCESS; | 214 | int rtn = ST_SUCCESS; |
| 216 | char header[20]; | 215 | char header[20]; |
| @@ -306,7 +305,7 @@ int st_vocstartread(ft_t ft) · 89 unmodified lines | |||
| 306 | } | 305 | } |
| 307 | 306 | ||
| 308 | /* setup number of channels */ | 307 | /* setup number of channels */ |
| 309 | if (ft->info.channels == -1) | 308 | if (ft->info.channels == 0) |
| 310 | ft->info.channels = v->channels; | 309 | ft->info.channels = v->channels; |
| 311 | 310 | ||
| 312 | return(ST_SUCCESS); | 311 | return(ST_SUCCESS); |
| @@ -317,10 +316,10 @@ int st_vocstartread(ft_t ft) · 4 unmodified lines | |||
| 317 | * ANN: Major changes here to support multi-part files and files | 316 | * ANN: Major changes here to support multi-part files and files |
| 318 | * that do not have audio in block 9's. | 317 | * that do not have audio in block 9's. |
| 319 | *-----------------------------------------------------------------*/ | 318 | *-----------------------------------------------------------------*/ |
| 320 | st_ssize_t st_vocread(ft_t ft, st_sample_t *buf, st_size_t len) | 319 | static st_size_t st_vocread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 321 | { | 320 | { |
| 322 | vs_t v = (vs_t) ft->priv; | 321 | vs_t v = (vs_t) ft->priv; |
| 323 | int done = 0; | 322 | st_size_t done = 0; |
| 324 | int rc = 0; | 323 | int rc = 0; |
| 325 | int16_t sw; | 324 | int16_t sw; |
| 326 | unsigned char uc; | 325 | unsigned char uc; |
| @@ -405,15 +404,6 @@ st_ssize_t st_vocread(ft_t ft, st_sample_t *buf, st_size_t len) · 78 unmodified lines | |||
| 405 | return done; | 404 | return done; |
| 406 | } | 405 | } |
| 407 | 406 | ||
| 408 | /*----------------------------------------------------------------- | ||
| 409 | * st_vocstartread() -- start reading a VOC file | ||
| 410 | * nothing to do | ||
| 411 | *-----------------------------------------------------------------*/ | ||
| 412 | int st_vocstopread(ft_t ft) | ||
| 413 | { | ||
| 414 | return(ST_SUCCESS); | ||
| 415 | } | ||
| 416 | |||
| 417 | /* When saving samples in VOC format the following outline is followed: | 407 | /* When saving samples in VOC format the following outline is followed: |
| 418 | * If an 8-bit mono sample then use a VOC_DATA header. | 408 | * If an 8-bit mono sample then use a VOC_DATA header. |
| 419 | * If an 8-bit stereo sample then use a VOC_EXTENDED header followed | 409 | * If an 8-bit stereo sample then use a VOC_EXTENDED header followed |
| @@ -427,7 +417,7 @@ int st_vocstopread(ft_t ft) · 7 unmodified lines | |||
| 427 | * which will work with the oldest software (eg. an 8-bit mono sample | 417 | * which will work with the oldest software (eg. an 8-bit mono sample |
| 428 | * will be able to be played with a really old SB VOC player.) | 418 | * will be able to be played with a really old SB VOC player.) |
| 429 | */ | 419 | */ |
| 430 | int st_vocstartwrite(ft_t ft) | 420 | static int st_vocstartwrite(ft_t ft) |
| 431 | { | 421 | { |
| 432 | vs_t v = (vs_t) ft->priv; | 422 | vs_t v = (vs_t) ft->priv; |
| 433 | 423 | ||
| @@ -457,21 +447,21 @@ int st_vocstartwrite(ft_t ft) · 23 unmodified lines | |||
| 457 | ft->info.encoding = ST_ENCODING_UNSIGNED; | 447 | ft->info.encoding = ST_ENCODING_UNSIGNED; |
| 458 | else | 448 | else |
| 459 | ft->info.encoding = ST_ENCODING_SIGN2; | 449 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 460 | if (ft->info.channels == -1) | 450 | if (ft->info.channels == 0) |
| 461 | ft->info.channels = 1; | 451 | ft->info.channels = 1; |
| 462 | 452 | ||
| 463 | return(ST_SUCCESS); | 453 | return(ST_SUCCESS); |
| 464 | } | 454 | } |
| 465 | 455 | ||
| 466 | /*----------------------------------------------------------------- | 456 | /*----------------------------------------------------------------- |
| 467 | * st_vocstartread() -- start reading a VOC file | 457 | * st_vocwrite() -- write a VOC file |
| 468 | *-----------------------------------------------------------------*/ | 458 | *-----------------------------------------------------------------*/ |
| 469 | st_ssize_t st_vocwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 459 | static st_size_t st_vocwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 470 | { | 460 | { |
| 471 | vs_t v = (vs_t) ft->priv; | 461 | vs_t v = (vs_t) ft->priv; |
| 472 | unsigned char uc; | 462 | unsigned char uc; |
| 473 | int16_t sw; | 463 | int16_t sw; |
| 474 | st_ssize_t done = 0; | 464 | st_size_t done = 0; |
| 475 | 465 | ||
| 476 | if (v->samples == 0) { | 466 | if (v->samples == 0) { |
| 477 | /* No silence packing yet. */ | 467 | /* No silence packing yet. */ |
| @@ -492,10 +482,40 @@ st_ssize_t st_vocwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 14 unmodified lines | |||
| 492 | return done; | 482 | return done; |
| 493 | } | 483 | } |
| 494 | 484 | ||
| 485 | /*----------------------------------------------------------------- | ||
| 486 | * blockstop() -- stop an output block | ||
| 487 | * End the current data or silence block. | ||
| 488 | *-----------------------------------------------------------------*/ | ||
| 489 | static void blockstop(ft_t ft) | ||
| 490 | { | ||
| 491 | vs_t v = (vs_t) ft->priv; | ||
| 492 | st_sample_t datum; | ||
| 493 | |||
| 494 | st_writeb(ft, 0); /* End of file block code */ | ||
| 495 | st_seeki(ft, v->blockseek, 0); /* seek back to block length */ | ||
| 496 | st_seeki(ft, 1, 1); /* seek forward one */ | ||
| 497 | if (v->silent) { | ||
| 498 | st_writew(ft, v->samples); | ||
| 499 | } else { | ||
| 500 | if (ft->info.size == ST_SIZE_BYTE) { | ||
| 501 | if (ft->info.channels > 1) { | ||
| 502 | st_seeki(ft, 8, 1); /* forward 7 + 1 for new block header */ | ||
| 503 | } | ||
| 504 | } | ||
| 505 | v->samples += 2; /* adjustment: SBDK pp. 3-5 */ | ||
| 506 | datum = (v->samples * ft->info.size) & 0xff; | ||
| 507 | st_writeb(ft, (int)datum); /* low byte of length */ | ||
| 508 | datum = ((v->samples * ft->info.size) >> 8) & 0xff; | ||
| 509 | st_writeb(ft, (int)datum); /* middle byte of length */ | ||
| 510 | datum = ((v->samples * ft->info.size)>> 16) & 0xff; | ||
| 511 | st_writeb(ft, (int)datum); /* high byte of length */ | ||
| 512 | } | ||
| 513 | } | ||
| 514 | |||
| 495 | /*----------------------------------------------------------------- | 515 | /*----------------------------------------------------------------- |
| 496 | * st_vocstopwrite() -- stop writing a VOC file | 516 | * st_vocstopwrite() -- stop writing a VOC file |
| 497 | *-----------------------------------------------------------------*/ | 517 | *-----------------------------------------------------------------*/ |
| 498 | int st_vocstopwrite(ft_t ft) | 518 | static int st_vocstopwrite(ft_t ft) |
| 499 | { | 519 | { |
| 500 | blockstop(ft); | 520 | blockstop(ft); |
| 501 | return(ST_SUCCESS); | 521 | return(ST_SUCCESS); |
| @@ -795,36 +815,6 @@ static void blockstart(ft_t ft) · 293 unmodified lines | |||
| 795 | } | 815 | } |
| 796 | } | 816 | } |
| 797 | 817 | ||
| 798 | /*----------------------------------------------------------------- | ||
| 799 | * blockstop() -- stop an output block | ||
| 800 | * End the current data or silence block. | ||
| 801 | *-----------------------------------------------------------------*/ | ||
| 802 | static void blockstop(ft_t ft) | ||
| 803 | { | ||
| 804 | vs_t v = (vs_t) ft->priv; | ||
| 805 | st_sample_t datum; | ||
| 806 | |||
| 807 | st_writeb(ft, 0); /* End of file block code */ | ||
| 808 | st_seeki(ft, v->blockseek, 0); /* seek back to block length */ | ||
| 809 | st_seeki(ft, 1, 1); /* seek forward one */ | ||
| 810 | if (v->silent) { | ||
| 811 | st_writew(ft, v->samples); | ||
| 812 | } else { | ||
| 813 | if (ft->info.size == ST_SIZE_BYTE) { | ||
| 814 | if (ft->info.channels > 1) { | ||
| 815 | st_seeki(ft, 8, 1); /* forward 7 + 1 for new block header */ | ||
| 816 | } | ||
| 817 | } | ||
| 818 | v->samples += 2; /* adjustment: SBDK pp. 3-5 */ | ||
| 819 | datum = (v->samples * ft->info.size) & 0xff; | ||
| 820 | st_writeb(ft, (int)datum); /* low byte of length */ | ||
| 821 | datum = ((v->samples * ft->info.size) >> 8) & 0xff; | ||
| 822 | st_writeb(ft, (int)datum); /* middle byte of length */ | ||
| 823 | datum = ((v->samples * ft->info.size)>> 16) & 0xff; | ||
| 824 | st_writeb(ft, (int)datum); /* high byte of length */ | ||
| 825 | } | ||
| 826 | } | ||
| 827 | |||
| 828 | /* Sound Blaster .VOC */ | 818 | /* Sound Blaster .VOC */ |
| 829 | static const char *vocnames[] = { | 819 | static const char *vocnames[] = { |
| 830 | "voc", | 820 | "voc", |
| @@ -837,7 +827,7 @@ static st_format_t st_voc_format = { · 6 unmodified lines | |||
| 837 | ST_FILE_STEREO, | 827 | ST_FILE_STEREO, |
| 838 | st_vocstartread, | 828 | st_vocstartread, |
| 839 | st_vocread, | 829 | st_vocread, |
| 840 | st_vocstopread, | 830 | st_format_nothing, |
| 841 | st_vocstartwrite, | 831 | st_vocstartwrite, |
| 842 | st_vocwrite, | 832 | st_vocwrite, |
| 843 | st_vocstopwrite, | 833 | st_vocstopwrite, |
| @@ -29,7 +29,7 @@ typedef struct { · 28 unmodified lines | |||
| 29 | /* | 29 | /* |
| 30 | * Process options: gain (float) type (amplitude, power, dB) | 30 | * Process options: gain (float) type (amplitude, power, dB) |
| 31 | */ | 31 | */ |
| 32 | int st_vol_getopts(eff_t effp, int n, char **argv) | 32 | static int st_vol_getopts(eff_t effp, int n, char **argv) |
| 33 | { | 33 | { |
| 34 | vol_t vol = (vol_t) effp->priv; | 34 | vol_t vol = (vol_t) effp->priv; |
| 35 | vol->gain = 1.0; /* default is no change */ | 35 | vol->gain = 1.0; /* default is no change */ |
| @@ -90,7 +90,7 @@ int st_vol_getopts(eff_t effp, int n, char **argv) · 54 unmodified lines | |||
| 90 | /* | 90 | /* |
| 91 | * Start processing | 91 | * Start processing |
| 92 | */ | 92 | */ |
| 93 | int st_vol_start(eff_t effp) | 93 | static int st_vol_start(eff_t effp) |
| 94 | { | 94 | { |
| 95 | vol_t vol = (vol_t) effp->priv; | 95 | vol_t vol = (vol_t) effp->priv; |
| 96 | 96 | ||
| @@ -116,7 +116,7 @@ int st_vol_start(eff_t effp) · 19 unmodified lines | |||
| 116 | /* | 116 | /* |
| 117 | * Process data. | 117 | * Process data. |
| 118 | */ | 118 | */ |
| 119 | int st_vol_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, | 119 | static int st_vol_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, |
| 120 | st_size_t *isamp, st_size_t *osamp) | 120 | st_size_t *isamp, st_size_t *osamp) |
| 121 | { | 121 | { |
| 122 | vol_t vol = (vol_t) effp->priv; | 122 | vol_t vol = (vol_t) effp->priv; |
| @@ -180,7 +180,7 @@ int st_vol_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 57 unmodified lines | |||
| 180 | * Do anything required when you stop reading samples. | 180 | * Do anything required when you stop reading samples. |
| 181 | * Don't close input file! | 181 | * Don't close input file! |
| 182 | */ | 182 | */ |
| 183 | int st_vol_stop(eff_t effp) | 183 | static int st_vol_stop(eff_t effp) |
| 184 | { | 184 | { |
| 185 | vol_t vol = (vol_t) effp->priv; | 185 | vol_t vol = (vol_t) effp->priv; |
| 186 | if (vol->limited) | 186 | if (vol->limited) |
| @@ -66,7 +66,7 @@ typedef struct vorbisstuff { · 65 unmodified lines | |||
| 66 | } *vorbis_t; | 66 | } *vorbis_t; |
| 67 | 67 | ||
| 68 | /******** Callback functions used in ov_open_callbacks ************/ | 68 | /******** Callback functions used in ov_open_callbacks ************/ |
| 69 | int myclose (void *datasource) | 69 | static int myclose (void *datasource UNUSED) |
| 70 | { | 70 | { |
| 71 | /* Do nothing so sox can close the file for us */ | 71 | /* Do nothing so sox can close the file for us */ |
| 72 | return 0; | 72 | return 0; |
| @@ -89,7 +89,7 @@ static int _fseeko64_wrap(FILE *f, ogg_int64_t off, int whence) { · 16 unmodified lines | |||
| 89 | * size and encoding of samples, | 89 | * size and encoding of samples, |
| 90 | * mono/stereo/quad. | 90 | * mono/stereo/quad. |
| 91 | */ | 91 | */ |
| 92 | int st_vorbisstartread(ft_t ft) | 92 | static int st_vorbisstartread(ft_t ft) |
| 93 | { | 93 | { |
| 94 | vorbis_t vb = (vorbis_t) ft->priv; | 94 | vorbis_t vb = (vorbis_t) ft->priv; |
| 95 | vorbis_info *vi; | 95 | vorbis_info *vi; |
| @@ -195,7 +195,7 @@ int st_vorbisstartread(ft_t ft) · 99 unmodified lines | |||
| 195 | /* Refill the buffer with samples. Returns BUF_EOF if the end of the | 195 | /* Refill the buffer with samples. Returns BUF_EOF if the end of the |
| 196 | vorbis data was reached while the buffer was being filled, | 196 | vorbis data was reached while the buffer was being filled, |
| 197 | BUF_ERROR is something bad happens, and BUF_DATA otherwise */ | 197 | BUF_ERROR is something bad happens, and BUF_DATA otherwise */ |
| 198 | int refill_buffer (vorbis_t vb) | 198 | static int refill_buffer (vorbis_t vb) |
| 199 | { | 199 | { |
| 200 | int num_read; | 200 | int num_read; |
| 201 | 201 | ||
| @@ -230,10 +230,10 @@ int refill_buffer (vorbis_t vb) · 28 unmodified lines | |||
| 230 | * Return number of samples read. | 230 | * Return number of samples read. |
| 231 | */ | 231 | */ |
| 232 | 232 | ||
| 233 | st_ssize_t st_vorbisread(ft_t ft, st_sample_t *buf, st_size_t len) | 233 | static st_size_t st_vorbisread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 234 | { | 234 | { |
| 235 | vorbis_t vb = (vorbis_t) ft->priv; | 235 | vorbis_t vb = (vorbis_t) ft->priv; |
| 236 | int i; | 236 | st_size_t i; |
| 237 | int ret; | 237 | int ret; |
| 238 | st_sample_t l; | 238 | st_sample_t l; |
| 239 | 239 | ||
| @@ -265,7 +265,7 @@ st_ssize_t st_vorbisread(ft_t ft, st_sample_t *buf, st_size_t len) · 25 unmodified lines | |||
| 265 | * Do anything required when you stop reading samples. | 265 | * Do anything required when you stop reading samples. |
| 266 | * Don't close input file! | 266 | * Don't close input file! |
| 267 | */ | 267 | */ |
| 268 | int st_vorbisstopread(ft_t ft) | 268 | static int st_vorbisstopread(ft_t ft) |
| 269 | { | 269 | { |
| 270 | vorbis_t vb = (vorbis_t) ft->priv; | 270 | vorbis_t vb = (vorbis_t) ft->priv; |
| 271 | 271 | ||
| @@ -277,7 +277,7 @@ int st_vorbisstopread(ft_t ft) · 5 unmodified lines | |||
| 277 | 277 | ||
| 278 | /* Write a page of ogg data to a file. Taken directly from encode.c in | 278 | /* Write a page of ogg data to a file. Taken directly from encode.c in |
| 279 | oggenc. Returns the number of bytes written. */ | 279 | oggenc. Returns the number of bytes written. */ |
| 280 | int oe_write_page(ogg_page *page, ft_t ft) | 280 | static int oe_write_page(ogg_page *page, ft_t ft) |
| 281 | { | 281 | { |
| 282 | int written; | 282 | int written; |
| 283 | written = st_writebuf(ft, page->header,1,page->header_len); | 283 | written = st_writebuf(ft, page->header,1,page->header_len); |
| @@ -289,7 +289,7 @@ int oe_write_page(ogg_page *page, ft_t ft) · 5 unmodified lines | |||
| 289 | /* Write out the header packets. Derived mostly from encode.c in | 289 | /* Write out the header packets. Derived mostly from encode.c in |
| 290 | oggenc. Returns HEADER_ERROR if the header cannot be written and | 290 | oggenc. Returns HEADER_ERROR if the header cannot be written and |
| 291 | HEADER_OK otherwise. */ | 291 | HEADER_OK otherwise. */ |
| 292 | int write_vorbis_header(ft_t ft, vorbis_enc_t *ve) | 292 | static int write_vorbis_header(ft_t ft, vorbis_enc_t *ve) |
| 293 | { | 293 | { |
| 294 | ogg_packet header_main; | 294 | ogg_packet header_main; |
| 295 | ogg_packet header_comments; | 295 | ogg_packet header_comments; |
| @@ -345,7 +345,7 @@ int write_vorbis_header(ft_t ft, vorbis_enc_t *ve) · 49 unmodified lines | |||
| 345 | return HEADER_OK; | 345 | return HEADER_OK; |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | int st_vorbisstartwrite(ft_t ft) | 348 | static int st_vorbisstartwrite(ft_t ft) |
| 349 | { | 349 | { |
| 350 | vorbis_t vb = (vorbis_t) ft->priv; | 350 | vorbis_t vb = (vorbis_t) ft->priv; |
| 351 | vorbis_enc_t *ve; | 351 | vorbis_enc_t *ve; |
| @@ -399,13 +399,13 @@ int st_vorbisstartwrite(ft_t ft) · 47 unmodified lines | |||
| 399 | return(ST_SUCCESS); | 399 | return(ST_SUCCESS); |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | st_ssize_t st_vorbiswrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 402 | static st_size_t st_vorbiswrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 403 | { | 403 | { |
| 404 | vorbis_t vb = (vorbis_t) ft->priv; | 404 | vorbis_t vb = (vorbis_t) ft->priv; |
| 405 | vorbis_enc_t *ve = vb->vorbis_enc_data; | 405 | vorbis_enc_t *ve = vb->vorbis_enc_data; |
| 406 | st_ssize_t samples = len / ft->info.channels; | 406 | st_size_t samples = len / ft->info.channels; |
| 407 | float **buffer = vorbis_analysis_buffer(&ve->vd, samples); | 407 | float **buffer = vorbis_analysis_buffer(&ve->vd, samples); |
| 408 | st_ssize_t i, j; | 408 | st_size_t i, j; |
| 409 | int ret; | 409 | int ret; |
| 410 | int eos = 0; | 410 | int eos = 0; |
| 411 | 411 | ||
| @@ -450,7 +450,7 @@ st_ssize_t st_vorbiswrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 38 unmodified lines | |||
| 450 | return (len); | 450 | return (len); |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | int st_vorbisstopwrite(ft_t ft) | 453 | static int st_vorbisstopwrite(ft_t ft) |
| 454 | { | 454 | { |
| 455 | vorbis_t vb = (vorbis_t) ft->priv; | 455 | vorbis_t vb = (vorbis_t) ft->priv; |
| 456 | vorbis_enc_t *ve = vb->vorbis_enc_data; | 456 | vorbis_enc_t *ve = vb->vorbis_enc_data; |
| @@ -26,10 +26,6 @@ · 25 unmodified lines | |||
| 26 | * * | 26 | * * |
| 27 | ************************************************************************/ | 27 | ************************************************************************/ |
| 28 | 28 | ||
| 29 | /////////////////////////////////////////// | ||
| 30 | // ORIGINAL SOX COPYRIGHT AND DISCLAIMER // | ||
| 31 | /////////////////////////////////////////// | ||
| 32 | |||
| 33 | /************************************************************************ | 29 | /************************************************************************ |
| 34 | * July 5, 1991 * | 30 | * July 5, 1991 * |
| 35 | * * | 31 | * * |
| @@ -43,30 +39,19 @@ · 7 unmodified lines | |||
| 43 | * * | 39 | * * |
| 44 | ************************************************************************/ | 40 | ************************************************************************/ |
| 45 | 41 | ||
| 46 | /////////////////// | ||
| 47 | // INCLUDE FILES // | ||
| 48 | /////////////////// | ||
| 49 | |||
| 50 | #include "st_i.h" | 42 | #include "st_i.h" |
| 51 | 43 | ||
| 52 | ////////////// | ||
| 53 | // TYPEDEFS // | ||
| 54 | ////////////// | ||
| 55 | 44 | ||
| 56 | typedef struct voxstuff { struct { short last; // ADPCM codec state | 45 | typedef struct voxstuff { struct { short last; /* ADPCM codec state */ |
| 57 | short index; | 46 | short index; |
| 58 | } state; | 47 | } state; |
| 59 | 48 | ||
| 60 | struct { uint8_t byte; // write store | 49 | struct { uint8_t byte; /* write store */ |
| 61 | uint8_t flag; | 50 | uint8_t flag; |
| 62 | } store; | 51 | } store; |
| 63 | } *vox_t; | 52 | } *vox_t; |
| 64 | 53 | ||
| 65 | 54 | ||
| 66 | /////////////// | ||
| 67 | // CONSTANTS // | ||
| 68 | /////////////// | ||
| 69 | |||
| 70 | static short STEPSIZE[49] = { 16, 17, 19, 21, 23, 25, 28, | 55 | static short STEPSIZE[49] = { 16, 17, 19, 21, 23, 25, 28, |
| 71 | 31, 34, 37, 41, 45, 50, 55, | 56 | 31, 34, 37, 41, 45, 50, 55, |
| 72 | 60, 66, 73, 80, 88, 97, 107, | 57 | 60, 66, 73, 80, 88, 97, 107, |
| @@ -79,18 +64,10 @@ static short STEPSIZE[49] = { 16, 17, 19, 21, 23, 25, 28, · 6 unmodified lines | |||
| 79 | static short STEPADJUST[8] = { -1,-1,-1,-1,2,4,6,8 }; | 64 | static short STEPADJUST[8] = { -1,-1,-1,-1,2,4,6,8 }; |
| 80 | 65 | ||
| 81 | 66 | ||
| 82 | ///////////////////////// | ||
| 83 | // FUNCTION PROTOTYPES // | ||
| 84 | ///////////////////////// | ||
| 85 | |||
| 86 | static uint8_t envox (short, vox_t); | 67 | static uint8_t envox (short, vox_t); |
| 87 | static short devox (uint8_t,vox_t); | 68 | static short devox (uint8_t,vox_t); |
| 88 | 69 | ||
| 89 | 70 | ||
| 90 | //////////////////// | ||
| 91 | // IMPLEMENTATION // | ||
| 92 | //////////////////// | ||
| 93 | |||
| 94 | /****************************************************************************** | 71 | /****************************************************************************** |
| 95 | * Function : st_voxstartread | 72 | * Function : st_voxstartread |
| 96 | * Description: Initialises the file parameters and ADPCM codec state. | 73 | * Description: Initialises the file parameters and ADPCM codec state. |
| @@ -104,11 +81,11 @@ static short devox (uint8_t,vox_t); · 7 unmodified lines | |||
| 104 | * rates but the codecs allows any user specified rate. | 81 | * rates but the codecs allows any user specified rate. |
| 105 | ******************************************************************************/ | 82 | ******************************************************************************/ |
| 106 | 83 | ||
| 107 | int st_voxstartread (ft_t ft) | 84 | static int st_voxstartread (ft_t ft) |
| 108 | { vox_t state = (vox_t) ft->priv; | 85 | { vox_t state = (vox_t) ft->priv; |
| 109 | 86 | ||
| 110 | 87 | ||
| 111 | // ... setup file info | 88 | /* ... setup file info */ |
| 112 | 89 | ||
| 113 | ft->file.buf = (char *)malloc(ST_BUFSIZ); | 90 | ft->file.buf = (char *)malloc(ST_BUFSIZ); |
| 114 | 91 | ||
| @@ -123,11 +100,11 @@ int st_voxstartread (ft_t ft) · 8 unmodified lines | |||
| 123 | ft->file.pos = 0; | 100 | ft->file.pos = 0; |
| 124 | ft->file.eof = 0; | 101 | ft->file.eof = 0; |
| 125 | 102 | ||
| 126 | ft->info.size = ST_SIZE_WORD; | 103 | ft->info.size = ST_SIZE_WORD; |
| 127 | ft->info.encoding = ST_ENCODING_OKI_ADPCM; | 104 | ft->info.encoding = ST_ENCODING_OKI_ADPCM; |
| 128 | ft->info.channels = 1; | 105 | ft->info.channels = 1; |
| 129 | 106 | ||
| 130 | // ... initialise CODEC state | 107 | /* ... initialise CODEC state */ |
| 131 | 108 | ||
| 132 | state->state.last = 0; | 109 | state->state.last = 0; |
| 133 | state->state.index = 0; | 110 | state->state.index = 0; |
| @@ -151,22 +128,22 @@ int st_voxstartread (ft_t ft) · 17 unmodified lines | |||
| 151 | * Notes : | 128 | * Notes : |
| 152 | ******************************************************************************/ | 129 | ******************************************************************************/ |
| 153 | 130 | ||
| 154 | st_ssize_t st_voxread (ft_t ft,st_sample_t *buffer,st_size_t length) | 131 | static st_size_t st_voxread (ft_t ft,st_sample_t *buffer,st_size_t length) |
| 155 | { vox_t state = (vox_t) ft->priv; | 132 | { vox_t state = (vox_t) ft->priv; |
| 156 | int count = 0; | 133 | int count = 0; |
| 157 | int N; | 134 | int N; |
| 158 | uint8_t byte; | 135 | uint8_t byte; |
| 159 | short word; | 136 | short word; |
| 160 | 137 | ||
| 161 | // ... round length down to nearest even number | 138 | /* ... round length down to nearest even number */ |
| 162 | 139 | ||
| 163 | N = length/2; | 140 | N = length/2; |
| 164 | N *=2; | 141 | N *=2; |
| 165 | 142 | ||
| 166 | // ... loop until buffer full or EOF | 143 | /* ... loop until buffer full or EOF */ |
| 167 | 144 | ||
| 168 | while (count < N) | 145 | while (count < N) |
| 169 | { // ... refill buffer | 146 | { /* ... refill buffer */ |
| 170 | 147 | ||
| 171 | if (ft->file.pos >= ft->file.count) | 148 | if (ft->file.pos >= ft->file.count) |
| 172 | { ft->file.count = st_readbuf (ft,ft->file.buf,1,ft->file.size); | 149 | { ft->file.count = st_readbuf (ft,ft->file.buf,1,ft->file.size); |
| @@ -176,7 +153,7 @@ st_ssize_t st_voxread (ft_t ft,st_sample_t *buffer,st_size_t length) · 3 unmodified lines | |||
| 176 | break; | 153 | break; |
| 177 | } | 154 | } |
| 178 | 155 | ||
| 179 | // ... decode two nibbles stored as a byte | 156 | /* ... decode two nybbles stored as a byte */ |
| 180 | 157 | ||
| 181 | byte = ft->file.buf[ft->file.pos++]; | 158 | byte = ft->file.buf[ft->file.pos++]; |
| 182 | 159 | ||
| @@ -201,7 +178,7 @@ st_ssize_t st_voxread (ft_t ft,st_sample_t *buffer,st_size_t length) · 18 unmodified lines | |||
| 201 | * Notes : | 178 | * Notes : |
| 202 | ******************************************************************************/ | 179 | ******************************************************************************/ |
| 203 | 180 | ||
| 204 | int st_voxstopread (ft_t ft) | 181 | static int st_voxstopread (ft_t ft) |
| 205 | { free (ft->file.buf); | 182 | { free (ft->file.buf); |
| 206 | 183 | ||
| 207 | return (ST_SUCCESS); | 184 | return (ST_SUCCESS); |
| @@ -221,11 +198,11 @@ int st_voxstopread (ft_t ft) · 13 unmodified lines | |||
| 221 | * rates but the codecs allows any user specified rate. | 198 | * rates but the codecs allows any user specified rate. |
| 222 | ******************************************************************************/ | 199 | ******************************************************************************/ |
| 223 | 200 | ||
| 224 | int st_voxstartwrite (ft_t ft) | 201 | static int st_voxstartwrite (ft_t ft) |
| 225 | { vox_t state = (vox_t) ft->priv; | 202 | { vox_t state = (vox_t) ft->priv; |
| 226 | 203 | ||
| 227 | 204 | ||
| 228 | // ... setup file info | 205 | /* ... setup file info */ |
| 229 | 206 | ||
| 230 | ft->file.buf = (char *)malloc(ST_BUFSIZ); | 207 | ft->file.buf = (char *)malloc(ST_BUFSIZ); |
| 231 | 208 | ||
| @@ -244,7 +221,7 @@ int st_voxstartwrite (ft_t ft) · 12 unmodified lines | |||
| 244 | ft->info.encoding = ST_ENCODING_OKI_ADPCM; | 221 | ft->info.encoding = ST_ENCODING_OKI_ADPCM; |
| 245 | ft->info.channels = 1; | 222 | ft->info.channels = 1; |
| 246 | 223 | ||
| 247 | // ... initialise CODEC state | 224 | /* ... initialise CODEC state */ |
| 248 | 225 | ||
| 249 | state->state.last = 0; | 226 | state->state.last = 0; |
| 250 | state->state.index = 0; | 227 | state->state.index = 0; |
| @@ -267,9 +244,9 @@ int st_voxstartwrite (ft_t ft) · 16 unmodified lines | |||
| 267 | * Notes : | 244 | * Notes : |
| 268 | ******************************************************************************/ | 245 | ******************************************************************************/ |
| 269 | 246 | ||
| 270 | st_ssize_t st_voxwrite (ft_t ft,const st_sample_t *buffer,st_size_t length) | 247 | static st_size_t st_voxwrite (ft_t ft,const st_sample_t *buffer,st_size_t length) |
| 271 | { vox_t state = (vox_t) ft->priv; | 248 | { vox_t state = (vox_t) ft->priv; |
| 272 | int count = 0; | 249 | st_size_t count = 0; |
| 273 | uint8_t byte = state->store.byte; | 250 | uint8_t byte = state->store.byte; |
| 274 | uint8_t flag = state->store.flag; | 251 | uint8_t flag = state->store.flag; |
| 275 | short word; | 252 | short word; |
| @@ -297,7 +274,7 @@ st_ssize_t st_voxwrite (ft_t ft,const st_sample_t *buffer,st_size_t length) · 21 unmodified lines | |||
| 297 | count++; | 274 | count++; |
| 298 | } | 275 | } |
| 299 | 276 | ||
| 300 | // ... keep last byte across calls | 277 | /* ... keep last byte across calls */ |
| 301 | 278 | ||
| 302 | state->store.byte = byte; | 279 | state->store.byte = byte; |
| 303 | state->store.flag = flag; | 280 | state->store.flag = flag; |
| @@ -315,12 +292,12 @@ st_ssize_t st_voxwrite (ft_t ft,const st_sample_t *buffer,st_size_t length) · 11 unmodified lines | |||
| 315 | * Notes : | 292 | * Notes : |
| 316 | ******************************************************************************/ | 293 | ******************************************************************************/ |
| 317 | 294 | ||
| 318 | int st_voxstopwrite (ft_t ft) | 295 | static int st_voxstopwrite (ft_t ft) |
| 319 | { vox_t state = (vox_t) ft->priv; | 296 | { vox_t state = (vox_t) ft->priv; |
| 320 | uint8_t byte = state->store.byte; | 297 | uint8_t byte = state->store.byte; |
| 321 | uint8_t flag = state->store.flag; | 298 | uint8_t flag = state->store.flag; |
| 322 | 299 | ||
| 323 | // ... flush remaining samples | 300 | /* ... flush remaining samples */ |
| 324 | 301 | ||
| 325 | if (flag != 0) | 302 | if (flag != 0) |
| 326 | { byte <<= 4; | 303 | { byte <<= 4; |
| @@ -332,8 +309,6 @@ int st_voxstopwrite (ft_t ft) · 5 unmodified lines | |||
| 332 | if (ft->file.count > 0) | 309 | if (ft->file.count > 0) |
| 333 | st_writebuf (ft,ft->file.buf,1,ft->file.count); | 310 | st_writebuf (ft,ft->file.buf,1,ft->file.count); |
| 334 | 311 | ||
| 335 | // ... free buffer | ||
| 336 | |||
| 337 | free (ft->file.buf); | 312 | free (ft->file.buf); |
| 338 | 313 | ||
| 339 | return (ST_SUCCESS); | 314 | return (ST_SUCCESS); |
| @@ -377,7 +352,8 @@ static uint8_t envox (short sample,vox_t state) · 37 unmodified lines | |||
| 377 | { code = code | 0x01; | 352 | { code = code | 0x01; |
| 378 | } | 353 | } |
| 379 | 354 | ||
| 380 | // ... use decoder to set the estimate of last sample and adjust the step index | 355 | /* ... use decoder to set the estimate of last sample and |
| 356 | adjust the step index */ | ||
| 381 | 357 | ||
| 382 | state->state.last = devox (code,state); | 358 | state->state.last = devox (code,state); |
| 383 | 359 | ||
| @@ -418,7 +394,7 @@ static short devox (uint8_t code,vox_t state) · 34 unmodified lines | |||
| 418 | 394 | ||
| 419 | sample = state->state.last + dn; | 395 | sample = state->state.last + dn; |
| 420 | 396 | ||
| 421 | // ... clip to 12 bits | 397 | /* ... clip to 12 bits */ |
| 422 | 398 | ||
| 423 | if (sample > 2047) | 399 | if (sample > 2047) |
| 424 | sample = 2047; | 400 | sample = 2047; |
| @@ -426,7 +402,7 @@ static short devox (uint8_t code,vox_t state) · 1 unmodified line | |||
| 426 | if (sample < -2048) | 402 | if (sample < -2048) |
| 427 | sample = -2048; | 403 | sample = -2048; |
| 428 | 404 | ||
| 429 | // ... adjust step size | 405 | /* ... adjust step size */ |
| 430 | 406 | ||
| 431 | state->state.last = sample; | 407 | state->state.last = sample; |
| 432 | state->state.index += STEPADJUST[code & 0x07]; | 408 | state->state.index += STEPADJUST[code & 0x07]; |
| @@ -437,7 +413,7 @@ static short devox (uint8_t code,vox_t state) · 4 unmodified lines | |||
| 437 | if (state->state.index > 48) | 413 | if (state->state.index > 48) |
| 438 | state->state.index = 48; | 414 | state->state.index = 48; |
| 439 | 415 | ||
| 440 | // ... done | 416 | /* ... done */ |
| 441 | 417 | ||
| 442 | return (sample); | 418 | return (sample); |
| 443 | } | 419 | } |
| @@ -1,58 +1,10 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Microsoft's WAVE sound format driver | 2 | * Microsoft's WAVE sound format driver |
| 3 | * | 3 | * |
| 4 | * This source code is freely redistributable and may be used for | 4 | * Copyright 1998-2006 Chris Bagwell and SoX Contributors |
| 5 | * any purpose. This copyright notice must be maintained. | ||
| 6 | * Lance Norskog And Sundry Contributors are not responsible for | ||
| 7 | * the consequences of using this software. | ||
| 8 | * | ||
| 9 | * Change History: | ||
| 10 | * | ||
| 11 | * November 23, 1999 - Stan Brooks (stabro@megsinet.com) | ||
| 12 | * Merged in gsm support patches from Stuart Daines... | ||
| 13 | * Since we had simultaneously made similar changes in | ||
| 14 | * wavwritehdr() and wavstartread(), this was some | ||
| 15 | * work. Hopefully the result is cleaner than either | ||
| 16 | * version, and nothing broke. | ||
| 17 | * | ||
| 18 | * November 20, 1999 - Stan Brooks (stabro@megsinet.com) | ||
| 19 | * Mods for faster adpcm decoding and addition of IMA_ADPCM | ||
| 20 | * and ADPCM writing... low-level codex functions moved to | ||
| 21 | * external modules ima_rw.c and adpcm.c. Some general cleanup, | ||
| 22 | * consistent with writing adpcm and other output formats. | ||
| 23 | * Headers written for adpcm include the 'fact' subchunk. | ||
| 24 | * | ||
| 25 | * September 11, 1998 - Chris Bagwell (cbagwell@sprynet.com) | ||
| 26 | * Fixed length bug for IMA and MS ADPCM files. | ||
| 27 | * | ||
| 28 | * June 1, 1998 - Chris Bagwell (cbagwell@sprynet.com) | ||
| 29 | * Fixed some compiler warnings as reported by Kjetil Torgrim Homme | ||
| 30 | * <kjetilho@ifi.uio.no>. | ||
| 31 | * Fixed bug that caused crashes when reading mono MS ADPCM files. Patch | ||
| 32 | * was sent from Michael Brown (mjb@pootle.demon.co.uk). | ||
| 33 | * | ||
| 34 | * March 15, 1998 - Chris Bagwell (cbagwell@sprynet.com) | ||
| 35 | * Added support for Microsoft's ADPCM and IMA (or better known as | ||
| 36 | * DVI) ADPCM format for wav files. Thanks goes to Mark Podlipec's | ||
| 37 | * XAnim code. It gave some real life understanding of how the ADPCM | ||
| 38 | * format is processed. Actual code was implemented based off of | ||
| 39 | * various sources from the net. | ||
| 40 | * | ||
| 41 | * NOTE: Previous maintainers weren't very good at providing contact | ||
| 42 | * information. | ||
| 43 | * | ||
| 44 | * Copyright 1992 Rick Richardson | ||
| 45 | * Copyright 1991 Lance Norskog And Sundry Contributors | 5 | * Copyright 1991 Lance Norskog And Sundry Contributors |
| 46 | * | 6 | * Copyright 1992 Rick Richardson |
| 47 | * Fixed by various contributors previous to 1998: | 7 | * Copyright 1997 Graeme W. Gill, 93/5/17 |
| 48 | * 1) Little-endian handling | ||
| 49 | * 2) Skip other kinds of file data | ||
| 50 | * 3) Handle 16-bit formats correctly | ||
| 51 | * 4) Not go into infinite loop | ||
| 52 | * | ||
| 53 | * User options should override file header - we assumed user knows what | ||
| 54 | * they are doing if they specify options. | ||
| 55 | * Enhancements and clean up by Graeme W. Gill, 93/5/17 | ||
| 56 | * | 8 | * |
| 57 | * Info for format tags can be found at: | 9 | * Info for format tags can be found at: |
| 58 | * http://www.microsoft.com/asf/resources/draft-ietf-fleischman-codec-subtree-01.txt | 10 | * http://www.microsoft.com/asf/resources/draft-ietf-fleischman-codec-subtree-01.txt |
| @@ -122,7 +74,7 @@ static int wavwritehdr(ft_t, int); · 63 unmodified lines | |||
| 122 | * ImaAdpcmReadBlock - Grab and decode complete block of samples | 74 | * ImaAdpcmReadBlock - Grab and decode complete block of samples |
| 123 | * | 75 | * |
| 124 | */ | 76 | */ |
| 125 | unsigned short ImaAdpcmReadBlock(ft_t ft) | 77 | static unsigned short ImaAdpcmReadBlock(ft_t ft) |
| 126 | { | 78 | { |
| 127 | wav_t wav = (wav_t) ft->priv; | 79 | wav_t wav = (wav_t) ft->priv; |
| 128 | int bytesRead; | 80 | int bytesRead; |
| @@ -162,7 +114,7 @@ unsigned short ImaAdpcmReadBlock(ft_t ft) · 33 unmodified lines | |||
| 162 | * AdpcmReadBlock - Grab and decode complete block of samples | 114 | * AdpcmReadBlock - Grab and decode complete block of samples |
| 163 | * | 115 | * |
| 164 | */ | 116 | */ |
| 165 | unsigned short AdpcmReadBlock(ft_t ft) | 117 | static unsigned short AdpcmReadBlock(ft_t ft) |
| 166 | { | 118 | { |
| 167 | wav_t wav = (wav_t) ft->priv; | 119 | wav_t wav = (wav_t) ft->priv; |
| 168 | int bytesRead; | 120 | int bytesRead; |
| @@ -211,7 +163,7 @@ static int xxxAdpcmWriteBlock(ft_t ft) · 42 unmodified lines | |||
| 211 | for (p = wav->samplePtr; p < wav->sampleTop; p++) *p=0; | 163 | for (p = wav->samplePtr; p < wav->sampleTop; p++) *p=0; |
| 212 | /* compress the samples to wav->packet */ | 164 | /* compress the samples to wav->packet */ |
| 213 | if (wav->formatTag == WAVE_FORMAT_ADPCM) { | 165 | if (wav->formatTag == WAVE_FORMAT_ADPCM) { |
| 214 | AdpcmBlockMashI(chans, wav->samples, wav->samplesPerBlock, wav->state, wav->packet, wav->blockAlign,9); | 166 | AdpcmBlockMashI(chans, wav->samples, wav->samplesPerBlock, wav->state, wav->packet, wav->blockAlign); |
| 215 | }else{ /* WAVE_FORMAT_IMA_ADPCM */ | 167 | }else{ /* WAVE_FORMAT_IMA_ADPCM */ |
| 216 | ImaBlockMashI(chans, wav->samples, wav->samplesPerBlock, wav->state, wav->packet, 9); | 168 | ImaBlockMashI(chans, wav->samples, wav->samplesPerBlock, wav->state, wav->packet, 9); |
| 217 | } | 169 | } |
| @@ -236,7 +188,7 @@ static int xxxAdpcmWriteBlock(ft_t ft) · 18 unmodified lines | |||
| 236 | /* WAV GSM6.10 support functions */ | 188 | /* WAV GSM6.10 support functions */ |
| 237 | /****************************************************************************/ | 189 | /****************************************************************************/ |
| 238 | /* create the gsm object, malloc buffer for 160*2 samples */ | 190 | /* create the gsm object, malloc buffer for 160*2 samples */ |
| 239 | int wavgsminit(ft_t ft) | 191 | static int wavgsminit(ft_t ft) |
| 240 | { | 192 | { |
| 241 | int valueP=1; | 193 | int valueP=1; |
| 242 | wav_t wav = (wav_t) ft->priv; | 194 | wav_t wav = (wav_t) ft->priv; |
| @@ -263,21 +215,21 @@ int wavgsminit(ft_t ft) · 20 unmodified lines | |||
| 263 | } | 215 | } |
| 264 | 216 | ||
| 265 | /*destroy the gsm object and free the buffer */ | 217 | /*destroy the gsm object and free the buffer */ |
| 266 | void wavgsmdestroy(ft_t ft) | 218 | static void wavgsmdestroy(ft_t ft) |
| 267 | { | 219 | { |
| 268 | wav_t wav = (wav_t) ft->priv; | 220 | wav_t wav = (wav_t) ft->priv; |
| 269 | gsm_destroy(wav->gsmhandle); | 221 | gsm_destroy(wav->gsmhandle); |
| 270 | free(wav->gsmsample); | 222 | free(wav->gsmsample); |
| 271 | } | 223 | } |
| 272 | 224 | ||
| 273 | st_ssize_t wavgsmread(ft_t ft, st_sample_t *buf, st_size_t len) | 225 | static st_size_t wavgsmread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 274 | { | 226 | { |
| 275 | wav_t wav = (wav_t) ft->priv; | 227 | wav_t wav = (wav_t) ft->priv; |
| 276 | int done=0; | 228 | size_t done=0; |
| 277 | int bytes; | 229 | int bytes; |
| 278 | gsm_byte frame[65]; | 230 | gsm_byte frame[65]; |
| 279 | 231 | ||
| 280 | ft->st_errno = ST_SUCCESS; | 232 | ft->st_errno = ST_SUCCESS; |
| 281 | 233 | ||
| 282 | /* copy out any samples left from the last call */ | 234 | /* copy out any samples left from the last call */ |
| 283 | while(wav->gsmindex && (wav->gsmindex<160*2) && (done < len)) | 235 | while(wav->gsmindex && (wav->gsmindex<160*2) && (done < len)) |
| @@ -338,13 +290,13 @@ static int wavgsmflush(ft_t ft) · 54 unmodified lines | |||
| 338 | return (ST_SUCCESS); | 290 | return (ST_SUCCESS); |
| 339 | } | 291 | } |
| 340 | 292 | ||
| 341 | st_ssize_t wavgsmwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 293 | static st_size_t wavgsmwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 342 | { | 294 | { |
| 343 | wav_t wav = (wav_t) ft->priv; | 295 | wav_t wav = (wav_t) ft->priv; |
| 344 | int done = 0; | 296 | size_t done = 0; |
| 345 | int rc; | 297 | int rc; |
| 346 | 298 | ||
| 347 | ft->st_errno = ST_SUCCESS; | 299 | ft->st_errno = ST_SUCCESS; |
| 348 | 300 | ||
| 349 | while (done < len) { | 301 | while (done < len) { |
| 350 | while ((wav->gsmindex < 160*2) && (done < len)) | 302 | while ((wav->gsmindex < 160*2) && (done < len)) |
| @@ -362,7 +314,7 @@ st_ssize_t wavgsmwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 11 unmodified lines | |||
| 362 | 314 | ||
| 363 | } | 315 | } |
| 364 | 316 | ||
| 365 | void wavgsmstopwrite(ft_t ft) | 317 | static void wavgsmstopwrite(ft_t ft) |
| 366 | { | 318 | { |
| 367 | wav_t wav = (wav_t) ft->priv; | 319 | wav_t wav = (wav_t) ft->priv; |
| 368 | 320 | ||
| @@ -425,7 +377,7 @@ static int findChunk(ft_t ft, const char *Label, st_size_t *len) · 56 unmodified lines | |||
| 425 | * size and encoding of samples, | 377 | * size and encoding of samples, |
| 426 | * mono/stereo/quad. | 378 | * mono/stereo/quad. |
| 427 | */ | 379 | */ |
| 428 | int st_wavstartread(ft_t ft) | 380 | static int st_wavstartread(ft_t ft) |
| 429 | { | 381 | { |
| 430 | wav_t wav = (wav_t) ft->priv; | 382 | wav_t wav = (wav_t) ft->priv; |
| 431 | char magic[5]; | 383 | char magic[5]; |
| @@ -537,7 +489,7 @@ int st_wavstartread(ft_t ft) · 105 unmodified lines | |||
| 537 | 489 | ||
| 538 | case WAVE_FORMAT_PCM: | 490 | case WAVE_FORMAT_PCM: |
| 539 | /* Default (-1) depends on sample size. Set that later on. */ | 491 | /* Default (-1) depends on sample size. Set that later on. */ |
| 540 | if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_UNSIGNED && | 492 | if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_UNSIGNED && |
| 541 | ft->info.encoding != ST_ENCODING_SIGN2) | 493 | ft->info.encoding != ST_ENCODING_SIGN2) |
| 542 | st_report("User options overriding encoding read in .wav header"); | 494 | st_report("User options overriding encoding read in .wav header"); |
| 543 | 495 | ||
| @@ -549,21 +501,21 @@ int st_wavstartread(ft_t ft) · 5 unmodified lines | |||
| 549 | break; | 501 | break; |
| 550 | 502 | ||
| 551 | case WAVE_FORMAT_IMA_ADPCM: | 503 | case WAVE_FORMAT_IMA_ADPCM: |
| 552 | if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_IMA_ADPCM) | 504 | if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_IMA_ADPCM) |
| 553 | ft->info.encoding = ST_ENCODING_IMA_ADPCM; | 505 | ft->info.encoding = ST_ENCODING_IMA_ADPCM; |
| 554 | else | 506 | else |
| 555 | st_report("User options overriding encoding read in .wav header"); | 507 | st_report("User options overriding encoding read in .wav header"); |
| 556 | break; | 508 | break; |
| 557 | 509 | ||
| 558 | case WAVE_FORMAT_ADPCM: | 510 | case WAVE_FORMAT_ADPCM: |
| 559 | if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_ADPCM) | 511 | if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_ADPCM) |
| 560 | ft->info.encoding = ST_ENCODING_ADPCM; | 512 | ft->info.encoding = ST_ENCODING_ADPCM; |
| 561 | else | 513 | else |
| 562 | st_report("User options overriding encoding read in .wav header"); | 514 | st_report("User options overriding encoding read in .wav header"); |
| 563 | break; | 515 | break; |
| 564 | 516 | ||
| 565 | case WAVE_FORMAT_IEEE_FLOAT: | 517 | case WAVE_FORMAT_IEEE_FLOAT: |
| 566 | if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_FLOAT) | 518 | if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_FLOAT) |
| 567 | ft->info.encoding = ST_ENCODING_FLOAT; | 519 | ft->info.encoding = ST_ENCODING_FLOAT; |
| 568 | else | 520 | else |
| 569 | st_report("User options overriding encoding read in .wav header"); | 521 | st_report("User options overriding encoding read in .wav header"); |
| @@ -576,7 +528,7 @@ int st_wavstartread(ft_t ft) · 6 unmodified lines | |||
| 576 | break; | 528 | break; |
| 577 | 529 | ||
| 578 | case WAVE_FORMAT_ALAW: | 530 | case WAVE_FORMAT_ALAW: |
| 579 | if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_ALAW) | 531 | if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_ALAW) |
| 580 | ft->info.encoding = ST_ENCODING_ALAW; | 532 | ft->info.encoding = ST_ENCODING_ALAW; |
| 581 | else | 533 | else |
| 582 | st_report("User options overriding encoding read in .wav header"); | 534 | st_report("User options overriding encoding read in .wav header"); |
| @@ -589,7 +541,7 @@ int st_wavstartread(ft_t ft) · 6 unmodified lines | |||
| 589 | break; | 541 | break; |
| 590 | 542 | ||
| 591 | case WAVE_FORMAT_MULAW: | 543 | case WAVE_FORMAT_MULAW: |
| 592 | if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_ULAW) | 544 | if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_ULAW) |
| 593 | ft->info.encoding = ST_ENCODING_ULAW; | 545 | ft->info.encoding = ST_ENCODING_ULAW; |
| 594 | else | 546 | else |
| 595 | st_report("User options overriding encoding read in .wav header"); | 547 | st_report("User options overriding encoding read in .wav header"); |
| @@ -614,7 +566,7 @@ int st_wavstartread(ft_t ft) · 18 unmodified lines | |||
| 614 | st_fail_errno(ft,ST_EHDR,"Sorry, this WAV file is in Dolby AC2 format."); | 566 | st_fail_errno(ft,ST_EHDR,"Sorry, this WAV file is in Dolby AC2 format."); |
| 615 | return ST_EOF; | 567 | return ST_EOF; |
| 616 | case WAVE_FORMAT_GSM610: | 568 | case WAVE_FORMAT_GSM610: |
| 617 | if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_GSM ) | 569 | if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_GSM ) |
| 618 | ft->info.encoding = ST_ENCODING_GSM; | 570 | ft->info.encoding = ST_ENCODING_GSM; |
| 619 | else | 571 | else |
| 620 | st_report("User options overriding encoding read in .wav header"); | 572 | st_report("User options overriding encoding read in .wav header"); |
| @@ -648,7 +600,7 @@ int st_wavstartread(ft_t ft) · 27 unmodified lines | |||
| 648 | } | 600 | } |
| 649 | 601 | ||
| 650 | /* User options take precedence */ | 602 | /* User options take precedence */ |
| 651 | if (ft->info.channels == -1 || ft->info.channels == wChannels) | 603 | if (ft->info.channels == 0 || ft->info.channels == wChannels) |
| 652 | ft->info.channels = wChannels; | 604 | ft->info.channels = wChannels; |
| 653 | else | 605 | else |
| 654 | st_report("User options overriding channels read in .wav header"); | 606 | st_report("User options overriding channels read in .wav header"); |
| @@ -839,7 +791,7 @@ int st_wavstartread(ft_t ft) · 184 unmodified lines | |||
| 839 | st_warn("User options overriding size read in .wav header"); | 791 | st_warn("User options overriding size read in .wav header"); |
| 840 | 792 | ||
| 841 | /* Now we have enough information to set default encodings. */ | 793 | /* Now we have enough information to set default encodings. */ |
| 842 | if (ft->info.encoding == -1) | 794 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) |
| 843 | ft->info.encoding = ST_ENCODING_UNSIGNED; | 795 | ft->info.encoding = ST_ENCODING_UNSIGNED; |
| 844 | break; | 796 | break; |
| 845 | 797 | ||
| @@ -850,7 +802,7 @@ int st_wavstartread(ft_t ft) · 4 unmodified lines | |||
| 850 | st_warn("User options overriding size read in .wav header"); | 802 | st_warn("User options overriding size read in .wav header"); |
| 851 | 803 | ||
| 852 | /* Now we have enough information to set default encodings. */ | 804 | /* Now we have enough information to set default encodings. */ |
| 853 | if (ft->info.encoding == -1) | 805 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) |
| 854 | ft->info.encoding = ST_ENCODING_SIGN2; | 806 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 855 | break; | 807 | break; |
| 856 | 808 | ||
| @@ -861,7 +813,7 @@ int st_wavstartread(ft_t ft) · 4 unmodified lines | |||
| 861 | st_warn("User options overriding size read in .wav header"); | 813 | st_warn("User options overriding size read in .wav header"); |
| 862 | 814 | ||
| 863 | /* Now we have enough information to set default encodings. */ | 815 | /* Now we have enough information to set default encodings. */ |
| 864 | if (ft->info.encoding == -1) | 816 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) |
| 865 | ft->info.encoding = ST_ENCODING_SIGN2; | 817 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 866 | break; | 818 | break; |
| 867 | 819 | ||
| @@ -872,7 +824,7 @@ int st_wavstartread(ft_t ft) · 4 unmodified lines | |||
| 872 | st_warn("User options overriding size read in .wav header"); | 824 | st_warn("User options overriding size read in .wav header"); |
| 873 | 825 | ||
| 874 | /* Now we have enough information to set default encodings. */ | 826 | /* Now we have enough information to set default encodings. */ |
| 875 | if (ft->info.encoding == -1) | 827 | if (ft->info.encoding == ST_ENCODING_UNKNOWN) |
| 876 | ft->info.encoding = ST_ENCODING_SIGN2; | 828 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 877 | break; | 829 | break; |
| 878 | 830 | ||
| @@ -1078,10 +1030,10 @@ int st_wavstartread(ft_t ft) · 199 unmodified lines | |||
| 1078 | * Return number of samples read. | 1030 | * Return number of samples read. |
| 1079 | */ | 1031 | */ |
| 1080 | 1032 | ||
| 1081 | st_ssize_t st_wavread(ft_t ft, st_sample_t *buf, st_size_t len) | 1033 | static st_size_t st_wavread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 1082 | { | 1034 | { |
| 1083 | wav_t wav = (wav_t) ft->priv; | 1035 | wav_t wav = (wav_t) ft->priv; |
| 1084 | st_ssize_t done; | 1036 | st_size_t done; |
| 1085 | 1037 | ||
| 1086 | ft->st_errno = ST_SUCCESS; | 1038 | ft->st_errno = ST_SUCCESS; |
| 1087 | 1039 | ||
| @@ -1116,7 +1068,7 @@ st_ssize_t st_wavread(ft_t ft, st_sample_t *buf, st_size_t len) · 28 unmodified lines | |||
| 1116 | /* Copy interleaved data into buf, converting to st_sample_t */ | 1068 | /* Copy interleaved data into buf, converting to st_sample_t */ |
| 1117 | { | 1069 | { |
| 1118 | short *p, *top; | 1070 | short *p, *top; |
| 1119 | int ct; | 1071 | size_t ct; |
| 1120 | ct = len-done; | 1072 | ct = len-done; |
| 1121 | if (ct > (wav->blockSamplesRemaining*ft->info.channels)) | 1073 | if (ct > (wav->blockSamplesRemaining*ft->info.channels)) |
| 1122 | ct = (wav->blockSamplesRemaining*ft->info.channels); | 1074 | ct = (wav->blockSamplesRemaining*ft->info.channels); |
| @@ -1186,7 +1138,7 @@ st_ssize_t st_wavread(ft_t ft, st_sample_t *buf, st_size_t len) · 63 unmodified lines | |||
| 1186 | * Do anything required when you stop reading samples. | 1138 | * Do anything required when you stop reading samples. |
| 1187 | * Don't close input file! | 1139 | * Don't close input file! |
| 1188 | */ | 1140 | */ |
| 1189 | int st_wavstopread(ft_t ft) | 1141 | static int st_wavstopread(ft_t ft) |
| 1190 | { | 1142 | { |
| 1191 | wav_t wav = (wav_t) ft->priv; | 1143 | wav_t wav = (wav_t) ft->priv; |
| 1192 | int rc = ST_SUCCESS; | 1144 | int rc = ST_SUCCESS; |
| @@ -1218,7 +1170,7 @@ int st_wavstopread(ft_t ft) · 25 unmodified lines | |||
| 1218 | return rc; | 1170 | return rc; |
| 1219 | } | 1171 | } |
| 1220 | 1172 | ||
| 1221 | int st_wavstartwrite(ft_t ft) | 1173 | static int st_wavstartwrite(ft_t ft) |
| 1222 | { | 1174 | { |
| 1223 | wav_t wav = (wav_t) ft->priv; | 1175 | wav_t wav = (wav_t) ft->priv; |
| 1224 | int rc; | 1176 | int rc; |
| @@ -1252,7 +1204,7 @@ int st_wavstartwrite(ft_t ft) · 27 unmodified lines | |||
| 1252 | wav->iCoefs = NULL; | 1204 | wav->iCoefs = NULL; |
| 1253 | switch (wav->formatTag) | 1205 | switch (wav->formatTag) |
| 1254 | { | 1206 | { |
| 1255 | int ch, sbsize; | 1207 | size_t ch, sbsize; |
| 1256 | 1208 | ||
| 1257 | case WAVE_FORMAT_IMA_ADPCM: | 1209 | case WAVE_FORMAT_IMA_ADPCM: |
| 1258 | initImaTable(); | 1210 | initImaTable(); |
| @@ -1572,7 +1524,7 @@ static int wavwritehdr(ft_t ft, int second_header) · 313 unmodified lines | |||
| 1572 | 1524 | ||
| 1573 | if (isExtensible) | 1525 | if (isExtensible) |
| 1574 | { | 1526 | { |
| 1575 | int i; | 1527 | size_t i; |
| 1576 | static const char guid[14] = "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71"; | 1528 | static const char guid[14] = "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71"; |
| 1577 | st_writew(ft, 22); | 1529 | st_writew(ft, 22); |
| 1578 | st_writew(ft, wBitsPerSample); /* No padding in container */ | 1530 | st_writew(ft, wBitsPerSample); /* No padding in container */ |
| @@ -1640,7 +1592,7 @@ static int wavwritehdr(ft_t ft, int second_header) · 61 unmodified lines | |||
| 1640 | return ST_SUCCESS; | 1592 | return ST_SUCCESS; |
| 1641 | } | 1593 | } |
| 1642 | 1594 | ||
| 1643 | st_ssize_t st_wavwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 1595 | static st_size_t st_wavwrite(ft_t ft, const st_sample_t *buf, st_size_t len) |
| 1644 | { | 1596 | { |
| 1645 | wav_t wav = (wav_t) ft->priv; | 1597 | wav_t wav = (wav_t) ft->priv; |
| 1646 | st_ssize_t total_len = len; | 1598 | st_ssize_t total_len = len; |
| @@ -1681,7 +1633,7 @@ st_ssize_t st_wavwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 34 unmodified lines | |||
| 1681 | } | 1633 | } |
| 1682 | } | 1634 | } |
| 1683 | 1635 | ||
| 1684 | int st_wavstopwrite(ft_t ft) | 1636 | static int st_wavstopwrite(ft_t ft) |
| 1685 | { | 1637 | { |
| 1686 | wav_t wav = (wav_t) ft->priv; | 1638 | wav_t wav = (wav_t) ft->priv; |
| 1687 | 1639 | ||
| @@ -1778,7 +1730,7 @@ static char *wav_format_str(unsigned wFormatTag) · 90 unmodified lines | |||
| 1778 | } | 1730 | } |
| 1779 | } | 1731 | } |
| 1780 | 1732 | ||
| 1781 | int st_wavseek(ft_t ft, st_size_t offset) | 1733 | static int st_wavseek(ft_t ft, st_size_t offset) |
| 1782 | { | 1734 | { |
| 1783 | wav_t wav = (wav_t) ft->priv; | 1735 | wav_t wav = (wav_t) ft->priv; |
| 1784 | int new_offset, channel_block, alignment; | 1736 | int new_offset, channel_block, alignment; |
| @@ -25,7 +25,7 @@ typedef struct wvepriv · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | static void wvewriteheader(ft_t ft); | 26 | static void wvewriteheader(ft_t ft); |
| 27 | 27 | ||
| 28 | int st_wveseek(ft_t ft, st_size_t offset) | 28 | static int st_wveseek(ft_t ft, st_size_t offset) |
| 29 | { | 29 | { |
| 30 | int new_offset, channel_block, alignment; | 30 | int new_offset, channel_block, alignment; |
| 31 | wve_t wve = (wve_t ) ft->priv; | 31 | wve_t wve = (wve_t ) ft->priv; |
| @@ -45,7 +45,7 @@ int st_wveseek(ft_t ft, st_size_t offset) · 13 unmodified lines | |||
| 45 | return st_seeki(ft, offset, SEEK_SET); | 45 | return st_seeki(ft, offset, SEEK_SET); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | int st_wvestartread(ft_t ft) | 48 | static int st_wvestartread(ft_t ft) |
| 49 | { | 49 | { |
| 50 | wve_t p = (wve_t ) ft->priv; | 50 | wve_t p = (wve_t ) ft->priv; |
| 51 | char magic[16]; | 51 | char magic[16]; |
| @@ -117,7 +117,7 @@ int st_wvestartread(ft_t ft) · 65 unmodified lines | |||
| 117 | st_report("WVE must use 8000 sample rate. Overriding"); | 117 | st_report("WVE must use 8000 sample rate. Overriding"); |
| 118 | ft->info.rate = 8000; | 118 | ft->info.rate = 8000; |
| 119 | 119 | ||
| 120 | if (ft->info.channels != -1 && ft->info.channels != 1) | 120 | if (ft->info.channels != ST_ENCODING_UNKNOWN && ft->info.channels != 1) |
| 121 | st_report("WVE must only supports 1 channel. Overriding"); | 121 | st_report("WVE must only supports 1 channel. Overriding"); |
| 122 | ft->info.channels = 1; | 122 | ft->info.channels = 1; |
| 123 | 123 | ||
| @@ -136,7 +136,7 @@ int st_wvestartread(ft_t ft) · 12 unmodified lines | |||
| 136 | if it is not, the unspecified size remains in the header | 136 | if it is not, the unspecified size remains in the header |
| 137 | (this is illegal). */ | 137 | (this is illegal). */ |
| 138 | 138 | ||
| 139 | int st_wvestartwrite(ft_t ft) | 139 | static int st_wvestartwrite(ft_t ft) |
| 140 | { | 140 | { |
| 141 | wve_t p = (wve_t ) ft->priv; | 141 | wve_t p = (wve_t ) ft->priv; |
| 142 | int rc; | 142 | int rc; |
| @@ -161,7 +161,7 @@ int st_wvestartwrite(ft_t ft) · 18 unmodified lines | |||
| 161 | if (ft->info.rate != 0) | 161 | if (ft->info.rate != 0) |
| 162 | st_report("WVE must use 8000 sample rate. Overriding"); | 162 | st_report("WVE must use 8000 sample rate. Overriding"); |
| 163 | 163 | ||
| 164 | if (ft->info.channels != -1 && ft->info.channels != 1) | 164 | if (ft->info.channels != 0 && ft->info.channels != 1) |
| 165 | st_report("WVE must only supports 1 channel. Overriding"); | 165 | st_report("WVE must only supports 1 channel. Overriding"); |
| 166 | 166 | ||
| 167 | ft->info.encoding = ST_ENCODING_ALAW; | 167 | ft->info.encoding = ST_ENCODING_ALAW; |
| @@ -172,14 +172,14 @@ int st_wvestartwrite(ft_t ft) · 4 unmodified lines | |||
| 172 | return ST_SUCCESS; | 172 | return ST_SUCCESS; |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | st_ssize_t st_wvewrite(ft_t ft, const st_sample_t *buf, st_size_t samp) | 175 | static st_size_t st_wvewrite(ft_t ft, const st_sample_t *buf, st_size_t samp) |
| 176 | { | 176 | { |
| 177 | wve_t p = (wve_t ) ft->priv; | 177 | wve_t p = (wve_t ) ft->priv; |
| 178 | p->length += samp * ft->info.size; | 178 | p->length += samp * ft->info.size; |
| 179 | return st_rawwrite(ft, buf, samp); | 179 | return st_rawwrite(ft, buf, samp); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | int st_wvestopwrite(ft_t ft) | 182 | static int st_wvestopwrite(ft_t ft) |
| 183 | { | 183 | { |
| 184 | 184 | ||
| 185 | /* Call before seeking to flush buffer */ | 185 | /* Call before seeking to flush buffer */ |
| @@ -141,7 +141,7 @@ static int st_xastartread(ft_t ft) · 140 unmodified lines | |||
| 141 | st_report("User options overriding size read in .xa header"); | 141 | st_report("User options overriding size read in .xa header"); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | if (ft->info.channels == -1 || ft->info.channels == xa->header.channels) { | 144 | if (ft->info.channels == 0 || ft->info.channels == xa->header.channels) { |
| 145 | ft->info.channels = xa->header.channels; | 145 | ft->info.channels = xa->header.channels; |
| 146 | } else { | 146 | } else { |
| 147 | st_report("User options overriding channels read in .xa header"); | 147 | st_report("User options overriding channels read in .xa header"); |
| @@ -210,14 +210,12 @@ static int st_xastartread(ft_t ft) · 62 unmodified lines | |||
| 210 | * Read up to len samples from a file, converted to signed longs. | 210 | * Read up to len samples from a file, converted to signed longs. |
| 211 | * Return the number of samples read. | 211 | * Return the number of samples read. |
| 212 | */ | 212 | */ |
| 213 | static st_ssize_t st_xaread(ft_t ft, st_sample_t *buf, st_size_t len) | 213 | static st_size_t st_xaread(ft_t ft, st_sample_t *buf, st_size_t len) |
| 214 | { | 214 | { |
| 215 | xa_t xa = (xa_t) ft->priv; | 215 | xa_t xa = (xa_t) ft->priv; |
| 216 | st_ssize_t done; | ||
| 217 | st_ssize_t bytes; | ||
| 218 | int32_t sample; | 216 | int32_t sample; |
| 219 | unsigned char inByte; | 217 | unsigned char inByte; |
| 220 | unsigned int i; | 218 | size_t i, done, bytes; |
| 221 | 219 | ||
| 222 | ft->st_errno = ST_SUCCESS; | 220 | ft->st_errno = ST_SUCCESS; |
| 223 | done = 0; | 221 | done = 0; |
| @@ -312,7 +310,7 @@ static int st_xastartwrite(ft_t ft) · 88 unmodified lines | |||
| 312 | return ST_EOF; | 310 | return ST_EOF; |
| 313 | } | 311 | } |
| 314 | 312 | ||
| 315 | static st_ssize_t st_xawrite(ft_t ft, const st_sample_t *buf, st_size_t len) | 313 | static st_size_t st_xawrite(ft_t ft, const st_sample_t *buf UNUSED, st_size_t len UNUSED) |
| 316 | { | 314 | { |
| 317 | st_fail_errno(ft, ST_ENOTSUP, ".XA writing not supported"); | 315 | st_fail_errno(ft, ST_ENOTSUP, ".XA writing not supported"); |
| 318 | return ST_EOF; | 316 | return ST_EOF; |