comparison 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
comparison
equal deleted inserted replaced
12:a6beeba3a648 13:6adb088196a7
59 int gRTAudioVerbose = 0; // Verbosity level for debugging 59 int gRTAudioVerbose = 0; // Verbosity level for debugging
60 char gPRUFilename[256] = "pru_rtaudio.bin"; // path to PRU binary file 60 char gPRUFilename[256] = "pru_rtaudio.bin"; // path to PRU binary file
61 int gAmplifierMutePin = -1; 61 int gAmplifierMutePin = -1;
62 int gAmplifierShouldBeginMuted = 0; 62 int gAmplifierShouldBeginMuted = 0;
63 63
64 // Number of audio and matrix channels, globally accessible
65 // At least gNumMatrixChannels needs to be global to be used
66 // by the analogRead() and analogWrite() macros without creating
67 // extra confusion in their use cases by passing this argument
68 int gNumAudioChannels = 0;
69 int gNumMatrixChannels = 0;
64 70
65 // initAudio() prepares the infrastructure for running PRU-based real-time 71 // initAudio() prepares the infrastructure for running PRU-based real-time
66 // audio, but does not actually start the calculations. 72 // audio, but does not actually start the calculations.
67 // periodSize indicates the number of _sensor_ frames per period: the audio period size 73 // periodSize indicates the number of _sensor_ frames per period: the audio period size
68 // is twice this value. In total, the audio latency in frames will be 4*periodSize, 74 // is twice this value. In total, the audio latency in frames will be 4*periodSize,
168 if(settings->useMatrix) { 174 if(settings->useMatrix) {
169 audioPeriodSize = settings->periodSize * settings->numMatrixChannels / 4; 175 audioPeriodSize = settings->periodSize * settings->numMatrixChannels / 4;
170 matrixSampleRate = audioSampleRate * 4.0 / (float)settings->numMatrixChannels; 176 matrixSampleRate = audioSampleRate * 4.0 / (float)settings->numMatrixChannels;
171 } 177 }
172 178
173 if(!initialise_render(settings->useMatrix ? settings->numMatrixChannels : 0, /* matrix channels */ 179 gNumAudioChannels = 2;
174 2, /* audio channels */ 180 gNumMatrixChannels = settings->useMatrix ? settings->numMatrixChannels : 0;
181
182 if(!initialise_render(gNumMatrixChannels, gNumAudioChannels,
175 settings->useMatrix ? settings->periodSize : 0, /* matrix period size */ 183 settings->useMatrix ? settings->periodSize : 0, /* matrix period size */
176 audioPeriodSize, 184 audioPeriodSize,
177 matrixSampleRate, audioSampleRate, 185 matrixSampleRate, audioSampleRate,
178 userData)) { 186 userData)) {
179 cout << "Couldn't initialise audio rendering\n"; 187 cout << "Couldn't initialise audio rendering\n";