Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libgambatte/src/sound/length_counter.h
2 views
1
/***************************************************************************
2
* Copyright (C) 2007 by Sindre Aamås *
3
* [email protected] *
4
* *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License version 2 as *
7
* published by the Free Software Foundation. *
8
* *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License version 2 for more details. *
13
* *
14
* You should have received a copy of the GNU General Public License *
15
* version 2 along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18
***************************************************************************/
19
#ifndef LENGTH_COUNTER_H
20
#define LENGTH_COUNTER_H
21
22
#include "sound_unit.h"
23
#include "../savestate.h"
24
#include "newstate.h"
25
26
namespace gambatte {
27
28
class MasterDisabler;
29
30
class LengthCounter : public SoundUnit {
31
MasterDisabler &disableMaster;
32
unsigned short lengthCounter;
33
const unsigned char lengthMask;
34
bool cgb;
35
36
public:
37
LengthCounter(MasterDisabler &disabler, unsigned lengthMask);
38
void event();
39
void nr1Change(unsigned newNr1, unsigned nr4, unsigned long cc);
40
void nr4Change(unsigned oldNr4, unsigned newNr4, unsigned long cc);
41
// void reset();
42
void init(bool cgb);
43
void loadState(const SaveState::SPU::LCounter &lstate, unsigned long cc);
44
45
template<bool isReader>void SyncState(NewState *ns);
46
};
47
48
}
49
50
#endif
51
52