Mesen-SX/Core/GbSquareChannel.h
NovaSquirrel c0e249e993 Revert "Merge branch 'reformat_code'"
This reverts commit daf3b57e89, reversing
changes made to 7a6e0b7d77.
2021-03-10 11:13:28 -05:00

44 lines
No EOL
817 B
C++

#pragma once
#include "stdafx.h"
#include "GbTypes.h"
#include "../Utilities/ISerializable.h"
#include "../Utilities/Serializer.h"
class GbApu;
class GbSquareChannel final : public ISerializable
{
private:
const uint8_t _dutySequences[4][8] = {
{ 0, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0, 1, 1, 1, 1 },
{ 0, 0, 0, 0, 0, 0, 1, 1 }
};
GbSquareState _state = {};
GbApu* _apu = nullptr;
public:
GbSquareChannel(GbApu* apu);
GbSquareState GetState();
bool Enabled();
void Disable();
void ClockSweepUnit();
uint16_t GetSweepTargetFrequency();
void ClockLengthCounter();
void ClockEnvelope();
uint8_t GetOutput();
void Exec(uint32_t clocksToRun);
uint8_t Read(uint16_t addr);
void Write(uint16_t addr, uint8_t value);
void Serialize(Serializer& s) override;
};