summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn Glover <j@johnglover.net>2012-08-22 14:29:33 +0100
committerJohn Glover <j@johnglover.net>2012-08-22 14:29:33 +0100
commit5fb34d7d5451cefd88bb9d7a0d9c442d67caf143 (patch)
treec1651ab1e046a69f409a8b885c3e53c2972cfadb /tests
parente49430f96bd0a5858097f6dc631480d49baab7a0 (diff)
downloadsimpl-5fb34d7d5451cefd88bb9d7a0d9c442d67caf143.tar.gz
simpl-5fb34d7d5451cefd88bb9d7a0d9c442d67caf143.tar.bz2
simpl-5fb34d7d5451cefd88bb9d7a0d9c442d67caf143.zip
[loris] LorisPeakDetection updates and fixes (save bandwidth to simpl Peak objects).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_peak_detection.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_peak_detection.cpp b/tests/test_peak_detection.cpp
index 41bc735..4c09dbd 100644
--- a/tests/test_peak_detection.cpp
+++ b/tests/test_peak_detection.cpp
@@ -31,39 +31,54 @@ protected:
int num_samples;
void test_find_peaks_in_frame_basic() {
+ pd->clear();
+ pd->frame_size(2048);
+
Frame* f = new Frame(2048, true);
Peaks p = pd->find_peaks_in_frame(f);
CPPUNIT_ASSERT(p.size() == 0);
+
delete f;
+ pd->clear();
}
void test_find_peaks_basic() {
sample* audio = new sample[1024];
+ pd->frame_size(512);
+
Frames frames = pd->find_peaks(1024, audio);
CPPUNIT_ASSERT(frames.size() == 2);
for(int i = 0; i < frames.size(); i++) {
CPPUNIT_ASSERT(frames[i]->num_peaks() == 0);
}
+
+ delete audio;
}
void test_find_peaks_change_hop_frame_size() {
sample* audio = new sample[1024];
pd->frame_size(256);
pd->hop_size(256);
+
Frames frames = pd->find_peaks(1024, audio);
CPPUNIT_ASSERT(frames.size() == 4);
for(int i = 0; i < frames.size(); i++) {
CPPUNIT_ASSERT(frames[i]->num_peaks() == 0);
}
+
+ delete audio;
}
void test_find_peaks_audio() {
sample* audio = new sample[(int)sf.frames()];
sf.read(audio, (int)sf.frames());
+
Frames frames = pd->find_peaks(num_samples, &(audio[(int)sf.frames() / 2]));
for(int i = 0; i < frames.size(); i++) {
CPPUNIT_ASSERT(frames[i]->num_peaks() > 0);
}
+
+ delete audio;
}
public: