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 #include "freescape/sid.h"
27 
28 namespace Freescape {
29 
31 public:
34 
35  void playSfx(int sfxIndex);
36  void sfxTick(); // Called every frame (50Hz) from onTimer
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 
48  // Voice 1 pitch slide state ($CC5B-$CC61)
49  uint8 _v1Counter; // 0xFF=inactive, 0=expired (marked 0xFF next tick)
50  uint8 _v1FreqLo;
51  uint8 _v1FreqHi;
52  uint8 _v1DeltaLo;
53  uint8 _v1DeltaHi;
54  uint8 _v1TickCtr;
55  uint8 _v1TickReload;
56 
57  // Voice 3 pitch slide state ($CC62-$CC66)
58  uint8 _v3Counter;
59  uint8 _v3FreqLo;
60  uint8 _v3FreqHi;
61  uint8 _v3DeltaLo;
62  uint8 _v3DeltaHi;
63 
64  // Noise burst timer ($CC67-$CC6A)
65  uint8 _noiseTimer;
66  uint8 _noiseCounter;
67  uint8 _noiseReload;
68  uint8 _noiseDec;
69 
70  // Phase state machine for multi-step SFX (#6, #14, #15)
71  uint8 _sfxPhase; // 0=inactive
72  uint8 _sfxPhaseTimer; // frames until next phase transition
73  uint8 _sfxActiveIndex; // which SFX owns the phase state
74 
75  // Tick handlers
76  void tickVoice1Slide();
77  void tickVoice3Slide();
78  void tickNoiseBurst();
79  void tickPhase();
80 
81  // Helper to silence all voices
82  void silenceAllVoices();
83 
84  // Noise burst subroutine ($C818)
85  void noiseBurst(uint8 param);
86 
87  // Individual SFX routines
88  void sfx2(); // Dual-voice noise sweep down
89  void sfx3(); // Noise pitch slide
90  void sfx4(); // Pulse slide down
91  void sfx5(); // Pulse slide up
92  void sfx6(); // Triangle blip
93  void sfx7(); // Dual noise burst
94  void sfx8(); // Triangle slide up
95  void sfx9(); // Dual slide (V1+V3) noise
96  void sfx10(); // Programmed noise bursts
97  void sfx11(); // Triangle slide down (fast)
98  void sfx14(); // 3-step chord (V1+V2)
99  void sfx15(); // Two-phase pulse effect
100  void sfx16(); // Filtered effect (V1+V3)
101  void sfx17(); // Freq echo (V1->V3)
102  void sfx18(); // Dual noise with modulation
103 
104  void onTimer();
105 };
106 
107 } // namespace Freescape
108 
109 #endif // FREESCAPE_DRILLER_C64_SFX_H
Definition: c64.sfx.h:30
Definition: area.h:36
Definition: sid.h:44