ScummVM API documentation
Poly.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_POLY_H
19 #define MT32EMU_POLY_H
20 
21 #include "globals.h"
22 #include "internals.h"
23 
24 namespace MT32Emu {
25 
26 class Part;
27 class Partial;
28 struct PatchCache;
29 
30 class Poly {
31 private:
32  Part *part;
33  unsigned int key;
34  unsigned int velocity;
35  unsigned int activePartialCount;
36  bool sustain;
37 
38  PolyState state;
39 
40  Partial *partials[4];
41 
42  Poly *next;
43 
44  void setState(PolyState state);
45 
46 public:
47  Poly();
48  void setPart(Part *usePart);
49  void reset(unsigned int key, unsigned int velocity, bool sustain, Partial **partials);
50  bool noteOff(bool pedalHeld);
51  bool stopPedalHold();
52  bool startDecay();
53  bool startAbort();
54 
55  void backupCacheToPartials(PatchCache cache[4]);
56 
57  unsigned int getKey() const;
58  unsigned int getVelocity() const;
59  bool canSustain() const;
60  PolyState getState() const;
61  unsigned int getActivePartialCount() const;
62  bool isActive() const;
63 
64  void partialDeactivated(Partial *partial);
65 
66  Poly *getNext() const;
67  void setNext(Poly *poly);
68 }; // class Poly
69 
70 } // namespace MT32Emu
71 
72 #endif // #ifndef MT32EMU_POLY_H
Definition: Analog.h:26
Definition: Partial.h:40
Definition: Structures.h:246
Definition: Poly.h:30
Definition: Part.h:47