Volume change on SGTL5000 does only work on startup

Status
Not open for further replies.

C0d3man

Well-known member
Hi forum,

I have a simple problem with changing the volume of the Teensy audio shield (SGTL5000): At startup it works without problem (inside setup()), but directly from my running code nothing happens when calling sgtl1.volume(...);:

Code:
...
// a black key!
    num = abs(num);
    if (num <= 10)
    {
      sgtl5000_1.volume(num * 0.1);
#ifdef DEBUG
      Serial.print(F("Volume changed to: "));
      Serial.println(num * 0.1, DEC);
#endif
...

num is an unsigned integer, so normally this should work, or? I can see the DEBUG code in the serial console so I am sure the call to volume() is done...

Any ideas?

TIA, Holger
 
I fixed my problem with setting up the volume in setup() to full and use sgtl5000_1.dacVolume() to tune the voume while playing (like this):

Code:
sgtl5000_1.dacVolume(master_volume * volume_left, master_volume * volume_right);

Regards, Holger
 
Status
Not open for further replies.
Back
Top