libopenmpt  0.4.10+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 
33 namespace openmpt {
34 
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 
76 namespace ext {
77 
78 #define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name) \
79  static const char name ## _id [] = # name ; \
80  class name; \
81 
82 
83 #define LIBOPENMPT_EXT_CXX_INTERFACE(name) \
84  protected: \
85  name () {} \
86  virtual ~ name () {} \
87  public: \
88 
89 
90 
91 #ifndef LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS
92 #define LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS
93 #endif
94 
96 
97 class pattern_vis {
98 
100 
101 
102  enum effect_type {
103 
104  effect_unknown = 0,
105  effect_general = 1,
106  effect_global = 2,
107  effect_volume = 3,
108  effect_panning = 4,
109  effect_pitch = 5
110 
111  }; // enum effect_type
112 
114 
121  virtual effect_type get_pattern_row_channel_volume_effect_type( std::int32_t pattern, std::int32_t row, std::int32_t channel ) const = 0;
122 
124 
131  virtual effect_type get_pattern_row_channel_effect_type( std::int32_t pattern, std::int32_t row, std::int32_t channel ) const = 0;
132 
133 }; // class pattern_vis
134 
135 
136 #ifndef LIBOPENMPT_EXT_INTERFACE_INTERACTIVE
137 #define LIBOPENMPT_EXT_INTERFACE_INTERACTIVE
138 #endif
139 
141 
142 class interactive {
143 
145 
146 
147 
153  virtual void set_current_speed( std::int32_t speed ) = 0;
154 
156 
162  virtual void set_current_tempo( std::int32_t tempo ) = 0;
163 
165 
171  virtual void set_tempo_factor( double factor ) = 0;
172 
174 
178  virtual double get_tempo_factor( ) const = 0;
179 
181 
188  virtual void set_pitch_factor( double factor ) = 0;
189 
191 
195  virtual double get_pitch_factor( ) const = 0;
196 
198 
204  virtual void set_global_volume( double volume ) = 0;
205 
207 
211  virtual double get_global_volume( ) const = 0;
212 
214 
221  virtual void set_channel_volume( std::int32_t channel, double volume ) = 0;
222 
224 
230  virtual double get_channel_volume( std::int32_t channel ) const = 0;
231 
233 
239  virtual void set_channel_mute_status( std::int32_t channel, bool mute ) = 0;
240 
242 
248  virtual bool get_channel_mute_status( std::int32_t channel ) const = 0;
249 
251 
257  virtual void set_instrument_mute_status( std::int32_t instrument, bool mute ) = 0;
258 
260 
266  virtual bool get_instrument_mute_status( std::int32_t instrument ) const = 0;
267 
269 
278  virtual std::int32_t play_note( std::int32_t instrument, std::int32_t note, double volume, double panning ) = 0;
279 
281 
286  virtual void stop_note( std::int32_t channel ) = 0;
287 
288 }; // class interactive
289 
290 
291 /* add stuff here */
292 
293 
294 
295 #undef LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE
296 #undef LIBOPENMPT_EXT_CXX_INTERFACE
297 
298 } // namespace ext
299 
300 } // namespace openmpt
301 
306 #endif // LIBOPENMPT_EXT_HPP
Definition: libopenmpt_ext.hpp:97
Definition: libopenmpt_ext.hpp:142
Definition: libopenmpt.hpp:132
#define LIBOPENMPT_EXT_CXX_INTERFACE(name)
Definition: libopenmpt_ext.hpp:83
Definition: libopenmpt_ext.hpp:37
Definition: libopenmpt.hpp:343
#define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name)
Definition: libopenmpt_ext.hpp:78
effect_type
Pattern command type.
Definition: libopenmpt_ext.hpp:102