ScummVM API documentation
PartialManager.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_PARTIALMANAGER_H
19 #define MT32EMU_PARTIALMANAGER_H
20 
21 #include "globals.h"
22 #include "internals.h"
23 #include "Types.h"
24 
25 namespace MT32Emu {
26 
27 class Part;
28 class Partial;
29 class Poly;
30 class Synth;
31 
33 private:
34  Synth *synth;
35  Part **parts;
36  Poly **freePolys;
37  Partial **partialTable;
38  Bit8u numReservedPartialsForPart[9];
39  Bit32u firstFreePolyIndex;
40  int *inactivePartials; // Holds indices of inactive Partials in the Partial table
41  Bit32u inactivePartialCount;
42 
43  bool abortFirstReleasingPolyWhereReserveExceeded(int minPart);
44  bool abortFirstPolyPreferHeldWhereReserveExceeded(int minPart);
45 
46 public:
47  PartialManager(Synth *synth, Part **parts);
48  ~PartialManager();
49  Partial *allocPartial(int partNum);
50  unsigned int getFreePartialCount();
51  void getPerPartPartialUsage(unsigned int perPartPartialUsage[9]);
52  bool freePartials(unsigned int needed, int partNum);
53  unsigned int setReserve(Bit8u *rset);
54  void deactivateAll();
55  bool produceOutput(int i, IntSample *leftBuf, IntSample *rightBuf, Bit32u bufferLength);
56  bool produceOutput(int i, FloatSample *leftBuf, FloatSample *rightBuf, Bit32u bufferLength);
57  bool shouldReverb(int i);
58  void clearAlreadyOutputed();
59  const Partial *getPartial(unsigned int partialNum) const;
60  Poly *assignPolyToPart(Part *part);
61  void polyFreed(Poly *poly);
62  void partialDeactivated(int partialIndex);
63 }; // class PartialManager
64 
65 } // namespace MT32Emu
66 
67 #endif // #ifndef MT32EMU_PARTIALMANAGER_H
Definition: Analog.h:26
Definition: Partial.h:40
Definition: PartialManager.h:32
Definition: Synth.h:131
Definition: Poly.h:30
Definition: Part.h:47