comparison CollidoscopeApp/include/AudioEngine.h @ 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
12 12
13 #include "Messages.h" 13 #include "Messages.h"
14 #include "Config.h" 14 #include "Config.h"
15 15
16 16
17 /**
18 * Audio engine of the application. It uses the Cinder library to process audio in input and output.
19 * The audio engine manages both waves. All methods have a waveIndx parameter to address a specific wave.
20 */
17 class AudioEngine 21 class AudioEngine
18 { 22 {
19 public: 23 public:
20 24
21 AudioEngine(); 25 AudioEngine();
24 28
25 // no copies 29 // no copies
26 AudioEngine( const AudioEngine &copy ) = delete; 30 AudioEngine( const AudioEngine &copy ) = delete;
27 AudioEngine & operator=(const AudioEngine &copy) = delete; 31 AudioEngine & operator=(const AudioEngine &copy) = delete;
28 32
33 /**
34 * Set up of the audio engine.
35 */
29 void setup( const Config& Config ); 36 void setup( const Config& Config );
30 37
31 size_t getSampleRate(); 38 size_t getSampleRate();
32 39
33 void record( size_t index ); 40 void record( size_t index );
38 45
39 void noteOn( size_t waveIdx, int note ); 46 void noteOn( size_t waveIdx, int note );
40 47
41 void noteOff( size_t waveIdx, int note ); 48 void noteOff( size_t waveIdx, int note );
42 49
50 /**
51 * Returns the number of elements available to read in the wave ring buffer.
52 * The wave ring buffer is used to pass the size of the wave chunks from the audio thread to the graphic thread,
53 * when a new wave is recorded.
54 */
43 size_t getRecordWaveAvailable( size_t index ); 55 size_t getRecordWaveAvailable( size_t index );
44 56 /**
45 bool readRecordWave( size_t waveIdx, RecordWaveMsg*, size_t count ); 57 * Called from the graphic thread. Reads count elements from the wave ring buffer into \a buffer.
58 * The wave ring buffer is used to pass the size of the wave chunks from the audio thread to the graphic thread,
59 * when a new wave is recorded.
60 *
61 */
62 bool readRecordWave( size_t waveIdx, RecordWaveMsg* buffer, size_t count );
46 63
47 void setSelectionSize( size_t waveIdx, size_t size ); 64 void setSelectionSize( size_t waveIdx, size_t size );
48 65
49 void setSelectionStart( size_t waveIdx, size_t start ); 66 void setSelectionStart( size_t waveIdx, size_t start );
50 67
52 69
53 void setFilterCutoff( size_t waveIdx, double cutoff ); 70 void setFilterCutoff( size_t waveIdx, double cutoff );
54 71
55 void checkCursorTriggers( size_t waveIdx, std::vector<CursorTriggerMsg>& cursorTriggers ); 72 void checkCursorTriggers( size_t waveIdx, std::vector<CursorTriggerMsg>& cursorTriggers );
56 73
74 /**
75 * Returns a const reference to the audio output buffer. This is the buffer that is sent off to the audio interface at each audio cycle.
76 * It is used in the graphic thread to draw the oscilloscope.
77 */
57 const ci::audio::Buffer& getAudioOutputBuffer( size_t waveIdx ) const; 78 const ci::audio::Buffer& getAudioOutputBuffer( size_t waveIdx ) const;
58 79
59 80
60 private: 81 private:
61 82