Changeset c34336e


Ignore:
Timestamp:
Dec 17, 2013, 5:13:28 PM (10 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
941c9f9
Parents:
5d10ac1
Message:

src/fvec.h: clean up fvec api

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • examples/aubionotes.c

    r5d10ac1 rc34336e  
    5252
    5353  aubio_pitch_do (pitch, ibuf, pitch_obuf);
    54   smpl_t new_pitch = fvec_read_sample(pitch_obuf, 0);
     54  smpl_t new_pitch = fvec_get_sample(pitch_obuf, 0);
    5555  if(median){
    5656    note_append(note_buffer, new_pitch);
     
    5959  /* curlevel is negatif or 1 if silence */
    6060  smpl_t curlevel = aubio_level_detection(ibuf, silence_threshold);
    61   if (fvec_read_sample(onset, 0)) {
     61  if (fvec_get_sample(onset, 0)) {
    6262    /* test for silence */
    6363    if (curlevel == 1.) {
  • examples/aubioonset.c

    r5d10ac1 rc34336e  
    3434  fvec_zeros(obuf);
    3535  aubio_onset_do (o, ibuf, onset);
    36   is_onset = fvec_read_sample(onset, 0);
     36  is_onset = fvec_get_sample(onset, 0);
    3737  if ( is_onset ) {
    3838    aubio_wavetable_play ( wavetable );
  • examples/aubiopitch.c

    r5d10ac1 rc34336e  
    3333  fvec_zeros(obuf);
    3434  aubio_pitch_do (o, ibuf, pitch);
    35   smpl_t freq = fvec_read_sample(pitch, 0);
     35  smpl_t freq = fvec_get_sample(pitch, 0);
    3636  aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) );
    3737  aubio_wavetable_set_freq ( wavetable, freq );
     
    4545void
    4646process_print (void) {
    47   smpl_t pitch_found = fvec_read_sample(pitch, 0);
     47  smpl_t pitch_found = fvec_get_sample(pitch, 0);
    4848  outmsg("%f %f\n",(blocks)
    4949      *hop_size/(float)samplerate, pitch_found);
     
    7070  if (pitch_unit != NULL)
    7171    aubio_pitch_set_unit (o, pitch_unit);
     72
    7273  pitch = new_fvec (1);
    7374
  • examples/aubiotrack.c

    r5d10ac1 rc34336e  
    2929fvec_t * tempo_out;
    3030smpl_t is_beat = 0;
    31 smpl_t is_onset = 0;
    3231uint_t is_silence = 0.;
    3332
    3433void process_block(fvec_t * ibuf, fvec_t *obuf) {
    3534  aubio_tempo_do (tempo, ibuf, tempo_out);
    36   is_beat = fvec_read_sample (tempo_out, 0);
    37   is_onset = fvec_read_sample (tempo_out, 1);
     35  is_beat = fvec_get_sample (tempo_out, 0);
    3836  if (silence_threshold != -90.)
    3937    is_silence = aubio_silence_detection(ibuf, silence_threshold);
     
    5452    outmsg("%f\n", aubio_tempo_get_last_s(tempo) );
    5553  }
    56   //if ( is_onset )
    57   //  outmsg(" \t \t%f\n",(blocks)*hop_size/(float)samplerate);
    5854}
    5955
  • examples/jackio.c

    r5d10ac1 rc34336e  
    253253  for (j=0;j<(unsigned)nframes;j++) {
    254254    /* put synthnew in output */
    255     output[0][j] = fvec_read_sample(dev->obuf, dev->pos);
     255    output[0][j] = fvec_get_sample(dev->obuf, dev->pos);
    256256    /* write input to datanew */
    257     fvec_write_sample(dev->ibuf, input[0][j], dev->pos);
     257    fvec_set_sample(dev->ibuf, input[0][j], dev->pos);
    258258    /*time for fft*/
    259259    if (dev->pos == (int)(dev->hop_size) - 1) {
  • src/fvec.c

    r5d10ac1 rc34336e  
    3737}
    3838
    39 void fvec_write_sample(fvec_t *s, smpl_t data, uint_t position) {
     39void fvec_set_sample(fvec_t *s, smpl_t data, uint_t position) {
    4040  s->data[position] = data;
    4141}
    4242
    43 smpl_t fvec_read_sample(fvec_t *s, uint_t position) {
     43smpl_t fvec_get_sample(fvec_t *s, uint_t position) {
    4444  return s->data[position];
    4545}
     
    5959}
    6060
    61 void fvec_set(fvec_t *s, smpl_t val) {
     61void fvec_set_all (fvec_t *s, smpl_t val) {
    6262  uint_t j;
    6363  for (j=0; j< s->length; j++) {
     
    7070  memset(s->data, 0, s->length * sizeof(smpl_t));
    7171#else
    72   fvec_set(s, 0.);
     72  fvec_set_all (s, 0.);
    7373#endif
    7474}
    7575
    7676void fvec_ones(fvec_t *s) {
    77   fvec_set(s, 1.);
     77  fvec_set_all (s, 1.);
    7878}
    7979
  • src/fvec.h

    r5d10ac1 rc34336e  
    7676*/
    7777fvec_t * new_fvec(uint_t length);
     78
    7879/** fvec_t buffer deletion function
    7980
     
    8283*/
    8384void del_fvec(fvec_t *s);
     85
    8486/** read sample value in a buffer
    8587
     
    9294
    9395*/
    94 smpl_t fvec_read_sample(fvec_t *s, uint_t position);
     96smpl_t fvec_get_sample(fvec_t *s, uint_t position);
     97
    9598/** write sample value in a buffer
    9699
     
    104107
    105108*/
    106 void  fvec_write_sample(fvec_t *s, smpl_t data, uint_t position);
     109void  fvec_set_sample(fvec_t *s, smpl_t data, uint_t position);
    107110
    108111/** read data from a buffer
     
    130133
    131134*/
    132 void fvec_set(fvec_t *s, smpl_t val);
     135void fvec_set_all (fvec_t *s, smpl_t val);
    133136
    134137/** set all elements to zero
  • tests/src/spectral/test-phasevoc-jack.c

    r5d10ac1 rc34336e  
    7575    for (i=0;i<channels;i++) {
    7676      /* write input to datanew */
    77       fvec_write_sample(in[i], input[i][j], pos);
     77      fvec_set_sample(in[i], input[i][j], pos);
    7878      /* put synthnew in output */
    79       output[i][j] = fvec_read_sample(out[i], pos);
     79      output[i][j] = fvec_get_sample(out[i], pos);
    8080    }
    8181    /*time for fft*/
  • tests/src/spectral/test-phasevoc.c

    r5d10ac1 rc34336e  
    1515
    1616  // fill input with some data
    17   fvec_set (in, 1.);
     17  fvec_set_all (in, 1.);
    1818  fvec_print (in);
    1919
Note: See TracChangeset for help on using the changeset viewer.