Mercurial > hg > beaglert
comparison core/RTAudio.cpp @ 171:e63563507edd
Added command-line options for the PGA
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 28 Dec 2015 03:53:36 +0100 |
parents | f944d0b60fa8 |
children | 5f4408705eed |
comparison
equal
deleted
inserted
replaced
170:e80340fe527a | 171:e63563507edd |
---|---|
208 } | 208 } |
209 if(gAudioCodec->initCodec()) { | 209 if(gAudioCodec->initCodec()) { |
210 cout << "Error: unable to initialise audio codec\n"; | 210 cout << "Error: unable to initialise audio codec\n"; |
211 return 1; | 211 return 1; |
212 } | 212 } |
213 | 213 cout << "Initialized codec\n"; |
214 // Set default volume levels | 214 // Set default volume levels |
215 BeagleRT_setDACLevel(settings->dacLevel); | 215 BeagleRT_setDACLevel(settings->dacLevel); |
216 BeagleRT_setADCLevel(settings->adcLevel); | 216 BeagleRT_setADCLevel(settings->adcLevel); |
217 for(int n = 0; n < 2; n++){ | |
218 BeagleRT_setPgaGain(settings->pgaGain[n], n); | |
219 } | |
217 BeagleRT_setHeadphoneLevel(settings->headphoneLevel); | 220 BeagleRT_setHeadphoneLevel(settings->headphoneLevel); |
218 | 221 |
219 // Call the user-defined initialisation function | 222 // Call the user-defined initialisation function |
220 if(!setup(&gContext, userData)) { | 223 if(!setup(&gContext, userData)) { |
221 cout << "Couldn't initialise audio rendering\n"; | 224 cout << "Couldn't initialise audio rendering\n"; |
450 if(gAudioCodec == 0) | 453 if(gAudioCodec == 0) |
451 return -1; | 454 return -1; |
452 return gAudioCodec->setADCVolume((int)floorf(decibels * 2.0 + 0.5)); | 455 return gAudioCodec->setADCVolume((int)floorf(decibels * 2.0 + 0.5)); |
453 } | 456 } |
454 | 457 |
458 // Set the level of the Programmable Gain Amplifier | |
459 // 59.5dB is maximum, 0dB is minimum; 0.5dB steps | |
460 int BeagleRT_setPgaGain(float decibels, int channel){ | |
461 if(gAudioCodec == 0) | |
462 return -1; | |
463 printf("calling\n"); | |
464 return gAudioCodec->setPga(decibels, channel); | |
465 } | |
466 | |
455 // Set the level of the onboard headphone amplifier; affects headphone | 467 // Set the level of the onboard headphone amplifier; affects headphone |
456 // output only (not line out or speaker) | 468 // output only (not line out or speaker) |
457 // 0dB is the maximum, -63.5dB is the minimum; 0.5dB steps | 469 // 0dB is the maximum, -63.5dB is the minimum; 0.5dB steps |
458 int BeagleRT_setHeadphoneLevel(float decibels) | 470 int BeagleRT_setHeadphoneLevel(float decibels) |
459 { | 471 { |