libopenmpt: libopenmpt/libopenmpt_ext.hpp Source File

libopenmpt 0.4.53-pre.0+r25032 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<char> & data, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
48 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() );
49 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() );
50 virtual ~module_ext();
51
52 public:
53
55
72 void * get_interface( const std::string & interface_id );
73
74 }; // class module_ext
75
80 namespace ext {
81
86 #define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name) \
87 static const char name ## _id [] = # name ; \
88 class name; \
89
90
91 #define LIBOPENMPT_EXT_CXX_INTERFACE(name) \
92 protected: \
93 name () {} \
94 virtual ~ name () {} \
95 public: \
96
97
98
99 #ifndef LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS
100 #define LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS
101 #endif
102
103 LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(pattern_vis)
104
105 class pattern_vis {
106
107 LIBOPENMPT_EXT_CXX_INTERFACE(pattern_vis)
108
109
110 enum effect_type {
111
112 effect_unknown = 0,
113 effect_general = 1,
114 effect_global = 2,
115 effect_volume = 3,
116 effect_panning = 4,
117 effect_pitch = 5
118
119 }; // enum effect_type
120
122
129 virtual effect_type get_pattern_row_channel_volume_effect_type( std::int32_t pattern, std::int32_t row, std::int32_t channel ) const = 0;
130
132
139 virtual effect_type get_pattern_row_channel_effect_type( std::int32_t pattern, std::int32_t row, std::int32_t channel ) const = 0;
140
141 }; // class pattern_vis
142
143
144 #ifndef LIBOPENMPT_EXT_INTERFACE_INTERACTIVE
145 #define LIBOPENMPT_EXT_INTERFACE_INTERACTIVE
146 #endif
147
148 LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(interactive)
149
150 class interactive {
151
152 LIBOPENMPT_EXT_CXX_INTERFACE(interactive)
153
154
155
161 virtual void set_current_speed( std::int32_t speed ) = 0;
162
164
170 virtual void set_current_tempo( std::int32_t tempo ) = 0;
171
173
179 virtual void set_tempo_factor( double factor ) = 0;
180
182
186 virtual double get_tempo_factor( ) const = 0;
187
189
196 virtual void set_pitch_factor( double factor ) = 0;
197
199
204 virtual double get_pitch_factor( ) const = 0;
205
207
213 virtual void set_global_volume( double volume ) = 0;
214
216
220 virtual double get_global_volume( ) const = 0;
221
223
230 virtual void set_channel_volume( std::int32_t channel, double volume ) = 0;
231
233
239 virtual double get_channel_volume( std::int32_t channel ) const = 0;
240
242
248 virtual void set_channel_mute_status( std::int32_t channel, bool mute ) = 0;
249
251
257 virtual bool get_channel_mute_status( std::int32_t channel ) const = 0;
258
260
266 virtual void set_instrument_mute_status( std::int32_t instrument, bool mute ) = 0;
267
269
275 virtual bool get_instrument_mute_status( std::int32_t instrument ) const = 0;
276
278
287 virtual std::int32_t play_note( std::int32_t instrument, std::int32_t note, double volume, double panning ) = 0;
288
290
295 virtual void stop_note( std::int32_t channel ) = 0;
296
297 }; // class interactive
298
299
300 /* add stuff here */
301
302
303
304 #undef LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE
305 #undef LIBOPENMPT_EXT_CXX_INTERFACE
306
311 } // namespace ext
312
313 } // namespace openmpt
314
315 #endif // LIBOPENMPT_EXT_HPP
openmpt::ext::pattern_vis
Definition: libopenmpt_ext.hpp:105
openmpt::ext::interactive
Definition: libopenmpt_ext.hpp:150
openmpt
Definition: libopenmpt.hpp:128
libopenmpt_config.h
LIBOPENMPT_EXT_CXX_INTERFACE
#define LIBOPENMPT_EXT_CXX_INTERFACE(name)
Definition: libopenmpt_ext.hpp:91
libopenmpt.hpp
openmpt::module_ext
Definition: libopenmpt_ext.hpp:37
openmpt::module
Definition: libopenmpt.hpp:343
openmpt::ext::pattern_vis::effect_type
effect_type
Pattern command type.
Definition: libopenmpt_ext.hpp:110
LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE
#define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name)
Definition: libopenmpt_ext.hpp:86