libopenmpt  0.6.3+release
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 
108 
109 class pattern_vis {
110 
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 
153 
154 class interactive {
155 
157 
158 
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 
293  virtual std::int32_t play_note( std::int32_t instrument, std::int32_t note, double volume, double panning ) = 0;
294 
296 
303  virtual void stop_note( std::int32_t channel ) = 0;
304 
305 }; // class interactive
306 
307 
308 #ifndef LIBOPENMPT_EXT_INTERFACE_INTERACTIVE2
309 #define LIBOPENMPT_EXT_INTERFACE_INTERACTIVE2
310 #endif
311 
313 
315 
317 
318 
328  virtual void note_off(int32_t channel ) = 0;
329 
331 
340  virtual void note_fade(int32_t channel) = 0;
341 
343 
351  virtual void set_channel_panning(int32_t channel, double panning ) = 0;
352 
354 
361  virtual double get_channel_panning( int32_t channel ) = 0;
362 
364 
373  virtual void set_note_finetune(int32_t channel, double finetune ) = 0;
374 
376 
384  virtual double get_note_finetune( int32_t channel ) = 0;
385 
386 }; // class interactive
387 
388 
389 /* add stuff here */
390 
391 
392 
393 #undef LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE
394 #undef LIBOPENMPT_EXT_CXX_INTERFACE
395 
400 } // namespace ext
401 
402 } // namespace openmpt
403 
404 #endif // LIBOPENMPT_EXT_HPP
Definition: libopenmpt_ext.hpp:314
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
module_ext(const std::vector< char > &data, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map())
module_ext(std::istream &stream, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map())
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())
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())
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())
void * get_interface(const std::string &interface_id)
Retrieve a libopenmpt extension.
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())
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())
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:397
#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