libopenmpt  0.2.4943
cross-platform C++ and C library to decode tracked music files
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
libopenmpt.h
Go to the documentation of this file.
1 /*
2  * libopenmpt.h
3  * ------------
4  * Purpose: libopenmpt public c interface
5  * Notes : (currently none)
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_H
11 #define LIBOPENMPT_H
12 
13 #include "libopenmpt_config.h"
14 #include <stddef.h>
15 #include <stdint.h>
16 
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 
80 LIBOPENMPT_API uint32_t openmpt_get_library_version(void);
81 
87 LIBOPENMPT_API uint32_t openmpt_get_core_version(void);
88 
90 #define OPENMPT_STRING_LIBRARY_VERSION "library_version"
91 
92 #define OPENMPT_STRING_LIBRARY_FEATURES "library_features"
93 
94 #define OPENMPT_STRING_CORE_VERSION "core_version"
95 
96 #define OPENMPT_STRING_BUILD "build"
97 
98 #define OPENMPT_STRING_CREDITS "credits"
99 
100 #define OPENMPT_STRING_CONTACT "contact"
101 
102 #define OPENMPT_STRING_LICENSE "license"
103 
108 LIBOPENMPT_API void openmpt_free_string( const char * str );
109 
121 LIBOPENMPT_API const char * openmpt_get_string( const char * key );
122 
127 LIBOPENMPT_API const char * openmpt_get_supported_extensions(void);
128 
134 LIBOPENMPT_API int openmpt_is_extension_supported( const char * extension );
135 
136 #define OPENMPT_STREAM_SEEK_SET 0
137 #define OPENMPT_STREAM_SEEK_CUR 1
138 #define OPENMPT_STREAM_SEEK_END 2
139 
149 typedef size_t (*openmpt_stream_read_func)( void * stream, void * dst, size_t bytes );
150 
161 typedef int (*openmpt_stream_seek_func)( void * stream, int64_t offset, int whence );
162 
170 typedef int64_t (*openmpt_stream_tell_func)( void * stream );
171 
176 typedef struct openmpt_stream_callbacks {
177 
183 
190 
197 
199 
205 typedef void (*openmpt_log_func)( const char * message, void * user );
206 
211 LIBOPENMPT_API void openmpt_log_func_default( const char * message, void * user );
212 
217 LIBOPENMPT_API void openmpt_log_func_silent( const char * message, void * user );
218 
228 LIBOPENMPT_API double openmpt_could_open_propability( openmpt_stream_callbacks stream_callbacks, void * stream, double effort, openmpt_log_func logfunc, void * user );
229 
233 
235  const char * ctl;
236  const char * value;
238 
239 LIBOPENMPT_API openmpt_module * openmpt_module_create( openmpt_stream_callbacks stream_callbacks, void * stream, openmpt_log_func logfunc, void * user, const openmpt_module_initial_ctl * ctls );
240 
241 LIBOPENMPT_API openmpt_module * openmpt_module_create_from_memory( const void * filedata, size_t filesize, openmpt_log_func logfunc, void * user, const openmpt_module_initial_ctl * ctls );
242 
243 LIBOPENMPT_API void openmpt_module_destroy( openmpt_module * mod );
244 
245 #define OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL 1
246 #define OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT 2
247 #define OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH 3
248 #define OPENMPT_MODULE_RENDER_VOLUMERAMPING_STRENGTH 4
249 
250 #define OPENMPT_MODULE_COMMAND_NOTE 0
251 #define OPENMPT_MODULE_COMMAND_INSTRUMENT 1
252 #define OPENMPT_MODULE_COMMAND_VOLUMEEFFECT 2
253 #define OPENMPT_MODULE_COMMAND_EFFECT 3
254 #define OPENMPT_MODULE_COMMAND_VOLUME 4
255 #define OPENMPT_MODULE_COMMAND_PARAMETER 5
256 
257 LIBOPENMPT_API int openmpt_module_select_subsong( openmpt_module * mod, int32_t subsong );
258 LIBOPENMPT_API int openmpt_module_set_repeat_count( openmpt_module * mod, int32_t repeat_count );
259 LIBOPENMPT_API int32_t openmpt_module_get_repeat_count( openmpt_module * mod );
260 
261 LIBOPENMPT_API double openmpt_module_get_duration_seconds( openmpt_module * mod );
262 
263 LIBOPENMPT_API double openmpt_module_set_position_seconds( openmpt_module * mod, double seconds );
264 LIBOPENMPT_API double openmpt_module_get_position_seconds( openmpt_module * mod );
265 
266 LIBOPENMPT_API double openmpt_module_set_position_order_row( openmpt_module * mod, int32_t order, int32_t row );
267 
268 LIBOPENMPT_API int openmpt_module_get_render_param( openmpt_module * mod, int param, int32_t * value );
269 LIBOPENMPT_API int openmpt_module_set_render_param( openmpt_module * mod, int param, int32_t value );
270 
271 LIBOPENMPT_API size_t openmpt_module_read_mono( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * mono );
272 LIBOPENMPT_API size_t openmpt_module_read_stereo( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * left, int16_t * right );
273 LIBOPENMPT_API size_t openmpt_module_read_quad( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * left, int16_t * right, int16_t * rear_left, int16_t * rear_right );
274 LIBOPENMPT_API size_t openmpt_module_read_float_mono( openmpt_module * mod, int32_t samplerate, size_t count, float * mono );
275 LIBOPENMPT_API size_t openmpt_module_read_float_stereo( openmpt_module * mod, int32_t samplerate, size_t count, float * left, float * right );
276 LIBOPENMPT_API size_t openmpt_module_read_float_quad( openmpt_module * mod, int32_t samplerate, size_t count, float * left, float * right, float * rear_left, float * rear_right );
277 LIBOPENMPT_API size_t openmpt_module_read_interleaved_stereo( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * interleaved_stereo );
278 LIBOPENMPT_API size_t openmpt_module_read_interleaved_quad( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * interleaved_quad );
279 LIBOPENMPT_API size_t openmpt_module_read_interleaved_float_stereo( openmpt_module * mod, int32_t samplerate, size_t count, float * interleaved_stereo );
280 LIBOPENMPT_API size_t openmpt_module_read_interleaved_float_quad( openmpt_module * mod, int32_t samplerate, size_t count, float * interleaved_quad );
281 
282 LIBOPENMPT_API const char * openmpt_module_get_metadata_keys( openmpt_module * mod );
283 LIBOPENMPT_API const char * openmpt_module_get_metadata( openmpt_module * mod, const char * key );
284 
285 LIBOPENMPT_API int32_t openmpt_module_get_current_speed( openmpt_module * mod );
286 LIBOPENMPT_API int32_t openmpt_module_get_current_tempo( openmpt_module * mod );
287 LIBOPENMPT_API int32_t openmpt_module_get_current_order( openmpt_module * mod );
288 LIBOPENMPT_API int32_t openmpt_module_get_current_pattern( openmpt_module * mod );
289 LIBOPENMPT_API int32_t openmpt_module_get_current_row( openmpt_module * mod );
290 LIBOPENMPT_API int32_t openmpt_module_get_current_playing_channels( openmpt_module * mod );
291 
292 LIBOPENMPT_API float openmpt_module_get_current_channel_vu_mono( openmpt_module * mod, int32_t channel );
293 LIBOPENMPT_API float openmpt_module_get_current_channel_vu_left( openmpt_module * mod, int32_t channel );
294 LIBOPENMPT_API float openmpt_module_get_current_channel_vu_right( openmpt_module * mod, int32_t channel );
295 LIBOPENMPT_API float openmpt_module_get_current_channel_vu_rear_left( openmpt_module * mod, int32_t channel );
296 LIBOPENMPT_API float openmpt_module_get_current_channel_vu_rear_right( openmpt_module * mod, int32_t channel );
297 
298 LIBOPENMPT_API int32_t openmpt_module_get_num_subsongs( openmpt_module * mod );
299 LIBOPENMPT_API int32_t openmpt_module_get_num_channels( openmpt_module * mod );
300 LIBOPENMPT_API int32_t openmpt_module_get_num_orders( openmpt_module * mod );
301 LIBOPENMPT_API int32_t openmpt_module_get_num_patterns( openmpt_module * mod );
302 LIBOPENMPT_API int32_t openmpt_module_get_num_instruments( openmpt_module * mod );
303 LIBOPENMPT_API int32_t openmpt_module_get_num_samples( openmpt_module * mod );
304 
305 LIBOPENMPT_API const char * openmpt_module_get_subsong_name( openmpt_module * mod, int32_t index );
306 LIBOPENMPT_API const char * openmpt_module_get_channel_name( openmpt_module * mod, int32_t index );
307 LIBOPENMPT_API const char * openmpt_module_get_order_name( openmpt_module * mod, int32_t index );
308 LIBOPENMPT_API const char * openmpt_module_get_pattern_name( openmpt_module * mod, int32_t index );
309 LIBOPENMPT_API const char * openmpt_module_get_instrument_name( openmpt_module * mod, int32_t index );
310 LIBOPENMPT_API const char * openmpt_module_get_sample_name( openmpt_module * mod, int32_t index );
311 
312 LIBOPENMPT_API int32_t openmpt_module_get_order_pattern( openmpt_module * mod, int32_t order );
313 LIBOPENMPT_API int32_t openmpt_module_get_pattern_num_rows( openmpt_module * mod, int32_t pattern );
314 
315 LIBOPENMPT_API uint8_t openmpt_module_get_pattern_row_channel_command( openmpt_module * mod, int32_t pattern, int32_t row, int32_t channel, int command );
316 
317 LIBOPENMPT_API const char * openmpt_module_format_pattern_row_channel_command( openmpt_module * mod, int32_t pattern, int32_t row, int32_t channel, int command );
318 LIBOPENMPT_API const char * openmpt_module_highlight_pattern_row_channel_command( openmpt_module * mod, int32_t pattern, int32_t row, int32_t channel, int command );
319 
320 LIBOPENMPT_API const char * openmpt_module_format_pattern_row_channel( openmpt_module * mod, int32_t pattern, int32_t row, int32_t channel, size_t width, int pad );
321 LIBOPENMPT_API const char * openmpt_module_highlight_pattern_row_channel( openmpt_module * mod, int32_t pattern, int32_t row, int32_t channel, size_t width, int pad );
322 
323 LIBOPENMPT_API const char * openmpt_module_get_ctls( openmpt_module * mod );
324 LIBOPENMPT_API const char * openmpt_module_ctl_get( openmpt_module * mod, const char * ctl );
325 LIBOPENMPT_API int openmpt_module_ctl_set( openmpt_module * mod, const char * ctl, const char * value );
326 
327 /* remember to add new functions to both C and C++ interfaces and to increase OPENMPT_API_VERSION_MINOR */
328 
329 #ifdef __cplusplus
330 }
331 #endif
332 
337 #endif /* LIBOPENMPT_H */