# HG changeset patch # User Giulio Moro # Date 1451271612 -3600 # Node ID 5f4408705eed274baf287d6479b7b5fce83c341d # Parent e63563507edd07f631dd4adf37b6a04c86d77874 Cleanup diff -r e63563507edd -r 5f4408705eed core/I2c_Codec.cpp --- 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 diff -r e63563507edd -r 5f4408705eed core/RTAudio.cpp --- 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); }