Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Volume change on SGTL5000 does only work on startup

  1. #1

    Volume change on SGTL5000 does only work on startup

    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

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •