ScummVM API documentation
cms.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef AUDIO_SOFTSYNTH_CMS_H
23
#define AUDIO_SOFTSYNTH_CMS_H
24
25
#include "audio/cms.h"
26
27
/* this structure defines a channel */
28
struct
saa1099_channel
{
29
int
frequency;
/* frequency (0x00..0xff) */
30
int
freq_enable;
/* frequency enable */
31
int
noise_enable;
/* noise enable */
32
int
octave;
/* octave (0x00..0x07) */
33
int
amplitude[2];
/* amplitude (0x00..0x0f) */
34
int
envelope[2];
/* envelope (0x00..0x0f or 0x10 == off) */
35
36
/* vars to simulate the square wave */
37
int32 counter;
38
int32 freq;
39
int
level;
40
};
41
42
/* this structure defines a noise channel */
43
struct
saa1099_noise
{
44
/* vars to simulate the noise generator output */
45
int32 counter;
46
int32 freq;
47
int
level;
/* noise polynomal shifter */
48
};
49
50
/* this structure defines a SAA1099 chip */
51
struct
SAA1099
{
52
int
stream;
/* our stream */
53
int
noise_params[2];
/* noise generators parameters */
54
int
env_enable[2];
/* envelope generators enable */
55
int
env_reverse_right[2];
/* envelope reversed for right channel */
56
int
env_mode[2];
/* envelope generators mode */
57
int
env_bits[2];
/* non zero = 3 bits resolution */
58
int
env_clock[2];
/* envelope clock mode (non-zero external) */
59
int
env_step[2];
/* current envelope step */
60
int
all_ch_enable;
/* all channels enable */
61
int
sync_state;
/* sync all channels */
62
int
selected_reg;
/* selected register */
63
struct
saa1099_channel
channels[6];
/* channels */
64
struct
saa1099_noise
noise[2];
/* noise generators */
65
};
66
67
class
DOSBoxCMS
:
public
::CMS::CMS
,
public
Audio::EmulatedChip
{
68
public
:
69
DOSBoxCMS
(uint32 basePort = 0x220) {
70
memset(_saa1099, 0,
sizeof
(
SAA1099
)*2);
71
_basePort = basePort;
72
}
73
74
~
DOSBoxCMS
()
override
{ }
75
76
bool
init()
override
;
77
void
reset()
override
;
78
void
write(
int
a,
int
v)
override
;
79
void
writeReg(
int
r,
int
v)
override
;
80
81
bool
isStereo
()
const override
{
return
true
; }
82
83
protected
:
84
void
generateSamples(int16 *buffer,
int
numSamples)
override
;
85
86
private
:
87
uint32 _basePort;
88
89
SAA1099
_saa1099[2];
90
91
void
envelope(
int
chip,
int
ch);
92
void
update(
int
chip, int16 *buffer,
int
length);
93
void
portWriteIntern(
int
chip,
int
offset,
int
data);
94
};
95
96
97
#endif
DOSBoxCMS::isStereo
bool isStereo() const override
Definition:
cms.h:81
saa1099_channel
Definition:
cms.h:28
CMS::CMS
Definition:
cms.h:39
Audio::EmulatedChip
Definition:
chip.h:112
DOSBoxCMS
Definition:
cms.h:67
SAA1099
Definition:
cms.h:51
saa1099_noise
Definition:
cms.h:43
audio
softsynth
cms.h
Generated on Fri Aug 30 2024 09:03:17 for ScummVM API documentation by
1.8.13