openMSX
Main Page
Namespaces
Classes
Files
File List
File Members
sound
Y8950Adpcm.hh
Go to the documentation of this file.
1
#ifndef Y8950ADPCM_HH
2
#define Y8950ADPCM_HH
3
4
#include "
Y8950.hh
"
5
#include "
Schedulable.hh
"
6
#include "
Clock.hh
"
7
#include "
serialize_meta.hh
"
8
#include "
openmsx.hh
"
9
#include <memory>
10
11
namespace
openmsx {
12
13
class
Y8950
;
14
class
DeviceConfig;
15
class
Ram
;
16
17
class
Y8950Adpcm
:
public
Schedulable
18
{
19
public
:
20
Y8950Adpcm
(
Y8950
& y8950,
const
DeviceConfig
& config,
21
const
std::string& name,
unsigned
sampleRam);
22
virtual
~Y8950Adpcm
();
23
24
void
clearRam
();
25
void
reset
(
EmuTime::param
time);
26
bool
isMuted
()
const
;
27
void
writeReg
(
byte
rg,
byte
data,
EmuTime::param
time);
28
byte
readReg
(
byte
rg,
EmuTime::param
time);
29
byte
peekReg
(
byte
rg,
EmuTime::param
time);
30
int
calcSample
();
31
void
sync
(
EmuTime::param
time);
32
void
resetStatus
();
33
34
template
<
typename
Archive>
35
void
serialize
(Archive& ar,
unsigned
version);
36
37
private
:
38
// This data is updated while playing
39
struct
PlayData {
40
unsigned
memPntr;
41
unsigned
nowStep;
42
int
out;
43
int
output;
44
int
diff;
45
int
nextLeveling;
46
int
sampleStep;
47
byte
adpcm_data;
48
};
49
50
// Schedulable
51
virtual
void
executeUntil(
EmuTime::param
time,
int
userData);
52
53
void
schedule();
54
void
restart(PlayData& pd);
55
56
bool
isPlaying()
const
;
57
void
writeData(
byte
data);
58
byte
peekReg
(
byte
rg)
const
;
59
byte
readData();
60
byte
peekData()
const
;
61
void
writeMemory(
unsigned
memPntr,
byte
value);
62
byte
readMemory(
unsigned
memPntr)
const
;
63
int
calcSample
(
bool
doEmu);
64
65
Y8950
& y8950;
66
const
std::unique_ptr<Ram> ram;
67
68
Clock<Y8950::CLOCK_FREQ, Y8950::CLOCK_FREQ_DIV>
clock;
69
70
PlayData emu;
// used for emulator behaviour (read back of sample data)
71
PlayData aud;
// used by audio generation thread
72
73
unsigned
startAddr;
74
unsigned
stopAddr;
75
unsigned
addrMask;
76
int
volume;
77
int
volumeWStep;
78
int
readDelay;
79
int
delta;
80
byte
reg7;
81
byte
reg15;
82
bool
romBank;
83
};
84
SERIALIZE_CLASS_VERSION
(
Y8950Adpcm
, 2);
85
86
}
// namespace openmsx
87
88
#endif
Generated on Sat May 18 2013 21:18:31 for openMSX by
1.8.1.2