libopenmpt: libopenmpt/libopenmpt_ext.hpp Source File

libopenmpt 0.5.41-pre.0+r24821 cross-platform C++ and C library to decode tracked music files

libopenmpt_ext.hpp
Go to the documentation of this file.
1 /*
2 * libopenmpt_ext.hpp
3 * ------------------
4 * Purpose: libopenmpt public c++ interface for libopenmpt extensions
5 * Notes :
6 * Authors: OpenMPT Devs
7 * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
8 */
9
10 #ifndef LIBOPENMPT_EXT_HPP
11 #define LIBOPENMPT_EXT_HPP
12
13 #include "libopenmpt_config.h"
14 #include "libopenmpt.hpp"
15
29 namespace openmpt {
30
35 class module_ext_impl;
36
37 class LIBOPENMPT_CXX_API module_ext : public module {
38
39 private:
40 module_ext_impl * ext_impl;
41 private:
42 // non-copyable
43 module_ext( const module_ext & );
44 void operator = ( const module_ext & );
45 public:
46 module_ext( std::istream & stream, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
47 module_ext( const std::vector<std::byte> & data, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
48 module_ext( const std::vector<std::uint8_t> & data, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
49 module_ext( const std::vector<char> & data, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
50 module_ext( const std::byte * data, std::size_t size, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
51 module_ext( const std::uint8_t * data, std::size_t size, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
52 module_ext( const char * data, std::size_t size, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
53 module_ext( const void * data, std::size_t size, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
54 virtual ~module_ext();
55
56 public:
57
59
76 void * get_interface( const std::string & interface_id );
77
78 }; // class module_ext
79
84 namespace ext {
85
90 #define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name) \
91 static const char name ## _id [] = # name ; \
92 class name; \
93
94
95 #define LIBOPENMPT_EXT_CXX_INTERFACE(name) \
96 protected: \
97 name () {} \
98 virtual ~ name () {} \
99 public: \
100
101
102
103 #ifndef LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS
104 #define LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS
105 #endif
106
107 LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(pattern_vis)
108
109 class pattern_vis {
110
111 LIBOPENMPT_EXT_CXX_INTERFACE(pattern_vis)
112
113
114 enum effect_type {
115
116 effect_unknown = 0,
117 effect_general = 1,
118 effect_global = 2,
119 effect_volume = 3,
120 effect_panning = 4,
121 effect_pitch = 5
122
123 }; // enum effect_type
124
126
133 virtual effect_type get_pattern_row_channel_volume_effect_type( std::int32_t pattern, std::int32_t row, std::int32_t channel ) const = 0;
134
136
143 virtual effect_type get_pattern_row_channel_effect_type( std::int32_t pattern, std::int32_t row, std::int32_t channel ) const = 0;
144
145 }; // class pattern_vis
146
147
148 #ifndef LIBOPENMPT_EXT_INTERFACE_INTERACTIVE
149 #define LIBOPENMPT_EXT_INTERFACE_INTERACTIVE
150 #endif
151
152 LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(interactive)
153
154 class interactive {
155
156 LIBOPENMPT_EXT_CXX_INTERFACE(interactive)
157
158
159
165 virtual void set_current_speed( std::int32_t speed ) = 0;
166
168
174 virtual void set_current_tempo( std::int32_t tempo ) = 0;
175
177
183 virtual void set_tempo_factor( double factor ) = 0;
184
186
190 virtual double get_tempo_factor( ) const = 0;
191
193
200 virtual void set_pitch_factor( double factor ) = 0;
201
203
208 virtual double get_pitch_factor( ) const = 0;
209
211
217 virtual void set_global_volume( double volume ) = 0;
218
220
224 virtual double get_global_volume( ) const = 0;
225
227
234 virtual void set_channel_volume( std::int32_t channel, double volume ) = 0;
235
237
243 virtual double get_channel_volume( std::int32_t channel ) const = 0;
244
246
252 virtual void set_channel_mute_status( std::int32_t channel, bool mute ) = 0;
253
255
261 virtual bool get_channel_mute_status( std::int32_t channel ) const = 0;
262
264
270 virtual void set_instrument_mute_status( std::int32_t instrument, bool mute ) = 0;
271
273
279 virtual bool get_instrument_mute_status( std::int32_t instrument ) const = 0;
280
282
291 virtual std::int32_t play_note( std::int32_t instrument, std::int32_t note, double volume, double panning ) = 0;
292
294
299 virtual void stop_note( std::int32_t channel ) = 0;
300
301 }; // class interactive
302
303
304 /* add stuff here */
305
306
307
308 #undef LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE
309 #undef LIBOPENMPT_EXT_CXX_INTERFACE
310
315 } // namespace ext
316
317 } // namespace openmpt
318
319 #endif // LIBOPENMPT_EXT_HPP
openmpt::ext::pattern_vis
Definition: libopenmpt_ext.hpp:109
openmpt::ext::interactive
Definition: libopenmpt_ext.hpp:154
openmpt
Definition: libopenmpt.hpp:130
libopenmpt_config.h
LIBOPENMPT_EXT_CXX_INTERFACE
#define LIBOPENMPT_EXT_CXX_INTERFACE(name)
Definition: libopenmpt_ext.hpp:95
libopenmpt.hpp
openmpt::module_ext
Definition: libopenmpt_ext.hpp:37
openmpt::module
Definition: libopenmpt.hpp:385
openmpt::ext::pattern_vis::effect_type
effect_type
Pattern command type.
Definition: libopenmpt_ext.hpp:114
LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE
#define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name)
Definition: libopenmpt_ext.hpp:90