SF_INFO sfinfo;
if (path == NULL) {
- AUBIO_ERR("Aborted opening null path\n");
+ AUBIO_ERR("sink_sndfile: Aborted opening null path\n");
return NULL;
}
if (s->handle == NULL) {
/* show libsndfile err msg */
- AUBIO_ERR("Failed opening %s. %s\n", s->path, sf_strerror (NULL));
+ AUBIO_ERR("sink_sndfile: Failed opening %s. %s\n", s->path, sf_strerror (NULL));
AUBIO_FREE(s);
return NULL;
}
s->scratch_size = s->max_size*s->channels;
/* allocate data for de/interleaving reallocated when needed. */
if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) {
- AUBIO_ERR("%d x %d exceeds maximum aubio_sink_sndfile buffer size %d\n",
+ AUBIO_ERR("sink_sndfile: %d x %d exceeds maximum aubio_sink_sndfile buffer size %d\n",
s->max_size, s->channels, MAX_CHANNELS * MAX_CHANNELS);
AUBIO_FREE(s);
return NULL;
written_frames = sf_write_float (s->handle, s->scratch_data, nsamples);
if (written_frames/channels != write) {
- AUBIO_WRN("trying to write %d frames to %s, but only %d could be written",
+ AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written",
write, s->path, (uint_t)written_frames);
}
return;
return AUBIO_FAIL;
}
if (sf_close(s->handle)) {
- AUBIO_ERR("Error closing file %s: %s", s->path, sf_strerror (NULL));
+ AUBIO_ERR("sink_sndfile: Error closing file %s: %s", s->path, sf_strerror (NULL));
return AUBIO_FAIL;
}
s->handle = NULL;
aubio_source_avcodec_t * s = AUBIO_NEW(aubio_source_avcodec_t);
int err;
if (path == NULL) {
- AUBIO_ERR("Aborted opening null path\n");
+ AUBIO_ERR("source_avcodec: Aborted opening null path\n");
goto beach;
}
if ((sint_t)samplerate < 0) {
- AUBIO_ERR("Can not open %s with samplerate %d\n", path, samplerate);
+ AUBIO_ERR("source_avcodec: Can not open %s with samplerate %d\n", path, samplerate);
goto beach;
}
if ((sint_t)hop_size <= 0) {
- AUBIO_ERR("Can not open %s with hop_size %d\n", path, hop_size);
+ AUBIO_ERR("source_avcodec: Can not open %s with hop_size %d\n", path, hop_size);
goto beach;
}
if ( (err = avformat_open_input(&avFormatCtx, s->path, NULL, NULL) ) < 0 ) {
char errorstr[256];
av_strerror (err, errorstr, sizeof(errorstr));
- AUBIO_ERR("Failed opening %s (%s)\n", s->path, errorstr);
+ AUBIO_ERR("source_avcodec: Failed opening %s (%s)\n", s->path, errorstr);
goto beach;
}
if ( (err = avformat_find_stream_info(avFormatCtx, NULL)) < 0 ) {
char errorstr[256];
av_strerror (err, errorstr, sizeof(errorstr));
- AUBIO_ERR("Could not find stream information " "for %s (%s)\n", s->path,
+ AUBIO_ERR("source_avcodec: Could not find stream information " "for %s (%s)\n", s->path,
errorstr);
goto beach;
}
if (selected_stream == -1) {
selected_stream = i;
} else {
- AUBIO_WRN("More than one audio stream in %s, "
+ AUBIO_WRN("source_avcodec: More than one audio stream in %s, "
"taking the first one\n", s->path);
}
}
}
if (selected_stream == -1) {
- AUBIO_ERR("No audio stream in %s\n", s->path);
+ AUBIO_ERR("source_avcodec: No audio stream in %s\n", s->path);
goto beach;
}
//AUBIO_DBG("Taking stream %d in file %s\n", selected_stream, s->path);
avCodecCtx = avFormatCtx->streams[selected_stream]->codec;
AVCodec *codec = avcodec_find_decoder(avCodecCtx->codec_id);
if (codec == NULL) {
- AUBIO_ERR("Could not find decoder for %s", s->path);
+ AUBIO_ERR("source_avcodec: Could not find decoder for %s", s->path);
goto beach;
}
if ( ( err = avcodec_open2(avCodecCtx, codec, NULL) ) < 0) {
char errorstr[256];
av_strerror (err, errorstr, sizeof(errorstr));
- AUBIO_ERR("Could not load codec for %s (%s)\n", s->path, errorstr);
+ AUBIO_ERR("source_avcodec: Could not load codec for %s (%s)\n", s->path, errorstr);
goto beach;
}
s->samplerate = samplerate;
if (s->samplerate > s->input_samplerate) {
- AUBIO_WRN("upsampling %s from %d to %d\n", s->path,
+ AUBIO_WRN("source_avcodec: upsampling %s from %d to %d\n", s->path,
s->input_samplerate, s->samplerate);
}
AVFrame *avFrame = s->avFrame;
avFrame = avcodec_alloc_frame();
if (!avFrame) {
- AUBIO_ERR("Could not allocate frame for (%s)\n", s->path);
+ AUBIO_ERR("source_avcodec: Could not allocate frame for (%s)\n", s->path);
}
/* allocate output for avr */
if ( ( err = avresample_open(avr) ) < 0) {
char errorstr[256];
av_strerror (err, errorstr, sizeof(errorstr));
- AUBIO_ERR("Could not open AVAudioResampleContext for %s (%s)\n",
+ AUBIO_ERR("source_avcodec: Could not open AVAudioResampleContext for %s (%s)\n",
s->path, errorstr);
//goto beach;
return;
SF_INFO sfinfo;
if (path == NULL) {
- AUBIO_ERR("Aborted opening null path\n");
+ AUBIO_ERR("source_sndfile: Aborted opening null path\n");
goto beach;
}
if ((sint_t)samplerate < 0) {
- AUBIO_ERR("Can not open %s with samplerate %d\n", path, samplerate);
+ AUBIO_ERR("source_sndfile: Can not open %s with samplerate %d\n", path, samplerate);
goto beach;
}
if ((sint_t)hop_size <= 0) {
- AUBIO_ERR("Can not open %s with hop_size %d\n", path, hop_size);
+ AUBIO_ERR("source_sndfile: Can not open %s with hop_size %d\n", path, hop_size);
goto beach;
}
if (s->handle == NULL) {
/* show libsndfile err msg */
- AUBIO_ERR("Failed opening %s: %s\n", s->path, sf_strerror (NULL));
+ AUBIO_ERR("source_sndfile: Failed opening %s: %s\n", s->path, sf_strerror (NULL));
goto beach;
}
s->input_hop_size = (uint_t)FLOOR(s->hop_size / s->ratio + .5);
if (s->input_hop_size * s->input_channels > MAX_SAMPLES) {
- AUBIO_ERR("Not able to process more than %d frames of %d channels\n",
+ AUBIO_ERR("source_sndfile: Not able to process more than %d frames of %d channels\n",
MAX_SAMPLES / s->input_channels, s->input_channels);
goto beach;
}
if (s->ratio > 1) {
// we would need to add a ring buffer for these
if ( (uint_t)(s->input_hop_size * s->ratio + .5) != s->hop_size ) {
- AUBIO_ERR("can not upsample %s from %d to %d\n", s->path,
+ AUBIO_ERR("source_sndfile: can not upsample %s from %d to %d\n", s->path,
s->input_samplerate, s->samplerate);
goto beach;
}
- AUBIO_WRN("upsampling %s from %d to %d\n", s->path,
+ AUBIO_WRN("source_sndfile: upsampling %s from %d to %d\n", s->path,
s->input_samplerate, s->samplerate);
}
}
#else
if (s->ratio != 1) {
- AUBIO_ERR("aubio was compiled without aubio_resampler\n");
+ AUBIO_ERR("source_sndfile: aubio was compiled without aubio_resampler\n");
goto beach;
}
#endif /* HAVE_SAMPLERATE */
return AUBIO_FAIL;
}
if(sf_close(s->handle)) {
- AUBIO_ERR("Error closing file %s: %s", s->path, sf_strerror (NULL));
+ AUBIO_ERR("source_sndfile: Error closing file %s: %s", s->path, sf_strerror (NULL));
return AUBIO_FAIL;
}
return AUBIO_OK;
int main (void)
{
uint_t i, window_size = 16; // window size
- utils_init_random();
cvec_t * complex_vector = new_cvec (window_size); // input buffer
uint_t rand_times = 4;
+ utils_init_random();
+
while (rand_times -- ) {
// fill with random phas and norm
for ( i = 0; i < complex_vector->length; i++ ) {