Bladeren bron

Better volume scaling in PassThroughUSB example

dds
PaulStoffregen 7 jaren geleden
bovenliggende
commit
ca594397d7
1 gewijzigde bestanden met toevoegingen van 9 en 1 verwijderingen
  1. +9
    -1
      examples/HardwareTesting/PassThroughUSB/PassThroughUSB.ino

+ 9
- 1
examples/HardwareTesting/PassThroughUSB/PassThroughUSB.ino Bestand weergeven

@@ -19,9 +19,17 @@ void setup() {
void loop() {
// read the PC's volume setting
float vol = usb1.volume();

// scale to a nice range (not too loud)
// and adjust the audio shield output volume
vol = vol * 0.75;
if (vol > 0) {
// scale 0 = 1.0 range to:
// 0.3 = almost silent
// 0.8 = really loud
vol = 0.3 + vol * 0.5;
}

// use the scaled volume setting. Delete this for fixed volume.
sgtl5000_1.volume(vol);

delay(100);

Laden…
Annuleren
Opslaan