Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libgambatte/src/sound/channel2.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 SOUND_CHANNEL2_H
20
#define SOUND_CHANNEL2_H
21
22
#include "gbint.h"
23
#include "length_counter.h"
24
#include "duty_unit.h"
25
#include "envelope_unit.h"
26
#include "static_output_tester.h"
27
#include "newstate.h"
28
29
namespace gambatte {
30
31
struct SaveState;
32
33
class Channel2 {
34
friend class StaticOutputTester<Channel2,DutyUnit>;
35
36
StaticOutputTester<Channel2,DutyUnit> staticOutputTest;
37
DutyMasterDisabler disableMaster;
38
LengthCounter lengthCounter;
39
DutyUnit dutyUnit;
40
EnvelopeUnit envelopeUnit;
41
42
SoundUnit *nextEventUnit;
43
44
unsigned long cycleCounter;
45
unsigned long soMask;
46
unsigned long prevOut;
47
48
unsigned char nr4;
49
bool master;
50
51
void setEvent();
52
53
public:
54
Channel2();
55
void setNr1(unsigned data);
56
void setNr2(unsigned data);
57
void setNr3(unsigned data);
58
void setNr4(unsigned data);
59
60
void setSo(unsigned long soMask);
61
// void deactivate() { disableMaster(); setEvent(); }
62
bool isActive() const { return master; }
63
64
void update(uint_least32_t *buf, unsigned long soBaseVol, unsigned long cycles);
65
66
void reset();
67
void init(bool cgb);
68
void loadState(const SaveState &state);
69
70
template<bool isReader>void SyncState(NewState *ns);
71
};
72
73
}
74
75
#endif
76
77