Mercurial > hg > qm-dsp
comparison tests/TestGetKeyMode.cpp @ 510:2adcd94c2079
Update test
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Thu, 06 Jun 2019 14:26:46 +0100 |
parents | dd132354ea02 |
children |
comparison
equal
deleted
inserted
replaced
509:3f0a96460c33 | 510:2adcd94c2079 |
---|---|
68 double concertA = 440.0; | 68 double concertA = 440.0; |
69 int sampleRate = 44100; | 69 int sampleRate = 44100; |
70 | 70 |
71 for (int midiPitch = 48; midiPitch < 96; ++midiPitch) { | 71 for (int midiPitch = 48; midiPitch < 96; ++midiPitch) { |
72 | 72 |
73 GetKeyMode gkm(sampleRate, concertA, 10, 10); | 73 GetKeyMode::Config config(sampleRate, concertA); |
74 GetKeyMode gkm(config); | |
74 int blockSize = gkm.getBlockSize(); | 75 int blockSize = gkm.getBlockSize(); |
75 int hopSize = gkm.getHopSize(); | 76 int hopSize = gkm.getHopSize(); |
76 | 77 |
77 double frequency = concertA * pow(2.0, (midiPitch - 69.0) / 12.0); | 78 double frequency = concertA * pow(2.0, (midiPitch - 69.0) / 12.0); |
78 /* | 79 |
79 cout << "midiPitch = " << midiPitch | |
80 << ", name = " << midiPitchName(midiPitch) | |
81 << ", frequency = " << frequency << endl; | |
82 */ | |
83 int blocks = 4; | 80 int blocks = 4; |
84 int totalLength = blockSize * blocks; | 81 int totalLength = blockSize * blocks; |
85 vector<double> signal = generateSinusoid(frequency, sampleRate, | 82 vector<double> signal = generateSinusoid(frequency, sampleRate, |
86 totalLength); | 83 totalLength); |
87 | 84 |
101 | 98 |
102 int tonic = key; | 99 int tonic = key; |
103 if (minor) tonic -= 12; | 100 if (minor) tonic -= 12; |
104 | 101 |
105 BOOST_CHECK_EQUAL(tonic, 1 + (midiPitch % 12)); | 102 BOOST_CHECK_EQUAL(tonic, 1 + (midiPitch % 12)); |
106 | |
107 // string name = keyName(tonic, minor); | |
108 // cout << "key value = " << key << ", name = " << name << endl; | |
109 } | 103 } |
110 } | 104 } |
111 | 105 |
112 BOOST_AUTO_TEST_SUITE_END() | 106 BOOST_AUTO_TEST_SUITE_END() |