Mercurial > hg > beaglert
diff core/RTAudio.cpp @ 13:6adb088196a7
Fixed ADC bug; added a simple passthrough test
author | andrewm |
---|---|
date | Fri, 23 Jan 2015 15:17:09 +0000 |
parents | a6beeba3a648 |
children | 901d205d1a3c |
line wrap: on
line diff
--- a/core/RTAudio.cpp Thu Jan 22 19:00:22 2015 +0000 +++ b/core/RTAudio.cpp Fri Jan 23 15:17:09 2015 +0000 @@ -61,6 +61,12 @@ int gAmplifierMutePin = -1; int gAmplifierShouldBeginMuted = 0; +// Number of audio and matrix channels, globally accessible +// At least gNumMatrixChannels needs to be global to be used +// by the analogRead() and analogWrite() macros without creating +// extra confusion in their use cases by passing this argument +int gNumAudioChannels = 0; +int gNumMatrixChannels = 0; // initAudio() prepares the infrastructure for running PRU-based real-time // audio, but does not actually start the calculations. @@ -170,8 +176,10 @@ matrixSampleRate = audioSampleRate * 4.0 / (float)settings->numMatrixChannels; } - if(!initialise_render(settings->useMatrix ? settings->numMatrixChannels : 0, /* matrix channels */ - 2, /* audio channels */ + gNumAudioChannels = 2; + gNumMatrixChannels = settings->useMatrix ? settings->numMatrixChannels : 0; + + if(!initialise_render(gNumMatrixChannels, gNumAudioChannels, settings->useMatrix ? settings->periodSize : 0, /* matrix period size */ audioPeriodSize, matrixSampleRate, audioSampleRate,