mirror of
https://github.com/JorjBauer/aiie.git
synced 2025-04-04 16:29:37 +00:00
implement volume
This commit is contained in:
parent
d1263bbf5a
commit
db0ed06375
@ -50,8 +50,11 @@ TeensySpeaker::~TeensySpeaker()
|
||||
|
||||
void TeensySpeaker::begin()
|
||||
{
|
||||
mixer1.gain(0, 0.1f); // left channel (off for now)
|
||||
mixer1.gain(1, 0.1f); // right channel (full volume for now)
|
||||
float curVolume = (float)g_volume / 15.0;
|
||||
mixer1.gain(0, curVolume); // left channel
|
||||
mixer1.gain(1, curVolume); // right channel
|
||||
mixer2.gain(0, curVolume); // left channel
|
||||
mixer2.gain(1, curVolume); // right channel
|
||||
|
||||
memset(soundBuf, 0, sizeof(soundBuf));
|
||||
|
||||
|
@ -142,7 +142,7 @@ void setup()
|
||||
yield();
|
||||
}
|
||||
#endif
|
||||
delay(120); // let the power settle
|
||||
delay(200); // let the power settle & serial to get its bearings
|
||||
|
||||
pinMode(DEBUGPIN, OUTPUT); // for debugging
|
||||
pinMode(BATTERYSELECT, OUTPUT);
|
||||
@ -220,7 +220,8 @@ void setup()
|
||||
|
||||
println("Reading prefs");
|
||||
readPrefs(); // read from eeprom and set anything we need setting
|
||||
|
||||
g_speaker->begin(); // let the speaker reset its volume from g_volume
|
||||
|
||||
// Debugging: insert a disk on startup...
|
||||
//((AppleVM *)g_vm)->insertDisk(0, "/A2DISKS/UTIL/mock2dem.dsk", false);
|
||||
//((AppleVM *)g_vm)->insertDisk(0, "/A2DISKS/JORJ/disk_s6d1.dsk", false);
|
||||
@ -475,6 +476,10 @@ void loop()
|
||||
|
||||
// Reset the CPU clock so it doesn't fast-forward
|
||||
cpuClockInitialized = false;
|
||||
|
||||
// Reset the speaker so it picks up its new volume (FIXME kinda hacky)
|
||||
g_speaker->begin();
|
||||
|
||||
wasBios = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user