ScummVM API documentation
c64.sfx.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 FREESCAPE_DRILLER_C64_SFX_H
23
#define FREESCAPE_DRILLER_C64_SFX_H
24
25
#include "audio/sid.h"
26
27
namespace
Freescape
{
28
29
// SID register offsets
30
enum
SIDRegs {
31
kSIDV1FreqLo = 0x00,
32
kSIDV1FreqHi = 0x01,
33
kSIDV1PwLo = 0x02,
34
kSIDV1PwHi = 0x03,
35
kSIDV1Ctrl = 0x04,
36
kSIDV1AD = 0x05,
37
kSIDV1SR = 0x06,
38
39
kSIDV2FreqLo = 0x07,
40
kSIDV2FreqHi = 0x08,
41
kSIDV2PwLo = 0x09,
42
kSIDV2PwHi = 0x0A,
43
kSIDV2Ctrl = 0x0B,
44
kSIDV2AD = 0x0C,
45
kSIDV2SR = 0x0D,
46
47
kSIDV3FreqLo = 0x0E,
48
kSIDV3FreqHi = 0x0F,
49
kSIDV3PwLo = 0x10,
50
kSIDV3PwHi = 0x11,
51
kSIDV3Ctrl = 0x12,
52
kSIDV3AD = 0x13,
53
kSIDV3SR = 0x14,
54
55
kSIDFilterLo = 0x15,
56
kSIDFilterHi = 0x16,
57
kSIDFilterCtrl = 0x17,
58
kSIDVolume = 0x18
59
};
60
61
class
DrillerC64SFXPlayer
{
62
public
:
63
DrillerC64SFXPlayer
();
64
~
DrillerC64SFXPlayer
();
65
66
void
playSfx(
int
sfxIndex);
67
void
sfxTick();
// Called every frame (50Hz) from onTimer
68
void
stopAllSfx();
69
70
bool
isSfxActive()
const
;
71
void
initSID();
72
void
destroySID();
73
74
private
:
75
SID::SID
*_sid;
76
77
void
sidWrite(
int
reg, uint8 data);
78
79
// Voice 1 pitch slide state ($CC5B-$CC61)
80
uint8 _v1Counter;
// 0xFF=inactive, 0=expired (marked 0xFF next tick)
81
uint8 _v1FreqLo;
82
uint8 _v1FreqHi;
83
uint8 _v1DeltaLo;
84
uint8 _v1DeltaHi;
85
uint8 _v1TickCtr;
86
uint8 _v1TickReload;
87
88
// Voice 3 pitch slide state ($CC62-$CC66)
89
uint8 _v3Counter;
90
uint8 _v3FreqLo;
91
uint8 _v3FreqHi;
92
uint8 _v3DeltaLo;
93
uint8 _v3DeltaHi;
94
95
// Noise burst timer ($CC67-$CC6A)
96
uint8 _noiseTimer;
97
uint8 _noiseCounter;
98
uint8 _noiseReload;
99
uint8 _noiseDec;
100
101
// Phase state machine for multi-step SFX (#6, #14, #15)
102
uint8 _sfxPhase;
// 0=inactive
103
uint8 _sfxPhaseTimer;
// frames until next phase transition
104
uint8 _sfxActiveIndex;
// which SFX owns the phase state
105
106
// Tick handlers
107
void
tickVoice1Slide();
108
void
tickVoice3Slide();
109
void
tickNoiseBurst();
110
void
tickPhase();
111
112
// Helper to silence all voices
113
void
silenceAllVoices();
114
115
// Noise burst subroutine ($C818)
116
void
noiseBurst(uint8 param);
117
118
// Individual SFX routines
119
void
sfx2();
// Dual-voice noise sweep down
120
void
sfx3();
// Noise pitch slide
121
void
sfx4();
// Pulse slide down
122
void
sfx5();
// Pulse slide up
123
void
sfx6();
// Triangle blip
124
void
sfx7();
// Dual noise burst
125
void
sfx8();
// Triangle slide up
126
void
sfx9();
// Dual slide (V1+V3) noise
127
void
sfx10();
// Programmed noise bursts
128
void
sfx11();
// Triangle slide down (fast)
129
void
sfx14();
// 3-step chord (V1+V2)
130
void
sfx15();
// Two-phase pulse effect
131
void
sfx16();
// Filtered effect (V1+V3)
132
void
sfx17();
// Freq echo (V1->V3)
133
void
sfx18();
// Dual noise with modulation
134
135
void
onTimer();
136
};
137
138
}
// namespace Freescape
139
140
#endif // FREESCAPE_DRILLER_C64_SFX_H
Freescape::DrillerC64SFXPlayer
Definition:
c64.sfx.h:61
Freescape
Definition:
area.h:36
SID::SID
Definition:
sid.h:44
engines
freescape
games
driller
c64.sfx.h
Generated on Fri Mar 13 2026 09:14:13 for ScummVM API documentation by
1.8.13