Mercurial > hg > beaglert
comparison core/RTAudio.cpp @ 537:bfcbeb437869 API-update
Updated RTAudioSettings with in/out, ported some examples and libpd
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 24 Jun 2016 01:36:07 +0100 |
parents | 5c8f46fcd4d0 |
children |
comparison
equal
deleted
inserted
replaced
528:5c8f46fcd4d0 | 537:bfcbeb437869 |
---|---|
165 cout << "Couldn't set value on amplifier mute pin\n"; | 165 cout << "Couldn't set value on amplifier mute pin\n"; |
166 return -1; | 166 return -1; |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 if(settings->numAnalogInChannels != settings->numAnalogOutChannels){ | |
171 printf("Error: TODO: a different number of channels for inputs and outputs is not yet supported\n"); | |
172 return 1; | |
173 } | |
174 unsigned int numAnalogChannels = settings->numAnalogInChannels; | |
170 // Limit the analog channels to sane values | 175 // Limit the analog channels to sane values |
171 if(settings->numAnalogChannels != 2 | 176 if(numAnalogChannels != 2 |
172 && settings->numAnalogChannels != 4 | 177 && numAnalogChannels != 4 |
173 && settings->numAnalogChannels != 8) { | 178 && numAnalogChannels != 8) { |
174 cout << "Invalid number of analog channels: " << settings->numAnalogChannels << ". Valid values are 2, 4, 8.\n"; | 179 cout << "Invalid number of analog channels: " << numAnalogChannels << ". Valid values are 2, 4, 8.\n"; |
175 return -1; | 180 return -1; |
176 } | 181 } |
177 | 182 |
178 // Initialise the rendering environment: sample rates, frame counts, numbers of channels | 183 // Initialise the rendering environment: sample rates, frame counts, numbers of channels |
179 gContext.audioSampleRate = 44100.0; | 184 gContext.audioSampleRate = 44100.0; |
183 gContext.audioOutChannels = 2; | 188 gContext.audioOutChannels = 2; |
184 | 189 |
185 if(settings->useAnalog) { | 190 if(settings->useAnalog) { |
186 gContext.audioFrames = settings->periodSize; | 191 gContext.audioFrames = settings->periodSize; |
187 | 192 |
188 gContext.analogFrames = gContext.audioFrames * 4 / settings->numAnalogChannels; | 193 // TODO: a different number of channels for inputs and outputs is not yet supported |
189 // TODO: settings a different number of channels for inputs and outputs is not yet supported | 194 gContext.analogFrames = gContext.audioFrames * 4 / settings->numAnalogInChannels; |
190 gContext.analogInChannels = settings->numAnalogChannels; | 195 gContext.analogInChannels = settings->numAnalogInChannels; |
191 gContext.analogOutChannels = settings->numAnalogChannels; | 196 gContext.analogOutChannels = settings->numAnalogOutChannels; |
192 gContext.analogSampleRate = gContext.audioSampleRate * 4.0 / (float)settings->numAnalogChannels; | 197 unsigned int numAnalogChannelsForSampleRate = settings->numAnalogInChannels; |
198 gContext.analogSampleRate = gContext.audioSampleRate * 4.0 / (float)numAnalogChannelsForSampleRate; | |
193 } | 199 } |
194 else { | 200 else { |
195 gContext.audioFrames = settings->periodSize; | 201 gContext.audioFrames = settings->periodSize; |
196 | 202 |
197 gContext.analogFrames = 0; | 203 gContext.analogFrames = 0; |