ScummVM API documentation
TVF.h
1 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
2  * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 2.1 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef MT32EMU_TVF_H
19 #define MT32EMU_TVF_H
20 
21 #include "globals.h"
22 #include "Types.h"
23 #include "Structures.h"
24 
25 namespace MT32Emu {
26 
27 class LA32Ramp;
28 class Partial;
29 
30 class TVF {
31 private:
32  const Partial * const partial;
33  LA32Ramp *cutoffModifierRamp;
34  const TimbreParam::PartialParam *partialParam;
35 
36  Bit8u baseCutoff;
37  int keyTimeSubtraction;
38  unsigned int levelMult;
39 
40  Bit8u target;
41  unsigned int phase;
42 
43  void startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase);
44  void nextPhase();
45 
46 public:
47  TVF(const Partial *partial, LA32Ramp *cutoffModifierRamp);
48  void reset(const TimbreParam::PartialParam *partialParam, Bit32u basePitch);
49  // Returns the base cutoff (without envelope modification).
50  // The base cutoff is calculated when reset() is called and remains static
51  // for the lifetime of the partial.
52  // Barring bugs, the number returned is confirmed accurate
53  // (based on specs from Mok).
54  Bit8u getBaseCutoff() const;
55  void handleInterrupt();
56  void startDecay();
57 }; // class TVF
58 
59 } // namespace MT32Emu
60 
61 #endif // #ifndef MT32EMU_TVF_H
Definition: Analog.h:26
Definition: Partial.h:40
Definition: LA32Ramp.h:26
Definition: TVF.h:30
Definition: Structures.h:56