Thanks to my EX I have managed to get the balance function operational. Improvements will follow so that the balance can be held when the volume is changed, at the moment the balance levels out when the overall volume is changed, I am told this can be overcome. I will also work on having the display show the balance as a series of bars. I had worked a lot of this out but couldn't quite get it over the line, well that's my story anyway :)
byte currLBal=DEFAULTATTNU; // Variable to hold Left Balance Value
byte currRBal=DEFAULTATTNU; // Variable to hold Right Balance Value
void setSabreRBalance(byte regVal)
{
writeSabreReg(0, regVal); // set up volume in DAC1
writeSabreReg(2, regVal); // set up volume in DAC3
writeSabreReg(4, regVal); // set up volume in DAC5
writeSabreReg(6, regVal); // set up volume in DAC7
}
void setSabreLBalance(byte regVal)
{
writeSabreReg(1, regVal); // set up volume in DAC1
writeSabreReg(3, regVal); // set up volume in DAC3
writeSabreReg(5, regVal); // set up volume in DAC5
writeSabreReg(7, regVal); // set up volume in DAC7
}
case 377: // BALANCE LEFT 377 is return for C1+C2+C3 it was "4" is the APPLE LEFT Key
if (currAttnu>MINATTNU && poweron) // Check if not already at minimum attenuation
{
if(dimmed) {
rampUp(); // Disengage dim
dimmed=false;
}
currLBal-=2; // Increase volume 1 db
setSabreLBalance(currLBal); // Write value into registers
currRBal+=2; // Decrease volume 1 db
setSabreRBalance(currRBal); // Write value into registers
//dispVol(currAttnu);
}
break;
case 376: // BALANCE RIGHT 376 is return for C1+C2+C3 it was "3" is the APPLE RIGHT Key,
if (currAttnu>MINATTNU && poweron) // Check if not already at minimum attenuation
{
if(dimmed) {
rampUp(); // Disengage dim
dimmed=false;
}
currRBal-=2; // Increase volume 1 db)
setSabreRBalance(currRBal); // Write value into registers
currLBal+=2; // Decrease volume 1 db
setSabreLBalance(currLBal); // Write value into registers
// dispVol(currAttnu);
}
break;
case 378: // VOLUME UP 378 is return for C1+C2+C3 it was "5" is the APPLE UP key, we will use for volume up
if (currAttnu>MINATTNU && poweron) // Check if not already at minimum attenuation
{
if(dimmed) {
rampUp(); // Disengage dim
dimmed=false;
}
currAttnu-=2; // Increase volume 1 db
currLBal = currAttnu; //Keep the values in synch
currRBal = currAttnu; //Keep the values in synch
setSabreVolume(currAttnu); // Write value into registers
dispVol(currAttnu);
}
break;
case 379: // VOLUME DOWN 379 is return for C1+C2+C3 it was "6" is the APPLE DOWN key, we will use for volume down
if (currAttnu<MAXATTNU && poweron) // Check if not already at maximum attenuation
{
if(dimmed) {
rampUp(); // Disengage dim
dimmed=false;
}
currAttnu+=2; // Decrease volume 1 db
currLBal = currAttnu; //Keep the values in synch
currRBal = currAttnu; //Keep the values in synch
setSabreVolume(currAttnu); // Write value into registers
dispVol(currAttnu);
}
Edited by user Sunday, March 24, 2013 10:12:56 AM(UTC)
| Reason: Not specified