diff --git a/src/emucore/tia/Audio.hxx b/src/emucore/tia/Audio.hxx index c656ed5a3..aa2e5e611 100644 --- a/src/emucore/tia/Audio.hxx +++ b/src/emucore/tia/Audio.hxx @@ -98,8 +98,8 @@ void Audio::tick() { // volume for each channel is sampled every color clock. the average of // these samples will be taken twice a scanline in the phase1() function - sumChannel0 += (uInt32)myChannel0.phase1(); - sumChannel1 += (uInt32)myChannel1.phase1(); + sumChannel0 += (uInt32)myChannel0.volume(); + sumChannel1 += (uInt32)myChannel1.volume(); sumCt++; switch (myCounter) { @@ -111,7 +111,9 @@ void Audio::tick() case 37: case 149: - phase1(); + myChannel0.phase1(); + myChannel1.phase1(); + phase1(); break; default: diff --git a/src/emucore/tia/AudioChannel.cxx b/src/emucore/tia/AudioChannel.cxx index 72db5a076..4bd8eaec0 100644 --- a/src/emucore/tia/AudioChannel.cxx +++ b/src/emucore/tia/AudioChannel.cxx @@ -77,7 +77,7 @@ void AudioChannel::phase0() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt8 AudioChannel::phase1() +void AudioChannel::phase1() { if (myClockEnable) { bool pulseFeedback = false; @@ -118,7 +118,10 @@ uInt8 AudioChannel::phase1() } } } +} +uInt8 AudioChannel::volume() +{ return (myPulseCounter & 0x01) * myAudv; } diff --git a/src/emucore/tia/AudioChannel.hxx b/src/emucore/tia/AudioChannel.hxx index 6302dcba3..f00938114 100644 --- a/src/emucore/tia/AudioChannel.hxx +++ b/src/emucore/tia/AudioChannel.hxx @@ -30,7 +30,9 @@ class AudioChannel : public Serializable void phase0(); - uInt8 phase1(); + void phase1(); + + uInt8 volume(); void audc(uInt8 value);