ScummVM API documentation
hmifxlib.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 AUDIO_EFFECTS_HMI_HMIFXLIB_H
23 #define AUDIO_EFFECTS_HMI_HMIFXLIB_H
24 
25 #include "audio/effects/hmi/hmifxfp.h"
26 
27 namespace Common {
28 class SeekableReadStream;
29 }
30 
31 namespace Audio {
32 
33 class HMIFxLib {
34 public:
35  HMIFxLib();
36  ~HMIFxLib();
37 
38  HMIFxFp *effects();
39 
40  int hmiFXInitSystem(HMIInitData *initData);
41  int hmiFXUnInitSystem(HMIInitData *initData);
42  int hmiFXGetInterface(int interfaceId, HMIInterface **outInterface);
43  unsigned int hmiFXGenerateQueryString(char *buffer, const char *prefix, unsigned int id);
44  int hmiFXGetFirstInterface(HMIInterface **outInterface);
45  int hmiFXGetNextInterface(HMIInterface **outInterface);
46 
47  int hmiFXPresetCreate(HMIPreset *preset);
48  int hmiFXPresetDestroy(HMIPreset *preset);
49  int hmiFXPresetAddEffect(HMIPreset *preset, HMIEffectNode *newNode);
50  int hmiFXPresetLoadLibrary(HMILibrary **outLib, const char *fileName);
51  int hmiFXPresetLoadLibrary(HMILibrary **outLib, Common::SeekableReadStream &stream);
52  int hmiFXPresetFreeLibrary(HMILibrary *library);
53  int hmiFXPresetProcess(HMILibrary *library, HMIProcessRequest *request);
54  int hmiFXPresetGetByName(HMILibrary *library, const char *name, HMIPreset **outPreset);
55  int hmiFXPresetLock(HMIPreset *preset);
56  int hmiFXPresetRelease(HMIPreset *preset);
57  int hmiFXPresetGetRouting(HMIPreset *preset, uint32 *routingOut);
58  void hmiFXSetWaveFmtEx(HMIFormat *format, int sampleRate, uint16 bitsPerSample, uint16 channels);
59  int hmiFXPresetCreateInstance(HMIPreset *source, HMIPreset **outInstance);
60  int hmiFXPresetDestroyInstance(HMIPreset *instance);
61  int hmiFXPresetProcessEx(HMIProcessRequest *request);
62 
63  void *hmiFXHeapAlloc(int size);
64  void hmiFXHeapFree(void *ptr);
65  int hmiFXHeapInit(HMIInitData *initData);
66  void *hmiFXHeapReset();
67 
68 private:
69  int convertPCMToFloat(HMIPreset *preset, const uint8 *buffer, int samples);
70  int convertFloatToPCM(HMIPreset *preset, uint8 *buffer, int samples, int clampOutput);
71  int processPreset(HMIPreset *preset, HMIProcessRequest *request);
72  void resetMixBuffers(HMIPreset *preset);
73  void processEffectChain(HMIPreset *preset);
74 
75  int readFile(HMIFileDescriptor *desc, Common::SeekableReadStream &stream);
76  int flushFile(HMIFileDescriptor *desc);
77  int findSection(HMIFileDescriptor *desc, const char *section);
78  int findKey(HMIFileDescriptor *desc, const char *key);
79  int readInt(HMIFileDescriptor *desc, int *value);
80  int readCSV(HMIFileDescriptor *desc, char *buffer, int size);
81  int readSectionInt(HMIFileDescriptor *desc, const char *key, int *value);
82  int readSectionString(HMIFileDescriptor *desc, const char *key, char *value, int size);
83 
84  HMIFxFp *_fxFp = nullptr;
85  HMIInterface *_loadedInterfaces[1024];
86  unsigned int _numLoadedInterfaces = 0;
87  unsigned int _curInterfaceIndex = 0;
88 
89  uint8 *_systemHeap = nullptr;
90  uint8 *_heapCursor = nullptr;
91  uint8 *_heapEnd = nullptr;
92 };
93 
94 } // End of namespace Audio
95 
96 #endif
Definition: hmi_types.h:138
Definition: hmi_types.h:89
Definition: hmi_types.h:112
Definition: hmi_types.h:126
Definition: stream.h:745
Definition: hmi_interface.h:31
Definition: hmifxlib.h:33
Definition: hmi_types.h:117
Definition: algorithm.h:29
Definition: hmi_types.h:60
Definition: hmifxfp.h:37
Definition: hmi_types.h:70
Definition: system.h:39