Mercurial > hg > beaglert
comparison core/RTAudio.cpp @ 307:ff5f346a293e prerelease
Changed BelaContext fields to be const where appropriate; there's now an InternalBelaContext used for setting the values within the core code. These need to stay aligned.
author | andrewm |
---|---|
date | Fri, 27 May 2016 18:12:15 +0100 |
parents | 421a69d42943 |
children | 3bed6b09223c |
comparison
equal
deleted
inserted
replaced
306:132fc61893af | 307:ff5f346a293e |
---|---|
49 bool hasArgs; | 49 bool hasArgs; |
50 void* args; | 50 void* args; |
51 bool autoSchedule; | 51 bool autoSchedule; |
52 } InternalAuxiliaryTask; | 52 } InternalAuxiliaryTask; |
53 | 53 |
54 const char gRTAudioThreadName[] = "bela-audio"; | |
55 const char gRTAudioInterruptName[] = "bela-pru-irq"; | |
56 | |
57 // Real-time tasks and objects | 54 // Real-time tasks and objects |
58 RT_TASK gRTAudioThread; | 55 RT_TASK gRTAudioThread; |
56 const char gRTAudioThreadName[] = "bela-audio"; | |
57 | |
59 #ifdef BELA_USE_XENOMAI_INTERRUPTS | 58 #ifdef BELA_USE_XENOMAI_INTERRUPTS |
60 RT_INTR gRTAudioInterrupt; | 59 RT_INTR gRTAudioInterrupt; |
60 const char gRTAudioInterruptName[] = "bela-pru-irq"; | |
61 #endif | 61 #endif |
62 | |
62 PRU *gPRU = 0; | 63 PRU *gPRU = 0; |
63 I2c_Codec *gAudioCodec = 0; | 64 I2c_Codec *gAudioCodec = 0; |
64 | 65 |
65 vector<InternalAuxiliaryTask*> &getAuxTasks(){ | 66 vector<InternalAuxiliaryTask*> &getAuxTasks(){ |
66 static vector<InternalAuxiliaryTask*> auxTasks; | 67 static vector<InternalAuxiliaryTask*> auxTasks; |
75 int gRTAudioVerbose = 0; // Verbosity level for debugging | 76 int gRTAudioVerbose = 0; // Verbosity level for debugging |
76 int gAmplifierMutePin = -1; | 77 int gAmplifierMutePin = -1; |
77 int gAmplifierShouldBeginMuted = 0; | 78 int gAmplifierShouldBeginMuted = 0; |
78 | 79 |
79 // Context which holds all the audio/sensor data passed to the render routines | 80 // Context which holds all the audio/sensor data passed to the render routines |
80 BelaContext gContext; | 81 InternalBelaContext gContext; |
81 | 82 |
82 // User data passed in from main() | 83 // User data passed in from main() |
83 void *gUserData; | 84 void *gUserData; |
84 | 85 |
85 // initAudio() prepares the infrastructure for running PRU-based real-time | 86 // initAudio() prepares the infrastructure for running PRU-based real-time |
242 Bela_setPgaGain(settings->pgaGain[n], n); | 243 Bela_setPgaGain(settings->pgaGain[n], n); |
243 } | 244 } |
244 Bela_setHeadphoneLevel(settings->headphoneLevel); | 245 Bela_setHeadphoneLevel(settings->headphoneLevel); |
245 | 246 |
246 // Call the user-defined initialisation function | 247 // Call the user-defined initialisation function |
247 if(!setup(&gContext, userData)) { | 248 if(!setup((BelaContext *)&gContext, userData)) { |
248 cout << "Couldn't initialise audio rendering\n"; | 249 cout << "Couldn't initialise audio rendering\n"; |
249 return 1; | 250 return 1; |
250 } | 251 } |
251 | 252 |
252 return 0; | 253 return 0; |
483 } | 484 } |
484 | 485 |
485 // Free any resources associated with PRU real-time audio | 486 // Free any resources associated with PRU real-time audio |
486 void Bela_cleanupAudio() | 487 void Bela_cleanupAudio() |
487 { | 488 { |
488 cleanup(&gContext, gUserData); | 489 cleanup((BelaContext *)&gContext, gUserData); |
489 | 490 |
490 // Clean up the auxiliary tasks | 491 // Clean up the auxiliary tasks |
491 vector<InternalAuxiliaryTask*>::iterator it; | 492 vector<InternalAuxiliaryTask*>::iterator it; |
492 for(it = getAuxTasks().begin(); it != getAuxTasks().end(); it++) { | 493 for(it = getAuxTasks().begin(); it != getAuxTasks().end(); it++) { |
493 InternalAuxiliaryTask *taskStruct = *it; | 494 InternalAuxiliaryTask *taskStruct = *it; |