Mercurial > hg > opencollidoscope
comparison CollidoscopeApp/include/PGranularNode.h @ 16:4dad0b810f18
Comment tidy up + attributions
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Tue, 16 Aug 2016 14:27:53 +0100 |
parents | 75b744078d66 |
children |
comparison
equal
deleted
inserted
replaced
15:5241f96479d6 | 16:4dad0b810f18 |
---|---|
38 | 38 |
39 | 39 |
40 struct RandomGenerator; | 40 struct RandomGenerator; |
41 | 41 |
42 /* | 42 /* |
43 A node in the Cinder audio graph that holds a PGranular | 43 A node in the Cinder audio graph that holds PGranulars for loop and keyboard playing |
44 */ | 44 */ |
45 class PGranularNode : public ci::audio::Node | 45 class PGranularNode : public ci::audio::Node |
46 { | 46 { |
47 public: | 47 public: |
48 static const size_t kMaxVoices = 6; | 48 static const size_t kMaxVoices = 6; |
80 void process( ci::audio::Buffer *buffer ) override; | 80 void process( ci::audio::Buffer *buffer ) override; |
81 | 81 |
82 private: | 82 private: |
83 | 83 |
84 // Wraps a std::atomic but get() returns a boost::optional that is set to a real value only when the atomic has changed. | 84 // Wraps a std::atomic but get() returns a boost::optional that is set to a real value only when the atomic has changed. |
85 // It is used to avoid calling PGranulat setter methods with * the same value at each audio callback. | 85 // It is used to avoid calling PGranular setter methods with the same value at each audio callback. |
86 template< typename T> | 86 template< typename T> |
87 class LazyAtomic | 87 class LazyAtomic |
88 { | 88 { |
89 public: | 89 public: |
90 LazyAtomic( T val ) : | 90 LazyAtomic( T val ) : |
118 void handleNoteMsg( const NoteMsg &msg ); | 118 void handleNoteMsg( const NoteMsg &msg ); |
119 | 119 |
120 // pointers to PGranular objects | 120 // pointers to PGranular objects |
121 std::unique_ptr < collidoscope::PGranular<float, RandomGenerator, PGranularNode > > mPGranularLoop; | 121 std::unique_ptr < collidoscope::PGranular<float, RandomGenerator, PGranularNode > > mPGranularLoop; |
122 std::array<std::unique_ptr < collidoscope::PGranular<float, RandomGenerator, PGranularNode > >, kMaxVoices> mPGranularNotes; | 122 std::array<std::unique_ptr < collidoscope::PGranular<float, RandomGenerator, PGranularNode > >, kMaxVoices> mPGranularNotes; |
123 // maps midi notes to pgranulars. When a noteOff is received maks sure the right PGranular is turned off | 123 // maps midi notes to pgranulars. When a noteOff is received makes sure the right PGranular is turned off |
124 std::array<int, kMaxVoices> mMidiNotes; | 124 std::array<int, kMaxVoices> mMidiNotes; |
125 | 125 |
126 // pointer to the random generator struct passed over to PGranular | 126 // pointer to the random generator struct passed over to PGranular |
127 std::unique_ptr< RandomGenerator > mRandomOffset; | 127 std::unique_ptr< RandomGenerator > mRandomOffset; |
128 | 128 |
129 // buffer containing the recorder audio, to pass to PGranular in initialize() | 129 // buffer containing the recorded audio, to pass to PGranular in initialize() |
130 ci::audio::Buffer *mGrainBuffer; | 130 ci::audio::Buffer *mGrainBuffer; |
131 | 131 |
132 ci::audio::BufferRef mTempBuffer; | 132 ci::audio::BufferRef mTempBuffer; |
133 | 133 |
134 CursorTriggerMsgRingBuffer &mTriggerRingBuffer; | 134 CursorTriggerMsgRingBuffer &mTriggerRingBuffer; |