Mercurial > hg > opencollidoscope
comparison CollidoscopeApp/src/AudioEngine.cpp @ 2:dd889fff8423
added some comments
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Mon, 11 Jul 2016 17:03:40 +0200 |
parents | 02467299402e |
children | 75b744078d66 |
comparison
equal
deleted
inserted
replaced
1:b5bcad8e7803 | 2:dd889fff8423 |
---|---|
3 //FIXME remove App.h include | 3 //FIXME remove App.h include |
4 #include "Log.h" | 4 #include "Log.h" |
5 | 5 |
6 using namespace ci::audio; | 6 using namespace ci::audio; |
7 | 7 |
8 /* Frequency ratios in the chromatic scale */ | |
8 double chromaticRatios[] = { | 9 double chromaticRatios[] = { |
9 1, | 10 1, |
10 1.0594630943591, | 11 1.0594630943591, |
11 1.1224620483089, | 12 1.1224620483089, |
12 1.1892071150019, | 13 1.1892071150019, |
18 1.6817928305039, | 19 1.6817928305039, |
19 1.7817974362766, | 20 1.7817974362766, |
20 1.8877486253586 | 21 1.8877486253586 |
21 }; | 22 }; |
22 | 23 |
24 | |
25 /* | |
26 * Calculates the ratio between the frequency of the midi note passed as argument and middle C note ( MIDI value = 60 ). | |
27 * This is used for pitch shifting the granular synth output, according to the key pressed by the user. | |
28 * The middle C is taken as reference in pitch in the pitch shifting of Collidoscope output. | |
29 * That is, with the middle C the output is not pitch shifted at all and is equal in frequency to the recorder sample. | |
30 * | |
31 */ | |
23 inline double calculateMidiNoteRatio( int midiNote ) | 32 inline double calculateMidiNoteRatio( int midiNote ) |
24 { | 33 { |
25 int distanceFromCenter = midiNote - 60; // 60 is the central midi note | 34 int distanceFromCenter = midiNote - 60; // 60 is the central midi note |
26 | 35 |
27 if ( distanceFromCenter < 0 ){ | 36 if ( distanceFromCenter < 0 ){ |
172 size_t AudioEngine::getRecordWaveAvailable( size_t waveIdx ) | 181 size_t AudioEngine::getRecordWaveAvailable( size_t waveIdx ) |
173 { | 182 { |
174 return mBufferRecorderNodes[waveIdx]->getRingBuffer().getAvailableRead(); | 183 return mBufferRecorderNodes[waveIdx]->getRingBuffer().getAvailableRead(); |
175 } | 184 } |
176 | 185 |
186 | |
177 bool AudioEngine::readRecordWave( size_t waveIdx, RecordWaveMsg* buffer, size_t count ) | 187 bool AudioEngine::readRecordWave( size_t waveIdx, RecordWaveMsg* buffer, size_t count ) |
178 { | 188 { |
179 return mBufferRecorderNodes[waveIdx]->getRingBuffer().read( buffer, count ); | 189 return mBufferRecorderNodes[waveIdx]->getRingBuffer().read( buffer, count ); |
180 } | 190 } |
181 | 191 |