- Timestamp:
- Dec 17, 2018, 3:11:17 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/crepe, fix/ffmpeg5, master
- Children:
- 7e2eef4
- Parents:
- 252f585
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink_vorbis.c
r252f585 rdc72476 36 36 #include <errno.h> // errno 37 37 #include <time.h> // time 38 39 #define MAX_SIZE 2048 38 40 39 41 struct _aubio_sink_vorbis_t { … … 245 247 { 246 248 uint_t c, v; 247 float **buffer = vorbis_analysis_buffer(&s->vd, (long)write); 249 uint_t length = aubio_sink_validate_input_length("sink_vorbis", s->path, 250 MAX_SIZE, write_data->length, write); 251 float **buffer = vorbis_analysis_buffer(&s->vd, (long)length); 248 252 // fill buffer 249 253 if (!write) { … … 254 258 } else { 255 259 for (c = 0; c < s->channels; c++) { 256 for (v = 0; v < write; v++) {260 for (v = 0; v < length; v++) { 257 261 buffer[c][v] = write_data->data[v]; 258 262 } 259 263 } 260 264 // tell vorbis how many frames were written 261 vorbis_analysis_wrote(&s->vd, (long) write);265 vorbis_analysis_wrote(&s->vd, (long)length); 262 266 } 263 267 // write to file … … 269 273 { 270 274 uint_t c, v; 271 uint_t channels = MIN(s->channels, write_data->height); 272 float **buffer = vorbis_analysis_buffer(&s->vd, (long)write); 275 uint_t channels = aubio_sink_validate_input_channels("sink_vorbis", s->path, 276 s->channels, write_data->height); 277 uint_t length = aubio_sink_validate_input_length("sink_vorbis", s->path, 278 MAX_SIZE, write_data->length, write); 279 float **buffer = vorbis_analysis_buffer(&s->vd, (long)length); 273 280 // fill buffer 274 281 if (!write) { … … 279 286 } else { 280 287 for (c = 0; c < channels; c++) { 281 for (v = 0; v < write; v++) {288 for (v = 0; v < length; v++) { 282 289 buffer[c][v] = write_data->data[c][v]; 283 290 }
Note: See TracChangeset
for help on using the changeset viewer.