summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--simpl/partial_tracking.pxd13
-rw-r--r--simpl/partial_tracking.pyx25
-rw-r--r--src/simpl/partial_tracking.cpp60
-rw-r--r--src/simpl/partial_tracking.h10
4 files changed, 106 insertions, 2 deletions
diff --git a/simpl/partial_tracking.pxd b/simpl/partial_tracking.pxd
index 69e9821..ce7c385 100644
--- a/simpl/partial_tracking.pxd
+++ b/simpl/partial_tracking.pxd
@@ -2,6 +2,7 @@ import numpy as np
cimport numpy as np
np.import_array()
from libcpp.vector cimport vector
+from libcpp cimport bool
from base cimport c_Peak
from base cimport c_Frame
@@ -27,6 +28,18 @@ cdef extern from "../src/simpl/partial_tracking.h" namespace "simpl":
cdef cppclass c_SMSPartialTracking "simpl::SMSPartialTracking"(c_PartialTracking):
c_SMSPartialTracking()
+ bool realtime()
+ void realtime(bool is_realtime)
+ bool harmonic()
+ void harmonic(bool is_harmonic)
+ int max_frame_delay()
+ void max_frame_delay(int new_max_frame_delay)
+ int analysis_delay()
+ void analysis_delay(int new_analysis_delay)
+ int min_good_frames()
+ void min_good_frames(int new_min_good_frames)
+ bool clean_tracks()
+ void clean_tracks(bool new_clean_tracks)
cdef cppclass c_SndObjPartialTracking "simpl::SndObjPartialTracking"(c_PartialTracking):
c_SndObjPartialTracking()
diff --git a/simpl/partial_tracking.pyx b/simpl/partial_tracking.pyx
index 58a0a78..87387a7 100644
--- a/simpl/partial_tracking.pyx
+++ b/simpl/partial_tracking.pyx
@@ -2,6 +2,7 @@ import numpy as np
cimport numpy as np
np.import_array()
from libcpp.vector cimport vector
+from libcpp cimport bool
from base cimport Peak
from base cimport Frame
@@ -69,6 +70,30 @@ cdef class SMSPartialTracking(PartialTracking):
del self.thisptr
self.thisptr = <c_PartialTracking*>0
+ property realtime:
+ def __get__(self): return (<c_SMSPartialTracking*>self.thisptr).realtime()
+ def __set__(self, bool b): (<c_SMSPartialTracking*>self.thisptr).realtime(b)
+
+ property harmonic:
+ def __get__(self): return (<c_SMSPartialTracking*>self.thisptr).harmonic()
+ def __set__(self, bool b): (<c_SMSPartialTracking*>self.thisptr).harmonic(b)
+
+ property max_frame_delay:
+ def __get__(self): return (<c_SMSPartialTracking*>self.thisptr).max_frame_delay()
+ def __set__(self, int i): (<c_SMSPartialTracking*>self.thisptr).max_frame_delay(i)
+
+ property analysis_delay:
+ def __get__(self): return (<c_SMSPartialTracking*>self.thisptr).analysis_delay()
+ def __set__(self, int i): (<c_SMSPartialTracking*>self.thisptr).analysis_delay(i)
+
+ property min_good_frames:
+ def __get__(self): return (<c_SMSPartialTracking*>self.thisptr).min_good_frames()
+ def __set__(self, int i): (<c_SMSPartialTracking*>self.thisptr).min_good_frames(i)
+
+ property clean_tracks:
+ def __get__(self): return (<c_SMSPartialTracking*>self.thisptr).clean_tracks()
+ def __set__(self, bool b): (<c_SMSPartialTracking*>self.thisptr).clean_tracks(b)
+
cdef class SndObjPartialTracking(PartialTracking):
def __cinit__(self):
diff --git a/src/simpl/partial_tracking.cpp b/src/simpl/partial_tracking.cpp
index 5bb08b3..420bcb6 100644
--- a/src/simpl/partial_tracking.cpp
+++ b/src/simpl/partial_tracking.cpp
@@ -143,6 +143,9 @@ void SMSPartialTracking::init_peaks() {
memset(_peak_phase, 0.0, sizeof(sample) * _max_partials);
}
+void SMSPartialTracking::reset() {
+}
+
void SMSPartialTracking::max_partials(int new_max_partials) {
_max_partials = new_max_partials;
@@ -193,7 +196,62 @@ void SMSPartialTracking::harmonic(bool is_harmonic) {
sms_allocFrameH(&_header, &_data);
}
-void SMSPartialTracking::reset() {
+int SMSPartialTracking::max_frame_delay() {
+ return _analysis_params.iMaxDelayFrames;
+}
+
+void SMSPartialTracking::max_frame_delay(int new_max_frame_delay) {
+ sms_freeAnalysis(&_analysis_params);
+ sms_freeFrame(&_data);
+
+ _analysis_params.iMaxDelayFrames = new_max_frame_delay;
+
+ sms_initAnalysis(&_analysis_params);
+ sms_fillHeader(&_header, &_analysis_params);
+ sms_allocFrameH(&_header, &_data);
+}
+
+int SMSPartialTracking::analysis_delay() {
+ return _analysis_params.analDelay;
+}
+
+void SMSPartialTracking::analysis_delay(int new_analysis_delay) {
+ sms_freeAnalysis(&_analysis_params);
+ sms_freeFrame(&_data);
+
+ _analysis_params.analDelay = new_analysis_delay;
+
+ sms_initAnalysis(&_analysis_params);
+ sms_fillHeader(&_header, &_analysis_params);
+ sms_allocFrameH(&_header, &_data);
+}
+
+int SMSPartialTracking::min_good_frames() {
+ return _analysis_params.minGoodFrames;
+}
+
+void SMSPartialTracking::min_good_frames(int new_min_good_frames) {
+ sms_freeAnalysis(&_analysis_params);
+ sms_freeFrame(&_data);
+
+ _analysis_params.minGoodFrames = new_min_good_frames;
+
+ sms_initAnalysis(&_analysis_params);
+ sms_fillHeader(&_header, &_analysis_params);
+ sms_allocFrameH(&_header, &_data);
+}
+
+bool SMSPartialTracking::clean_tracks() {
+ return _analysis_params.iCleanTracks == 1;
+}
+
+void SMSPartialTracking::clean_tracks(bool new_clean_tracks) {
+ if(new_clean_tracks) {
+ _analysis_params.iCleanTracks = 1;
+ }
+ else {
+ _analysis_params.iCleanTracks = 0;
+ }
}
Peaks SMSPartialTracking::update_partials(Frame* frame) {
diff --git a/src/simpl/partial_tracking.h b/src/simpl/partial_tracking.h
index 324c348..0812e64 100644
--- a/src/simpl/partial_tracking.h
+++ b/src/simpl/partial_tracking.h
@@ -77,12 +77,20 @@ class SMSPartialTracking : public PartialTracking {
public:
SMSPartialTracking();
~SMSPartialTracking();
+ void reset();
void max_partials(int new_max_partials);
bool realtime();
void realtime(bool is_realtime);
bool harmonic();
void harmonic(bool is_harmonic);
- void reset();
+ int max_frame_delay();
+ void max_frame_delay(int new_max_frame_delay);
+ int analysis_delay();
+ void analysis_delay(int new_analysis_delay);
+ int min_good_frames();
+ void min_good_frames(int new_min_good_frames);
+ bool clean_tracks();
+ void clean_tracks(bool new_clean_tracks);
Peaks update_partials(Frame* frame);
};