Changes in / [8605361:34e505f]


Ignore:
Location:
src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_apple_audio.c

    r8605361 r34e505f  
    3737extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize);
    3838extern void freeAudioBufferList(AudioBufferList *bufferList);
    39 extern CFURLRef createURLFromPath(const char * path);
     39extern CFURLRef getURLFromPath(const char * path);
    4040char_t *getPrintableOSStatusError(char_t *str, OSStatus error);
    4141
     
    138138
    139139  AudioFileTypeID fileType = kAudioFileWAVEType;
    140   CFURLRef fileURL = createURLFromPath(s->path);
     140  CFURLRef fileURL = getURLFromPath(s->path);
    141141  bool overwrite = true;
    142142  OSStatus err = noErr;
    143143  err = ExtAudioFileCreateWithURL(fileURL, fileType, &clientFormat, NULL,
    144144     overwrite ? kAudioFileFlags_EraseFile : 0, &s->audioFile);
    145   CFRelease(fileURL);
    146145  if (err) {
    147146    char_t errorstr[20];
  • src/io/source_apple_audio.c

    r8605361 r34e505f  
    5252extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int max_source_samples);
    5353extern void freeAudioBufferList(AudioBufferList *bufferList);
    54 extern CFURLRef createURLFromPath(const char * path);
     54extern CFURLRef getURLFromPath(const char * path);
    5555char_t *getPrintableOSStatusError(char_t *str, OSStatus error);
    5656
     
    9999
    100100  // open the resource url
    101   CFURLRef fileURL = createURLFromPath(path);
     101  CFURLRef fileURL = getURLFromPath(path);
    102102  err = ExtAudioFileOpenURL(fileURL, &s->audioFile);
    103   CFRelease(fileURL);
    104103  if (err == -43) {
    105104    AUBIO_ERR("source_apple_audio: Failed opening %s, "
  • src/io/utils_apple_audio.c

    r8605361 r34e505f  
    3434}
    3535
    36 CFURLRef createURLFromPath(const char * path) {
     36CFURLRef getURLFromPath(const char * path) {
    3737  CFStringRef cfTotalPath = CFStringCreateWithCString (kCFAllocatorDefault,
    3838      path, kCFStringEncodingUTF8);
    3939
    40   CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,
     40  return CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,
    4141      kCFURLPOSIXPathStyle, false);
    42   CFRelease(cfTotalPath);
    43   return url;
    4442}
    4543
  • src/pitch/pitchmcomb.c

    r8605361 r34e505f  
    336336  uint_t run = 0;
    337337  for (cur = 0; cur < nbins; cur++) {
    338     for (run = cur + 1; run < nbins; run++) {
     338    run = cur + 1;
     339    for (run = cur; run < nbins; run++) {
    339340      if (candidates[run]->ene > candidates[cur]->ene)
    340341        CAND_SWAP (candidates[run], candidates[cur]);
     
    351352  uint_t run = 0;
    352353  for (cur = 0; cur < nbins; cur++) {
    353     for (run = cur + 1; run < nbins; run++) {
     354    run = cur + 1;
     355    for (run = cur; run < nbins; run++) {
    354356      if (candidates[run]->ebin < candidates[cur]->ebin)
    355357        CAND_SWAP (candidates[run], candidates[cur]);
  • src/tempo/beattracking.c

    r8605361 r34e505f  
    410410
    411411smpl_t
    412 aubio_beattracking_get_period (aubio_beattracking_t * bt)
    413 {
    414   return bt->hop_size * bt->bp;
    415 }
    416 
    417 smpl_t
    418 aubio_beattracking_get_period_s (aubio_beattracking_t * bt)
    419 {
    420   return aubio_beattracking_get_period(bt) / (smpl_t) bt->samplerate;
    421 }
    422 
    423 smpl_t
    424412aubio_beattracking_get_bpm (aubio_beattracking_t * bt)
    425413{
    426414  if (bt->bp != 0) {
    427     return 60. / aubio_beattracking_get_period_s(bt);
     415    return 60. * bt->samplerate/ bt->bp / bt->hop_size;
    428416  } else {
    429417    return 0.;
  • src/tempo/beattracking.h

    r8605361 r34e505f  
    6868    fvec_t * out);
    6969
    70 /** get current beat period in samples
    71 
    72   \param bt beat tracking object
    73 
    74   Returns the currently observed period, in samples, or 0 if no consistent
    75   value is found.
    76 
    77 */
    78 smpl_t aubio_beattracking_get_period (aubio_beattracking_t * bt);
    79 
    80 /** get current beat period in seconds
    81 
    82   \param bt beat tracking object
    83 
    84   Returns the currently observed period, in seconds, or 0 if no consistent
    85   value is found.
    86 
    87 */
    88 smpl_t aubio_beattracking_get_period_s (aubio_beattracking_t * bt);
    89 
    9070/** get current tempo in bpm
    9171
  • src/tempo/tempo.c

    r8605361 r34e505f  
    6565  sint_t blockpos;               /** current position in dfframe */
    6666  uint_t winlen;                 /** dfframe bufsize */
    67   uint_t step;                   /** dfframe hopsize */
    68   uint_t samplerate;             /** sampling rate of the signal */
     67  uint_t step;                   /** dfframe hopsize */ 
     68  uint_t samplerate;             /** sampling rate of the signal */ 
    6969  uint_t hop_size;               /** get hop_size */
    7070  uint_t total_frames;           /** total frames since beginning */
    7171  uint_t last_beat;              /** time of latest detected beat, in samples */
    7272  uint_t delay;                  /** delay to remove to last beat, in samples */
    73   uint_t last_tatum;             /** time of latest detected tatum, in samples */
    74   uint_t tatum_signature;        /** number of tatum between each beats */
    7573};
    7674
     
    9391    aubio_beattracking_do(o->bt,o->dfframe,o->out);
    9492    /* rotate dfframe */
    95     for (i = 0 ; i < winlen - step; i++ )
     93    for (i = 0 ; i < winlen - step; i++ ) 
    9694      o->dfframe->data[i] = o->dfframe->data[i+step];
    97     for (i = winlen - step ; i < winlen; i++ )
     95    for (i = winlen - step ; i < winlen; i++ ) 
    9896      o->dfframe->data[i] = 0.;
    9997    o->blockpos = -1;
     
    106104  /* end of second level loop */
    107105  tempo->data[0] = 0; /* reset tactus */
    108   //i=0;
     106  i=0;
    109107  for (i = 1; i < o->out->data[0]; i++ ) {
    110108    /* if current frame is a predicted tactus */
     
    116114      }
    117115      o->last_beat = o->total_frames + (uint_t)ROUND(tempo->data[0] * o->hop_size);
    118       o->last_tatum = o->last_beat;
    119116    }
    120117  }
     
    218215    onset2 = new_fvec(1);
    219216  }*/
    220   o->last_tatum = 0;
    221   o->tatum_signature = 4;
    222217  return o;
    223218
     
    231226}
    232227
    233 smpl_t aubio_tempo_get_period (aubio_tempo_t *o)
    234 {
    235   return aubio_beattracking_get_period (o->bt);
    236 }
    237 
    238 smpl_t aubio_tempo_get_period_s (aubio_tempo_t *o)
    239 {
    240   return aubio_beattracking_get_period_s (o->bt);
    241 }
    242 
    243228smpl_t aubio_tempo_get_confidence(aubio_tempo_t *o) {
    244229  return aubio_beattracking_get_confidence(o->bt);
    245 }
    246 
    247 uint_t aubio_tempo_was_tatum (aubio_tempo_t *o)
    248 {
    249   uint_t last_tatum_distance = o->total_frames - o->last_tatum;
    250   smpl_t beat_period = aubio_tempo_get_period(o);
    251   smpl_t tatum_period = beat_period / o->tatum_signature;
    252   if (last_tatum_distance < o->hop_size) {
    253     o->last_tatum = o->last_beat;
    254     return 2;
    255   }
    256   else if (last_tatum_distance > tatum_period) {
    257     if ( last_tatum_distance + o->hop_size > beat_period ) {
    258       // next beat is too close, pass
    259       return 0;
    260     }
    261     o->last_tatum = o->total_frames;
    262     return 1;
    263   }
    264   return 0;
    265 }
    266 
    267 smpl_t aubio_tempo_get_last_tatum (aubio_tempo_t *o) {
    268   return (smpl_t)o->last_tatum - o->delay;
    269 }
    270 
    271 uint_t aubio_tempo_set_tatum_signature (aubio_tempo_t *o, uint_t signature) {
    272   if (signature < 1 || signature > 64) {
    273     return AUBIO_FAIL;
    274   } else {
    275     o->tatum_signature = signature;
    276     return AUBIO_OK;
    277   }
    278230}
    279231
  • src/tempo/tempo.h

    r8605361 r34e505f  
    122122smpl_t aubio_tempo_get_threshold(aubio_tempo_t * o);
    123123
    124 /** get current beat period in samples
    125 
    126   \param bt beat tracking object
    127 
    128   Returns the currently observed period, in samples, or 0 if no consistent
    129   value is found.
    130 
    131 */
    132 smpl_t aubio_tempo_get_period (aubio_tempo_t * bt);
    133 
    134 /** get current beat period in seconds
    135 
    136   \param bt beat tracking object
    137 
    138   Returns the currently observed period, in seconds, or 0 if no consistent
    139   value is found.
    140 
    141 */
    142 smpl_t aubio_tempo_get_period_s (aubio_tempo_t * bt);
    143 
    144124/** get current tempo
    145125
     
    161141smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o);
    162142
    163 /* set number of tatum per beat
    164 
    165    \param o beat tracking object
    166    \param signature number of tatum per beat (between 1 and 64)
    167 
    168 */
    169 uint_t aubio_tempo_set_tatum_signature(aubio_tempo_t *o, uint_t signature);
    170 
    171 /* check whether a tatum was detected in the current frame
    172 
    173    \param o beat tracking object
    174 
    175    \return 2 if a beat was detected, 1 if a tatum was detected, 0 otherwise
    176 
    177 */
    178 uint_t aubio_tempo_was_tatum(aubio_tempo_t *o);
    179 
    180 /* get position of last_tatum, in samples
    181 
    182    \param o beat tracking object
    183 
    184 */
    185 smpl_t aubio_tempo_get_last_tatum(aubio_tempo_t *o);
    186 
    187143/** delete tempo detection object
    188144
Note: See TracChangeset for help on using the changeset viewer.