Mesen-X/Core/InvA13Audio.h
Persune a22b17b2c1 Add /A13 and /OE1 audio interference
In hardware, the audio from the 2A03 APU pins go through an inverted
preamp using one of the 74HCU04 inverter chips in the motherboard.
Though this may be cost-effective on Nintendo's part, the signals on the
hex inverter chip can interfere with one another, especially on the
audio. This can be heard as a buzz or a high pitched whine.

The only known signals to interfere with the audio so far is:
- /A13, the inverted signal of PPU A13 going into the cartridge
   connector.
- /OE1, Output enable for controller reads, though this is only found
   present on the RF Famicom.
2021-08-11 17:55:56 +08:00

41 lines
No EOL
742 B
C++

#pragma once
#include "stdafx.h"
#include "Snapshotable.h"
#include "APU.h"
#include "BaseExpansionAudio.h"
#include "Console.h"
#include <array>
class InvA13Audio : public BaseExpansionAudio
{
private:
int8_t _currentOutput;
int8_t _lastOutput;
void UpdateOutputLevel()
{
if (_currentOutput != _lastOutput) {
_console->GetApu()->AddExpansionAudioDelta(AudioChannel::InvA13, _currentOutput - _lastOutput);
_lastOutput = _currentOutput;
}
}
protected:
void StreamState(bool saving) override
{
}
void ClockAudio() override
{
_currentOutput = _console->_InvA13;
UpdateOutputLevel();
}
public:
InvA13Audio(shared_ptr<Console> console) : BaseExpansionAudio(console)
{
_lastOutput = 0;
_currentOutput = 0;
}
};