changeset 172:5f4408705eed

Cleanup
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 28 Dec 2015 04:00:12 +0100
parents e63563507edd
children 2877bc2cd449
files core/I2c_Codec.cpp core/RTAudio.cpp
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/core/I2c_Codec.cpp	Mon Dec 28 03:53:36 2015 +0100
+++ b/core/I2c_Codec.cpp	Mon Dec 28 04:00:12 2015 +0100
@@ -271,10 +271,7 @@
 		// Values between 0b01110111 and 0b01111111 are clipped to 59.5dB
 		value = (int)(newGain * 2 + 0.5) & 0x7f;
 	}
-	printf("channel: %d, gain: %f, value: 0x%x, reg: 0x%x\n", channel, newGain, value, reg);
-	int ret = writeRegister(reg, value);
-	printf("ret: %d\n", ret);
-	return ret;
+	return writeRegister(reg, value);
 }
 
 // Set the volume of the DAC output
--- a/core/RTAudio.cpp	Mon Dec 28 03:53:36 2015 +0100
+++ b/core/RTAudio.cpp	Mon Dec 28 04:00:12 2015 +0100
@@ -210,11 +210,15 @@
 		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++){
+		if(settings->pgaGain[n] > 59.5){
+			std::cerr << "PGA gain out of range [0,59.5]\n";
+			exit(1);
+		}
 		BeagleRT_setPgaGain(settings->pgaGain[n], n);
 	}
 	BeagleRT_setHeadphoneLevel(settings->headphoneLevel);
@@ -460,7 +464,6 @@
 int BeagleRT_setPgaGain(float decibels, int channel){
 	if(gAudioCodec == 0)
 		return -1;
-	printf("calling\n");
 	return gAudioCodec->setPga(decibels, channel);
 }