Пример #1
0
void
del_aubio_resampler (aubio_resampler_t * s)
{
  if (s->stat) src_delete (s->stat);
  AUBIO_FREE (s->proc);
  AUBIO_FREE (s);
}
Пример #2
0
void del_aubio_sink_sndfile(aubio_sink_sndfile_t * s){
  if (!s) return;
  if (s->path) AUBIO_FREE(s->path);
  aubio_sink_sndfile_close(s);
  AUBIO_FREE(s->scratch_data);
  AUBIO_FREE(s);
}
Пример #3
0
void del_fmat (fmat_t *s) {
  uint_t i;
  for (i=0; i<s->height; i++) {
    AUBIO_FREE(s->data[i]);
  }
  AUBIO_FREE(s->data);
  AUBIO_FREE(s);
}
Пример #4
0
static uint_t aubio_jack_free(aubio_jack_t * jack_setup) {
  AUBIO_FREE(jack_setup->oports);
  AUBIO_FREE(jack_setup->iports);
  AUBIO_FREE(jack_setup->ibufs );
  AUBIO_FREE(jack_setup->obufs );
  AUBIO_FREE(jack_setup);
  return AUBIO_OK;
}
Пример #5
0
void del_aubio_pvoc(aubio_pvoc_t *pv) {
	del_fvec(pv->data);
	del_fvec(pv->synth);
	del_fvec(pv->dataold);
	del_fvec(pv->synthold);
	del_aubio_mfft(pv->fft);
	AUBIO_FREE(pv->w);
	AUBIO_FREE(pv);
}
Пример #6
0
/** del_aubio_track */
int del_aubio_track(aubio_track_t* track)
{
  if (track->name != NULL) {
    AUBIO_FREE(track->name);
  }
  if (track->first != NULL) {
    del_aubio_midi_event(track->first);
  }
  AUBIO_FREE(track);
  return AUBIO_OK;
}
Пример #7
0
void del_aubio_fft(aubio_fft_t * s) {
  /* destroy data */
  del_fvec(s->compspec);
#ifdef HAVE_FFTW3
  fftw_destroy_plan(s->pfw);
  fftw_destroy_plan(s->pbw);
  fftw_free(s->specdata);
#else /* HAVE_FFTW3 */
  AUBIO_FREE(s->w);
  AUBIO_FREE(s->ip);
#endif /* HAVE_FFTW3 */
  AUBIO_FREE(s->out);
  AUBIO_FREE(s->in);
  AUBIO_FREE(s);
}
Пример #8
0
void
del_aubio_list1(aubio_list_t *list)
{
  if (list) {
    AUBIO_FREE(list);
  }
}
Пример #9
0
aubio_wavetable_t *new_aubio_wavetable(uint_t samplerate, uint_t blocksize)
{
    uint_t i = 0;
    aubio_wavetable_t *s = AUBIO_NEW(aubio_wavetable_t);
    if ((sint_t)samplerate <= 0) {
        AUBIO_ERR("Can not create wavetable with samplerate %d\n", samplerate);
        goto beach;
    }
    s->samplerate = samplerate;
    s->blocksize = blocksize;
    s->wavetable_length = WAVETABLE_LEN;
    s->wavetable = new_fvec(s->wavetable_length + 3);
    for (i = 0; i < s->wavetable_length; i++) {
        s->wavetable->data[i] = SIN(TWO_PI * i / (smpl_t) s->wavetable_length );
    }
    s->wavetable->data[s->wavetable_length] = s->wavetable->data[0];
    s->wavetable->data[s->wavetable_length + 1] = s->wavetable->data[1];
    s->wavetable->data[s->wavetable_length + 2] = s->wavetable->data[2];
    s->playing = 0;
    s->last_pos = 0.;
    s->freq = new_aubio_parameter( 0., s->samplerate / 2., 10 );
    s->amp = new_aubio_parameter( 0., 1., 100 );
    return s;
beach:
    AUBIO_FREE(s);
    return NULL;
}
Пример #10
0
aubio_filterbank_t *
new_aubio_filterbank (uint_t n_filters, uint_t win_s)
{
  /* allocate space for filterbank object */
  aubio_filterbank_t *fb = AUBIO_NEW (aubio_filterbank_t);

  if ((sint_t)n_filters <= 0) {
    AUBIO_ERR("filterbank: n_filters should be > 0, got %d\n", n_filters);
    goto fail;
  }
  if ((sint_t)win_s <= 0) {
    AUBIO_ERR("filterbank: win_s should be > 0, got %d\n", win_s);
    goto fail;
  }
  fb->win_s = win_s;
  fb->n_filters = n_filters;

  /* allocate filter tables, a matrix of length win_s and of height n_filters */
  fb->filters = new_fmat (n_filters, win_s / 2 + 1);

  fb->norm = 1;

  fb->power = 1;

  return fb;
fail:
  AUBIO_FREE (fb);
  return NULL;
}
Пример #11
0
void del_aubio_source_avcodec(aubio_source_avcodec_t * s){
  if (!s) return;
  if (s->output != NULL) {
    av_free(s->output);
  }
  if (s->avr != NULL) {
    avresample_close( s->avr );
    av_free ( s->avr );
  }
  s->avr = NULL;
  if (s->avFrame != NULL) {
    avcodec_free_frame( &(s->avFrame) );
  }
  s->avFrame = NULL;
  if (s->avCodecCtx != NULL) {
    avcodec_close ( s->avCodecCtx );
  }
  s->avCodecCtx = NULL;
  if (s->avFormatCtx != NULL) {
    avformat_close_input ( &(s->avFormatCtx) );
  }
  s->avFrame = NULL;
  s->avFormatCtx = NULL;
  AUBIO_FREE(s);
}
Пример #12
0
void del_aubio_wavetable( aubio_wavetable_t * s )
{
    del_aubio_parameter(s->freq);
    del_aubio_parameter(s->amp);
    del_fvec(s->wavetable);
    AUBIO_FREE(s);
}
Пример #13
0
aubio_sink_sndfile_t * new_aubio_sink_sndfile(const char_t * path, uint_t samplerate) {
  aubio_sink_sndfile_t * s = AUBIO_NEW(aubio_sink_sndfile_t);
  s->max_size = MAX_SIZE;

  if (path == NULL) {
    AUBIO_ERR("sink_sndfile: Aborted opening null path\n");
    return NULL;
  }

  if (s->path) AUBIO_FREE(s->path);
  s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX) + 1);
  strncpy(s->path, path, strnlen(path, PATH_MAX) + 1);

  s->samplerate = 0;
  s->channels = 0;

  // negative samplerate given, abort
  if ((sint_t)samplerate < 0) goto beach;
  // zero samplerate given. do not open yet
  if ((sint_t)samplerate == 0) return s;

  s->samplerate = samplerate;
  s->channels = 1;

  if (aubio_sink_sndfile_open(s) != AUBIO_OK) {;
    goto beach;
  }
  return s;

beach:
  del_aubio_sink_sndfile(s);
  return NULL;
}
Пример #14
0
void
del_aubio_pitchmcomb (aubio_pitchmcomb_t * p)
{
  uint_t i;
  del_fvec (p->newmag);
  del_fvec (p->scratch);
  del_fvec (p->theta);
  del_fvec (p->scratch2);
  AUBIO_FREE (p->peaks);
  for (i = 0; i < p->ncand; i++) {
    AUBIO_FREE (p->candidates[i]->ecomb);
    AUBIO_FREE (p->candidates[i]);
  }
  AUBIO_FREE (p->candidates);
  AUBIO_FREE (p);
}
Пример #15
0
/** del_aubio_alsa_seq_driver */
int del_aubio_alsa_seq_driver(aubio_midi_driver_t* p)
{
    aubio_alsa_seq_driver_t* dev;

    dev = (aubio_alsa_seq_driver_t*) p;
    if (dev == NULL) {
        return AUBIO_OK;
    }

    dev->status = AUBIO_MIDI_DONE;

    /* cancel the thread and wait for it before cleaning up */
    if (dev->thread) {
        if (pthread_cancel(dev->thread)) {
            AUBIO_ERR( "Failed to cancel the midi thread");
            return AUBIO_FAIL;
        }
        if (pthread_join(dev->thread, NULL)) {
            AUBIO_ERR( "Failed to join the midi thread");
            return AUBIO_FAIL;
        }
    }
    if (dev->seq_port >= 0) {
        snd_seq_delete_simple_port (dev->seq_handle, dev->seq_port);
    }
    if (dev->seq_handle) {
        snd_seq_drain_output(dev->seq_handle);
        snd_seq_close(dev->seq_handle);
    }
    AUBIO_FREE(dev);
    return AUBIO_OK;
}
Пример #16
0
void
del_aubio_pitch (aubio_pitch_t * p)
{
  switch (p->type) {
    case aubio_pitcht_yin:
      del_fvec (p->buf);
      del_aubio_pitchyin (p->p_object);
      break;
    case aubio_pitcht_mcomb:
      del_aubio_pvoc (p->pv);
      del_cvec (p->fftgrain);
      del_aubio_filter (p->filter);
      del_aubio_pitchmcomb (p->p_object);
      break;
    case aubio_pitcht_schmitt:
      del_fvec (p->buf);
      del_aubio_pitchschmitt (p->p_object);
      break;
    case aubio_pitcht_fcomb:
      del_fvec (p->buf);
      del_aubio_pitchfcomb (p->p_object);
      break;
    case aubio_pitcht_yinfft:
      del_fvec (p->buf);
      del_aubio_pitchyinfft (p->p_object);
      break;
    case aubio_pitcht_specacf:
      del_fvec (p->buf);
      del_aubio_pitchspecacf (p->p_object);
      break;
    default:
      break;
  }
  AUBIO_FREE (p);
}
Пример #17
0
void del_aubio_sampler( aubio_sampler_t * o )
{
  if (o->source) {
    del_aubio_source(o->source);
  }
  del_fvec(o->source_output);
  del_fmat(o->source_output_multi);
  AUBIO_FREE(o);
}
Пример #18
0
void del_aubio_tss(aubio_tss_t *s)
{
  del_fvec(s->theta1);
  del_fvec(s->theta2);
  del_fvec(s->oft1);
  del_fvec(s->oft2);
  del_fvec(s->dev);
  AUBIO_FREE(s);
}
Пример #19
0
void del_aubio_onset (aubio_onset_t *o)
{
  del_aubio_specdesc(o->od);
  del_aubio_peakpicker(o->pp);
  del_aubio_pvoc(o->pv);
  del_fvec(o->desc);
  del_cvec(o->fftgrain);
  AUBIO_FREE(o);
}
Пример #20
0
void del_aubio_notes (aubio_notes_t *o) {
  if (o->note_buffer) del_fvec(o->note_buffer);
  if (o->note_buffer2) del_fvec(o->note_buffer2);
  if (o->pitch_output) del_fvec(o->pitch_output);
  if (o->pitch) del_aubio_pitch(o->pitch);
  if (o->onset_output) del_fvec(o->onset_output);
  if (o->onset) del_aubio_onset(o->onset);
  AUBIO_FREE(o);
}
Пример #21
0
void
del_aubio_pitchspecacf (aubio_pitchspecacf_t * p)
{
    del_fvec (p->win);
    del_fvec (p->winput);
    del_aubio_fft (p->fft);
    del_fvec (p->sqrmag);
    del_fvec (p->fftout);
    AUBIO_FREE (p);
}
Пример #22
0
void
del_aubio_pitchfcomb (aubio_pitchfcomb_t * p)
{
    del_cvec (p->fftOut);
    del_fvec (p->fftLastPhase);
    del_fvec (p->win);
    del_fvec (p->winput);
    del_aubio_fft (p->fft);
    AUBIO_FREE (p);
}
Пример #23
0
void
del_aubio_list(aubio_list_t *list)
{
  aubio_list_t *next;
  while (list) {
    next = list->next;
    AUBIO_FREE(list);
    list = next;
  }
}
Пример #24
0
void
del_aubio_filter (aubio_filter_t * f)
{
  del_lvec (f->a);
  del_lvec (f->b);
  del_lvec (f->x);
  del_lvec (f->y);
  AUBIO_FREE (f);
  return;
}
Пример #25
0
void del_aubio_source_apple_audio(aubio_source_apple_audio_t * s){
  OSStatus err = noErr;
  if (!s || !s->audioFile) { return; }
  err = ExtAudioFileDispose(s->audioFile);
  if (err) AUBIO_ERROR("error in ExtAudioFileDispose, %d\n", (int)err);
  s->audioFile = NULL;
  freeAudioBufferList(&s->bufferList);
  AUBIO_FREE(s);
  return;
}
Пример #26
0
void del_aubio_source(aubio_source_t * s) {
  if (!s) return;
#ifdef __APPLE__
  del_aubio_source_apple_audio((aubio_source_apple_audio_t *)s->source);
#else /* __APPLE__ */
#if HAVE_SNDFILE
  del_aubio_source_sndfile((aubio_source_sndfile_t *)s->source);
#endif /* HAVE_SNDFILE */
#endif /* __APPLE__ */
  AUBIO_FREE(s);
}
Пример #27
0
void freeAudioBufferList(AudioBufferList *bufferList) {
  UInt32 i = 0;
  if (!bufferList) return;
  for (i = 0; i < bufferList->mNumberBuffers; i++) {
    if (bufferList->mBuffers[i].mData) {
      AUBIO_FREE(bufferList->mBuffers[i].mData);
      bufferList->mBuffers[i].mData = NULL;
    }
  }
  bufferList = NULL;
}
Пример #28
0
/** del_aubio_midi_event */
int del_aubio_midi_event(aubio_midi_event_t* evt)
{
  aubio_midi_event_t *temp;
  while(evt)
  {
    temp = evt->next;
    AUBIO_FREE(evt);
    evt = temp;
  }
  return AUBIO_OK;
}
Пример #29
0
void
del_aubio_pitchyinfft (aubio_pitchyinfft_t * p)
{
  del_fvec (p->win);
  del_aubio_fft (p->fft);
  del_fvec (p->yinfft);
  del_fvec (p->sqrmag);
  del_fvec (p->fftout);
  del_fvec (p->winput);
  del_fvec (p->weight);
  AUBIO_FREE (p);
}
Пример #30
0
aubio_sink_t * new_aubio_sink(const char_t * uri, uint_t samplerate) {
  aubio_sink_t * s = AUBIO_NEW(aubio_sink_t);
#ifdef HAVE_SINK_APPLE_AUDIO
  s->sink = (void *)new_aubio_sink_apple_audio(uri, samplerate);
  if (s->sink) {
    s->s_do = (aubio_sink_do_t)(aubio_sink_apple_audio_do);
    s->s_do_multi = (aubio_sink_do_multi_t)(aubio_sink_apple_audio_do_multi);
    s->s_preset_samplerate = (aubio_sink_preset_samplerate_t)(aubio_sink_apple_audio_preset_samplerate);
    s->s_preset_channels = (aubio_sink_preset_channels_t)(aubio_sink_apple_audio_preset_channels);
    s->s_get_samplerate = (aubio_sink_get_samplerate_t)(aubio_sink_apple_audio_get_samplerate);
    s->s_get_channels = (aubio_sink_get_channels_t)(aubio_sink_apple_audio_get_channels);
    s->s_close = (aubio_sink_close_t)(aubio_sink_apple_audio_close);
    s->s_del = (del_aubio_sink_t)(del_aubio_sink_apple_audio);
    return s;
  }
#endif /* HAVE_SINK_APPLE_AUDIO */
#ifdef HAVE_SNDFILE
  s->sink = (void *)new_aubio_sink_sndfile(uri, samplerate);
  if (s->sink) {
    s->s_do = (aubio_sink_do_t)(aubio_sink_sndfile_do);
    s->s_do_multi = (aubio_sink_do_multi_t)(aubio_sink_sndfile_do_multi);
    s->s_preset_samplerate = (aubio_sink_preset_samplerate_t)(aubio_sink_sndfile_preset_samplerate);
    s->s_preset_channels = (aubio_sink_preset_channels_t)(aubio_sink_sndfile_preset_channels);
    s->s_get_samplerate = (aubio_sink_get_samplerate_t)(aubio_sink_sndfile_get_samplerate);
    s->s_get_channels = (aubio_sink_get_channels_t)(aubio_sink_sndfile_get_channels);
    s->s_close = (aubio_sink_close_t)(aubio_sink_sndfile_close);
    s->s_del = (del_aubio_sink_t)(del_aubio_sink_sndfile);
    return s;
  }
#endif /* HAVE_SNDFILE */
#ifdef HAVE_WAVWRITE
  s->sink = (void *)new_aubio_sink_wavwrite(uri, samplerate);
  if (s->sink) {
    s->s_do = (aubio_sink_do_t)(aubio_sink_wavwrite_do);
    s->s_do_multi = (aubio_sink_do_multi_t)(aubio_sink_wavwrite_do_multi);
    s->s_preset_samplerate = (aubio_sink_preset_samplerate_t)(aubio_sink_wavwrite_preset_samplerate);
    s->s_preset_channels = (aubio_sink_preset_channels_t)(aubio_sink_wavwrite_preset_channels);
    s->s_get_samplerate = (aubio_sink_get_samplerate_t)(aubio_sink_wavwrite_get_samplerate);
    s->s_get_channels = (aubio_sink_get_channels_t)(aubio_sink_wavwrite_get_channels);
    s->s_close = (aubio_sink_close_t)(aubio_sink_wavwrite_close);
    s->s_del = (del_aubio_sink_t)(del_aubio_sink_wavwrite);
    return s;
  }
#endif /* HAVE_WAVWRITE */
#if !defined(HAVE_WAVWRITE) && \
  !defined(HAVE_SNDFILE) && \
  !defined(HAVE_SINK_APPLE_AUDIO)
  AUBIO_ERROR("sink: failed creating '%s' at %dHz (no sink built-in)\n", uri, samplerate);
#endif
  AUBIO_FREE(s);
  return NULL;
}