Mesen2/Core/GBA/APU/GbaWaveChannel.h
Sour fadf7c4d44 GBA: Fixed problem with wave channel in Kidou Senshi Gundam - Seed Destiny
Wave channel was playing the wrong audio on the title screen, because some writes were being blocked.
It looks like the restriction on wave "ram" access that exists on GB don't exist on GBA
Additionally, it seems like the wave data is supposed to be stored in a large shift register (not emulated yet), rather than an array of bytes
2025-02-26 17:41:33 +09:00

40 lines
No EOL
789 B
C++

#pragma once
#include "pch.h"
#include "GBA/GbaTypes.h"
#include "Utilities/ISerializable.h"
#include "Utilities/Serializer.h"
class GbaApu;
class GbaConsole;
class GbaWaveChannel final : public ISerializable
{
private:
GbaWaveState _state = {};
GbaApu* _apu = nullptr;
GbaConsole* _console = nullptr;
void UpdateOutput();
public:
GbaWaveChannel(GbaApu* apu, GbaConsole* console);
GbaWaveState& GetState();
bool Enabled();
void Disable();
void ResetLengthCounter();
uint8_t GetRawOutput();
double GetOutput();
void ClockLengthCounter();
void Exec(uint32_t clocksToRun);
uint8_t Read(uint16_t addr);
void Write(uint16_t addr, uint8_t value);
void WriteRam(uint16_t addr, uint8_t value);
uint8_t ReadRam(uint16_t addr);
void Serialize(Serializer& s) override;
};