ScummVM API documentation
TVP.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_TVP_H
19 #define MT32EMU_TVP_H
20 
21 #include "globals.h"
22 #include "Types.h"
23 #include "Structures.h"
24 
25 namespace MT32Emu {
26 
27 class Part;
28 class Partial;
29 
30 class TVP {
31 private:
32  const Partial * const partial;
33  const MemParams::System * const system; // FIXME: Only necessary because masterTune calculation is done in the wrong place atm.
34 
35  const Part *part;
36  const TimbreParam::PartialParam *partialParam;
37  const MemParams::PatchTemp *patchTemp;
38 
39  const int processTimerTicksPerSampleX16;
40  int processTimerIncrement;
41  int counter;
42  Bit32u timeElapsed;
43 
44  int phase;
45  Bit32u basePitch;
46  Bit32s targetPitchOffsetWithoutLFO;
47  Bit32s currentPitchOffset;
48 
49  Bit16s lfoPitchOffset;
50  // In range -12 - 36
51  Bit8s timeKeyfollowSubtraction;
52 
53  Bit16s pitchOffsetChangePerBigTick;
54  Bit16u targetPitchOffsetReachedBigTick;
55  unsigned int shifts;
56 
57  Bit16u pitch;
58 
59  void updatePitch();
60  void setupPitchChange(int targetPitchOffset, Bit8u changeDuration);
61  void targetPitchOffsetReached();
62  void nextPhase();
63  void process();
64 public:
65  TVP(const Partial *partial);
66  void reset(const Part *part, const TimbreParam::PartialParam *partialParam);
67  Bit32u getBasePitch() const;
68  Bit16u nextPitch();
69  void startDecay();
70 }; // class TVP
71 
72 } // namespace MT32Emu
73 
74 #endif // #ifndef MT32EMU_TVP_H
Definition: Analog.h:26
Definition: TVP.h:30
Definition: Structures.h:136
Definition: Partial.h:40
Definition: Structures.h:160
Definition: Part.h:47
Definition: Structures.h:56