libgambatte/sound/length_counter: formatting/readability
This commit is contained in:
parent
8fd449cf04
commit
b9e715d2c2
@ -22,9 +22,9 @@
|
||||
|
||||
namespace gambatte {
|
||||
|
||||
LengthCounter::LengthCounter(MasterDisabler &disabler, const unsigned mask) :
|
||||
disableMaster(disabler),
|
||||
lengthMask(mask)
|
||||
LengthCounter::LengthCounter(MasterDisabler &disabler, const unsigned mask)
|
||||
: disableMaster(disabler)
|
||||
, lengthMask(mask)
|
||||
{
|
||||
init(false);
|
||||
nr1Change(0, 0, 0);
|
||||
@ -38,7 +38,9 @@ void LengthCounter::event() {
|
||||
|
||||
void LengthCounter::nr1Change(const unsigned newNr1, const unsigned nr4, const unsigned long cycleCounter) {
|
||||
lengthCounter = (~newNr1 & lengthMask) + 1;
|
||||
counter = (nr4 & 0x40) ?( (cycleCounter >> 13) + lengthCounter) << 13 : static_cast<unsigned long>(COUNTER_DISABLED);
|
||||
counter = nr4 & 0x40
|
||||
? ((cycleCounter >> 13) + lengthCounter) << 13
|
||||
: static_cast<unsigned long>(COUNTER_DISABLED);
|
||||
}
|
||||
|
||||
void LengthCounter::nr4Change(const unsigned oldNr4, const unsigned newNr4, const unsigned long cycleCounter) {
|
||||
@ -67,13 +69,6 @@ void LengthCounter::nr4Change(const unsigned oldNr4, const unsigned newNr4, cons
|
||||
counter = COUNTER_DISABLED;
|
||||
}
|
||||
|
||||
/*void LengthCounter::reset() {
|
||||
counter = COUNTER_DISABLED;
|
||||
|
||||
if (cgb)
|
||||
lengthCounter = lengthMask + 1;
|
||||
}*/
|
||||
|
||||
void LengthCounter::init(const bool cgb) {
|
||||
this->cgb = cgb;
|
||||
}
|
||||
|
@ -27,20 +27,20 @@ namespace gambatte {
|
||||
class MasterDisabler;
|
||||
|
||||
class LengthCounter : public SoundUnit {
|
||||
public:
|
||||
LengthCounter(MasterDisabler &disabler, unsigned lengthMask);
|
||||
virtual void event();
|
||||
void nr1Change(unsigned newNr1, unsigned nr4, unsigned long cc);
|
||||
void nr4Change(unsigned oldNr4, unsigned newNr4, unsigned long cc);
|
||||
void init(bool cgb);
|
||||
void saveState(SaveState::SPU::LCounter &lstate) const;
|
||||
void loadState(const SaveState::SPU::LCounter &lstate, unsigned long cc);
|
||||
|
||||
private:
|
||||
MasterDisabler &disableMaster;
|
||||
unsigned short lengthCounter;
|
||||
const unsigned char lengthMask;
|
||||
bool cgb;
|
||||
|
||||
public:
|
||||
LengthCounter(MasterDisabler &disabler, unsigned lengthMask);
|
||||
void event();
|
||||
void nr1Change(unsigned newNr1, unsigned nr4, unsigned long cc);
|
||||
void nr4Change(unsigned oldNr4, unsigned newNr4, unsigned long cc);
|
||||
// void reset();
|
||||
void init(bool cgb);
|
||||
void saveState(SaveState::SPU::LCounter &lstate) const;
|
||||
void loadState(const SaveState::SPU::LCounter &lstate, unsigned long cc);
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user