ref: c62141591cadf438920632793215ed9282740c16
parent: 714380d80ba23ef6a90d2c478b89ac519acfe1c1
author: Paul Brossier <piem@altern.org>
date: Thu Jul 13 11:57:21 EDT 2006
fix memory freeing in onsetdetection, remove useless _alloc fix memory freeing in onsetdetection, remove useless _alloc
--- a/src/onsetdetection.c
+++ b/src/onsetdetection.c
@@ -40,8 +40,6 @@
};
-static aubio_onsetdetection_t * aubio_onsetdetection_alloc(aubio_onsetdetection_type type, uint_t size, uint_t channels);
-
/* Energy based onset detection function */
void aubio_onsetdetection_energy (aubio_onsetdetection_t *o,
cvec_t * fftgrain, fvec_t * onset) {
@@ -192,17 +190,12 @@
o->funcpointer(o,fftgrain,onset);
}
-/* Allocate memory for an onset detection */
+/* Allocate memory for an onset detection
+ * depending on the choosen type, allocate memory as needed
+ */
aubio_onsetdetection_t *
new_aubio_onsetdetection (aubio_onsetdetection_type type,
uint_t size, uint_t channels){
- return aubio_onsetdetection_alloc(type,size,channels);
-}
-
-/* depending on the choosen type, allocate memory as needed */
-aubio_onsetdetection_t *
-aubio_onsetdetection_alloc (aubio_onsetdetection_type type,
- uint_t size, uint_t channels){
aubio_onsetdetection_t * o = AUBIO_NEW(aubio_onsetdetection_t);
uint_t rsize = size/2+1;
switch(type) {
@@ -306,6 +299,12 @@
del_fvec(o->oldmag);
del_fvec(o->dev1);
del_aubio_hist(o->histog);
+ break;
+ case aubio_onset_kl:
+ del_fvec(o->oldmag);
+ break;
+ case aubio_onset_mkl:
+ del_fvec(o->oldmag);
break;
default:
break;