Changeset 7e80dc9 for src/tempo/tempo.c
- Timestamp:
- Feb 8, 2016, 6:06:52 PM (8 years ago)
- 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:
- a33d406
- Parents:
- fa74361
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tempo/tempo.c
rfa74361 r7e80dc9 28 28 #include "mathutils.h" 29 29 #include "tempo/tempo.h" 30 31 // TODO implement get/set_delay32 33 /** set current delay34 35 \param o beat tracking object36 37 \return current delay, in samples38 39 */40 uint_t aubio_tempo_get_delay(aubio_tempo_t * o);41 42 /** set current delay43 44 \param o beat tracking object45 \param delay delay to set tempo to, in samples46 47 \return `0` if successful, non-zero otherwise48 49 */50 uint_t aubio_tempo_set_delay(aubio_tempo_t * o, uint_t delay);51 30 52 31 /* structure to store object state */ … … 70 49 uint_t total_frames; /** total frames since beginning */ 71 50 uint_t last_beat; /** time of latest detected beat, in samples */ 72 uint_t delay; /** delay to remove to last beat, in samples */51 sint_t delay; /** delay to remove to last beat, in samples */ 73 52 uint_t last_tatum; /** time of latest detected tatum, in samples */ 74 53 uint_t tatum_signature; /** number of tatum between each beats */ … … 125 104 uint_t aubio_tempo_get_last (aubio_tempo_t *o) 126 105 { 127 return o->last_beat -o->delay;106 return o->last_beat + o->delay; 128 107 } 129 108 … … 138 117 } 139 118 140 uint_t aubio_tempo_set_delay(aubio_tempo_t * o, uint_t delay) {119 uint_t aubio_tempo_set_delay(aubio_tempo_t * o, sint_t delay) { 141 120 o->delay = delay; 121 return AUBIO_OK; 122 } 123 124 uint_t aubio_tempo_set_delay_s(aubio_tempo_t * o, smpl_t delay) { 125 o->delay = delay * o->samplerate; 126 return AUBIO_OK; 127 } 128 129 uint_t aubio_tempo_set_delay_ms(aubio_tempo_t * o, smpl_t delay) { 130 o->delay = 1000. * delay * o->samplerate; 142 131 return AUBIO_OK; 143 132 } … … 145 134 uint_t aubio_tempo_get_delay(aubio_tempo_t * o) { 146 135 return o->delay; 136 } 137 138 smpl_t aubio_tempo_get_delay_s(aubio_tempo_t * o) { 139 return o->delay / (smpl_t)(o->samplerate); 140 } 141 142 smpl_t aubio_tempo_get_delay_ms(aubio_tempo_t * o) { 143 return o->delay / (smpl_t)(o->samplerate) / 1000.; 147 144 } 148 145
Note: See TracChangeset
for help on using the changeset viewer.