/***************************************************************************1* Copyright (C) 2007 by Sindre Aamås *2* [email protected] *3* *4* This program is free software; you can redistribute it and/or modify *5* it under the terms of the GNU General Public License version 2 as *6* published by the Free Software Foundation. *7* *8* This program is distributed in the hope that it will be useful, *9* but WITHOUT ANY WARRANTY; without even the implied warranty of *10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *11* GNU General Public License version 2 for more details. *12* *13* You should have received a copy of the GNU General Public License *14* version 2 along with this program; if not, write to the *15* Free Software Foundation, Inc., *16* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *17***************************************************************************/18#ifndef LENGTH_COUNTER_H19#define LENGTH_COUNTER_H2021#include "sound_unit.h"22#include "../savestate.h"23#include "newstate.h"2425namespace gambatte {2627class MasterDisabler;2829class LengthCounter : public SoundUnit {30MasterDisabler &disableMaster;31unsigned short lengthCounter;32const unsigned char lengthMask;33bool cgb;3435public:36LengthCounter(MasterDisabler &disabler, unsigned lengthMask);37void event();38void nr1Change(unsigned newNr1, unsigned nr4, unsigned long cc);39void nr4Change(unsigned oldNr4, unsigned newNr4, unsigned long cc);40// void reset();41void init(bool cgb);42void loadState(const SaveState::SPU::LCounter &lstate, unsigned long cc);4344template<bool isReader>void SyncState(NewState *ns);45};4647}4849#endif505152