diff 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
line wrap: on
line diff
--- a/core/RTAudio.cpp	Mon Dec 28 03:19:59 2015 +0100
+++ b/core/RTAudio.cpp	Mon Dec 28 03:53:36 2015 +0100
@@ -210,10 +210,13 @@
 		cout << "Error: unable to initialise audio codec\n";
 		return 1;
 	}
-
+	cout << "Initialized codec\n";
 	// Set default volume levels
 	BeagleRT_setDACLevel(settings->dacLevel);
 	BeagleRT_setADCLevel(settings->adcLevel);
+	for(int n = 0; n < 2; n++){
+		BeagleRT_setPgaGain(settings->pgaGain[n], n);
+	}
 	BeagleRT_setHeadphoneLevel(settings->headphoneLevel);
 
 	// Call the user-defined initialisation function
@@ -452,6 +455,15 @@
 	return gAudioCodec->setADCVolume((int)floorf(decibels * 2.0 + 0.5));
 }
 
+// Set the level of the Programmable Gain Amplifier
+// 59.5dB is maximum, 0dB is minimum; 0.5dB steps
+int BeagleRT_setPgaGain(float decibels, int channel){
+	if(gAudioCodec == 0)
+		return -1;
+	printf("calling\n");
+	return gAudioCodec->setPga(decibels, channel);
+}
+
 // Set the level of the onboard headphone amplifier; affects headphone
 // output only (not line out or speaker)
 // 0dB is the maximum, -63.5dB is the minimum; 0.5dB steps