ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mt32emu.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_MT32EMU_H
19 #define MT32EMU_MT32EMU_H
20 
21 #include "config.h"
22 
23 /* API Configuration */
24 
25 /* 0: Use full-featured C++ API. Well suitable when the library is to be linked statically.
26  * When the library is shared, ABI compatibility may be an issue. Therefore, it should
27  * only be used within a project comprising of several modules to share the library code.
28  * 1: Use C-compatible API. Make the library looks as a regular C library with well-defined ABI.
29  * This is also crucial when the library is to be linked with modules in a different
30  * language, either statically or dynamically.
31  * 2: Use plugin-like API via C-interface wrapped in a C++ class. This is mainly intended
32  * for a shared library being dynamically loaded in run-time. To get access to all the library
33  * services, a client application only needs to bind with a single factory function.
34  * 3: Use optimised C++ API compatible with the plugin API (type 2). The facade class also wraps
35  * the C functions but they are invoked directly. This enables the compiler to generate better
36  * code for the library when linked statically yet being consistent with the plugin-like API.
37  */
38 
39 #ifdef MT32EMU_API_TYPE
40 # if MT32EMU_API_TYPE == 0 && (MT32EMU_EXPORTS_TYPE == 1 || MT32EMU_EXPORTS_TYPE == 2)
41 # error Incompatible setting MT32EMU_API_TYPE=0
42 # elif MT32EMU_API_TYPE == 1 && (MT32EMU_EXPORTS_TYPE == 0 || MT32EMU_EXPORTS_TYPE == 2)
43 # error Incompatible setting MT32EMU_API_TYPE=1
44 # elif MT32EMU_API_TYPE == 2 && (MT32EMU_EXPORTS_TYPE == 0)
45 # error Incompatible setting MT32EMU_API_TYPE=2
46 # elif MT32EMU_API_TYPE == 3 && (MT32EMU_EXPORTS_TYPE == 0 || MT32EMU_EXPORTS_TYPE == 2)
47 # error Incompatible setting MT32EMU_API_TYPE=3
48 # endif
49 #else /* #ifdef MT32EMU_API_TYPE */
50 # if 0 < MT32EMU_EXPORTS_TYPE && MT32EMU_EXPORTS_TYPE < 3
51 # define MT32EMU_API_TYPE MT32EMU_EXPORTS_TYPE
52 # else
53 # define MT32EMU_API_TYPE 0
54 # endif
55 #endif /* #ifdef MT32EMU_API_TYPE */
56 
57 #include "globals.h"
58 
59 #if !defined(__cplusplus) || MT32EMU_API_TYPE == 1
60 
61 #include "c_interface/c_interface.h"
62 
63 #elif MT32EMU_API_TYPE == 2 || MT32EMU_API_TYPE == 3
64 
65 #include "c_interface/cpp_interface.h"
66 
67 #else /* #if !defined(__cplusplus) || MT32EMU_API_TYPE == 1 */
68 
69 #include "Types.h"
70 #include "File.h"
71 #include "FileStream.h"
72 #include "ROMInfo.h"
73 #include "Synth.h"
74 #include "MidiStreamParser.h"
75 #include "SampleRateConverter.h"
76 
77 #if MT32EMU_RUNTIME_VERSION_CHECK == 1
78 #include "VersionTagging.h"
79 #endif
80 
81 #endif /* #if !defined(__cplusplus) || MT32EMU_API_TYPE == 1 */
82 
83 #if MT32EMU_RUNTIME_VERSION_CHECK == 2
84 #include "VersionTagging.h"
85 #endif
86 
87 #endif /* #ifndef MT32EMU_MT32EMU_H */