libopenmpt  0.2.7386-autotools
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 extending libopenmpt
5  * Notes : The API defined in this file is currently not considered stable yet. Do NOT ship in distributions yet to avoid applications relying on API/ABI compatibility.
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 
16 #if !defined(LIBOPENMPT_EXT_IS_EXPERIMENTAL)
17 
18 #error "libopenmpt_ext is still completely experimental. The ABIs and APIs WILL change. Use at your own risk, and use only internally for now. You have to #define LIBOPENMPT_EXT_IS_EXPERIMENTAL to use it."
19 
20 #else // LIBOPENMPT_EXT_IS_EXPERIMENTAL
21 
55 namespace openmpt {
56 
57 class module_ext_impl;
58 
59 class LIBOPENMPT_CXX_API module_ext : public module {
60 
61 private:
62  module_ext_impl * ext_impl;
63 private:
64  // non-copyable
65  module_ext( const module_ext & );
66  void operator = ( const module_ext & );
67 public:
68  module_ext( std::istream & stream, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
69  module_ext( const std::vector<char> & data, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
70  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() );
71  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() );
72  virtual ~module_ext();
73 
74 public:
75 
77 
86  void * get_interface( const std::string & interface_id );
87 
88 }; // class module_ext
89 
90 namespace ext {
91 
92 #define LIBOPENMPT_DECLARE_EXT_INTERFACE(name) \
93  static const char name ## _id [] = # name ; \
94  class name; \
95 
96 
97 #define LIBOPENMPT_EXT_INTERFACE(name) \
98  protected: \
99  name () {} \
100  virtual ~ name() {} \
101  public: \
102 
103 
104 
105 #define LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS
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 #define LIBOPENMPT_EXT_INTERFACE_INTERACTIVE
149 
151 
152 class interactive {
153 
155 
156 
157 
163  virtual void set_current_speed( std::int32_t speed ) = 0;
164 
166 
172  virtual void set_current_tempo( std::int32_t tempo ) = 0;
173 
175 
181  virtual void set_tempo_factor( double factor ) = 0;
182 
184 
188  virtual double get_tempo_factor( ) const = 0;
189 
191 
198  virtual void set_pitch_factor( double factor ) = 0;
199 
201 
205  virtual double get_pitch_factor( ) const = 0;
206 
208 
214  virtual void set_global_volume( double volume ) = 0;
215 
217 
221  virtual double get_global_volume( ) const = 0;
222 
224 
231  virtual void set_channel_volume( std::int32_t channel, double volume ) = 0;
232 
234 
240  virtual double get_channel_volume( std::int32_t channel ) const = 0;
241 
243 
249  virtual void set_channel_mute_status( std::int32_t channel, bool mute ) = 0;
250 
252 
258  virtual bool get_channel_mute_status( std::int32_t channel ) const = 0;
259 
261 
267  virtual void set_instrument_mute_status( std::int32_t instrument, bool mute ) = 0;
268 
270 
276  virtual bool get_instrument_mute_status( std::int32_t instrument ) const = 0;
277 
279 
288  virtual std::int32_t play_note( std::int32_t instrument, std::int32_t note, double volume, double panning ) = 0;
289 
291 
296  virtual void stop_note( std::int32_t channel ) = 0;
297 
298 }; // class interactive
299 
300 
301 /* add stuff here */
302 
303 
304 
305 #undef LIBOPENMPT_DECLARE_EXT_INTERFACE
306 #undef LIBOPENMPT_EXT_INTERFACE
307 
308 } // namespace ext
309 
310 } // namespace openmpt
311 
316 #endif // LIBOPENMPT_EXT_IS_EXPERIMENTAL
317 
318 #endif // LIBOPENMPT_EXT_HPP
#define LIBOPENMPT_DECLARE_EXT_INTERFACE(name)
Definition: libopenmpt_ext.hpp:92
Definition: libopenmpt_ext.hpp:109
#define LIBOPENMPT_EXT_INTERFACE(name)
Definition: libopenmpt_ext.hpp:97
STL namespace.
Definition: libopenmpt_ext.hpp:152
Definition: libopenmpt.hpp:142
Definition: libopenmpt_ext.hpp:59
Definition: libopenmpt.hpp:243
effect_type
Pattern command type.
Definition: libopenmpt_ext.hpp:114