Changeset b4f5967 for examples/utils.c


Ignore:
Timestamp:
Oct 15, 2009, 5:09:34 PM (15 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:
cd77c15
Parents:
27fa522
Message:

src/onset: use a string to set onset mode, keeping onset types enum private, update everywhere onsets are used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/utils.c

    r27fa522 rb4f5967  
    4646
    4747/* energy,specdiff,hfc,complexdomain,phase */
    48 aubio_onsetdetection_type type_onset = aubio_onset_kl;
    49 aubio_onsetdetection_type type_onset2 = aubio_onset_complex;
     48char_t * onset_mode = "default";
    5049smpl_t threshold = 0.3;
    5150smpl_t silence = -90.;
     
    9291
    9392/* badly redeclare some things */
    94 aubio_onsetdetection_type type_onset;
    9593smpl_t threshold;
    9694smpl_t averaging;
     
    164162        break;
    165163      case 'O':                /*onset type */
    166         if (strcmp (optarg, "energy") == 0)
    167           type_onset = aubio_onset_energy;
    168         else if (strcmp (optarg, "specdiff") == 0)
    169           type_onset = aubio_onset_specdiff;
    170         else if (strcmp (optarg, "hfc") == 0)
    171           type_onset = aubio_onset_hfc;
    172         else if (strcmp (optarg, "complexdomain") == 0)
    173           type_onset = aubio_onset_complex;
    174         else if (strcmp (optarg, "complex") == 0)
    175           type_onset = aubio_onset_complex;
    176         else if (strcmp (optarg, "phase") == 0)
    177           type_onset = aubio_onset_phase;
    178         else if (strcmp (optarg, "mkl") == 0)
    179           type_onset = aubio_onset_mkl;
    180         else if (strcmp (optarg, "kl") == 0)
    181           type_onset = aubio_onset_kl;
    182         else if (strcmp (optarg, "specflux") == 0)
    183           type_onset = aubio_onset_specflux;
    184         else {
    185           errmsg ("unknown onset type.\n");
    186           abort ();
    187         }
    188         usedoubled = 0;
     164        onset_mode = optarg;
    189165        break;
    190166      case 's':                /* threshold value for onset */
     
    332308  /* onsets */
    333309  parms = new_aubio_peakpicker (threshold);
    334   o = new_aubio_onsetdetection (type_onset, buffer_size, channels);
     310  o = new_aubio_onsetdetection (onset_mode, buffer_size, channels);
    335311  onset = new_fvec (1, channels);
    336   if (usedoubled) {
    337     o2 = new_aubio_onsetdetection (type_onset2, buffer_size, channels);
    338     onset2 = new_fvec (1, channels);
    339   }
    340312
    341313}
Note: See TracChangeset for help on using the changeset viewer.