f@0
|
1 #pragma once
|
f@0
|
2
|
f@0
|
3 #include <array>
|
f@0
|
4
|
f@0
|
5 #include "cinder/audio/Context.h"
|
f@0
|
6 #include "cinder/audio/ChannelRouterNode.h"
|
f@0
|
7 #include "cinder/audio/MonitorNode.h"
|
f@0
|
8 #include "cinder/audio/FilterNode.h"
|
f@0
|
9 #include "BufferToWaveRecorderNode.h"
|
f@0
|
10 #include "PGranularNode.h"
|
f@0
|
11 #include "RingBufferPack.h"
|
f@0
|
12
|
f@0
|
13 #include "Messages.h"
|
f@0
|
14 #include "Config.h"
|
f@0
|
15
|
f@0
|
16
|
f@0
|
17 class AudioEngine
|
f@0
|
18 {
|
f@0
|
19 public:
|
f@0
|
20
|
f@0
|
21 AudioEngine();
|
f@0
|
22
|
f@0
|
23 ~AudioEngine();
|
f@0
|
24
|
f@0
|
25 // no copies
|
f@0
|
26 AudioEngine( const AudioEngine © ) = delete;
|
f@0
|
27 AudioEngine & operator=(const AudioEngine ©) = delete;
|
f@0
|
28
|
f@0
|
29 void setup( const Config& Config );
|
f@0
|
30
|
f@0
|
31 size_t getSampleRate();
|
f@0
|
32
|
f@0
|
33 void record( size_t index );
|
f@0
|
34
|
f@0
|
35 void loopOn( size_t waveIdx );
|
f@0
|
36
|
f@0
|
37 void loopOff( size_t waveIdx );
|
f@0
|
38
|
f@0
|
39 void noteOn( size_t waveIdx, int note );
|
f@0
|
40
|
f@0
|
41 void noteOff( size_t waveIdx, int note );
|
f@0
|
42
|
f@0
|
43 size_t getRecordWaveAvailable( size_t index );
|
f@0
|
44
|
f@0
|
45 bool readRecordWave( size_t waveIdx, RecordWaveMsg*, size_t count );
|
f@0
|
46
|
f@0
|
47 void setSelectionSize( size_t waveIdx, size_t size );
|
f@0
|
48
|
f@0
|
49 void setSelectionStart( size_t waveIdx, size_t start );
|
f@0
|
50
|
f@0
|
51 void setGrainDurationCoeff( size_t waveIdx, double coeff );
|
f@0
|
52
|
f@0
|
53 void setFilterCutoff( size_t waveIdx, double cutoff );
|
f@0
|
54
|
f@0
|
55 void checkCursorTriggers( size_t waveIdx, std::vector<CursorTriggerMsg>& cursorTriggers );
|
f@0
|
56
|
f@0
|
57 const ci::audio::Buffer& getAudioOutputBuffer( size_t waveIdx ) const;
|
f@0
|
58
|
f@0
|
59
|
f@0
|
60 private:
|
f@0
|
61
|
f@0
|
62 // nodes for mic input
|
f@0
|
63 std::array< ci::audio::ChannelRouterNodeRef, NUM_WAVES > mInputRouterNodes;
|
f@0
|
64 // nodes for recording audio input into buffer. Also sends chunks information through
|
f@0
|
65 // non-blocking queue
|
f@0
|
66 std::array< BufferToWaveRecorderNodeRef, NUM_WAVES > mBufferRecorderNodes;
|
f@0
|
67 // pgranulars for loop synths
|
f@0
|
68 std::array< PGranularNodeRef, NUM_WAVES > mPGranularNodes;
|
f@0
|
69
|
f@0
|
70
|
f@0
|
71 std::array< ci::audio::ChannelRouterNodeRef, NUM_WAVES > mOutputRouterNodes;
|
f@0
|
72 // nodes to get the audio buffer scoped in the oscilloscope
|
f@0
|
73 std::array< ci::audio::MonitorNodeRef, NUM_WAVES > mOutputMonitorNodes;
|
f@0
|
74 // nodes for lowpass filtering
|
f@0
|
75 std::array< cinder::audio::FilterLowPassNodeRef, NUM_WAVES> mLowPassFilterNodes;
|
f@0
|
76
|
f@0
|
77 std::array< std::unique_ptr< RingBufferPack<CursorTriggerMsg> >, NUM_WAVES > mCursorTriggerRingBufferPacks;
|
f@0
|
78
|
f@0
|
79 }; |