VRC7: Implemented missing "mute audio" flag

This commit is contained in:
Sour 2018-06-17 21:17:59 -04:00
parent dd9ae7b715
commit f818047c2a
2 changed files with 11 additions and 3 deletions

View File

@ -4,7 +4,6 @@
#include "VrcIrq.h"
#include "Vrc7Audio.h"
//incomplete - missing audio
class VRC7 : public BaseMapper
{
private:
@ -60,6 +59,8 @@ protected:
}
UpdatePrgRamAccess();
_audio.SetMuteAudio((_controlFlags & 0x40) != 0);
}
void WriteRegister(uint16_t addr, uint8_t value) override

View File

@ -11,6 +11,7 @@ private:
uint8_t _currentReg;
int16_t _previousOutput;
double _clockTimer;
bool _muted;
protected:
void ClockAudio() override
@ -18,7 +19,7 @@ protected:
_clockTimer--;
if(_clockTimer <= 0) {
int16_t output = _opllEmulator->GetOutput();
APU::AddExpansionAudioDelta(AudioChannel::VRC7, output - _previousOutput);
APU::AddExpansionAudioDelta(AudioChannel::VRC7, _muted ? 0 : (output - _previousOutput));
_previousOutput = output;
_clockTimer = ((double)CPU::GetClockRate(Console::GetModel())) / 49716;
}
@ -29,7 +30,7 @@ protected:
BaseExpansionAudio::StreamState(saving);
SnapshotInfo opllEmulator{ _opllEmulator.get() };
Stream(opllEmulator, _currentReg, _previousOutput, _clockTimer);
Stream(opllEmulator, _currentReg, _previousOutput, _clockTimer, _muted);
}
public:
@ -37,11 +38,17 @@ public:
{
_previousOutput = 0;
_currentReg = 0;
_muted = false;
_clockTimer = ((double)CPU::GetClockRate(Console::GetModel())) / 49716;
_opllEmulator.reset(new Vrc7Opll::OpllEmulator());
}
void SetMuteAudio(bool muted)
{
_muted = muted;
}
void WriteReg(uint16_t addr, uint8_t value)
{
switch(addr & 0xF030) {