libopenmpt  0.5.5+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<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 
80 namespace ext {
81 
82 #define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name) \
83  static const char name ## _id [] = # name ; \
84  class name; \
85 
86 
87 #define LIBOPENMPT_EXT_CXX_INTERFACE(name) \
88  protected: \
89  name () {} \
90  virtual ~ name () {} \
91  public: \
92 
93 
94 
95 #ifndef LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS
96 #define LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS
97 #endif
98 
100 
101 class pattern_vis {
102 
104 
105 
106  enum effect_type {
107 
108  effect_unknown = 0,
109  effect_general = 1,
110  effect_global = 2,
111  effect_volume = 3,
112  effect_panning = 4,
113  effect_pitch = 5
114 
115  }; // enum effect_type
116 
118 
125  virtual effect_type get_pattern_row_channel_volume_effect_type( std::int32_t pattern, std::int32_t row, std::int32_t channel ) const = 0;
126 
128 
135  virtual effect_type get_pattern_row_channel_effect_type( std::int32_t pattern, std::int32_t row, std::int32_t channel ) const = 0;
136 
137 }; // class pattern_vis
138 
139 
140 #ifndef LIBOPENMPT_EXT_INTERFACE_INTERACTIVE
141 #define LIBOPENMPT_EXT_INTERFACE_INTERACTIVE
142 #endif
143 
145 
146 class interactive {
147 
149 
150 
151 
157  virtual void set_current_speed( std::int32_t speed ) = 0;
158 
160 
166  virtual void set_current_tempo( std::int32_t tempo ) = 0;
167 
169 
175  virtual void set_tempo_factor( double factor ) = 0;
176 
178 
182  virtual double get_tempo_factor( ) const = 0;
183 
185 
192  virtual void set_pitch_factor( double factor ) = 0;
193 
195 
199  virtual double get_pitch_factor( ) const = 0;
200 
202 
208  virtual void set_global_volume( double volume ) = 0;
209 
211 
215  virtual double get_global_volume( ) const = 0;
216 
218 
225  virtual void set_channel_volume( std::int32_t channel, double volume ) = 0;
226 
228 
234  virtual double get_channel_volume( std::int32_t channel ) const = 0;
235 
237 
243  virtual void set_channel_mute_status( std::int32_t channel, bool mute ) = 0;
244 
246 
252  virtual bool get_channel_mute_status( std::int32_t channel ) const = 0;
253 
255 
261  virtual void set_instrument_mute_status( std::int32_t instrument, bool mute ) = 0;
262 
264 
270  virtual bool get_instrument_mute_status( std::int32_t instrument ) const = 0;
271 
273 
282  virtual std::int32_t play_note( std::int32_t instrument, std::int32_t note, double volume, double panning ) = 0;
283 
285 
290  virtual void stop_note( std::int32_t channel ) = 0;
291 
292 }; // class interactive
293 
294 
295 /* add stuff here */
296 
297 
298 
299 #undef LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE
300 #undef LIBOPENMPT_EXT_CXX_INTERFACE
301 
302 } // namespace ext
303 
304 } // namespace openmpt
305 
310 #endif // LIBOPENMPT_EXT_HPP
Definition: libopenmpt_ext.hpp:101
Definition: libopenmpt_ext.hpp:146
Definition: libopenmpt.hpp:134
#define LIBOPENMPT_EXT_CXX_INTERFACE(name)
Definition: libopenmpt_ext.hpp:87
Definition: libopenmpt_ext.hpp:37
Definition: libopenmpt.hpp:385
#define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name)
Definition: libopenmpt_ext.hpp:82
effect_type
Pattern command type.
Definition: libopenmpt_ext.hpp:106