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