libopenmpt  0.3.2+release.autotools
cross-platform C++ and C library to decode tracked music files
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 
172 #ifdef __cplusplus
173 extern "C" {
174 #endif
175 
182 LIBOPENMPT_API uint32_t openmpt_get_library_version(void);
183 
189 LIBOPENMPT_API uint32_t openmpt_get_core_version(void);
190 
192 #define OPENMPT_STRING_LIBRARY_VERSION LIBOPENMPT_DEPRECATED_STRING( "library_version" )
193 
194 #define OPENMPT_STRING_LIBRARY_FEATURES LIBOPENMPT_DEPRECATED_STRING( "library_features" )
195 
196 #define OPENMPT_STRING_CORE_VERSION LIBOPENMPT_DEPRECATED_STRING( "core_version" )
197 
198 #define OPENMPT_STRING_BUILD LIBOPENMPT_DEPRECATED_STRING( "build" )
199 
200 #define OPENMPT_STRING_CREDITS LIBOPENMPT_DEPRECATED_STRING( "credits" )
201 
202 #define OPENMPT_STRING_CONTACT LIBOPENMPT_DEPRECATED_STRING( "contact" )
203 
204 #define OPENMPT_STRING_LICENSE LIBOPENMPT_DEPRECATED_STRING( "license" )
205 
210 LIBOPENMPT_API void openmpt_free_string( const char * str );
211 
236 LIBOPENMPT_API const char * openmpt_get_string( const char * key );
237 
242 LIBOPENMPT_API const char * openmpt_get_supported_extensions(void);
243 
249 LIBOPENMPT_API int openmpt_is_extension_supported( const char * extension );
250 
252 #define OPENMPT_STREAM_SEEK_SET 0
253 
254 #define OPENMPT_STREAM_SEEK_CUR 1
255 
256 #define OPENMPT_STREAM_SEEK_END 2
257 
268 typedef size_t (*openmpt_stream_read_func)( void * stream, void * dst, size_t bytes );
269 
281 typedef int (*openmpt_stream_seek_func)( void * stream, int64_t offset, int whence );
282 
290 typedef int64_t (*openmpt_stream_tell_func)( void * stream );
291 
296 typedef struct openmpt_stream_callbacks {
297 
303 
310 
317 
319 
325 typedef void (*openmpt_log_func)( const char * message, void * user );
326 
331 LIBOPENMPT_API void openmpt_log_func_default( const char * message, void * user );
332 
337 LIBOPENMPT_API void openmpt_log_func_silent( const char * message, void * user );
338 
340 #define OPENMPT_ERROR_OK 0
341 
343 #define OPENMPT_ERROR_BASE 256
344 
346 #define OPENMPT_ERROR_UNKNOWN ( OPENMPT_ERROR_BASE + 1 )
347 
349 #define OPENMPT_ERROR_EXCEPTION ( OPENMPT_ERROR_BASE + 11 )
350 
352 #define OPENMPT_ERROR_OUT_OF_MEMORY ( OPENMPT_ERROR_BASE + 21 )
353 
355 #define OPENMPT_ERROR_RUNTIME ( OPENMPT_ERROR_BASE + 30 )
356 
357 #define OPENMPT_ERROR_RANGE ( OPENMPT_ERROR_BASE + 31 )
358 
359 #define OPENMPT_ERROR_OVERFLOW ( OPENMPT_ERROR_BASE + 32 )
360 
361 #define OPENMPT_ERROR_UNDERFLOW ( OPENMPT_ERROR_BASE + 33 )
362 
364 #define OPENMPT_ERROR_LOGIC ( OPENMPT_ERROR_BASE + 40 )
365 
366 #define OPENMPT_ERROR_DOMAIN ( OPENMPT_ERROR_BASE + 41 )
367 
368 #define OPENMPT_ERROR_LENGTH ( OPENMPT_ERROR_BASE + 42 )
369 
370 #define OPENMPT_ERROR_OUT_OF_RANGE ( OPENMPT_ERROR_BASE + 43 )
371 
372 #define OPENMPT_ERROR_INVALID_ARGUMENT ( OPENMPT_ERROR_BASE + 44 )
373 
375 #define OPENMPT_ERROR_GENERAL ( OPENMPT_ERROR_BASE + 101 )
376 
377 #define OPENMPT_ERROR_INVALID_MODULE_POINTER ( OPENMPT_ERROR_BASE + 102 )
378 
379 #define OPENMPT_ERROR_ARGUMENT_NULL_POINTER ( OPENMPT_ERROR_BASE + 103 )
380 
390 LIBOPENMPT_API int openmpt_error_is_transient( int error );
391 
400 LIBOPENMPT_API const char * openmpt_error_string( int error );
401 
403 #define OPENMPT_ERROR_FUNC_RESULT_NONE 0
404 
405 #define OPENMPT_ERROR_FUNC_RESULT_LOG ( 1 << 0 )
406 
407 #define OPENMPT_ERROR_FUNC_RESULT_STORE ( 1 << 1 )
408 
409 #define OPENMPT_ERROR_FUNC_RESULT_DEFAULT ( OPENMPT_ERROR_FUNC_RESULT_LOG | OPENMPT_ERROR_FUNC_RESULT_STORE )
410 
431 typedef int (*openmpt_error_func)( int error, void * user );
432 
441 LIBOPENMPT_API int openmpt_error_func_default( int error, void * user );
442 
451 LIBOPENMPT_API int openmpt_error_func_log( int error, void * user );
452 
461 LIBOPENMPT_API int openmpt_error_func_store( int error, void * user );
462 
471 LIBOPENMPT_API int openmpt_error_func_ignore( int error, void * user );
472 
482 LIBOPENMPT_API int openmpt_error_func_errno( int error, void * user );
483 
491 LIBOPENMPT_API void * openmpt_error_func_errno_userdata( int * error );
492 
508 LIBOPENMPT_API LIBOPENMPT_DEPRECATED double openmpt_could_open_probability( openmpt_stream_callbacks stream_callbacks, void * stream, double effort, openmpt_log_func logfunc, void * user );
509 
524 LIBOPENMPT_API LIBOPENMPT_DEPRECATED double openmpt_could_open_propability( openmpt_stream_callbacks stream_callbacks, void * stream, double effort, openmpt_log_func logfunc, void * user );
525 
547 LIBOPENMPT_API double openmpt_could_open_probability2( openmpt_stream_callbacks stream_callbacks, void * stream, double effort, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message );
548 
555 LIBOPENMPT_API size_t openmpt_probe_file_header_get_recommended_size(void);
556 
558 #define OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES 0x1ul
559 
560 #define OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS 0x2ul
561 
563 #define OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT ( OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES | OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS )
564 
565 #define OPENMPT_PROBE_FILE_HEADER_FLAGS_NONE 0x0ul
566 
568 #define OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS 1
569 
570 #define OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE 0
571 
572 #define OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA (-1)
573 
574 #define OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR (-255)
575 
600 LIBOPENMPT_API int openmpt_probe_file_header( uint64_t flags, const void * data, size_t size, uint64_t filesize, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message );
625 LIBOPENMPT_API int openmpt_probe_file_header_without_filesize( uint64_t flags, const void * data, size_t size, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message );
626 
651 LIBOPENMPT_API int openmpt_probe_file_header_from_stream( uint64_t flags, openmpt_stream_callbacks stream_callbacks, void * stream, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message );
652 
653 
657 
659  const char * ctl;
660  const char * value;
662 
676 LIBOPENMPT_API LIBOPENMPT_DEPRECATED openmpt_module * openmpt_module_create( openmpt_stream_callbacks stream_callbacks, void * stream, openmpt_log_func logfunc, void * loguser, const openmpt_module_initial_ctl * ctls );
677 
695 LIBOPENMPT_API openmpt_module * openmpt_module_create2( openmpt_stream_callbacks stream_callbacks, void * stream, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message, const openmpt_module_initial_ctl * ctls );
696 
709 LIBOPENMPT_API LIBOPENMPT_DEPRECATED openmpt_module * openmpt_module_create_from_memory( const void * filedata, size_t filesize, openmpt_log_func logfunc, void * loguser, const openmpt_module_initial_ctl * ctls );
710 
727 LIBOPENMPT_API openmpt_module * openmpt_module_create_from_memory2( const void * filedata, size_t filesize, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message, const openmpt_module_initial_ctl * ctls );
728 
733 LIBOPENMPT_API void openmpt_module_destroy( openmpt_module * mod );
734 
743 LIBOPENMPT_API void openmpt_module_set_log_func( openmpt_module * mod, openmpt_log_func logfunc, void * loguser );
744 
753 LIBOPENMPT_API void openmpt_module_set_error_func( openmpt_module * mod, openmpt_error_func errfunc, void * erruser );
754 
765 LIBOPENMPT_API int openmpt_module_error_get_last( openmpt_module * mod );
766 
776 LIBOPENMPT_API const char * openmpt_module_error_get_last_message( openmpt_module * mod );
777 
787 LIBOPENMPT_API void openmpt_module_error_set_last( openmpt_module * mod, int error );
788 
797 LIBOPENMPT_API void openmpt_module_error_clear( openmpt_module * mod );
798 
811 #define OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL 1
812 
818 #define OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT 2
819 
831 #define OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH 3
832 
840 #define OPENMPT_MODULE_RENDER_VOLUMERAMPING_STRENGTH 4
841 
849 #define OPENMPT_MODULE_COMMAND_NOTE 0
850 #define OPENMPT_MODULE_COMMAND_INSTRUMENT 1
851 #define OPENMPT_MODULE_COMMAND_VOLUMEEFFECT 2
852 #define OPENMPT_MODULE_COMMAND_EFFECT 3
853 #define OPENMPT_MODULE_COMMAND_VOLUME 4
854 #define OPENMPT_MODULE_COMMAND_PARAMETER 5
855 
865 LIBOPENMPT_API int openmpt_module_select_subsong( openmpt_module * mod, int32_t subsong );
873 LIBOPENMPT_API int32_t openmpt_module_get_selected_subsong( openmpt_module * mod );
884 LIBOPENMPT_API int openmpt_module_set_repeat_count( openmpt_module * mod, int32_t repeat_count );
894 LIBOPENMPT_API int32_t openmpt_module_get_repeat_count( openmpt_module * mod );
895 
901 LIBOPENMPT_API double openmpt_module_get_duration_seconds( openmpt_module * mod );
902 
910 LIBOPENMPT_API double openmpt_module_set_position_seconds( openmpt_module * mod, double seconds );
917 LIBOPENMPT_API double openmpt_module_get_position_seconds( openmpt_module * mod );
918 
929 LIBOPENMPT_API double openmpt_module_set_position_order_row( openmpt_module * mod, int32_t order, int32_t row );
930 
943 LIBOPENMPT_API int openmpt_module_get_render_param( openmpt_module * mod, int param, int32_t * value );
956 LIBOPENMPT_API int openmpt_module_set_render_param( openmpt_module * mod, int param, int32_t value );
957 
972 LIBOPENMPT_API size_t openmpt_module_read_mono( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * mono );
987 LIBOPENMPT_API size_t openmpt_module_read_stereo( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * left, int16_t * right );
1004 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 );
1018 LIBOPENMPT_API size_t openmpt_module_read_float_mono( openmpt_module * mod, int32_t samplerate, size_t count, float * mono );
1033 LIBOPENMPT_API size_t openmpt_module_read_float_stereo( openmpt_module * mod, int32_t samplerate, size_t count, float * left, float * right );
1050 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 );
1064 LIBOPENMPT_API size_t openmpt_module_read_interleaved_stereo( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * interleaved_stereo );
1078 LIBOPENMPT_API size_t openmpt_module_read_interleaved_quad( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * interleaved_quad );
1092 LIBOPENMPT_API size_t openmpt_module_read_interleaved_float_stereo( openmpt_module * mod, int32_t samplerate, size_t count, float * interleaved_stereo );
1106 LIBOPENMPT_API size_t openmpt_module_read_interleaved_float_quad( openmpt_module * mod, int32_t samplerate, size_t count, float * interleaved_quad );
1115 LIBOPENMPT_API const char * openmpt_module_get_metadata_keys( openmpt_module * mod );
1135 LIBOPENMPT_API const char * openmpt_module_get_metadata( openmpt_module * mod, const char * key );
1136 
1142 LIBOPENMPT_API int32_t openmpt_module_get_current_speed( openmpt_module * mod );
1148 LIBOPENMPT_API int32_t openmpt_module_get_current_tempo( openmpt_module * mod );
1154 LIBOPENMPT_API int32_t openmpt_module_get_current_order( openmpt_module * mod );
1160 LIBOPENMPT_API int32_t openmpt_module_get_current_pattern( openmpt_module * mod );
1166 LIBOPENMPT_API int32_t openmpt_module_get_current_row( openmpt_module * mod );
1172 LIBOPENMPT_API int32_t openmpt_module_get_current_playing_channels( openmpt_module * mod );
1173 
1181 LIBOPENMPT_API float openmpt_module_get_current_channel_vu_mono( openmpt_module * mod, int32_t channel );
1189 LIBOPENMPT_API float openmpt_module_get_current_channel_vu_left( openmpt_module * mod, int32_t channel );
1197 LIBOPENMPT_API float openmpt_module_get_current_channel_vu_right( openmpt_module * mod, int32_t channel );
1205 LIBOPENMPT_API float openmpt_module_get_current_channel_vu_rear_left( openmpt_module * mod, int32_t channel );
1213 LIBOPENMPT_API float openmpt_module_get_current_channel_vu_rear_right( openmpt_module * mod, int32_t channel );
1214 
1221 LIBOPENMPT_API int32_t openmpt_module_get_num_subsongs( openmpt_module * mod );
1228 LIBOPENMPT_API int32_t openmpt_module_get_num_channels( openmpt_module * mod );
1234 LIBOPENMPT_API int32_t openmpt_module_get_num_orders( openmpt_module * mod );
1240 LIBOPENMPT_API int32_t openmpt_module_get_num_patterns( openmpt_module * mod );
1246 LIBOPENMPT_API int32_t openmpt_module_get_num_instruments( openmpt_module * mod );
1252 LIBOPENMPT_API int32_t openmpt_module_get_num_samples( openmpt_module * mod );
1253 
1261 LIBOPENMPT_API const char * openmpt_module_get_subsong_name( openmpt_module * mod, int32_t index );
1269 LIBOPENMPT_API const char * openmpt_module_get_channel_name( openmpt_module * mod, int32_t index );
1277 LIBOPENMPT_API const char * openmpt_module_get_order_name( openmpt_module * mod, int32_t index );
1285 LIBOPENMPT_API const char * openmpt_module_get_pattern_name( openmpt_module * mod, int32_t index );
1293 LIBOPENMPT_API const char * openmpt_module_get_instrument_name( openmpt_module * mod, int32_t index );
1301 LIBOPENMPT_API const char * openmpt_module_get_sample_name( openmpt_module * mod, int32_t index );
1302 
1309 LIBOPENMPT_API int32_t openmpt_module_get_order_pattern( openmpt_module * mod, int32_t order );
1316 LIBOPENMPT_API int32_t openmpt_module_get_pattern_num_rows( openmpt_module * mod, int32_t pattern );
1317 
1327 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 );
1328 
1339 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 );
1361 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 );
1362 
1374 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 );
1386 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 );
1387 
1408 LIBOPENMPT_API const char * openmpt_module_get_ctls( openmpt_module * mod );
1416 LIBOPENMPT_API const char * openmpt_module_ctl_get( openmpt_module * mod, const char * ctl );
1425 LIBOPENMPT_API int openmpt_module_ctl_set( openmpt_module * mod, const char * ctl, const char * value );
1426 
1427 /* remember to add new functions to both C and C++ interfaces and to increase OPENMPT_API_VERSION_MINOR */
1428 
1429 #ifdef __cplusplus
1430 }
1431 #endif
1432 
1437 #endif /* LIBOPENMPT_H */
1438 
int32_t openmpt_module_get_current_tempo(openmpt_module *mod)
Get the current tempo.
uint32_t openmpt_get_core_version(void)
Get the core version number.
size_t openmpt_module_read_stereo(openmpt_module *mod, int32_t samplerate, size_t count, int16_t *left, int16_t *right)
Render audio data.
const char * openmpt_get_string(const char *key)
Get library related metadata.
#define LIBOPENMPT_DEPRECATED
Definition: libopenmpt_config.h:149
void openmpt_log_func_silent(const char *message, void *user)
Silent logging function.
openmpt_module * openmpt_module_create(openmpt_stream_callbacks stream_callbacks, void *stream, openmpt_log_func logfunc, void *loguser, const openmpt_module_initial_ctl *ctls)
Construct an openmpt_module.
int openmpt_probe_file_header_from_stream(uint64_t flags, openmpt_stream_callbacks stream_callbacks, void *stream, openmpt_log_func logfunc, void *loguser, openmpt_error_func errfunc, void *erruser, int *error, const char **error_message)
Probe the provided bytes from the beginning of a file for supported file format headers to find out w...
int openmpt_error_func_store(int error, void *user)
Store error function.
int(* openmpt_error_func)(int error, void *user)
Error function.
Definition: libopenmpt.h:431
int32_t openmpt_module_get_pattern_num_rows(openmpt_module *mod, int32_t pattern)
Get the number of rows in a pattern.
int openmpt_module_select_subsong(openmpt_module *mod, int32_t subsong)
Select a sub-song from a multi-song module.
size_t openmpt_module_read_float_stereo(openmpt_module *mod, int32_t samplerate, size_t count, float *left, float *right)
Render audio data.
struct openmpt_stream_callbacks openmpt_stream_callbacks
Stream callbacks.
int openmpt_module_get_render_param(openmpt_module *mod, int param, int32_t *value)
Get render parameter.
size_t openmpt_module_read_interleaved_float_stereo(openmpt_module *mod, int32_t samplerate, size_t count, float *interleaved_stereo)
Render audio data.
const char * ctl
Definition: libopenmpt.h:659
const char * openmpt_module_get_instrument_name(openmpt_module *mod, int32_t index)
Get an instrument name.
int openmpt_module_set_repeat_count(openmpt_module *mod, int32_t repeat_count)
Set Repeat Count.
void openmpt_free_string(const char *str)
Free a string returned by libopenmpt.
double openmpt_module_set_position_seconds(openmpt_module *mod, double seconds)
Set approximate current song position.
int openmpt_error_func_ignore(int error, void *user)
Ignore error function.
int openmpt_error_func_errno(int error, void *user)
Errno error function.
int32_t openmpt_module_get_current_pattern(openmpt_module *mod)
Get the current pattern.
openmpt_stream_tell_func tell
Tell callback.
Definition: libopenmpt.h:316
openmpt_module * openmpt_module_create_from_memory(const void *filedata, size_t filesize, openmpt_log_func logfunc, void *loguser, const openmpt_module_initial_ctl *ctls)
Construct an openmpt_module.
void(* openmpt_log_func)(const char *message, void *user)
Logging function.
Definition: libopenmpt.h:325
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)
Render audio data.
float openmpt_module_get_current_channel_vu_right(openmpt_module *mod, int32_t channel)
Get an approximate indication of the channel volume on the front-right speaker.
const char * openmpt_module_format_pattern_row_channel_command(openmpt_module *mod, int32_t pattern, int32_t row, int32_t channel, int command)
Get formatted (human-readable) pattern content.
int openmpt_error_func_default(int error, void *user)
Default error function.
size_t openmpt_module_read_mono(openmpt_module *mod, int32_t samplerate, size_t count, int16_t *mono)
Render audio data.
double openmpt_could_open_propability(openmpt_stream_callbacks stream_callbacks, void *stream, double effort, openmpt_log_func logfunc, void *user)
Roughly scan the input stream to find out whether libopenmpt might be able to open it...
const char * openmpt_module_get_metadata(openmpt_module *mod, const char *key)
Get a metadata item value.
size_t openmpt_module_read_interleaved_quad(openmpt_module *mod, int32_t samplerate, size_t count, int16_t *interleaved_quad)
Render audio data.
double openmpt_could_open_probability(openmpt_stream_callbacks stream_callbacks, void *stream, double effort, openmpt_log_func logfunc, void *user)
Roughly scan the input stream to find out whether libopenmpt might be able to open it...
const char * value
Definition: libopenmpt.h:660
int32_t openmpt_module_get_num_patterns(openmpt_module *mod)
Get the number of patterns.
void openmpt_module_error_set_last(openmpt_module *mod, int error)
Set last error.
float openmpt_module_get_current_channel_vu_rear_right(openmpt_module *mod, int32_t channel)
Get an approximate indication of the channel volume on the rear-right speaker.
int32_t openmpt_module_get_repeat_count(openmpt_module *mod)
Get Repeat Count.
int openmpt_module_error_get_last(openmpt_module *mod)
Get last error.
size_t openmpt_module_read_interleaved_stereo(openmpt_module *mod, int32_t samplerate, size_t count, int16_t *interleaved_stereo)
Render audio data.
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)
Get highlighting information for formatted pattern content.
int(* openmpt_stream_seek_func)(void *stream, int64_t offset, int whence)
Seek stream position.
Definition: libopenmpt.h:281
void * openmpt_error_func_errno_userdata(int *error)
User pointer for openmpt_error_func_errno.
struct openmpt_module openmpt_module
Opaque type representing a libopenmpt module.
Definition: libopenmpt.h:656
int openmpt_probe_file_header(uint64_t flags, const void *data, size_t size, uint64_t filesize, openmpt_log_func logfunc, void *loguser, openmpt_error_func errfunc, void *erruser, int *error, const char **error_message)
Probe the provided bytes from the beginning of a file for supported file format headers to find out w...
const char * openmpt_module_get_order_name(openmpt_module *mod, int32_t index)
Get an order name.
int openmpt_module_ctl_set(openmpt_module *mod, const char *ctl, const char *value)
Set ctl value.
struct openmpt_module_initial_ctl openmpt_module_initial_ctl
double openmpt_module_set_position_order_row(openmpt_module *mod, int32_t order, int32_t row)
Set approximate current song position.
const char * openmpt_error_string(int error)
Convert error code to text.
const char * openmpt_module_get_metadata_keys(openmpt_module *mod)
Get the list of supported metadata item keys.
uint32_t openmpt_get_library_version(void)
Get the libopenmpt version number.
int openmpt_is_extension_supported(const char *extension)
Query whether a file extension is supported.
size_t openmpt_probe_file_header_get_recommended_size(void)
Get recommended header size for successfull format probing.
const char * openmpt_module_get_sample_name(openmpt_module *mod, int32_t index)
Get a sample name.
int openmpt_error_is_transient(int error)
Check whether the error is transient.
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)
Get formatted (human-readable) pattern content.
Stream callbacks.
Definition: libopenmpt.h:296
int32_t openmpt_module_get_num_samples(openmpt_module *mod)
Get the number of samples.
double openmpt_module_get_position_seconds(openmpt_module *mod)
Get current song position.
int openmpt_error_func_log(int error, void *user)
Log error function.
int openmpt_module_set_render_param(openmpt_module *mod, int param, int32_t value)
Set render parameter.
int32_t openmpt_module_get_current_playing_channels(openmpt_module *mod)
Get the current amount of playing channels.
size_t openmpt_module_read_float_mono(openmpt_module *mod, int32_t samplerate, size_t count, float *mono)
Render audio data.
int32_t openmpt_module_get_current_order(openmpt_module *mod)
Get the current order.
size_t openmpt_module_read_interleaved_float_quad(openmpt_module *mod, int32_t samplerate, size_t count, float *interleaved_quad)
Render audio data.
const char * openmpt_module_ctl_get(openmpt_module *mod, const char *ctl)
Get current ctl value.
void openmpt_module_error_clear(openmpt_module *mod)
Clear last error.
size_t(* openmpt_stream_read_func)(void *stream, void *dst, size_t bytes)
Read bytes from stream.
Definition: libopenmpt.h:268
const char * openmpt_module_get_channel_name(openmpt_module *mod, int32_t index)
Get a channel name.
openmpt_module * openmpt_module_create_from_memory2(const void *filedata, size_t filesize, openmpt_log_func logfunc, void *loguser, openmpt_error_func errfunc, void *erruser, int *error, const char **error_message, const openmpt_module_initial_ctl *ctls)
Construct an openmpt_module.
int64_t(* openmpt_stream_tell_func)(void *stream)
Tell stream position.
Definition: libopenmpt.h:290
const char * openmpt_module_get_pattern_name(openmpt_module *mod, int32_t index)
Get a pattern name.
double openmpt_could_open_probability2(openmpt_stream_callbacks stream_callbacks, void *stream, double effort, openmpt_log_func logfunc, void *loguser, openmpt_error_func errfunc, void *erruser, int *error, const char **error_message)
Roughly scan the input stream to find out whether libopenmpt might be able to open it...
openmpt_stream_read_func read
Read callback.
Definition: libopenmpt.h:302
double openmpt_module_get_duration_seconds(openmpt_module *mod)
approximate song duration
int32_t openmpt_module_get_selected_subsong(openmpt_module *mod)
Get currently selected sub-song from a multi-song module.
const char * openmpt_module_get_subsong_name(openmpt_module *mod, int32_t index)
Get a sub-song name.
openmpt_module * openmpt_module_create2(openmpt_stream_callbacks stream_callbacks, void *stream, openmpt_log_func logfunc, void *loguser, openmpt_error_func errfunc, void *erruser, int *error, const char **error_message, const openmpt_module_initial_ctl *ctls)
Construct an openmpt_module.
void openmpt_module_destroy(openmpt_module *mod)
Unload a previously created openmpt_module from memory.
int32_t openmpt_module_get_num_channels(openmpt_module *mod)
Get the number of pattern channels.
void openmpt_module_set_log_func(openmpt_module *mod, openmpt_log_func logfunc, void *loguser)
Set logging function.
const char * openmpt_get_supported_extensions(void)
Get a list of supported file extensions.
int32_t openmpt_module_get_current_row(openmpt_module *mod)
Get the current row.
const char * openmpt_module_get_ctls(openmpt_module *mod)
Retrieve supported ctl keys.
float openmpt_module_get_current_channel_vu_left(openmpt_module *mod, int32_t channel)
Get an approximate indication of the channel volume on the front-left speaker.
const char * openmpt_module_highlight_pattern_row_channel_command(openmpt_module *mod, int32_t pattern, int32_t row, int32_t channel, int command)
Get highlighting information for formatted pattern content.
int32_t openmpt_module_get_order_pattern(openmpt_module *mod, int32_t order)
Get pattern at order position.
void openmpt_module_set_error_func(openmpt_module *mod, openmpt_error_func errfunc, void *erruser)
Set error function.
float openmpt_module_get_current_channel_vu_mono(openmpt_module *mod, int32_t channel)
Get an approximate indication of the channel volume.
int32_t openmpt_module_get_num_orders(openmpt_module *mod)
Get the number of orders.
uint8_t openmpt_module_get_pattern_row_channel_command(openmpt_module *mod, int32_t pattern, int32_t row, int32_t channel, int command)
Get raw pattern content.
openmpt_stream_seek_func seek
Seek callback.
Definition: libopenmpt.h:309
int32_t openmpt_module_get_num_instruments(openmpt_module *mod)
Get the number of instruments.
int32_t openmpt_module_get_num_subsongs(openmpt_module *mod)
Get the number of sub-songs.
Definition: libopenmpt.h:658
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)
Render audio data.
int openmpt_probe_file_header_without_filesize(uint64_t flags, const void *data, size_t size, openmpt_log_func logfunc, void *loguser, openmpt_error_func errfunc, void *erruser, int *error, const char **error_message)
Probe the provided bytes from the beginning of a file for supported file format headers to find out w...
float openmpt_module_get_current_channel_vu_rear_left(openmpt_module *mod, int32_t channel)
Get an approximate indication of the channel volume on the rear-left speaker.
void openmpt_log_func_default(const char *message, void *user)
Default logging function.
int32_t openmpt_module_get_current_speed(openmpt_module *mod)
Get the current speed.
const char * openmpt_module_error_get_last_message(openmpt_module *mod)
Get last error message.