Changeset 633400d for src/io/sink_wavwrite.c
- Timestamp:
- Dec 5, 2018, 10:34:39 PM (5 years ago)
- Branches:
- feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- 283a619a
- Parents:
- 5b46bc3 (diff), f19db54 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink_wavwrite.c
r5b46bc3 r633400d 20 20 21 21 22 #include " config.h"22 #include "aubio_priv.h" 23 23 24 24 #ifdef HAVE_WAVWRITE 25 25 26 #include "aubio_priv.h"27 26 #include "fvec.h" 28 27 #include "fmat.h" 29 28 #include "io/sink_wavwrite.h" 29 #include "io/ioutils.h" 30 30 31 31 #include <errno.h> 32 32 33 #define MAX_CHANNELS 634 33 #define MAX_SIZE 4096 35 34 … … 105 104 s->channels = 0; 106 105 107 // negative samplerate given, abort108 if ((sint_t)samplerate < 0) goto beach;109 106 // zero samplerate given. do not open yet 110 if ((sint_t)samplerate == 0) return s; 111 // samplerate way too large, fail 112 if ((sint_t)samplerate > 192000 * 4) goto beach; 107 if ((sint_t)samplerate == 0) { 108 return s; 109 } 110 // invalid samplerate given, abort 111 if (aubio_io_validate_samplerate("sink_wavwrite", s->path, samplerate)) { 112 goto beach; 113 } 113 114 114 115 s->samplerate = samplerate; … … 130 131 uint_t aubio_sink_wavwrite_preset_samplerate(aubio_sink_wavwrite_t *s, uint_t samplerate) 131 132 { 132 if ((sint_t)(samplerate) <= 0) return AUBIO_FAIL; 133 if (aubio_io_validate_samplerate("sink_wavwrite", s->path, samplerate)) { 134 return AUBIO_FAIL; 135 } 133 136 s->samplerate = samplerate; 134 137 // automatically open when both samplerate and channels have been set … … 141 144 uint_t aubio_sink_wavwrite_preset_channels(aubio_sink_wavwrite_t *s, uint_t channels) 142 145 { 143 if ((sint_t)(channels) <= 0) return AUBIO_FAIL; 146 if (aubio_io_validate_channels("sink_wavwrite", s->path, channels)) { 147 return AUBIO_FAIL; 148 } 144 149 s->channels = channels; 145 150 // automatically open when both samplerate and channels have been set … … 214 219 s->scratch_size = s->max_size * s->channels; 215 220 /* allocate data for de/interleaving reallocated when needed. */ 216 if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) {221 if (s->scratch_size >= MAX_SIZE * AUBIO_MAX_CHANNELS) { 217 222 AUBIO_ERR("sink_wavwrite: %d x %d exceeds SIZE maximum buffer size %d\n", 218 s->max_size, s->channels, MAX_SIZE * MAX_CHANNELS);223 s->max_size, s->channels, MAX_SIZE * AUBIO_MAX_CHANNELS); 219 224 goto beach; 220 225 }
Note: See TracChangeset
for help on using the changeset viewer.