libopenmpt 0.8.0-pre.12+r22605
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
29namespace openmpt {
30
35class module_ext_impl;
36
37class LIBOPENMPT_CXX_API_CLASS module_ext : public module {
38
39private:
40 module_ext_impl * ext_impl;
41private:
42 // non-copyable
43 LIBOPENMPT_CXX_API_MEMBER module_ext( const module_ext & );
44 LIBOPENMPT_CXX_API_MEMBER void operator = ( const module_ext & );
45public:
46 LIBOPENMPT_CXX_API_MEMBER module_ext( std::istream & stream, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
47 LIBOPENMPT_CXX_API_MEMBER 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 LIBOPENMPT_CXX_API_MEMBER 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 LIBOPENMPT_CXX_API_MEMBER 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 LIBOPENMPT_CXX_API_MEMBER 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 LIBOPENMPT_CXX_API_MEMBER 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 LIBOPENMPT_CXX_API_MEMBER 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 LIBOPENMPT_CXX_API_MEMBER 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 LIBOPENMPT_CXX_API_MEMBER virtual ~module_ext();
55
56public:
57
59
76 LIBOPENMPT_CXX_API_MEMBER void * get_interface( const std::string & interface_id );
77
78}; // class module_ext
79
84namespace 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
108
110
112
113
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
153
155
157
158
165 virtual void set_current_speed( std::int32_t speed ) = 0;
166
168
175 LIBOPENMPT_ATTR_DEPRECATED virtual void set_current_tempo( std::int32_t tempo ) = 0;
176
178
184 virtual void set_tempo_factor( double factor ) = 0;
185
187
191 virtual double get_tempo_factor( ) const = 0;
192
194
201 virtual void set_pitch_factor( double factor ) = 0;
202
204
209 virtual double get_pitch_factor( ) const = 0;
210
212
218 virtual void set_global_volume( double volume ) = 0;
219
221
225 virtual double get_global_volume( ) const = 0;
226
228
235 virtual void set_channel_volume( std::int32_t channel, double volume ) = 0;
236
238
244 virtual double get_channel_volume( std::int32_t channel ) const = 0;
245
247
253 virtual void set_channel_mute_status( std::int32_t channel, bool mute ) = 0;
254
256
262 virtual bool get_channel_mute_status( std::int32_t channel ) const = 0;
263
265
271 virtual void set_instrument_mute_status( std::int32_t instrument, bool mute ) = 0;
272
274
280 virtual bool get_instrument_mute_status( std::int32_t instrument ) const = 0;
281
283
294 virtual std::int32_t play_note( std::int32_t instrument, std::int32_t note, double volume, double panning ) = 0;
295
297
304 virtual void stop_note( std::int32_t channel ) = 0;
305
306}; // class interactive
307
308
309#ifndef LIBOPENMPT_EXT_INTERFACE_INTERACTIVE2
310#define LIBOPENMPT_EXT_INTERFACE_INTERACTIVE2
311#endif
312
314
316
318
319
329 virtual void note_off(int32_t channel ) = 0;
330
332
341 virtual void note_fade(int32_t channel) = 0;
342
344
352 virtual void set_channel_panning(int32_t channel, double panning ) = 0;
353
355
362 virtual double get_channel_panning( int32_t channel ) = 0;
363
365
374 virtual void set_note_finetune(int32_t channel, double finetune ) = 0;
375
377
385 virtual double get_note_finetune( int32_t channel ) = 0;
386
387}; // class interactive2
388
389
390#ifndef LIBOPENMPT_EXT_INTERFACE_INTERACTIVE3
391#define LIBOPENMPT_EXT_INTERFACE_INTERACTIVE3
392#endif
393
395
397
399
400
408 virtual void set_current_tempo2( double tempo ) = 0;
409
410}; // class interactive3
411
412
413
414/* add stuff here */
415
416
417
418#undef LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE
419#undef LIBOPENMPT_EXT_CXX_INTERFACE
420
425} // namespace ext
426
427} // namespace openmpt
428
429#endif // LIBOPENMPT_EXT_HPP
Definition: libopenmpt_ext.hpp:315
Definition: libopenmpt_ext.hpp:396
Definition: libopenmpt_ext.hpp:154
Definition: libopenmpt_ext.hpp:109
virtual effect_type get_pattern_row_channel_effect_type(std::int32_t pattern, std::int32_t row, std::int32_t channel) const =0
Get pattern command type for pattern highlighting.
effect_type
Pattern command type.
Definition: libopenmpt_ext.hpp:114
virtual effect_type get_pattern_row_channel_volume_effect_type(std::int32_t pattern, std::int32_t row, std::int32_t channel) const =0
Get pattern command type for pattern highlighting.
Definition: libopenmpt_ext.hpp:37
LIBOPENMPT_CXX_API_MEMBER 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())
LIBOPENMPT_CXX_API_MEMBER 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())
LIBOPENMPT_CXX_API_MEMBER void * get_interface(const std::string &interface_id)
Retrieve a libopenmpt extension.
LIBOPENMPT_CXX_API_MEMBER 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())
LIBOPENMPT_CXX_API_MEMBER 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())
LIBOPENMPT_CXX_API_MEMBER 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())
virtual LIBOPENMPT_CXX_API_MEMBER ~module_ext()
LIBOPENMPT_CXX_API_MEMBER module_ext(std::istream &stream, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map())
LIBOPENMPT_CXX_API_MEMBER module_ext(const std::vector< char > &data, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map())
LIBOPENMPT_CXX_API_MEMBER 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())
Definition: libopenmpt.hpp:400
static const std::uint64_t probe_file_header_flags_modules LIBOPENMPT_ATTR_DEPRECATED
Probe for module formats in openmpt::probe_file_header().
Definition: libopenmpt.hpp:276
#define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name)
Definition: libopenmpt_ext.hpp:90
#define LIBOPENMPT_EXT_CXX_INTERFACE(name)
Definition: libopenmpt_ext.hpp:95
Definition: libopenmpt.hpp:130