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_DARK_C64_SFX_H
23
#define FREESCAPE_DARK_C64_SFX_H
24
25
#include "audio/sid.h"
26
#include "freescape/sid.h"
27
#include "freescape/sound.h"
28
29
namespace
Freescape
{
30
31
class
DarkSideC64SFXPlayer
:
public
Sound
{
32
public
:
33
DarkSideC64SFXPlayer
();
34
~
DarkSideC64SFXPlayer
();
35
36
void
playSound(
int
sfxIndex, Type type)
override
;
37
void
stopSound(Type type)
override
;
38
bool
isPlayingSound(Type type)
const override
;
39
40
void
sfxTick();
41
42
void
initSID();
43
void
destroySID();
44
45
private
:
46
SID::SID
*_sid;
47
48
void
sidWrite(
int
reg, uint8 data);
49
void
onTimer();
50
51
// State machine ($C801 equivalent)
52
uint8 _state;
// 0=off, 1=start, 2=slide
53
54
// Work buffer (copied from SFX data table)
55
uint8 _numNotes;
56
uint8 _repeatCount;
57
uint8 _waveform;
58
uint8 _speed;
59
60
// Runtime state
61
uint8 _repeatLeft;
// $CE52: remaining sequence repeats
62
uint8 _notesLeft;
// $CE55: remaining notes in this pass
63
uint8 _freqIndex;
// $CE54: index into freq/delta arrays (by 2)
64
uint8 _durIndex;
// $CE53: index into duration array (by 1)
65
uint8 _durCounter;
// $CE4F: remaining ticks for current note
66
uint8 _speedCounter;
// $CE56: frames until next freq update
67
68
// Current frequency (16-bit)
69
uint8 _curFreqLo;
// $CE50
70
uint8 _curFreqHi;
// $CE51
71
72
// Precomputed start frequencies and deltas per note
73
int16 _startFreqs[16];
// $CE97: starting frequency for each note (lo,hi)
74
int16 _deltas[16];
// $CEA6: per-speed-unit frequency delta per note
75
uint8 _durCopies[9];
// $CEB5: copy of durations per note
76
77
void
silenceV1();
78
void
silenceAll();
79
void
setupSfx(
int
index);
80
void
tickStart();
81
void
tickSlide();
82
};
83
84
}
// namespace Freescape
85
86
#endif // FREESCAPE_DARK_C64_SFX_H
Freescape
Definition:
area.h:36
SID::SID
Definition:
sid.h:44
Freescape::DarkSideC64SFXPlayer
Definition:
c64.sfx.h:31
Freescape::Sound
Definition:
sound.h:35
engines
freescape
games
dark
c64.sfx.h
Generated on Sat Jul 25 2026 09:11:15 for ScummVM API documentation by
1.8.13