History

Count samples with 64 bits in more places

Change a number of places where size_t or off_t were still used to count samples in order to now use (sox_)uint64_t. Also use PRIu64 where such numbers are output. Some function prototypes and data structures from sox.h are also affected. This breaks ABI compatibility; the library version number has been incremented for 14.4.0 already in commit e9a66b7c, so no change necessary here.

Ulrich Klauer committed 14 years ago

Commit f596a1a1 parent 9279a4817 files · +74 −69Browse files

Unified · Split

17 files
  1. src/bend.c +3 −2
  2. src/crop.c +2 −2
  3. src/delay.c +5 −4
  4. src/effects.c +7 −7
  5. src/effects_i.c +2 −2
  6. src/fade.c +6 −4
  7. src/oss.c +1 −1
  8. src/pad.c +6 −6
  9. src/repeat.c +2 −2
  10. src/sox.c +15 −14
  11. src/sox.h +5 −5
  12. src/sox_i.h +1 −1
  13. src/spectrogram.c +2 −2
  14. src/splice.c +8 −8
  15. src/stat.c +2 −2
  16. src/synth.c +4 −4
  17. src/trim.c +3 −3
src/bend.c+3−2
@@ -43,7 +43,7 @@ typedef struct { · 42 unmodified lines
43 char *str; /* Command-line argument to parse for this bend */43 char *str; /* Command-line argument to parse for this bend */
44 size_t start; /* Start bending when in_pos equals this */44 size_t start; /* Start bending when in_pos equals this */
45 double cents;45 double cents;
46 size_t duration; /* Number of samples to bend */46 uint64_t duration; /* Number of samples to bend */
47 } *bends;47 } *bends;
48 48
49 unsigned frame_rate;49 unsigned frame_rate;
@@ -69,7 +69,8 @@ typedef struct { · 19 unmodified lines
69static int parse(sox_effect_t * effp, char **argv, sox_rate_t rate)69static int parse(sox_effect_t * effp, char **argv, sox_rate_t rate)
70{70{
71 priv_t *p = (priv_t *) effp->priv;71 priv_t *p = (priv_t *) effp->priv;
72 size_t i, time = 0, delay;72 size_t i;
73 uint64_t time = 0, delay;
73 char const *next;74 char const *next;
74 75
75 for (i = 0; i < p->nbends; ++i) {76 for (i = 0; i < p->nbends; ++i) {
src/crop.c+2−2
@@ -32,7 +32,7 @@ static int parse(sox_effect_t * effp, char * * argv, sox_rate_t rate) · 31 unmodified lines
32{32{
33 priv_t * p = (priv_t *)effp->priv;33 priv_t * p = (priv_t *)effp->priv;
34 char const * s, * q;34 char const * s, * q;
35 size_t samples;35 uint64_t samples;
36 int i;36 int i;
37 37
38 for (i = p->argc - 1; i == 0 || i == 1; --i) {38 for (i = p->argc - 1; i == 0 || i == 1; --i) {
@@ -105,7 +105,7 @@ static int flow(sox_effect_t * effp, sox_sample_t const * ibuf, · 66 unmodified lines
105 sox_sample_t * obuf, size_t * isamp, size_t * osamp)105 sox_sample_t * obuf, size_t * isamp, size_t * osamp)
106{106{
107 priv_t * p = (priv_t *)effp->priv;107 priv_t * p = (priv_t *)effp->priv;
108 size_t skipped;108 uint64_t skipped;
109 109
110 p->pos[0].at -= skipped = min(p->pos[0].at, *isamp);110 p->pos[0].at -= skipped = min(p->pos[0].at, *isamp);
111 *osamp = !p->pos[0].at * min(p->pos[1].at, min(*isamp - skipped, *osamp));111 *osamp = !p->pos[0].at * min(p->pos[1].at, min(*isamp - skipped, *osamp));
src/delay.c+5−4
@@ -21,7 +21,8 @@ · 20 unmodified lines
21typedef struct {21typedef struct {
22 size_t argc;22 size_t argc;
23 char * * argv, * max_arg;23 char * * argv, * max_arg;
24 size_t delay, pre_pad, pad, buffer_size, buffer_index;24 uint64_t delay, pre_pad, pad;
25 size_t buffer_size, buffer_index;
25 sox_sample_t * buffer;26 sox_sample_t * buffer;
26 sox_bool drain_started;27 sox_bool drain_started;
27} priv_t;28} priv_t;
@@ -40,7 +41,7 @@ static int lsx_kill(sox_effect_t * effp) · 12 unmodified lines
40static int create(sox_effect_t * effp, int argc, char * * argv)41static int create(sox_effect_t * effp, int argc, char * * argv)
41{42{
42 priv_t * p = (priv_t *)effp->priv;43 priv_t * p = (priv_t *)effp->priv;
43 size_t delay, max_samples = 0;44 uint64_t delay, max_samples = 0;
44 unsigned i;45 unsigned i;
45 46
46 --argc, ++argv;47 --argc, ++argv;
@@ -70,7 +71,7 @@ static int stop(sox_effect_t * effp) · 23 unmodified lines
70static int start(sox_effect_t * effp)71static int start(sox_effect_t * effp)
71{72{
72 priv_t * p = (priv_t *)effp->priv;73 priv_t * p = (priv_t *)effp->priv;
73 size_t max_delay;74 uint64_t max_delay;
74 75
75 if (!p->max_arg)76 if (!p->max_arg)
76 return SOX_EFF_NULL;77 return SOX_EFF_NULL;
@@ -82,7 +83,7 @@ static int start(sox_effect_t * effp) · 5 unmodified lines
82 lsx_parsesamples(effp->in_signal.rate, p->argv[effp->flow], &p->buffer_size, 't');83 lsx_parsesamples(effp->in_signal.rate, p->argv[effp->flow], &p->buffer_size, 't');
83 lsx_parsesamples(effp->in_signal.rate, p->max_arg, &max_delay, 't');84 lsx_parsesamples(effp->in_signal.rate, p->max_arg, &max_delay, 't');
84 if (effp->flow == 0)85 if (effp->flow == 0)
85 lsx_debug("extending audio by %" PRIuPTR " samples", max_delay);86 lsx_debug("extending audio by %" PRIu64 " samples", max_delay);
86 p->buffer_index = p->delay = p->pre_pad = 0;87 p->buffer_index = p->delay = p->pre_pad = 0;
87 p->pad = max_delay - p->buffer_size;88 p->pad = max_delay - p->buffer_size;
88 p->buffer = lsx_malloc(p->buffer_size * sizeof(*p->buffer));89 p->buffer = lsx_malloc(p->buffer_size * sizeof(*p->buffer));
src/effects.c+7−7
@@ -397,20 +397,20 @@ int sox_flow_effects(sox_effects_chain_t * chain, int (* callback)(sox_bool all_ · 396 unmodified lines
397 return flow_status;397 return flow_status;
398}398}
399 399
400size_t sox_effects_clips(sox_effects_chain_t * chain)400uint64_t sox_effects_clips(sox_effects_chain_t * chain)
401{401{
402 unsigned i, f;402 unsigned i, f;
403 size_t clips = 0;403 uint64_t clips = 0;
404 for (i = 1; i < chain->length - 1; ++i)404 for (i = 1; i < chain->length - 1; ++i)
405 for (f = 0; f < chain->effects[i][0].flows; ++f)405 for (f = 0; f < chain->effects[i][0].flows; ++f)
406 clips += chain->effects[i][f].clips;406 clips += chain->effects[i][f].clips;
407 return clips;407 return clips;
408}408}
409 409
410size_t sox_stop_effect(sox_effect_t *effp)410uint64_t sox_stop_effect(sox_effect_t *effp)
411{411{
412 unsigned f;412 unsigned f;
413 size_t clips = 0;413 uint64_t clips = 0;
414 414
415 for (f = 0; f < effp->flows; ++f) {415 for (f = 0; f < effp->flows; ++f) {
416 effp[f].handler.stop(&effp[f]);416 effp[f].handler.stop(&effp[f]);
@@ -451,12 +451,12 @@ sox_effect_t *sox_pop_effect_last(sox_effects_chain_t *chain) · 34 unmodified lines
451 */451 */
452void sox_delete_effect(sox_effect_t *effp)452void sox_delete_effect(sox_effect_t *effp)
453{453{
454 size_t clips;454 uint64_t clips;
455 unsigned f;455 unsigned f;
456 456
457 if ((clips = sox_stop_effect(effp)) != 0)457 if ((clips = sox_stop_effect(effp)) != 0)
458 lsx_warn("%s clipped %lu samples; decrease volume?",458 lsx_warn("%s clipped %" PRIu64 " samples; decrease volume?",
459 effp->handler.name, (unsigned long)clips);459 effp->handler.name, clips);
460 effp->handler.kill(effp); /* N.B. only one kill; not one per flow */460 effp->handler.kill(effp); /* N.B. only one kill; not one per flow */
461 for (f = 0; f < effp->flows; ++f)461 for (f = 0; f < effp->flows; ++f)
462 free(effp[f].priv);462 free(effp[f].priv);
src/effects_i.c+2−2
@@ -145,7 +145,7 @@ void lsx_generate_wave_table( · 144 unmodified lines
145 * # of samples.145 * # of samples.
146 * Returns NULL on error, pointer to next char to parse otherwise.146 * Returns NULL on error, pointer to next char to parse otherwise.
147 */147 */
148char const * lsx_parsesamples(sox_rate_t rate, const char *str0, size_t *samples, int def)148char const * lsx_parsesamples(sox_rate_t rate, const char *str0, uint64_t *samples, int def)
149{149{
150 int i, found_samples = 0, found_time = 0;150 int i, found_samples = 0, found_time = 0;
151 char const * end;151 char const * end;
@@ -214,7 +214,7 @@ char const * lsx_parsesamples(sox_rate_t rate, const char *str0, size_t *samples · 62 unmodified lines
214int main(int argc, char * * argv)214int main(int argc, char * * argv)
215{215{
216 char const * str, * next;216 char const * str, * next;
217 size_t samples;217 uint64_t samples;
218 218
219 TEST("0" , 0, 1)219 TEST("0" , 0, 1)
220 TEST("1" , 10000, 1)220 TEST("1" , 10000, 1)
src/fade.c+6−4
@@ -47,7 +47,7 @@ static int sox_fade_getopts(sox_effect_t * effp, int argc, char **argv) · 46 unmodified lines
47 priv_t * fade = (priv_t *) effp->priv;47 priv_t * fade = (priv_t *) effp->priv;
48 char t_char[2];48 char t_char[2];
49 int t_argno;49 int t_argno;
50 size_t samples;50 uint64_t samples;
51 const char *n;51 const char *n;
52 --argc, ++argv;52 --argc, ++argv;
53 53
@@ -118,7 +118,7 @@ static int sox_fade_start(sox_effect_t * effp) · 64 unmodified lines
118{118{
119 priv_t * fade = (priv_t *) effp->priv;119 priv_t * fade = (priv_t *) effp->priv;
120 sox_bool truncate = sox_false;120 sox_bool truncate = sox_false;
121 size_t samples;121 uint64_t samples;
122 122
123 /* converting time values to samples */123 /* converting time values to samples */
124 fade->in_start = 0;124 fade->in_start = 0;
@@ -179,7 +179,9 @@ static int sox_fade_start(sox_effect_t * effp) · 54 unmodified lines
179 fade->samplesdone = fade->in_start;179 fade->samplesdone = fade->in_start;
180 fade->endpadwarned = 0;180 fade->endpadwarned = 0;
181 181
182 lsx_debug("in_start = %lu in_stop = %lu out_start = %lu out_stop = %lu", (unsigned long)fade->in_start, (unsigned long)fade->in_stop, (unsigned long)fade->out_start, (unsigned long)fade->out_stop);182 lsx_debug("in_start = %" PRIu64 " in_stop = %" PRIu64 " "
183 "out_start = %" PRIu64 " out_stop = %" PRIu64,
184 fade->in_start, fade->in_stop, fade->out_start, fade->out_stop);
183 185
184 if (fade->in_start == fade->in_stop && !truncate &&186 if (fade->in_start == fade->in_stop && !truncate &&
185 fade->out_start == fade->out_stop)187 fade->out_start == fade->out_stop)
@@ -285,7 +287,7 @@ static int sox_fade_drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp · 99 unmodified lines
285 if (fade->do_out && fade->samplesdone < fade->out_stop &&287 if (fade->do_out && fade->samplesdone < fade->out_stop &&
286 !(fade->endpadwarned))288 !(fade->endpadwarned))
287 { /* Warning about padding silence into end of sample */289 { /* Warning about padding silence into end of sample */
288 lsx_warn("Fade: warning: End time passed end-of-file. Padding with silence");290 lsx_warn("End time past end of audio. Padding with silence");
289 fade->endpadwarned = 1;291 fade->endpadwarned = 1;
290 } /* endif endpadwarned */292 } /* endif endpadwarned */
291 293
src/oss.c+1−1
@@ -204,7 +204,7 @@ static int ossinit(sox_format_t * ft) · 203 unmodified lines
204 file->size = 0;204 file->size = 0;
205 ioctl (fileno(ft->fp), SNDCTL_DSP_GETBLKSIZE, &file->size);205 ioctl (fileno(ft->fp), SNDCTL_DSP_GETBLKSIZE, &file->size);
206 if (file->size < 4 || file->size > 65536) {206 if (file->size < 4 || file->size > 65536) {
207 lsx_fail_errno(ft,SOX_EOF,"Invalid audio buffer size %lu", (unsigned long)file->size);207 lsx_fail_errno(ft,SOX_EOF,"Invalid audio buffer size %" PRIuPTR, file->size);
208 return (SOX_EOF);208 return (SOX_EOF);
209 }209 }
210 file->count = 0;210 file->count = 0;
src/pad.c+6−6
@@ -21,13 +21,13 @@ typedef struct { · 20 unmodified lines
21 unsigned npads; /* Number of pads requested */21 unsigned npads; /* Number of pads requested */
22 struct {22 struct {
23 char * str; /* Command-line argument to parse for this pad */23 char * str; /* Command-line argument to parse for this pad */
24 size_t start; /* Start padding when in_pos equals this */24 uint64_t start; /* Start padding when in_pos equals this */
25 size_t pad; /* Number of samples to pad */25 uint64_t pad; /* Number of samples to pad */
26 } * pads;26 } * pads;
27 27
28 size_t in_pos; /* Number of samples read from the input stream */28 uint64_t in_pos; /* Number of samples read from the input stream */
29 unsigned pads_pos; /* Number of pads completed so far */29 unsigned pads_pos; /* Number of pads completed so far */
30 size_t pad_pos; /* Number of samples through the current pad */30 uint64_t pad_pos; /* Number of samples through the current pad */
31} priv_t;31} priv_t;
32 32
33static int parse(sox_effect_t * effp, char * * argv, sox_rate_t rate)33static int parse(sox_effect_t * effp, char * * argv, sox_rate_t rate)
@@ -42,7 +42,7 @@ static int parse(sox_effect_t * effp, char * * argv, sox_rate_t rate) · 8 unmodified lines
42 next = lsx_parsesamples(rate, p->pads[i].str, &p->pads[i].pad, 't');42 next = lsx_parsesamples(rate, p->pads[i].str, &p->pads[i].pad, 't');
43 if (next == NULL) break;43 if (next == NULL) break;
44 if (*next == '\0')44 if (*next == '\0')
45 p->pads[i].start = i? SOX_SIZE_MAX : 0;45 p->pads[i].start = i? UINT64_MAX : 0;
46 else {46 else {
47 if (*next != '@') break;47 if (*next != '@') break;
48 next = lsx_parsesamples(rate, next+1, &p->pads[i].start, 't');48 next = lsx_parsesamples(rate, next+1, &p->pads[i].start, 't');
@@ -118,7 +118,7 @@ static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp) · 69 unmodified lines
118 priv_t * p = (priv_t *)effp->priv;118 priv_t * p = (priv_t *)effp->priv;
119 static size_t isamp = 0;119 static size_t isamp = 0;
120 if (p->pads_pos != p->npads && p->in_pos != p->pads[p->pads_pos].start)120 if (p->pads_pos != p->npads && p->in_pos != p->pads[p->pads_pos].start)
121 p->in_pos = SOX_SIZE_MAX; /* Invoke the final pad (with no given start) */121 p->in_pos = UINT64_MAX; /* Invoke the final pad (with no given start) */
122 return flow(effp, 0, obuf, &isamp, osamp);122 return flow(effp, 0, obuf, &isamp, osamp);
123}123}
124 124
src/repeat.c+2−2
@@ -20,7 +20,7 @@ · 19 unmodified lines
20 20
21typedef struct {21typedef struct {
22 unsigned num_repeats, remaining_repeats;22 unsigned num_repeats, remaining_repeats;
23 off_t num_samples, remaining_samples;23 uint64_t num_samples, remaining_samples;
24 FILE * tmp_file;24 FILE * tmp_file;
25} priv_t;25} priv_t;
26 26
@@ -74,7 +74,7 @@ static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp) · 47 unmodified lines
74 --p->remaining_repeats;74 --p->remaining_repeats;
75 rewind(p->tmp_file);75 rewind(p->tmp_file);
76 }76 }
77 n = min(p->remaining_samples, (off_t)(*osamp - odone));77 n = min(p->remaining_samples, *osamp - odone);
78 if ((fread(obuf + odone, sizeof(*obuf), n, p->tmp_file)) != n) {78 if ((fread(obuf + odone, sizeof(*obuf), n, p->tmp_file)) != n) {
79 lsx_fail("error reading temporary file: %s", strerror(errno));79 lsx_fail("error reading temporary file: %s", strerror(errno));
80 return SOX_EOF;80 return SOX_EOF;
src/sox.c+15−14
@@ -151,7 +151,7 @@ typedef struct { · 150 unmodified lines
151 sox_bool no_glob;151 sox_bool no_glob;
152 152
153 sox_format_t * ft; /* libSoX file descriptor */153 sox_format_t * ft; /* libSoX file descriptor */
154 size_t volume_clips;154 uint64_t volume_clips;
155 rg_mode replay_gain_mode;155 rg_mode replay_gain_mode;
156} file_t;156} file_t;
157 157
@@ -187,7 +187,7 @@ static char * play_rate_arg = NULL; · 29 unmodified lines
187 187
188static sox_signalinfo_t combiner_signal, ofile_signal_options;188static sox_signalinfo_t combiner_signal, ofile_signal_options;
189static sox_encodinginfo_t combiner_encoding, ofile_encoding_options;189static sox_encodinginfo_t combiner_encoding, ofile_encoding_options;
190static size_t mixing_clips = 0;190static uint64_t mixing_clips = 0;
191static size_t current_input = 0;191static size_t current_input = 0;
192static uint64_t input_wide_samples = 0;192static uint64_t input_wide_samples = 0;
193static uint64_t read_wide_samples = 0;193static uint64_t read_wide_samples = 0;
@@ -381,9 +381,9 @@ static void display_file_info(sox_format_t * ft, file_t * f, sox_bool full) · 187 unmodified lines
381 uint64_t ws = ft->signal.length / ft->signal.channels;381 uint64_t ws = ft->signal.length / ft->signal.channels;
382 char const * text, * text2 = NULL;382 char const * text, * text2 = NULL;
383 fprintf(output,383 fprintf(output,
384 "Duration : %s = %lu samples %c %g CDDA sectors\n",384 "Duration : %s = %" PRIu64 " samples %c %g CDDA sectors\n",
385 str_time((double)ws / ft->signal.rate),385 str_time((double)ws / ft->signal.rate),
386 (unsigned long)ws, "~="[ft->signal.rate == 44100],386 ws, "~="[ft->signal.rate == 44100],
387 (double)ws / ft->signal.rate * 44100 / 588);387 (double)ws / ft->signal.rate * 44100 / 588);
388 if (ft->mode == 'r' && (text = size_and_bitrate(ft, &text2))) {388 if (ft->mode == 'r' && (text = size_and_bitrate(ft, &text2))) {
389 fprintf(output, "File Size : %s\n", text);389 fprintf(output, "File Size : %s\n", text);
@@ -489,7 +489,8 @@ typedef struct { · 99 unmodified lines
489static int combiner_start(sox_effect_t *effp)489static int combiner_start(sox_effect_t *effp)
490{490{
491 input_combiner_t * z = (input_combiner_t *) effp->priv;491 input_combiner_t * z = (input_combiner_t *) effp->priv;
492 size_t ws, i;492 uint64_t ws;
493 size_t i;
493 494
494 if (is_serial(combine_method))495 if (is_serial(combine_method))
495 progress_to_next_input_file(files[current_input], effp);496 progress_to_next_input_file(files[current_input], effp);
@@ -1113,10 +1114,10 @@ static int advance_eff_chain(void) · 617 unmodified lines
1113 return SOX_SUCCESS;1114 return SOX_SUCCESS;
1114} /* advance_eff_chain */1115} /* advance_eff_chain */
1115 1116
1116static size_t total_clips(void)1117static uint64_t total_clips(void)
1117{1118{
1118 unsigned i;1119 unsigned i;
1119 size_t clips = 0;1120 uint64_t clips = 0;
1120 for (i = 0; i < file_count; ++i)1121 for (i = 0; i < file_count; ++i)
1121 clips += files[i]->ft->clips + files[i]->volume_clips;1122 clips += files[i]->ft->clips + files[i]->volume_clips;
1122 return clips + mixing_clips + sox_effects_clips(effects_chain);1123 return clips + mixing_clips + sox_effects_clips(effects_chain);
@@ -2615,7 +2616,7 @@ static int soxi1(soxi_t const * type, char const * filename) · 1492 unmodified lines
2615 case Type: printf("%s\n", ft->filetype); break;2616 case Type: printf("%s\n", ft->filetype); break;
2616 case Rate: printf("%g\n", ft->signal.rate); break;2617 case Rate: printf("%g\n", ft->signal.rate); break;
2617 case Channels: printf("%u\n", ft->signal.channels); break;2618 case Channels: printf("%u\n", ft->signal.channels); break;
2618 case Samples: if (soxi_total ==-1) printf("%lu\n",(unsigned long)ws); break;2619 case Samples: if (soxi_total ==-1) printf("%" PRIu64 "\n", ws); break;
2619 case Duration: if (soxi_total ==-1) printf("%s\n", str_time(secs)); break;2620 case Duration: if (soxi_total ==-1) printf("%s\n", str_time(secs)); break;
2620 case Duration_secs: if (soxi_total ==-1) printf("%f\n", secs); break;2621 case Duration_secs: if (soxi_total ==-1) printf("%f\n", secs); break;
2621 case Bits: printf("%u\n", ft->encoding.bits_per_sample); break;2622 case Bits: printf("%u\n", ft->encoding.bits_per_sample); break;
@@ -2952,19 +2953,19 @@ int main(int argc, char **argv) · 330 unmodified lines
2952 2953
2953 for (i = 0; i < file_count; ++i)2954 for (i = 0; i < file_count; ++i)
2954 if (files[i]->ft->clips != 0)2955 if (files[i]->ft->clips != 0)
2955 lsx_warn(i < input_count?"`%s' input clipped %lu samples" :2956 lsx_warn(i < input_count?"`%s' input clipped %" PRIu64 " samples" :
2956 "`%s' output clipped %lu samples; decrease volume?",2957 "`%s' output clipped %" PRIu64 " samples; decrease volume?",
2957 (files[i]->ft->handler.flags & SOX_FILE_DEVICE)?2958 (files[i]->ft->handler.flags & SOX_FILE_DEVICE)?
2958 files[i]->ft->handler.names[0] : files[i]->ft->filename,2959 files[i]->ft->handler.names[0] : files[i]->ft->filename,
2959 (unsigned long)files[i]->ft->clips);2960 files[i]->ft->clips);
2960 2961
2961 if (mixing_clips > 0)2962 if (mixing_clips > 0)
2962 lsx_warn("mix-combining clipped %lu samples; decrease volume?", (unsigned long)mixing_clips);2963 lsx_warn("mix-combining clipped %" PRIu64 " samples; decrease volume?", mixing_clips);
2963 2964
2964 for (i = 0; i < file_count; i++)2965 for (i = 0; i < file_count; i++)
2965 if (files[i]->volume_clips > 0)2966 if (files[i]->volume_clips > 0)
2966 lsx_warn("`%s' balancing clipped %lu samples; decrease volume?",2967 lsx_warn("`%s' balancing clipped %" PRIu64 " samples; decrease volume?",
2967 files[i]->filename, (unsigned long)files[i]->volume_clips);2968 files[i]->filename, files[i]->volume_clips);
2968 2969
2969 if (show_progress) {2970 if (show_progress) {
2970 if (user_abort)2971 if (user_abort)
src/sox.h+5−5
@@ -1515,7 +1515,7 @@ Data passed to/from the format handler · 1514 unmodified lines
1515*/1515*/
1516struct sox_format_t {1516struct sox_format_t {
1517 char * filename; /**< File name */1517 char * filename; /**< File name */
1518 1518
1519 /**1519 /**
1520 Signal specifications for reader (decoder) or writer (encoder):1520 Signal specifications for reader (decoder) or writer (encoder):
1521 sample rate, number of channels, precision, length, headroom multiplier.1521 sample rate, number of channels, precision, length, headroom multiplier.
@@ -1543,7 +1543,7 @@ struct sox_format_t { · 21 unmodified lines
1543 sox_bool seekable; /**< Can seek on this file */1543 sox_bool seekable; /**< Can seek on this file */
1544 char mode; /**< Read or write mode ('r' or 'w') */1544 char mode; /**< Read or write mode ('r' or 'w') */
1545 sox_uint64_t olength; /**< Samples * chans written to file */1545 sox_uint64_t olength; /**< Samples * chans written to file */
1546 size_t clips; /**< Incremented if clipping occurs */1546 sox_uint64_t clips; /**< Incremented if clipping occurs */
1547 int sox_errno; /**< Failure error code */1547 int sox_errno; /**< Failure error code */
1548 char sox_errstr[256]; /**< Failure error text */1548 char sox_errstr[256]; /**< Failure error text */
1549 void * fp; /**< File stream pointer */1549 void * fp; /**< File stream pointer */
@@ -1606,7 +1606,7 @@ struct sox_effect_t { · 56 unmodified lines
1606 size_t obeg; /**< output buffer consumed */1606 size_t obeg; /**< output buffer consumed */
1607 size_t oend; /**< output buffer total length */1607 size_t oend; /**< output buffer total length */
1608 size_t imin; /**< minimum input buffer size */1608 size_t imin; /**< minimum input buffer size */
1609 size_t clips; /**< increment if clipping occurs */1609 sox_uint64_t clips; /**< increment if clipping occurs */
1610 size_t flows; /**< 1 if MCHAN, number of chans otherwise */1610 size_t flows; /**< 1 if MCHAN, number of chans otherwise */
1611 size_t flow; /**< flow number */1611 size_t flow; /**< flow number */
1612 void * priv; /**< Effect's private data area */1612 void * priv; /**< Effect's private data area */
@@ -2129,7 +2129,7 @@ Client API: · 516 unmodified lines
2129Gets the number of clips that occurred while running an effects chain.2129Gets the number of clips that occurred while running an effects chain.
2130@returns the number of clips that occurred while running an effects chain.2130@returns the number of clips that occurred while running an effects chain.
2131*/2131*/
2132size_t2132sox_uint64_t
2133LSX_API2133LSX_API
2134sox_effects_clips(2134sox_effects_clips(
2135 LSX_PARAM_IN sox_effects_chain_t * chain /**< Effects chain from which to read clip information. */2135 LSX_PARAM_IN sox_effects_chain_t * chain /**< Effects chain from which to read clip information. */
@@ -2140,7 +2140,7 @@ Client API: · 4 unmodified lines
2140Shuts down an effect (calls stop on each of its flows).2140Shuts down an effect (calls stop on each of its flows).
2141@returns the number of clips from all flows.2141@returns the number of clips from all flows.
2142*/2142*/
2143size_t2143sox_uint64_t
2144LSX_API2144LSX_API
2145sox_stop_effect(2145sox_stop_effect(
2146 LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t * effp /**< Effect to stop. */2146 LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t * effp /**< Effect to stop. */
src/sox_i.h+1−1
@@ -73,7 +73,7 @@ void lsx_generate_wave_table( · 72 unmodified lines
73 double min, /* Minimum value on the y-axis. (e.g. -1) */73 double min, /* Minimum value on the y-axis. (e.g. -1) */
74 double max, /* Maximum value on the y-axis. (e.g. +1) */74 double max, /* Maximum value on the y-axis. (e.g. +1) */
75 double phase); /* Phase at 1st point; 0..2pi. (e.g. pi/2 for cosine) */75 double phase); /* Phase at 1st point; 0..2pi. (e.g. pi/2 for cosine) */
76char const * lsx_parsesamples(sox_rate_t rate, const char *str, size_t *samples, int def);76char const * lsx_parsesamples(sox_rate_t rate, const char *str, uint64_t *samples, int def);
77int lsx_parse_note(char const * text, char * * end_ptr);77int lsx_parse_note(char const * text, char * * end_ptr);
78double lsx_parse_frequency_k(char const * text, char * * end_ptr, int key);78double lsx_parse_frequency_k(char const * text, char * * end_ptr, int key);
79#define lsx_parse_frequency(a, b) lsx_parse_frequency_k(a, b, INT_MAX)79#define lsx_parse_frequency(a, b) lsx_parse_frequency_k(a, b, INT_MAX)
src/spectrogram.c+2−2
@@ -56,7 +56,7 @@ typedef struct { · 55 unmodified lines
56 56
57 /* Per-channel work area */57 /* Per-channel work area */
58 int WORK; /* Start of work area is marked by this dummy variable. */58 int WORK; /* Start of work area is marked by this dummy variable. */
59 size_t skip;59 uint64_t skip;
60 int dft_size, step_size, block_steps, block_num, rows, cols, read;60 int dft_size, step_size, block_steps, block_num, rows, cols, read;
61 int x_size, end, end_min, last_end;61 int x_size, end, end_min, last_end;
62 sox_bool truncated;62 sox_bool truncated;
@@ -92,7 +92,7 @@ static unsigned char const alt_palette[] = · 29 unmodified lines
92static int getopts(sox_effect_t * effp, int argc, char **argv)92static int getopts(sox_effect_t * effp, int argc, char **argv)
93{93{
94 priv_t * p = (priv_t *)effp->priv;94 priv_t * p = (priv_t *)effp->priv;
95 size_t duration;95 uint64_t duration;
96 char const * next;96 char const * next;
97 int c;97 int c;
98 lsx_getopt_t optstate;98 lsx_getopt_t optstate;
src/splice.c+8−8
@@ -50,12 +50,12 @@ typedef struct { · 49 unmodified lines
50 unsigned nsplices; /* Number of splices requested */50 unsigned nsplices; /* Number of splices requested */
51 struct {51 struct {
52 char * str; /* Command-line argument to parse for this splice */52 char * str; /* Command-line argument to parse for this splice */
53 size_t overlap; /* Number of samples to overlap */53 uint64_t overlap; /* Number of samples to overlap */
54 size_t search; /* Number of samples to search */54 uint64_t search; /* Number of samples to search */
55 size_t start; /* Start splicing when in_pos equals this */55 uint64_t start; /* Start splicing when in_pos equals this */
56 } * splices;56 } * splices;
57 57
58 size_t in_pos; /* Number of samples read from the input stream */58 uint64_t in_pos; /* Number of samples read from the input stream */
59 unsigned splices_pos; /* Number of splices completed so far */59 unsigned splices_pos; /* Number of splices completed so far */
60 size_t buffer_pos; /* Number of samples through the current splice */60 size_t buffer_pos; /* Number of samples through the current splice */
61 size_t max_buffer_size;61 size_t max_buffer_size;
@@ -64,7 +64,7 @@ typedef struct { · 2 unmodified lines
64} priv_t;64} priv_t;
65 65
66static void splice(sox_effect_t * effp, const sox_sample_t * in1, const66static void splice(sox_effect_t * effp, const sox_sample_t * in1, const
67 sox_sample_t * in2, sox_sample_t * output, size_t overlap, size_t channels)67 sox_sample_t * in2, sox_sample_t * output, uint64_t overlap, size_t channels)
68{68{
69 priv_t * p = (priv_t *)effp->priv;69 priv_t * p = (priv_t *)effp->priv;
70 size_t i, j, k = 0;70 size_t i, j, k = 0;
@@ -104,10 +104,10 @@ static void splice(sox_effect_t * effp, const sox_sample_t * in1, const · 33 unmodified lines
104 }104 }
105}105}
106 106
107static size_t do_splice(sox_effect_t * effp,107static uint64_t do_splice(sox_effect_t * effp,
108 sox_sample_t * f, size_t overlap, size_t search, size_t channels)108 sox_sample_t * f, uint64_t overlap, uint64_t search, size_t channels)
109{109{
110 size_t offset = search? best_overlap_position(110 uint64_t offset = search? best_overlap_position(
111 f, f + overlap * channels, overlap, search, channels) : 0;111 f, f + overlap * channels, overlap, search, channels) : 0;
112 splice(effp, f, f + (overlap + offset) * channels,112 splice(effp, f, f + (overlap + offset) * channels,
113 f + (overlap + offset) * channels, overlap, channels);113 f + (overlap + offset) * channels, overlap, channels);
src/stat.c+2−2
@@ -25,7 +25,7 @@ typedef struct { · 24 unmodified lines
25 double dsum1, dsum2; /* deltas */25 double dsum1, dsum2; /* deltas */
26 double scale; /* scale-factor */26 double scale; /* scale-factor */
27 double last; /* previous sample */27 double last; /* previous sample */
28 size_t read; /* samples processed */28 uint64_t read; /* samples processed */
29 int volume;29 int volume;
30 int srms;30 int srms;
31 int fft;31 int fft;
@@ -265,7 +265,7 @@ static int sox_stat_stop(sox_effect_t * effp) · 233 unmodified lines
265 if (stat->volume == 2)265 if (stat->volume == 2)
266 fprintf(stderr, "\n\n");266 fprintf(stderr, "\n\n");
267 /* print out the info */267 /* print out the info */
268 fprintf(stderr, "Samples read: %12lu\n", (unsigned long)stat->read);268 fprintf(stderr, "Samples read: %12" PRIu64 "\n", stat->read);
269 fprintf(stderr, "Length (seconds): %12.6f\n", (double)stat->read/effp->in_signal.rate/effp->in_signal.channels);269 fprintf(stderr, "Length (seconds): %12.6f\n", (double)stat->read/effp->in_signal.rate/effp->in_signal.channels);
270 if (stat->srms)270 if (stat->srms)
271 fprintf(stderr, "Scaled by rms: %12.6f\n", rms);271 fprintf(stderr, "Scaled by rms: %12.6f\n", rms);
src/synth.c+4−4
@@ -186,8 +186,8 @@ typedef struct { · 185 unmodified lines
186 char * length_str;186 char * length_str;
187 channel_t * getopts_channels;187 channel_t * getopts_channels;
188 size_t getopts_nchannels;188 size_t getopts_nchannels;
189 size_t samples_done;189 uint64_t samples_done;
190 size_t samples_to_do;190 uint64_t samples_to_do;
191 channel_t * channels;191 channel_t * channels;
192 size_t number_of_channels;192 size_t number_of_channels;
193 sox_bool no_headroom;193 sox_bool no_headroom;
@@ -514,11 +514,11 @@ static int start(sox_effect_t * effp) · 320 unmodified lines
514 (log(chan->freq2) - log(chan->freq)) / p->samples_to_do : 1;514 (log(chan->freq2) - log(chan->freq)) / p->samples_to_do : 1;
515 break;515 break;
516 }516 }
517 lsx_debug("type=%s, combine=%s, samples_to_do=%lu, f1=%g, f2=%g, "517 lsx_debug("type=%s, combine=%s, samples_to_do=%" PRIu64 ", f1=%g, f2=%g, "
518 "offset=%g, phase=%g, p1=%g, p2=%g, p3=%g mult=%g",518 "offset=%g, phase=%g, p1=%g, p2=%g, p3=%g mult=%g",
519 lsx_find_enum_value(chan->type, synth_type)->text,519 lsx_find_enum_value(chan->type, synth_type)->text,
520 lsx_find_enum_value(chan->combine, combine_type)->text,520 lsx_find_enum_value(chan->combine, combine_type)->text,
521 (unsigned long)p->samples_to_do, chan->freq, chan->freq2,521 p->samples_to_do, chan->freq, chan->freq2,
522 chan->offset, chan->phase, chan->p1, chan->p2, chan->p3, chan->mult);522 chan->offset, chan->phase, chan->p1, chan->p2, chan->p3, chan->mult);
523 }523 }
524 p->gain = 1;524 p->gain = 1;
src/trim.c+3−3
@@ -31,7 +31,7 @@ static int sox_trim_getopts(sox_effect_t * effp, int argc, char **argv) · 30 unmodified lines
31{31{
32 char *end;32 char *end;
33 priv_t * trim = (priv_t *) effp->priv;33 priv_t * trim = (priv_t *) effp->priv;
34 size_t samples;34 uint64_t samples;
35 const char *n;35 const char *n;
36 --argc, ++argv;36 --argc, ++argv;
37 37
@@ -72,7 +72,7 @@ static int sox_trim_getopts(sox_effect_t * effp, int argc, char **argv) · 34 unmodified lines
72static int sox_trim_start(sox_effect_t * effp)72static int sox_trim_start(sox_effect_t * effp)
73{73{
74 priv_t * trim = (priv_t *) effp->priv;74 priv_t * trim = (priv_t *) effp->priv;
75 size_t samples;75 uint64_t samples;
76 76
77 if (lsx_parsesamples(effp->in_signal.rate, trim->start_str,77 if (lsx_parsesamples(effp->in_signal.rate, trim->start_str,
78 &samples, 't') == NULL)78 &samples, 't') == NULL)
@@ -98,7 +98,7 @@ static int sox_trim_start(sox_effect_t * effp) · 19 unmodified lines
98 trim->length = 0;98 trim->length = 0;
99 /* with trim->end_str == NULL, this means indefinite length */99 /* with trim->end_str == NULL, this means indefinite length */
100 100
101 lsx_debug("start at %lus, length %lu", (unsigned long)trim->start, (unsigned long)trim->length);101 lsx_debug("start at %" PRIu64 ", length %" PRIu64, trim->start, trim->length);
102 102
103 /* Account for # of channels */103 /* Account for # of channels */
104 trim->start *= effp->in_signal.channels;104 trim->start *= effp->in_signal.channels;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t