comparison core/RTAudio.cpp @ 280:c55c6f6c233c prerelease

Added support for multiplexer capelet and command-line support for choosing PRU
author andrewm
date Tue, 17 May 2016 17:49:23 +0100
parents 88cf310417cd
children e4392164b458
comparison
equal deleted inserted replaced
278:3c3d042dad12 280:c55c6f6c233c
96 // 96 //
97 // Returns 0 on success. 97 // Returns 0 on success.
98 98
99 int BeagleRT_initAudio(BeagleRTInitSettings *settings, void *userData) 99 int BeagleRT_initAudio(BeagleRTInitSettings *settings, void *userData)
100 { 100 {
101 // Sanity checks
102 if(settings->pruNumber < 0 || settings->pruNumber > 1) {
103 cout << "Invalid PRU number " << settings->pruNumber << endl;
104 return -1;
105 }
106 if(settings->pruNumber != 1 && settings->numMuxChannels != 0) {
107 cout << "Incompatible settings: multiplexer can only be run using PRU 1\n";
108 return -1;
109 }
110
101 rt_print_auto_init(1); 111 rt_print_auto_init(1);
102 112
103 BeagleRT_setVerboseLevel(settings->verbose); 113 BeagleRT_setVerboseLevel(settings->verbose);
104 strncpy(gPRUFilename, settings->pruFilename, MAX_PRU_FILENAME_LENGTH); 114 strncpy(gPRUFilename, settings->pruFilename, MAX_PRU_FILENAME_LENGTH);
105 gUserData = userData; 115 gUserData = userData;
200 // Initialise the GPIO pins, including possibly the digital pins in the render routines 210 // Initialise the GPIO pins, including possibly the digital pins in the render routines
201 if(gPRU->prepareGPIO(1, 1)) { 211 if(gPRU->prepareGPIO(1, 1)) {
202 cout << "Error: unable to prepare GPIO for PRU audio\n"; 212 cout << "Error: unable to prepare GPIO for PRU audio\n";
203 return 1; 213 return 1;
204 } 214 }
205 215
206 // Get the PRU memory buffers ready to go 216 // Get the PRU memory buffers ready to go
207 if(gPRU->initialise(0, gContext.analogFrames, gContext.analogChannels, true)) { 217 if(gPRU->initialise(settings->pruNumber, gContext.analogFrames, gContext.analogChannels,
218 settings->numMuxChannels, true)) {
208 cout << "Error: unable to initialise PRU\n"; 219 cout << "Error: unable to initialise PRU\n";
209 return 1; 220 return 1;
210 } 221 }
211 222
212 // Prepare the audio codec, which clocks the whole system 223 // Prepare the audio codec, which clocks the whole system