libopenmpt.h 89 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552
  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. #ifndef LIBOPENMPT_H
  10. #define LIBOPENMPT_H
  11. #include "libopenmpt_config.h"
  12. #include <stddef.h>
  13. #include <stdint.h>
  14. /*!
  15. * \page libopenmpt_c_overview C API
  16. *
  17. * \section libopenmpt_c_error Error Handling
  18. *
  19. * - Functions with no return value in the corresponding C++ API return 0 on
  20. * failure and 1 on success.
  21. * - Functions that return a string in the corresponding C++ API return a
  22. * dynamically allocated const char *. In case of failure or memory allocation
  23. * failure, a NULL pointer is returned.
  24. * - Functions that return integer values signal error condition by returning
  25. * an invalid value (-1 in most cases, 0 in some cases).
  26. * - All functions that work on an \ref openmpt_module object will call an
  27. * \ref openmpt_error_func and depending on the value returned by this function
  28. * log the error code and/xor/or store it inside the openmpt_module object.
  29. * Stored error codes can be accessed with the openmpt_module_error_get_last()
  30. * and openmpt_module_error_get_last_message(). Stored errors will not get
  31. * cleared automatically and should be reset with openmpt_module_error_clear().
  32. * - Some functions not directly related to an \ref openmpt_module object take
  33. * an explicit \ref openmpt_error_func error function callback and a pointer to
  34. * an int and behave analog to the functions working on an \ref openmpt_module
  35. * object.
  36. *
  37. * \section libopenmpt_c_strings Strings
  38. *
  39. * - All strings returned from libopenmpt are encoded in UTF-8.
  40. * - All strings passed to libopenmpt should also be encoded in UTF-8.
  41. * Behaviour in case of invalid UTF-8 is unspecified.
  42. * - libopenmpt does not enforce or expect any particular Unicode
  43. * normalization form.
  44. * - All strings returned from libopenmpt are dynamically allocated and must
  45. * be freed with openmpt_free_string(). Do NOT use the C standard library
  46. * free() for libopenmpt strings as that would make your code invalid on
  47. * windows when dynamically linking against libopenmpt which itself statically
  48. * links to the C runtime.
  49. * - All strings passed to libopenmpt are copied. No ownership is assumed or
  50. * transferred.
  51. *
  52. * \section libopenmpt_c_fileio File I/O
  53. *
  54. * libopenmpt can use 3 different strategies for file I/O.
  55. *
  56. * - openmpt_module_create_from_memory2() will load the module from the provided
  57. * memory buffer, which will require loading all data upfront by the library
  58. * caller.
  59. * - openmpt_module_create2() with a seekable stream will load the module via
  60. * callbacks to the stream interface. libopenmpt will not implement an
  61. * additional buffering layer in this case which means the callbacks are assumed
  62. * to be performant even with small i/o sizes.
  63. * - openmpt_module_create2() with an unseekable stream will load the module via
  64. * callbacks to the stream interface. libopempt will make an internal copy as
  65. * it goes along, and sometimes have to pre-cache the whole file in case it
  66. * needs to know the complete file size. This strategy is intended to be used
  67. * if the file is located on a high latency network.
  68. *
  69. * | create function | speed | memory consumption |
  70. * | ----------------------------------------------: | :----: | :----------------: |
  71. * | openmpt_module_create_from_memory2() | <p style="background-color:green" >fast </p> | <p style="background-color:yellow">medium</p> |
  72. * | openmpt_module_create2() with seekable stream | <p style="background-color:red" >slow </p> | <p style="background-color:green" >low </p> |
  73. * | openmpt_module_create2() with unseekable stream | <p style="background-color:yellow">medium</p> | <p style="background-color:red" >high </p> |
  74. *
  75. * In all cases, the data or stream passed to the create function is no longer
  76. * needed after the openmpt_module has been created and can be freed by the
  77. * caller.
  78. *
  79. * \section libopenmpt_c_outputformat Output Format
  80. *
  81. * libopenmpt supports a wide range of PCM output formats:
  82. * [8000..192000]/[mono|stereo|quad]/[f32|i16].
  83. *
  84. * Unless you have some very specific requirements demanding a particular aspect
  85. * of the output format, you should always prefer 48000/stereo/f32 as the
  86. * libopenmpt PCM format.
  87. *
  88. * - Please prefer 48000Hz unless the user explicitly demands something else.
  89. * Practically all audio equipment and file formats use 48000Hz nowadays.
  90. * - Practically all module formats are made for stereo output. Mono will not
  91. * give you any measurable speed improvements and can trivially be obtained from
  92. * the stereo output anyway. Quad is not expected by almost all modules and even
  93. * if they do use surround effects, they expect the effects to be mixed to
  94. * stereo.
  95. * - Floating point output provides headroom instead of hard clipping if the
  96. * module is louder than 0dBFs, will give you a better signal-to-noise ratio
  97. * than int16 output, and avoid the need to apply an additional dithering to the
  98. * output by libopenmpt. Unless your platform has no floating point unit at all,
  99. * floating point will thus also be slightly faster.
  100. *
  101. * \section libopenmpt_c_threads libopenmpt in multi-threaded environments
  102. *
  103. * - libopenmpt is thread-aware.
  104. * - Individual libopenmpt objects are not thread-safe.
  105. * - libopenmpt itself does not spawn any user-visible threads but may spawn
  106. * threads for internal use.
  107. * - You must ensure to only ever access a particular libopenmpt object from a
  108. * single thread at a time.
  109. * - Consecutive accesses can happen from different threads.
  110. * - Different objects can be accessed concurrently from different threads.
  111. *
  112. * \section libopenmpt_c_staticlinking Statically linking to libopenmpt
  113. *
  114. * libopenmpt is implemented in C++. This implies that linking to libopenmpt
  115. * statically requires linking to the C++ runtime and standard library. The
  116. * **highly preferred and recommended** way to do this is by using the C++
  117. * compiler instead of the platform linker to do the linking. This will do all
  118. * necessary things that are C++ specific (in particular, it will pull in the
  119. * appropriate runtime and/or library). If for whatever reason it is not
  120. * possible to use the C++ compiler for statically linking against libopenmpt,
  121. * the libopenmpt build system can list the required libraries in the pkg-config
  122. * file `libopenmpt.pc`. However, there is no reliable way to determine the name
  123. * of the required library or libraries from within the build system. The
  124. * libopenmpt autotools `configure` and plain `Makefile` honor the custom
  125. * variable `CXXSTDLIB_PCLIBSPRIVATE` which serves the sole purpose of listing
  126. * the standard library (or libraries) required for static linking. The contents
  127. * of this variable will be put in `libopenmpt.pc` `Libs.private` and used for
  128. * nothing else.
  129. *
  130. * This problem is inherent to libraries implemented in C++ that can also be used
  131. * without a C++ compiler. Other libraries try to solve that by listing
  132. * `-lstdc++` unconditionally in `Libs.private`. However, that will break
  133. * platforms that use a different C++ standard library (in particular FreeBSD).
  134. *
  135. * See https://lists.freedesktop.org/archives/pkg-config/2016-August/001055.html .
  136. *
  137. * Dymically linking to libopenmpt does not require anything special and will
  138. * work as usual (and exactly as done for libraries implemented in C).
  139. *
  140. * Note: This section does not apply when using Microsoft Visual Studio or
  141. * Andriod NDK ndk-build build systems.
  142. *
  143. * \section libopenmpt_c_detailed Detailed documentation
  144. *
  145. * \ref libopenmpt_c
  146. *
  147. * In case a function is not documented here, you might want to look at the
  148. * \ref libopenmpt_cpp documentation. The C and C++ APIs are kept semantically
  149. * as close as possible.
  150. *
  151. * \section libopenmpt_c_examples Examples
  152. *
  153. * \subsection libopenmpt_c_example_unsafe Unsafe, simplified example without any error checking to get a first idea of the API
  154. * \include libopenmpt_example_c_unsafe.c
  155. * \subsection libopenmpt_c_example_file FILE*
  156. * \include libopenmpt_example_c.c
  157. * \subsection libopenmpt_c_example_inmemory in memory
  158. * \include libopenmpt_example_c_mem.c
  159. * \subsection libopenmpt_c_example_stdout reading FILE* and writing PCM data to STDOUT (usable without PortAudio)
  160. * \include libopenmpt_example_c_stdout.c
  161. *
  162. */
  163. /*! \defgroup libopenmpt_c libopenmpt C */
  164. /*! \addtogroup libopenmpt_c
  165. * @{
  166. */
  167. #ifdef __cplusplus
  168. extern "C" {
  169. #endif
  170. /*! \brief Get the libopenmpt version number
  171. *
  172. * Returns the libopenmpt version number.
  173. * \return The value represents (major << 24 + minor << 16 + patch << 0).
  174. * \remarks libopenmpt < 0.3.0-pre used the following scheme: (major << 24 + minor << 16 + revision).
  175. */
  176. LIBOPENMPT_API uint32_t openmpt_get_library_version(void);
  177. /*! \brief Get the core version number
  178. *
  179. * Return the OpenMPT core version number.
  180. * \return The value represents (majormajor << 24 + major << 16 + minor << 8 + minorminor).
  181. */
  182. LIBOPENMPT_API uint32_t openmpt_get_core_version(void);
  183. /*! Return a verbose library version string from openmpt_get_string(). \deprecated Please use `"library_version"` directly. */
  184. #define OPENMPT_STRING_LIBRARY_VERSION LIBOPENMPT_DEPRECATED_STRING( "library_version" )
  185. /*! Return a verbose library features string from openmpt_get_string(). \deprecated Please use `"library_features"` directly. */
  186. #define OPENMPT_STRING_LIBRARY_FEATURES LIBOPENMPT_DEPRECATED_STRING( "library_features" )
  187. /*! Return a verbose OpenMPT core version string from openmpt_get_string(). \deprecated Please use `"core_version"` directly. */
  188. #define OPENMPT_STRING_CORE_VERSION LIBOPENMPT_DEPRECATED_STRING( "core_version" )
  189. /*! Return information about the current build (e.g. the build date or compiler used) from openmpt_get_string(). \deprecated Please use `"build"` directly. */
  190. #define OPENMPT_STRING_BUILD LIBOPENMPT_DEPRECATED_STRING( "build" )
  191. /*! Return all contributors from openmpt_get_string(). \deprecated Please use `"credits"` directly. */
  192. #define OPENMPT_STRING_CREDITS LIBOPENMPT_DEPRECATED_STRING( "credits" )
  193. /*! Return contact information about libopenmpt from openmpt_get_string(). \deprecated Please use `"contact"` directly. */
  194. #define OPENMPT_STRING_CONTACT LIBOPENMPT_DEPRECATED_STRING( "contact" )
  195. /*! Return the libopenmpt license from openmpt_get_string(). \deprecated Please use `"license"` directly. */
  196. #define OPENMPT_STRING_LICENSE LIBOPENMPT_DEPRECATED_STRING( "license" )
  197. /*! \brief Free a string returned by libopenmpt
  198. *
  199. * Frees any string that got returned by libopenmpt.
  200. */
  201. LIBOPENMPT_API void openmpt_free_string( const char * str );
  202. /*! \brief Get library related metadata.
  203. *
  204. * \param key Key to query.
  205. * Possible keys are:
  206. * - "library_version": verbose library version string
  207. * - "library_version_is_release": "1" if the version is an officially released version
  208. * - "library_features": verbose library features string
  209. * - "core_version": verbose OpenMPT core version string
  210. * - "source_url": original source code URL
  211. * - "source_date": original source code date
  212. * - "source_revision": original source code revision
  213. * - "source_is_modified": "1" if the original source has been modified
  214. * - "source_has_mixed_revisions": "1" if the original source has been compiled from different various revision
  215. * - "source_is_package": "1" if the original source has been obtained from a source pacakge instead of source code version control
  216. * - "build": information about the current build (e.g. the build date or compiler used)
  217. * - "build_compiler": information about the compiler used to build libopenmpt
  218. * - "credits": all contributors
  219. * - "contact": contact information about libopenmpt
  220. * - "license": the libopenmpt license
  221. * - "url": libopenmpt website URL
  222. * - "support_forum_url": libopenmpt support and discussions forum URL
  223. * - "bugtracker_url": libopenmpt bug and issue tracker URL
  224. * \return A (possibly multi-line) string containing the queried information. If no information is available, the string is empty.
  225. */
  226. LIBOPENMPT_API const char * openmpt_get_string( const char * key );
  227. /*! \brief Get a list of supported file extensions
  228. *
  229. * \return The semicolon-separated list of extensions supported by this libopenmpt build. The extensions are returned lower-case without a leading dot.
  230. */
  231. LIBOPENMPT_API const char * openmpt_get_supported_extensions(void);
  232. /// <summary>
  233. /// From version: 0.7.0
  234. /// Hakan DANISIK
  235. /// </summary>
  236. /// <param name="extension"></param>
  237. /// <returns></returns>
  238. LIBOPENMPT_API const char * openmpt_get_tracker_name( const char * extension );
  239. /*! \brief Query whether a file extension is supported
  240. *
  241. * \param extension file extension to query without a leading dot. The case is ignored.
  242. * \return 1 if the extension is supported by libopenmpt, 0 otherwise.
  243. */
  244. LIBOPENMPT_API int openmpt_is_extension_supported( const char * extension );
  245. /*! Seek to the given offset relative to the beginning of the file. */
  246. #define OPENMPT_STREAM_SEEK_SET 0
  247. /*! Seek to the given offset relative to the current position in the file. */
  248. #define OPENMPT_STREAM_SEEK_CUR 1
  249. /*! Seek to the given offset relative to the end of the file. */
  250. #define OPENMPT_STREAM_SEEK_END 2
  251. /*! \brief Read bytes from stream
  252. *
  253. * Read bytes data from stream to dst.
  254. * \param stream Stream to read data from
  255. * \param dst Target where to copy data.
  256. * \param bytes Number of bytes to read.
  257. * \return Number of bytes actually read and written to dst.
  258. * \retval 0 End of stream or error.
  259. * \remarks Short reads are allowed as long as they return at least 1 byte if EOF is not reached.
  260. */
  261. typedef size_t (*openmpt_stream_read_func)( void * stream, void * dst, size_t bytes );
  262. /*! \brief Seek stream position
  263. *
  264. * Seek to stream position offset at whence.
  265. * \param stream Stream to operate on.
  266. * \param offset Offset to seek to.
  267. * \param whence OPENMPT_STREAM_SEEK_SET, OPENMPT_STREAM_SEEK_CUR, OPENMPT_STREAM_SEEK_END. See C89 documentation.
  268. * \return Returns 0 on success.
  269. * \retval 0 Success.
  270. * \retval -1 Failure. Position does not get updated.
  271. * \remarks libopenmpt will not try to seek beyond the file size, thus it is not important whether you allow for virtual positioning after the file end, or return an error in that case. The position equal to the file size needs to be seekable to.
  272. */
  273. typedef int (*openmpt_stream_seek_func)( void * stream, int64_t offset, int whence );
  274. /*! \brief Tell stream position
  275. *
  276. * Tell position of stream.
  277. * \param stream Stream to operate on.
  278. * \return Current position in stream.
  279. * \retval -1 Failure.
  280. */
  281. typedef int64_t (*openmpt_stream_tell_func)( void * stream );
  282. /*! \brief Stream callbacks
  283. *
  284. * Stream callbacks used by libopenmpt for stream operations.
  285. * \sa openmpt_stream_get_file_callbacks
  286. * \sa openmpt_stream_get_fd_callbacks
  287. * \sa openmpt_stream_get_buffer_callbacks
  288. */
  289. typedef struct openmpt_stream_callbacks {
  290. /*! \brief Read callback.
  291. *
  292. * \sa openmpt_stream_read_func
  293. */
  294. openmpt_stream_read_func read;
  295. /*! \brief Seek callback.
  296. *
  297. * Seek callback can be NULL if seeking is not supported.
  298. * \sa openmpt_stream_seek_func
  299. */
  300. openmpt_stream_seek_func seek;
  301. /*! \brief Tell callback.
  302. *
  303. * Tell callback can be NULL if seeking is not supported.
  304. * \sa openmpt_stream_tell_func
  305. */
  306. openmpt_stream_tell_func tell;
  307. } openmpt_stream_callbacks;
  308. /*! \brief Logging function
  309. *
  310. * \param message UTF-8 encoded log message.
  311. * \param user User context that was passed to openmpt_module_create2(), openmpt_module_create_from_memory2() or openmpt_could_open_probability2().
  312. */
  313. typedef void (*openmpt_log_func)( const char * message, void * user );
  314. /*! \brief Default logging function
  315. *
  316. * Default logging function that logs anything to stderr.
  317. */
  318. LIBOPENMPT_API void openmpt_log_func_default( const char * message, void * user );
  319. /*! \brief Silent logging function
  320. *
  321. * Silent logging function that throws any log message away.
  322. */
  323. LIBOPENMPT_API void openmpt_log_func_silent( const char * message, void * user );
  324. /*! No error. \since 0.3.0 */
  325. #define OPENMPT_ERROR_OK 0
  326. /*! Lowest value libopenmpt will use for any of its own error codes. \since 0.3.0 */
  327. #define OPENMPT_ERROR_BASE 256
  328. /*! Unknown internal error. \since 0.3.0 */
  329. #define OPENMPT_ERROR_UNKNOWN ( OPENMPT_ERROR_BASE + 1 )
  330. /*! Unknown internal C++ exception. \since 0.3.0 */
  331. #define OPENMPT_ERROR_EXCEPTION ( OPENMPT_ERROR_BASE + 11 )
  332. /*! Out of memory. \since 0.3.0 */
  333. #define OPENMPT_ERROR_OUT_OF_MEMORY ( OPENMPT_ERROR_BASE + 21 )
  334. /*! Runtime error. \since 0.3.0 */
  335. #define OPENMPT_ERROR_RUNTIME ( OPENMPT_ERROR_BASE + 30 )
  336. /*! Range error. \since 0.3.0 */
  337. #define OPENMPT_ERROR_RANGE ( OPENMPT_ERROR_BASE + 31 )
  338. /*! Arithmetic overflow. \since 0.3.0 */
  339. #define OPENMPT_ERROR_OVERFLOW ( OPENMPT_ERROR_BASE + 32 )
  340. /*! Arithmetic underflow. \since 0.3.0 */
  341. #define OPENMPT_ERROR_UNDERFLOW ( OPENMPT_ERROR_BASE + 33 )
  342. /*! Logic error. \since 0.3.0 */
  343. #define OPENMPT_ERROR_LOGIC ( OPENMPT_ERROR_BASE + 40 )
  344. /*! Value domain error. \since 0.3.0 */
  345. #define OPENMPT_ERROR_DOMAIN ( OPENMPT_ERROR_BASE + 41 )
  346. /*! Maximum supported size exceeded. \since 0.3.0 */
  347. #define OPENMPT_ERROR_LENGTH ( OPENMPT_ERROR_BASE + 42 )
  348. /*! Argument out of range. \since 0.3.0 */
  349. #define OPENMPT_ERROR_OUT_OF_RANGE ( OPENMPT_ERROR_BASE + 43 )
  350. /*! Invalid argument. \since 0.3.0 */
  351. #define OPENMPT_ERROR_INVALID_ARGUMENT ( OPENMPT_ERROR_BASE + 44 )
  352. /*! General libopenmpt error. \since 0.3.0 */
  353. #define OPENMPT_ERROR_GENERAL ( OPENMPT_ERROR_BASE + 101 )
  354. /*! openmpt_module * is invalid. \since 0.3.0 */
  355. #define OPENMPT_ERROR_INVALID_MODULE_POINTER ( OPENMPT_ERROR_BASE + 102 )
  356. /*! NULL pointer argument. \since 0.3.0 */
  357. #define OPENMPT_ERROR_ARGUMENT_NULL_POINTER ( OPENMPT_ERROR_BASE + 103 )
  358. /*! \brief Check whether the error is transient
  359. *
  360. * Checks whether an error code represents a transient error which may not occur again in a later try if for example memory has been freed up after an out-of-memory error.
  361. * \param error Error code.
  362. * \retval 0 Error is not transient.
  363. * \retval 1 Error is transient.
  364. * \sa OPENMPT_ERROR_OUT_OF_MEMORY
  365. * \since 0.3.0
  366. */
  367. LIBOPENMPT_API int openmpt_error_is_transient( int error );
  368. /*! \brief Convert error code to text
  369. *
  370. * Converts an error code into a text string describing the error.
  371. * \param error Error code.
  372. * \return Allocated string describing the error.
  373. * \retval NULL Not enough memory to allocate the string.
  374. * \since 0.3.0
  375. */
  376. LIBOPENMPT_API const char * openmpt_error_string( int error );
  377. /*! Do not log or store the error. \since 0.3.0 */
  378. #define OPENMPT_ERROR_FUNC_RESULT_NONE 0
  379. /*! Log the error. \since 0.3.0 */
  380. #define OPENMPT_ERROR_FUNC_RESULT_LOG ( 1 << 0 )
  381. /*! Store the error. \since 0.3.0 */
  382. #define OPENMPT_ERROR_FUNC_RESULT_STORE ( 1 << 1 )
  383. /*! Log and store the error. \since 0.3.0 */
  384. #define OPENMPT_ERROR_FUNC_RESULT_DEFAULT ( OPENMPT_ERROR_FUNC_RESULT_LOG | OPENMPT_ERROR_FUNC_RESULT_STORE )
  385. /*! \brief Error function
  386. *
  387. * \param error Error code.
  388. * \param user User context that was passed to openmpt_module_create2(), openmpt_module_create_from_memory2() or openmpt_could_open_probability2().
  389. * \return Mask of OPENMPT_ERROR_FUNC_RESULT_LOG and OPENMPT_ERROR_FUNC_RESULT_STORE.
  390. * \retval OPENMPT_ERROR_FUNC_RESULT_NONE Do not log or store the error.
  391. * \retval OPENMPT_ERROR_FUNC_RESULT_LOG Log the error.
  392. * \retval OPENMPT_ERROR_FUNC_RESULT_STORE Store the error.
  393. * \retval OPENMPT_ERROR_FUNC_RESULT_DEFAULT Log and store the error.
  394. * \sa OPENMPT_ERROR_FUNC_RESULT_NONE
  395. * \sa OPENMPT_ERROR_FUNC_RESULT_LOG
  396. * \sa OPENMPT_ERROR_FUNC_RESULT_STORE
  397. * \sa OPENMPT_ERROR_FUNC_RESULT_DEFAULT
  398. * \sa openmpt_error_func_default
  399. * \sa openmpt_error_func_log
  400. * \sa openmpt_error_func_store
  401. * \sa openmpt_error_func_ignore
  402. * \sa openmpt_error_func_errno
  403. * \since 0.3.0
  404. */
  405. typedef int (*openmpt_error_func)( int error, void * user );
  406. /*! \brief Default error function
  407. *
  408. * Causes all errors to be logged and stored.
  409. * \param error Error code.
  410. * \param user Ignored.
  411. * \retval OPENMPT_ERROR_FUNC_RESULT_DEFAULT Always.
  412. * \since 0.3.0
  413. */
  414. LIBOPENMPT_API int openmpt_error_func_default( int error, void * user );
  415. /*! \brief Log error function
  416. *
  417. * Causes all errors to be logged.
  418. * \param error Error code.
  419. * \param user Ignored.
  420. * \retval OPENMPT_ERROR_FUNC_RESULT_LOG Always.
  421. * \since 0.3.0
  422. */
  423. LIBOPENMPT_API int openmpt_error_func_log( int error, void * user );
  424. /*! \brief Store error function
  425. *
  426. * Causes all errors to be stored.
  427. * \param error Error code.
  428. * \param user Ignored.
  429. * \retval OPENMPT_ERROR_FUNC_RESULT_STORE Always.
  430. * \since 0.3.0
  431. */
  432. LIBOPENMPT_API int openmpt_error_func_store( int error, void * user );
  433. /*! \brief Ignore error function
  434. *
  435. * Causes all errors to be neither logged nor stored.
  436. * \param error Error code.
  437. * \param user Ignored.
  438. * \retval OPENMPT_ERROR_FUNC_RESULT_NONE Always.
  439. * \since 0.3.0
  440. */
  441. LIBOPENMPT_API int openmpt_error_func_ignore( int error, void * user );
  442. /*! \brief Errno error function
  443. *
  444. * Causes all errors to be stored in the pointer passed in as user.
  445. * \param error Error code.
  446. * \param user Pointer to an int as generated by openmpt_error_func_errno_userdata.
  447. * \retval OPENMPT_ERROR_FUNC_RESULT_NONE user is not NULL.
  448. * \retval OPENMPT_ERROR_FUNC_RESULT_DEFAULT user is NULL.
  449. * \since 0.3.0
  450. */
  451. LIBOPENMPT_API int openmpt_error_func_errno( int error, void * user );
  452. /*! \brief User pointer for openmpt_error_func_errno
  453. *
  454. * Provides a suitable user pointer argument for openmpt_error_func_errno.
  455. * \param error Pointer to an integer value to be used as output by openmpt_error_func_errno.
  456. * \retval (void*)error.
  457. * \since 0.3.0
  458. */
  459. LIBOPENMPT_API void * openmpt_error_func_errno_userdata( int * error );
  460. /*! \brief Roughly scan the input stream to find out whether libopenmpt might be able to open it
  461. *
  462. * \param stream_callbacks Input stream callback operations.
  463. * \param stream Input stream to scan.
  464. * \param effort Effort to make when validating stream. Effort 0.0 does not even look at stream at all and effort 1.0 completely loads the file from stream. A lower effort requires less data to be loaded but only gives a rough estimate answer. Use an effort of 0.25 to only verify the header data of the module file.
  465. * \param logfunc Logging function where warning and errors are written. May be NULL.
  466. * \param user Logging function user context. Used to pass any user-defined data associated with this module to the logging function.
  467. * \return Probability between 0.0 and 1.0.
  468. * \remarks openmpt_could_open_probability() can return any value between 0.0 and 1.0. Only 0.0 and 1.0 are definitive answers, all values in between are just estimates. In general, any return value >0.0 means that you should try loading the file, and any value below 1.0 means that loading may fail. If you want a threshold above which you can be reasonably sure that libopenmpt will be able to load the file, use >=0.5. If you see the need for a threshold below which you could reasonably outright reject a file, use <0.25 (Note: Such a threshold for rejecting on the lower end is not recommended, but may be required for better integration into some other framework's probe scoring.).
  469. * \remarks openmpt_could_open_probability() expects the complete file data to be eventually available to it, even if it is asked to just parse the header. Verification will be unreliable (both false positives and false negatives), if you pretend that the file is just some few bytes of initial data threshold in size. In order to really just access the first bytes of a file, check in your callback functions whether data or seeking is requested beyond your initial data threshold, and in that case, return an error. openmpt_could_open_probability() will treat this as any other I/O error and return 0.0. You must not expect the correct result in this case. You instead must remember that it asked for more data than you currently want to provide to it and treat this situation as if openmpt_could_open_probability() returned 0.5.
  470. * \sa \ref libopenmpt_c_fileio
  471. * \sa openmpt_stream_callbacks
  472. * \deprecated Please use openmpt_could_open_probability2().
  473. * \since 0.3.0
  474. */
  475. LIBOPENMPT_API LIBOPENMPT_DEPRECATED double openmpt_could_open_probability( openmpt_stream_callbacks stream_callbacks, void * stream, double effort, openmpt_log_func logfunc, void * user );
  476. /*! \brief Roughly scan the input stream to find out whether libopenmpt might be able to open it
  477. *
  478. * \param stream_callbacks Input stream callback operations.
  479. * \param stream Input stream to scan.
  480. * \param effort Effort to make when validating stream. Effort 0.0 does not even look at stream at all and effort 1.0 completely loads the file from stream. A lower effort requires less data to be loaded but only gives a rough estimate answer. Use an effort of 0.25 to only verify the header data of the module file.
  481. * \param logfunc Logging function where warning and errors are written. May be NULL.
  482. * \param user Logging function user context. Used to pass any user-defined data associated with this module to the logging function.
  483. * \return Probability between 0.0 and 1.0.
  484. * \remarks openmpt_could_open_probability() can return any value between 0.0 and 1.0. Only 0.0 and 1.0 are definitive answers, all values in between are just estimates. In general, any return value >0.0 means that you should try loading the file, and any value below 1.0 means that loading may fail. If you want a threshold above which you can be reasonably sure that libopenmpt will be able to load the file, use >=0.5. If you see the need for a threshold below which you could reasonably outright reject a file, use <0.25 (Note: Such a threshold for rejecting on the lower end is not recommended, but may be required for better integration into some other framework's probe scoring.).
  485. * \remarks openmpt_could_open_probability() expects the complete file data to be eventually available to it, even if it is asked to just parse the header. Verification will be unreliable (both false positives and false negatives), if you pretend that the file is just some few bytes of initial data threshold in size. In order to really just access the first bytes of a file, check in your callback functions whether data or seeking is requested beyond your initial data threshold, and in that case, return an error. openmpt_could_open_probability() will treat this as any other I/O error and return 0.0. You must not expect the correct result in this case. You instead must remember that it asked for more data than you currently want to provide to it and treat this situation as if openmpt_could_open_probability() returned 0.5.
  486. * \sa \ref libopenmpt_c_fileio
  487. * \sa openmpt_stream_callbacks
  488. * \deprecated Please use openmpt_could_open_probability2().
  489. */
  490. LIBOPENMPT_API LIBOPENMPT_DEPRECATED double openmpt_could_open_propability( openmpt_stream_callbacks stream_callbacks, void * stream, double effort, openmpt_log_func logfunc, void * user );
  491. /*! \brief Roughly scan the input stream to find out whether libopenmpt might be able to open it
  492. *
  493. * \param stream_callbacks Input stream callback operations.
  494. * \param stream Input stream to scan.
  495. * \param effort Effort to make when validating stream. Effort 0.0 does not even look at stream at all and effort 1.0 completely loads the file from stream. A lower effort requires less data to be loaded but only gives a rough estimate answer. Use an effort of 0.25 to only verify the header data of the module file.
  496. * \param logfunc Logging function where warning and errors are written. May be NULL.
  497. * \param loguser Logging function user context. Used to pass any user-defined data associated with this module to the logging function.
  498. * \param errfunc Error function to define error behaviour. May be NULL.
  499. * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function.
  500. * \param error Pointer to an integer where an error may get stored. May be NULL.
  501. * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL.
  502. * \return Probability between 0.0 and 1.0.
  503. * \remarks openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize() provide a simpler and faster interface that fits almost all use cases better. It is recommended to use openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize() instead of openmpt_could_open_probability().
  504. * \remarks openmpt_could_open_probability2() can return any value between 0.0 and 1.0. Only 0.0 and 1.0 are definitive answers, all values in between are just estimates. In general, any return value >0.0 means that you should try loading the file, and any value below 1.0 means that loading may fail. If you want a threshold above which you can be reasonably sure that libopenmpt will be able to load the file, use >=0.5. If you see the need for a threshold below which you could reasonably outright reject a file, use <0.25 (Note: Such a threshold for rejecting on the lower end is not recommended, but may be required for better integration into some other framework's probe scoring.).
  505. * \remarks openmpt_could_open_probability2() expects the complete file data to be eventually available to it, even if it is asked to just parse the header. Verification will be unreliable (both false positives and false negatives), if you pretend that the file is just some few bytes of initial data threshold in size. In order to really just access the first bytes of a file, check in your callback functions whether data or seeking is requested beyond your initial data threshold, and in that case, return an error. openmpt_could_open_probability2() will treat this as any other I/O error and return 0.0. You must not expect the correct result in this case. You instead must remember that it asked for more data than you currently want to provide to it and treat this situation as if openmpt_could_open_probability2() returned 0.5. \include libopenmpt_example_c_probe.c
  506. * \sa \ref libopenmpt_c_fileio
  507. * \sa openmpt_stream_callbacks
  508. * \sa openmpt_probe_file_header
  509. * \sa openmpt_probe_file_header_without_filesize
  510. * \since 0.3.0
  511. */
  512. 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 );
  513. /*! \brief Get recommended header size for successfull format probing
  514. *
  515. * \sa openmpt_probe_file_header()
  516. * \sa openmpt_probe_file_header_without_filesize()
  517. * \since 0.3.0
  518. */
  519. LIBOPENMPT_API size_t openmpt_probe_file_header_get_recommended_size(void);
  520. /*! Probe for module formats in openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize(). \since 0.3.0 */
  521. #define OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES 0x1ull
  522. /*! Probe for module-specific container formats in openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize(). \since 0.3.0 */
  523. #define OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS 0x2ull
  524. /*! Probe for the default set of formats in openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize(). \since 0.3.0 */
  525. #define OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT ( OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES | OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS )
  526. /*! Probe for no formats in openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize(). \since 0.3.0 */
  527. #define OPENMPT_PROBE_FILE_HEADER_FLAGS_NONE 0x0ull
  528. /*! Possible return values fo openmpt_probe_file_header() and openmpt_probe_file_header_without_filesize(). \since 0.3.0 */
  529. #define OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS 1
  530. /*! Possible return values fo openmpt_probe_file_header() and openmpt_probe_file_header_without_filesize(). \since 0.3.0 */
  531. #define OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE 0
  532. /*! Possible return values fo openmpt_probe_file_header() and openmpt_probe_file_header_without_filesize(). \since 0.3.0 */
  533. #define OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA (-1)
  534. /*! Possible return values fo openmpt_probe_file_header() and openmpt_probe_file_header_without_filesize(). \since 0.3.0 */
  535. #define OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR (-255)
  536. /*! \brief Probe the provided bytes from the beginning of a file for supported file format headers to find out whether libopenmpt might be able to open it
  537. *
  538. * \param flags Bit mask of OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES and OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS, or OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT.
  539. * \param data Beginning of the file data.
  540. * \param size Size of the beginning of the file data.
  541. * \param filesize Full size of the file data on disk.
  542. * \param logfunc Logging function where warning and errors are written. May be NULL.
  543. * \param loguser Logging function user context. Used to pass any user-defined data associated with this module to the logging function.
  544. * \param errfunc Error function to define error behaviour. May be NULL.
  545. * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function.
  546. * \param error Pointer to an integer where an error may get stored. May be NULL.
  547. * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL.
  548. * \remarks It is recommended to provide openmpt_probe_file_header_get_recommended_size() bytes of data for data and size. If the file is smaller, only provide the filesize amount and set size and filesize to the file's size.
  549. * \remarks openmpt_could_open_probability2() provides a more elaborate interface that might be required for special use cases. It is recommended to use openmpt_probe_file_header() though, if possible.
  550. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS The file will most likely be supported by libopenmpt.
  551. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE The file is not supported by libopenmpt.
  552. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA An answer could not be determined with the amount of data provided.
  553. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR An internal error occurred.
  554. * \sa openmpt_probe_file_header_get_recommended_size()
  555. * \sa openmpt_probe_file_header_without_filesize()
  556. * \sa openmpt_probe_file_header_from_stream()
  557. * \sa openmpt_could_open_probability2()
  558. * \since 0.3.0
  559. */
  560. 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 );
  561. /*! \brief Probe the provided bytes from the beginning of a file for supported file format headers to find out whether libopenmpt might be able to open it
  562. *
  563. * \param flags Bit mask of OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES and OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS, or OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT.
  564. * \param data Beginning of the file data.
  565. * \param size Size of the beginning of the file data.
  566. * \param logfunc Logging function where warning and errors are written. May be NULL.
  567. * \param loguser Logging function user context. Used to pass any user-defined data associated with this module to the logging function.
  568. * \param errfunc Error function to define error behaviour. May be NULL.
  569. * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function.
  570. * \param error Pointer to an integer where an error may get stored. May be NULL.
  571. * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL.
  572. * \remarks It is recommended to use openmpt_probe_file_header() and provide the acutal file's size as a parameter if at all possible. libopenmpt can provide more accurate answers if the filesize is known.
  573. * \remarks It is recommended to provide openmpt_probe_file_header_get_recommended_size() bytes of data for data and size. If the file is smaller, only provide the filesize amount and set size to the file's size.
  574. * \remarks openmpt_could_open_probability2() provides a more elaborate interface that might be required for special use cases. It is recommended to use openmpt_probe_file_header() though, if possible.
  575. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS The file will most likely be supported by libopenmpt.
  576. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE The file is not supported by libopenmpt.
  577. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA An answer could not be determined with the amount of data provided.
  578. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR An internal error occurred.
  579. * \sa openmpt_probe_file_header_get_recommended_size()
  580. * \sa openmpt_probe_file_header()
  581. * \sa openmpt_probe_file_header_from_stream()
  582. * \sa openmpt_could_open_probability2()
  583. * \since 0.3.0
  584. */
  585. 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 );
  586. /*! \brief Probe the provided bytes from the beginning of a file for supported file format headers to find out whether libopenmpt might be able to open it
  587. *
  588. * \param flags Bit mask of OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES and OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS, or OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT.
  589. * \param stream_callbacks Input stream callback operations.
  590. * \param stream Input stream to scan.
  591. * \param logfunc Logging function where warning and errors are written. May be NULL.
  592. * \param loguser Logging function user context. Used to pass any user-defined data associated with this module to the logging function.
  593. * \param errfunc Error function to define error behaviour. May be NULL.
  594. * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function.
  595. * \param error Pointer to an integer where an error may get stored. May be NULL.
  596. * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL.
  597. * \remarks The stream is left in an unspecified state when this function returns.
  598. * \remarks It is recommended to provide openmpt_probe_file_header_get_recommended_size() bytes of data for data and size. If the file is smaller, only provide the filesize amount and set size and filesize to the file's size.
  599. * \remarks openmpt_could_open_probability2() provides a more elaborate interface that might be required for special use cases. It is recommended to use openmpt_probe_file_header() though, if possible.
  600. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS The file will most likely be supported by libopenmpt.
  601. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE The file is not supported by libopenmpt.
  602. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA An answer could not be determined with the amount of data provided.
  603. * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR An internal error occurred.
  604. * \sa openmpt_probe_file_header_get_recommended_size()
  605. * \sa openmpt_probe_file_header()
  606. * \sa openmpt_probe_file_header_without_filesize()
  607. * \sa openmpt_could_open_probability2()
  608. * \since 0.3.0
  609. */
  610. 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 );
  611. /*! \brief Opaque type representing a libopenmpt module
  612. */
  613. typedef struct openmpt_module openmpt_module;
  614. typedef struct openmpt_module_initial_ctl {
  615. const char * ctl;
  616. const char * value;
  617. } openmpt_module_initial_ctl;
  618. /*! \brief Construct an openmpt_module
  619. *
  620. * \param stream_callbacks Input stream callback operations.
  621. * \param stream Input stream to load the module from.
  622. * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module. May be NULL.
  623. * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc)
  624. * \param ctls A map of initial ctl values. See openmpt_module_get_ctls()
  625. * \return A pointer to the constructed openmpt_module, or NULL on failure.
  626. * \remarks The input data can be discarded after an openmpt_module has been constructed successfully.
  627. * \sa openmpt_stream_callbacks
  628. * \sa \ref libopenmpt_c_fileio
  629. * \deprecated Please use openmpt_module_create2().
  630. */
  631. 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 );
  632. /*! \brief Construct an openmpt_module
  633. *
  634. * \param stream_callbacks Input stream callback operations.
  635. * \param stream Input stream to load the module from.
  636. * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module. May be NULL.
  637. * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc)
  638. * \param errfunc Error function to define error behaviour. May be NULL.
  639. * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function.
  640. * \param error Pointer to an integer where an error may get stored. May be NULL.
  641. * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL.
  642. * \param ctls A map of initial ctl values. See openmpt_module_get_ctls()
  643. * \return A pointer to the constructed openmpt_module, or NULL on failure.
  644. * \remarks The input data can be discarded after an openmpt_module has been constructed successfully.
  645. * \sa openmpt_stream_callbacks
  646. * \sa \ref libopenmpt_c_fileio
  647. * \since 0.3.0
  648. */
  649. 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 );
  650. /*! \brief Construct an openmpt_module
  651. *
  652. * \param filedata Data to load the module from.
  653. * \param filesize Amount of data available.
  654. * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module.
  655. * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc)
  656. * \param ctls A map of initial ctl values. See openmpt_module_get_ctls()
  657. * \return A pointer to the constructed openmpt_module, or NULL on failure.
  658. * \remarks The input data can be discarded after an openmpt_module has been constructed successfully.
  659. * \sa \ref libopenmpt_c_fileio
  660. * \deprecated Please use openmpt_module_create_from_memory2().
  661. */
  662. 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 );
  663. /*! \brief Construct an openmpt_module
  664. *
  665. * \param filedata Data to load the module from.
  666. * \param filesize Amount of data available.
  667. * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module.
  668. * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc)
  669. * \param errfunc Error function to define error behaviour. May be NULL.
  670. * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function.
  671. * \param error Pointer to an integer where an error may get stored. May be NULL.
  672. * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL.
  673. * \param ctls A map of initial ctl values. See openmpt_module_get_ctls()
  674. * \return A pointer to the constructed openmpt_module, or NULL on failure.
  675. * \remarks The input data can be discarded after an openmpt_module has been constructed successfully.
  676. * \sa \ref libopenmpt_c_fileio
  677. * \since 0.3.0
  678. */
  679. 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 );
  680. /*! \brief Unload a previously created openmpt_module from memory.
  681. *
  682. * \param mod The module to unload.
  683. */
  684. LIBOPENMPT_API void openmpt_module_destroy( openmpt_module * mod );
  685. /*! \brief Set logging function.
  686. *
  687. * Set the logging function of an already constructed openmpt_module.
  688. * \param mod The module handle to work on.
  689. * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module.
  690. * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc)
  691. * \since 0.3.0
  692. */
  693. LIBOPENMPT_API void openmpt_module_set_log_func( openmpt_module * mod, openmpt_log_func logfunc, void * loguser );
  694. /*! \brief Set error function.
  695. *
  696. * Set the error function of an already constructed openmpt_module.
  697. * \param mod The module handle to work on.
  698. * \param errfunc Error function to define error behaviour. May be NULL.
  699. * \param erruser Error function user context.
  700. * \since 0.3.0
  701. */
  702. LIBOPENMPT_API void openmpt_module_set_error_func( openmpt_module * mod, openmpt_error_func errfunc, void * erruser );
  703. /*! \brief Get last error.
  704. *
  705. * Return the error currently stored in an openmpt_module. The stored error is not cleared.
  706. * \param mod The module handle to work on.
  707. * \return The error currently stored.
  708. * \sa openmpt_module_error_get_last_message
  709. * \sa openmpt_module_error_set_last
  710. * \sa openmpt_module_error_clear
  711. * \since 0.3.0
  712. */
  713. LIBOPENMPT_API int openmpt_module_error_get_last( openmpt_module * mod );
  714. /*! \brief Get last error message.
  715. *
  716. * Return the error message currently stored in an openmpt_module. The stored error is not cleared.
  717. * \param mod The module handle to work on.
  718. * \return The error message currently stored.
  719. * \sa openmpt_module_error_set_last
  720. * \sa openmpt_module_error_clear
  721. * \since 0.3.0
  722. */
  723. LIBOPENMPT_API const char * openmpt_module_error_get_last_message( openmpt_module * mod );
  724. /*! \brief Set last error.
  725. *
  726. * Set the error currently stored in an openmpt_module.
  727. * \param mod The module handle to work on.
  728. * \param error Error to be stored.
  729. * \sa openmpt_module_error_get_last
  730. * \sa openmpt_module_error_clear
  731. * \since 0.3.0
  732. */
  733. LIBOPENMPT_API void openmpt_module_error_set_last( openmpt_module * mod, int error );
  734. /*! \brief Clear last error.
  735. *
  736. * Set the error currently stored in an openmpt_module to OPPENMPT_ERROR_OK.
  737. * \param mod The module handle to work on.
  738. * \sa openmpt_module_error_get_last
  739. * \sa openmpt_module_error_set_last
  740. * \since 0.3.0
  741. */
  742. LIBOPENMPT_API void openmpt_module_error_clear( openmpt_module * mod );
  743. /**
  744. * \defgroup openmpt_module_render_param Render param indices
  745. *
  746. * \brief Parameter index to use with openmpt_module_get_render_param() and openmpt_module_set_render_param()
  747. * @{
  748. */
  749. /*! \brief Master Gain
  750. *
  751. * The related value represents a relative gain in milliBel.\n
  752. * The default value is 0.\n
  753. * The supported value range is unlimited.\n
  754. */
  755. #define OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL 1
  756. /*! \brief Stereo Separation
  757. *
  758. * The related value represents the stereo separation generated by the libopenmpt mixer in percent.\n
  759. * The default value is 100.\n
  760. * The supported value range is [0,200].\n
  761. */
  762. #define OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT 2
  763. /*! \brief Interpolation Filter
  764. *
  765. * The related value represents the interpolation filter length used by the libopenmpt mixer.\n
  766. * The default value is 0, which indicates a recommended default value.\n
  767. * The supported value range is [0,inf). Values greater than the implementation limit are clamped to the maximum supported value.\n
  768. * Currently supported values:
  769. * - 0: internal default
  770. * - 1: no interpolation (zero order hold)
  771. * - 2: linear interpolation
  772. * - 4: cubic interpolation
  773. * - 8: windowed sinc with 8 taps
  774. */
  775. #define OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH 3
  776. /*! \brief Volume Ramping Strength
  777. *
  778. * The related value represents the amount of volume ramping done by the libopenmpt mixer.\n
  779. * The default value is -1, which indicates a recommended default value.\n
  780. * The meaningful value range is [-1..10].\n
  781. * A value of 0 completely disables volume ramping. This might cause clicks in sound output.\n
  782. * Higher values imply slower/softer volume ramps.
  783. */
  784. #define OPENMPT_MODULE_RENDER_VOLUMERAMPING_STRENGTH 4
  785. /** @}*/
  786. /**
  787. * \defgroup openmpt_module_command_index Pattern cell indices
  788. *
  789. * \brief Parameter index to use with openmpt_module_get_pattern_row_channel_command(), openmpt_module_format_pattern_row_channel_command() and openmpt_module_highlight_pattern_row_channel_command()
  790. * @{
  791. */
  792. #define OPENMPT_MODULE_COMMAND_NOTE 0
  793. #define OPENMPT_MODULE_COMMAND_INSTRUMENT 1
  794. #define OPENMPT_MODULE_COMMAND_VOLUMEEFFECT 2
  795. #define OPENMPT_MODULE_COMMAND_EFFECT 3
  796. #define OPENMPT_MODULE_COMMAND_VOLUME 4
  797. #define OPENMPT_MODULE_COMMAND_PARAMETER 5
  798. /** @}*/
  799. /*! \brief Select a sub-song from a multi-song module
  800. *
  801. * \param mod The module handle to work on.
  802. * \param subsong Index of the sub-song. -1 plays all sub-songs consecutively.
  803. * \return 1 on success, 0 on failure.
  804. * \sa openmpt_module_get_num_subsongs, openmpt_module_get_selected_subsong, openmpt_module_get_subsong_name
  805. * \remarks Whether subsong -1 (all subsongs consecutively), subsong 0 or some other subsong is selected by default, is an implementation detail and subject to change. If you do not want to care about subsongs, it is recommended to just not call openmpt_module_select_subsong() at all.
  806. */
  807. LIBOPENMPT_API int openmpt_module_select_subsong( openmpt_module * mod, int32_t subsong );
  808. /*! \brief Get currently selected sub-song from a multi-song module
  809. *
  810. * \param mod The module handle to work on.
  811. * \return Currently selected sub-song. -1 for all subsongs consecutively, 0 or greater for the current sub-song index.
  812. * \sa openmpt_module_get_num_subsongs, openmpt_module_select_subsong, openmpt_module_get_subsong_name
  813. * \since 0.3.0
  814. */
  815. LIBOPENMPT_API int32_t openmpt_module_get_selected_subsong( openmpt_module * mod );
  816. /*! \brief Set Repeat Count
  817. *
  818. * \param mod The module handle to work on.
  819. * \param repeat_count Repeat Count
  820. * - -1: repeat forever
  821. * - 0: play once, repeat zero times (the default)
  822. * - n>0: play once and repeat n times after that
  823. * \return 1 on success, 0 on failure.
  824. * \sa openmpt_module_get_repeat_count
  825. */
  826. LIBOPENMPT_API int openmpt_module_set_repeat_count( openmpt_module * mod, int32_t repeat_count );
  827. /*! \brief Get Repeat Count
  828. *
  829. * \param mod The module handle to work on.
  830. * \return Repeat Count
  831. * - -1: repeat forever
  832. * - 0: play once, repeat zero times (the default)
  833. * - n>0: play once and repeat n times after that
  834. * \sa openmpt_module_set_repeat_count
  835. */
  836. LIBOPENMPT_API int32_t openmpt_module_get_repeat_count( openmpt_module * mod );
  837. /*! \brief approximate song duration
  838. *
  839. * \param mod The module handle to work on.
  840. * \return Approximate duration of current sub-song in seconds.
  841. * \remarks The function may return infinity if the pattern data is too complex to evaluate.
  842. */
  843. LIBOPENMPT_API double openmpt_module_get_duration_seconds( openmpt_module * mod );
  844. /*! \brief Set approximate current song position
  845. *
  846. * \param mod The module handle to work on.
  847. * \param seconds Seconds to seek to. If seconds is out of range, the position gets set to song start or end respectively.
  848. * \return Approximate new song position in seconds.
  849. * \sa openmpt_module_get_position_seconds
  850. */
  851. LIBOPENMPT_API double openmpt_module_set_position_seconds( openmpt_module * mod, double seconds );
  852. /*! \brief Get current song position
  853. *
  854. * \param mod The module handle to work on.
  855. * \return Current song position in seconds.
  856. * \sa openmpt_module_set_position_seconds
  857. */
  858. LIBOPENMPT_API double openmpt_module_get_position_seconds( openmpt_module * mod );
  859. /*! \brief Set approximate current song position
  860. *
  861. * If order or row are out of range, to position is not modified and the current position is returned.
  862. * \param mod The module handle to work on.
  863. * \param order Pattern order number to seek to.
  864. * \param row Pattern row number to seek to.
  865. * \return Approximate new song position in seconds.
  866. * \sa openmpt_module_set_position_seconds
  867. * \sa openmpt_module_get_position_seconds
  868. */
  869. LIBOPENMPT_API double openmpt_module_set_position_order_row( openmpt_module * mod, int32_t order, int32_t row );
  870. /*! \brief Get render parameter
  871. *
  872. * \param mod The module handle to work on.
  873. * \param param Parameter to query. See \ref openmpt_module_render_param
  874. * \param value Pointer to the variable that receives the current value of the parameter.
  875. * \return 1 on success, 0 on failure (invalid param or value is NULL).
  876. * \sa OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL
  877. * \sa OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT
  878. * \sa OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH
  879. * \sa OPENMPT_MODULE_RENDER_VOLUMERAMPING_STRENGTH
  880. * \sa openmpt_module_set_render_param
  881. */
  882. LIBOPENMPT_API int openmpt_module_get_render_param( openmpt_module * mod, int param, int32_t * value );
  883. /*! \brief Set render parameter
  884. *
  885. * \param mod The module handle to work on.
  886. * \param param Parameter to set. See \ref openmpt_module_render_param
  887. * \param value The value to set param to.
  888. * \return 1 on success, 0 on failure (invalid param).
  889. * \sa OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL
  890. * \sa OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT
  891. * \sa OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH
  892. * \sa OPENMPT_MODULE_RENDER_VOLUMERAMPING_STRENGTH
  893. * \sa openmpt_module_get_render_param
  894. */
  895. LIBOPENMPT_API int openmpt_module_set_render_param( openmpt_module * mod, int param, int32_t value );
  896. /*@{*/
  897. /*! \brief Render audio data
  898. *
  899. * \param mod The module handle to work on.
  900. * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced.
  901. * \param count Number of audio frames to render per channel.
  902. * \param mono Pointer to a buffer of at least count elements that receives the mono/center output.
  903. * \return The number of frames actually rendered.
  904. * \retval 0 The end of song has been reached.
  905. * \remarks The output buffers are only written to up to the returned number of elements.
  906. * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module.
  907. * \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping.
  908. * \sa \ref libopenmpt_c_outputformat
  909. */
  910. LIBOPENMPT_API size_t openmpt_module_read_mono( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * mono );
  911. /*! \brief Render audio data
  912. *
  913. * \param mod The module handle to work on.
  914. * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced.
  915. * \param count Number of audio frames to render per channel.
  916. * \param left Pointer to a buffer of at least count elements that receives the left output.
  917. * \param right Pointer to a buffer of at least count elements that receives the right output.
  918. * \return The number of frames actually rendered.
  919. * \retval 0 The end of song has been reached.
  920. * \remarks The output buffers are only written to up to the returned number of elements.
  921. * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module.
  922. * \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping.
  923. * \sa \ref libopenmpt_c_outputformat
  924. */
  925. LIBOPENMPT_API size_t openmpt_module_read_stereo( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * left, int16_t * right );
  926. /*! \brief Render audio data
  927. *
  928. * \param mod The module handle to work on.
  929. * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced.
  930. * \param count Number of audio frames to render per channel.
  931. * \param left Pointer to a buffer of at least count elements that receives the left output.
  932. * \param right Pointer to a buffer of at least count elements that receives the right output.
  933. * \param rear_left Pointer to a buffer of at least count elements that receives the rear left output.
  934. * \param rear_right Pointer to a buffer of at least count elements that receives the rear right output.
  935. * \return The number of frames actually rendered.
  936. * \retval 0 The end of song has been reached.
  937. * \remarks The output buffers are only written to up to the returned number of elements.
  938. * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module.
  939. * \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping.
  940. * \sa \ref libopenmpt_c_outputformat
  941. */
  942. 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 );
  943. /*! \brief Render audio data
  944. *
  945. * \param mod The module handle to work on.
  946. * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced.
  947. * \param count Number of audio frames to render per channel.
  948. * \param mono Pointer to a buffer of at least count elements that receives the mono/center output.
  949. * \return The number of frames actually rendered.
  950. * \retval 0 The end of song has been reached.
  951. * \remarks The output buffers are only written to up to the returned number of elements.
  952. * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module.
  953. * \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot.
  954. * \sa \ref libopenmpt_c_outputformat
  955. */
  956. LIBOPENMPT_API size_t openmpt_module_read_float_mono( openmpt_module * mod, int32_t samplerate, size_t count, float * mono );
  957. /*! \brief Render audio data
  958. *
  959. * \param mod The module handle to work on.
  960. * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced.
  961. * \param count Number of audio frames to render per channel.
  962. * \param left Pointer to a buffer of at least count elements that receives the left output.
  963. * \param right Pointer to a buffer of at least count elements that receives the right output.
  964. * \return The number of frames actually rendered.
  965. * \retval 0 The end of song has been reached.
  966. * \remarks The output buffers are only written to up to the returned number of elements.
  967. * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module.
  968. * \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot.
  969. * \sa \ref libopenmpt_c_outputformat
  970. */
  971. LIBOPENMPT_API size_t openmpt_module_read_float_stereo( openmpt_module * mod, int32_t samplerate, size_t count, float * left, float * right );
  972. /*! \brief Render audio data
  973. *
  974. * \param mod The module handle to work on.
  975. * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced.
  976. * \param count Number of audio frames to render per channel.
  977. * \param left Pointer to a buffer of at least count elements that receives the left output.
  978. * \param right Pointer to a buffer of at least count elements that receives the right output.
  979. * \param rear_left Pointer to a buffer of at least count elements that receives the rear left output.
  980. * \param rear_right Pointer to a buffer of at least count elements that receives the rear right output.
  981. * \return The number of frames actually rendered.
  982. * \retval 0 The end of song has been reached.
  983. * \remarks The output buffers are only written to up to the returned number of elements.
  984. * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module.
  985. * \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot.
  986. * \sa \ref libopenmpt_c_outputformat
  987. */
  988. 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 );
  989. /*! \brief Render audio data
  990. *
  991. * \param mod The module handle to work on.
  992. * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced.
  993. * \param count Number of audio frames to render per channel.
  994. * \param interleaved_stereo Pointer to a buffer of at least count*2 elements that receives the interleaved stereo output in the order (L,R).
  995. * \return The number of frames actually rendered.
  996. * \retval 0 The end of song has been reached.
  997. * \remarks The output buffers are only written to up to the returned number of elements.
  998. * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module.
  999. * \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping.
  1000. * \sa \ref libopenmpt_c_outputformat
  1001. */
  1002. LIBOPENMPT_API size_t openmpt_module_read_interleaved_stereo( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * interleaved_stereo );
  1003. /*! \brief Render audio data
  1004. *
  1005. * \param mod The module handle to work on.
  1006. * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced.
  1007. * \param count Number of audio frames to render per channel.
  1008. * \param interleaved_quad Pointer to a buffer of at least count*4 elements that receives the interleaved quad surround output in the order (L,R,RL,RR).
  1009. * \return The number of frames actually rendered.
  1010. * \retval 0 The end of song has been reached.
  1011. * \remarks The output buffers are only written to up to the returned number of elements.
  1012. * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module.
  1013. * \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping.
  1014. * \sa \ref libopenmpt_c_outputformat
  1015. */
  1016. LIBOPENMPT_API size_t openmpt_module_read_interleaved_quad( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * interleaved_quad );
  1017. /*! \brief Render audio data
  1018. *
  1019. * \param mod The module handle to work on.
  1020. * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced.
  1021. * \param count Number of audio frames to render per channel.
  1022. * \param interleaved_stereo Pointer to a buffer of at least count*2 elements that receives the interleaved stereo output in the order (L,R).
  1023. * \return The number of frames actually rendered.
  1024. * \retval 0 The end of song has been reached.
  1025. * \remarks The output buffers are only written to up to the returned number of elements.
  1026. * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module.
  1027. * \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot.
  1028. * \sa \ref libopenmpt_c_outputformat
  1029. */
  1030. LIBOPENMPT_API size_t openmpt_module_read_interleaved_float_stereo( openmpt_module * mod, int32_t samplerate, size_t count, float * interleaved_stereo );
  1031. /*! \brief Render audio data
  1032. *
  1033. * \param mod The module handle to work on.
  1034. * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced.
  1035. * \param count Number of audio frames to render per channel.
  1036. * \param interleaved_quad Pointer to a buffer of at least count*4 elements that receives the interleaved quad surround output in the order (L,R,RL,RR).
  1037. * \return The number of frames actually rendered.
  1038. * \retval 0 The end of song has been reached.
  1039. * \remarks The output buffers are only written to up to the returned number of elements.
  1040. * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module.
  1041. * \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot.
  1042. * \sa \ref libopenmpt_c_outputformat
  1043. */
  1044. LIBOPENMPT_API size_t openmpt_module_read_interleaved_float_quad( openmpt_module * mod, int32_t samplerate, size_t count, float * interleaved_quad );
  1045. /*@}*/
  1046. /*! \brief Get the list of supported metadata item keys
  1047. *
  1048. * \param mod The module handle to work on.
  1049. * \return Metadata item keys supported by openmpt_module_get_metadata, as a semicolon-separated list.
  1050. * \sa openmpt_module_get_metadata
  1051. */
  1052. LIBOPENMPT_API const char * openmpt_module_get_metadata_keys( openmpt_module * mod );
  1053. /*! \brief Get a metadata item value
  1054. *
  1055. * \param mod The module handle to work on.
  1056. * \param key Metadata item key to query. Use openmpt_module_get_metadata_keys to check for available keys.
  1057. * Possible keys are:
  1058. * - type: Module format extension (e.g. it) or another similar identifier for modules formats that typically do not use a file extension
  1059. * - type_long: Format name associated with the module format (e.g. Impulse Tracker)
  1060. * - originaltype: Module format extension (e.g. it) of the original module in case the actual type is a converted format (e.g. mo3 or gdm)
  1061. * - originaltype_long: Format name associated with the module format (e.g. Impulse Tracker) of the original module in case the actual type is a converted format (e.g. mo3 or gdm)
  1062. * - container: Container format the module file is embedded in, if any (e.g. umx)
  1063. * - container_long: Full container name if the module is embedded in a container (e.g. Unreal Music)
  1064. * - tracker: Tracker that was (most likely) used to save the module file, if known
  1065. * - artist: Author of the module
  1066. * - title: Module title
  1067. * - date: Date the module was last saved, in ISO-8601 format.
  1068. * - message: Song message. If the song message is empty or the module format does not support song messages, a list of instrument and sample names is returned instead.
  1069. * - message_raw: Song message. If the song message is empty or the module format does not support song messages, an empty string is returned.
  1070. * - warnings: A list of warnings that were generated while loading the module.
  1071. * \return The associated value for key.
  1072. * \sa openmpt_module_get_metadata_keys
  1073. */
  1074. LIBOPENMPT_API const char * openmpt_module_get_metadata( openmpt_module * mod, const char * key );
  1075. /*! Get the current estimated beats per minute (BPM).
  1076. *
  1077. * \param mod The module handle to work on.
  1078. * \remarks Many module formats lack time signature metadata. It is common that this estimate is off by a factor of two, but other multipliers are also possible.
  1079. * \remarks Due to the nature of how module tempo works, the estimate may change slightly after switching libopenmpt's output to a different sample rate.
  1080. * \return The current estimated BPM.
  1081. */
  1082. LIBOPENMPT_API double openmpt_module_get_current_estimated_bpm( openmpt_module * mod );
  1083. /*! \brief Get the current speed
  1084. *
  1085. * \param mod The module handle to work on.
  1086. * \return The current speed in ticks per row.
  1087. */
  1088. LIBOPENMPT_API int32_t openmpt_module_get_current_speed( openmpt_module * mod );
  1089. /*! \brief Get the current tempo
  1090. *
  1091. * \param mod The module handle to work on.
  1092. * \return The current tempo in tracker units. The exact meaning of this value depends on the tempo mode being used.
  1093. */
  1094. LIBOPENMPT_API int32_t openmpt_module_get_current_tempo( openmpt_module * mod );
  1095. /*! \brief Get the current order
  1096. *
  1097. * \param mod The module handle to work on.
  1098. * \return The current order at which the module is being played back.
  1099. */
  1100. LIBOPENMPT_API int32_t openmpt_module_get_current_order( openmpt_module * mod );
  1101. /*! \brief Get the current pattern
  1102. *
  1103. * \param mod The module handle to work on.
  1104. * \return The current pattern that is being played.
  1105. */
  1106. LIBOPENMPT_API int32_t openmpt_module_get_current_pattern( openmpt_module * mod );
  1107. /*! \brief Get the current row
  1108. *
  1109. * \param mod The module handle to work on.
  1110. * \return The current row at which the current pattern is being played.
  1111. */
  1112. LIBOPENMPT_API int32_t openmpt_module_get_current_row( openmpt_module * mod );
  1113. /*! \brief Get the current amount of playing channels.
  1114. *
  1115. * \param mod The module handle to work on.
  1116. * \return The amount of sample channels that are currently being rendered.
  1117. */
  1118. LIBOPENMPT_API int32_t openmpt_module_get_current_playing_channels( openmpt_module * mod );
  1119. /*! \brief Get an approximate indication of the channel volume.
  1120. *
  1121. * \param mod The module handle to work on.
  1122. * \param channel The channel whose volume should be retrieved.
  1123. * \return The approximate channel volume.
  1124. * \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account.
  1125. */
  1126. LIBOPENMPT_API float openmpt_module_get_current_channel_vu_mono( openmpt_module * mod, int32_t channel );
  1127. /*! \brief Get an approximate indication of the channel volume on the front-left speaker.
  1128. *
  1129. * \param mod The module handle to work on.
  1130. * \param channel The channel whose volume should be retrieved.
  1131. * \return The approximate channel volume.
  1132. * \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account.
  1133. */
  1134. LIBOPENMPT_API float openmpt_module_get_current_channel_vu_left( openmpt_module * mod, int32_t channel );
  1135. /*! \brief Get an approximate indication of the channel volume on the front-right speaker.
  1136. *
  1137. * \param mod The module handle to work on.
  1138. * \param channel The channel whose volume should be retrieved.
  1139. * \return The approximate channel volume.
  1140. * \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account.
  1141. */
  1142. LIBOPENMPT_API float openmpt_module_get_current_channel_vu_right( openmpt_module * mod, int32_t channel );
  1143. /*! \brief Get an approximate indication of the channel volume on the rear-left speaker.
  1144. *
  1145. * \param mod The module handle to work on.
  1146. * \param channel The channel whose volume should be retrieved.
  1147. * \return The approximate channel volume.
  1148. * \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account.
  1149. */
  1150. LIBOPENMPT_API float openmpt_module_get_current_channel_vu_rear_left( openmpt_module * mod, int32_t channel );
  1151. /*! \brief Get an approximate indication of the channel volume on the rear-right speaker.
  1152. *
  1153. * \param mod The module handle to work on.
  1154. * \param channel The channel whose volume should be retrieved.
  1155. * \return The approximate channel volume.
  1156. * \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account.
  1157. */
  1158. LIBOPENMPT_API float openmpt_module_get_current_channel_vu_rear_right( openmpt_module * mod, int32_t channel );
  1159. /*! \brief Get the number of sub-songs
  1160. *
  1161. * \param mod The module handle to work on.
  1162. * \return The number of sub-songs in the module. This includes any "hidden" songs (songs that share the same sequence, but start at different order indices) and "normal" sub-songs or "sequences" (if the format supports them).
  1163. * \sa openmpt_module_get_subsong_name, openmpt_module_select_subsong, openmpt_module_get_selected_subsong
  1164. */
  1165. LIBOPENMPT_API int32_t openmpt_module_get_num_subsongs( openmpt_module * mod );
  1166. /*! \brief Get the number of pattern channels
  1167. *
  1168. * \param mod The module handle to work on.
  1169. * \return The number of pattern channels in the module. Not all channels do necessarily contain data.
  1170. * \remarks The number of pattern channels is completely independent of the number of output channels. libopenmpt can render modules in mono, stereo or quad surround, but the choice of which of the three modes to use must not be made based on the return value of this function, which may be any positive integer amount. Only use this function for informational purposes.
  1171. */
  1172. LIBOPENMPT_API int32_t openmpt_module_get_num_channels( openmpt_module * mod );
  1173. /*! \brief Get the number of orders
  1174. *
  1175. * \param mod The module handle to work on.
  1176. * \return The number of orders in the current sequence of the module.
  1177. */
  1178. LIBOPENMPT_API int32_t openmpt_module_get_num_orders( openmpt_module * mod );
  1179. /*! \brief Get the number of patterns
  1180. *
  1181. * \param mod The module handle to work on.
  1182. * \return The number of distinct patterns in the module.
  1183. */
  1184. LIBOPENMPT_API int32_t openmpt_module_get_num_patterns( openmpt_module * mod );
  1185. /*! \brief Get the number of instruments
  1186. *
  1187. * \param mod The module handle to work on.
  1188. * \return The number of instrument slots in the module. Instruments are a layer on top of samples, and are not supported by all module formats.
  1189. */
  1190. LIBOPENMPT_API int32_t openmpt_module_get_num_instruments( openmpt_module * mod );
  1191. /*! \brief Get the number of samples
  1192. *
  1193. * \param mod The module handle to work on.
  1194. * \return The number of sample slots in the module.
  1195. */
  1196. LIBOPENMPT_API int32_t openmpt_module_get_num_samples( openmpt_module * mod );
  1197. /*! \brief Get a sub-song name
  1198. *
  1199. * \param mod The module handle to work on.
  1200. * \param index The sub-song whose name should be retrieved
  1201. * \return The sub-song name.
  1202. * \sa openmpt_module_get_num_subsongs, openmpt_module_select_subsong, openmpt_module_get_selected_subsong
  1203. */
  1204. LIBOPENMPT_API const char * openmpt_module_get_subsong_name( openmpt_module * mod, int32_t index );
  1205. /*! \brief Get a channel name
  1206. *
  1207. * \param mod The module handle to work on.
  1208. * \param index The channel whose name should be retrieved
  1209. * \return The channel name.
  1210. * \sa openmpt_module_get_num_channels
  1211. */
  1212. LIBOPENMPT_API const char * openmpt_module_get_channel_name( openmpt_module * mod, int32_t index );
  1213. /*! \brief Get an order name
  1214. *
  1215. * \param mod The module handle to work on.
  1216. * \param index The order whose name should be retrieved
  1217. * \return The order name.
  1218. * \sa openmpt_module_get_num_orders
  1219. */
  1220. LIBOPENMPT_API const char * openmpt_module_get_order_name( openmpt_module * mod, int32_t index );
  1221. /*! \brief Get a pattern name
  1222. *
  1223. * \param mod The module handle to work on.
  1224. * \param index The pattern whose name should be retrieved
  1225. * \return The pattern name.
  1226. * \sa openmpt_module_get_num_patterns
  1227. */
  1228. LIBOPENMPT_API const char * openmpt_module_get_pattern_name( openmpt_module * mod, int32_t index );
  1229. /*! \brief Get an instrument name
  1230. *
  1231. * \param mod The module handle to work on.
  1232. * \param index The instrument whose name should be retrieved
  1233. * \return The instrument name.
  1234. * \sa openmpt_module_get_num_instruments
  1235. */
  1236. LIBOPENMPT_API const char * openmpt_module_get_instrument_name( openmpt_module * mod, int32_t index );
  1237. /*! \brief Get a sample name
  1238. *
  1239. * \param mod The module handle to work on.
  1240. * \param index The sample whose name should be retrieved
  1241. * \return The sample name.
  1242. * \sa openmpt_module_get_num_samples
  1243. */
  1244. LIBOPENMPT_API const char * openmpt_module_get_sample_name( openmpt_module * mod, int32_t index );
  1245. /*! \brief Get pattern at order position
  1246. *
  1247. * \param mod The module handle to work on.
  1248. * \param order The order item whose pattern index should be retrieved.
  1249. * \return The pattern index found at the given order position of the current sequence.
  1250. */
  1251. LIBOPENMPT_API int32_t openmpt_module_get_order_pattern( openmpt_module * mod, int32_t order );
  1252. /*! \brief Get the number of rows in a pattern
  1253. *
  1254. * \param mod The module handle to work on.
  1255. * \param pattern The pattern whose row count should be retrieved.
  1256. * \return The number of rows in the given pattern. If the pattern does not exist, 0 is returned.
  1257. */
  1258. LIBOPENMPT_API int32_t openmpt_module_get_pattern_num_rows( openmpt_module * mod, int32_t pattern );
  1259. /*! \brief Get raw pattern content
  1260. *
  1261. * \param mod The module handle to work on.
  1262. * \param pattern The pattern whose data should be retrieved.
  1263. * \param row The row from which the data should be retrieved.
  1264. * \param channel The channel from which the data should be retrieved.
  1265. * \param command The cell index at which the data should be retrieved. See \ref openmpt_module_command_index
  1266. * \return The internal, raw pattern data at the given pattern position.
  1267. */
  1268. 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 );
  1269. /*! \brief Get formatted (human-readable) pattern content
  1270. *
  1271. * \param mod The module handle to work on.
  1272. * \param pattern The pattern whose data should be retrieved.
  1273. * \param row The row from which the data should be retrieved.
  1274. * \param channel The channel from which the data should be retrieved.
  1275. * \param command The cell index at which the data should be retrieved.
  1276. * \return The formatted pattern data at the given pattern position. See \ref openmpt_module_command_index
  1277. * \sa openmpt_module_highlight_pattern_row_channel_command
  1278. */
  1279. 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 );
  1280. /*! \brief Get highlighting information for formatted pattern content
  1281. *
  1282. * \param mod The module handle to work on.
  1283. * \param pattern The pattern whose data should be retrieved.
  1284. * \param row The row from which the data should be retrieved.
  1285. * \param channel The channel from which the data should be retrieved.
  1286. * \param command The cell index at which the data should be retrieved. See \ref openmpt_module_command_index
  1287. * \return The highlighting string for the formatted pattern data as retrieved by openmpt_module_get_pattern_row_channel_command at the given pattern position.
  1288. * \remarks The returned string will map each character position of the string returned by openmpt_module_get_pattern_row_channel_command to a highlighting instruction.
  1289. * Possible highlighting characters are:
  1290. * - " " : empty/space
  1291. * - "." : empty/dot
  1292. * - "n" : generic note
  1293. * - "m" : special note
  1294. * - "i" : generic instrument
  1295. * - "u" : generic volume column effect
  1296. * - "v" : generic volume column parameter
  1297. * - "e" : generic effect column effect
  1298. * - "f" : generic effect column parameter
  1299. * \sa openmpt_module_get_pattern_row_channel_command
  1300. */
  1301. 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 );
  1302. /*! \brief Get formatted (human-readable) pattern content
  1303. *
  1304. * \param mod The module handle to work on.
  1305. * \param pattern The pattern whose data should be retrieved.
  1306. * \param row The row from which the data should be retrieved.
  1307. * \param channel The channel from which the data should be retrieved.
  1308. * \param width The maximum number of characters the string should contain. 0 means no limit.
  1309. * \param pad If true, the string will be resized to the exact length provided in the width parameter.
  1310. * \return The formatted pattern data at the given pattern position.
  1311. * \sa openmpt_module_highlight_pattern_row_channel
  1312. */
  1313. 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 );
  1314. /*! \brief Get highlighting information for formatted pattern content
  1315. *
  1316. * \param mod The module handle to work on.
  1317. * \param pattern The pattern whose data should be retrieved.
  1318. * \param row The row from which the data should be retrieved.
  1319. * \param channel The channel from which the data should be retrieved.
  1320. * \param width The maximum number of characters the string should contain. 0 means no limit.
  1321. * \param pad If true, the string will be resized to the exact length provided in the width parameter.
  1322. * \return The highlighting string for the formatted pattern data as retrieved by openmpt_module_format_pattern_row_channel at the given pattern position.
  1323. * \sa openmpt_module_format_pattern_row_channel
  1324. */
  1325. 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 );
  1326. /*! \brief Retrieve supported ctl keys
  1327. *
  1328. * \param mod The module handle to work on.
  1329. * \return A semicolon-separated list containing all supported ctl keys.
  1330. * \remarks Currently supported ctl values are:
  1331. * - load.skip_samples (boolean): Set to "1" to avoid loading samples into memory
  1332. * - load.skip_patterns (boolean): Set to "1" to avoid loading patterns into memory
  1333. * - load.skip_plugins (boolean): Set to "1" to avoid loading plugins
  1334. * - load.skip_subsongs_init (boolean): Set to "1" to avoid pre-initializing sub-songs. Skipping results in faster module loading but slower seeking.
  1335. * - seek.sync_samples (boolean): Set to "1" to sync sample playback when using openmpt_module_set_position_seconds or openmpt_module_set_position_order_row.
  1336. * - subsong (integer): The current subsong. Setting it has identical semantics as openmpt_module_select_subsong(), getting it returns the currently selected subsong.
  1337. * - play.at_end (text): Chooses the behaviour when the end of song is reached:
  1338. * - "fadeout": Fades the module out for a short while. Subsequent reads after the fadeout will return 0 rendered frames.
  1339. * - "continue": Returns 0 rendered frames when the song end is reached. Subsequent reads will continue playing from the song start or loop start.
  1340. * - "stop": Returns 0 rendered frames when the song end is reached. Subsequent reads will return 0 rendered frames.
  1341. * - play.tempo_factor (floatingpoint): Set a floating point tempo factor. "1.0" is the default tempo.
  1342. * - play.pitch_factor (floatingpoint): Set a floating point pitch factor. "1.0" is the default pitch.
  1343. * - render.resampler.emulate_amiga (boolean): Set to "1" to enable the Amiga resampler for Amiga modules. This emulates the sound characteristics of the Paula chip and overrides the selected interpolation filter. Non-Amiga module formats are not affected by this setting.
  1344. * - render.resampler.emulate_amiga_type (string): Configures the filter type to use for the Amiga resampler. Supported values are:
  1345. * - "auto": Filter type is chosen by the library and might change. This is the default.
  1346. * - "a500": Amiga A500 filter.
  1347. * - "a1200": Amiga A1200 filter.
  1348. * - "unfiltered": BLEP synthesis without model-specific filters. The LED filter is ignored by this setting. This filter mode is considered to be experimental and might change in the future.
  1349. * - render.opl.volume_factor (floatingpoint): Set volume factor applied to synthesized OPL sounds, relative to the default OPL volume.
  1350. * - dither (integer): Set the dither algorithm that is used for the 16 bit versions of openmpt_module_read. Supported values are:
  1351. * - 0: No dithering.
  1352. * - 1: Default mode. Chosen by OpenMPT code, might change.
  1353. * - 2: Rectangular, 0.5 bit depth, no noise shaping (original ModPlug Tracker).
  1354. * - 3: Rectangular, 1 bit depth, simple 1st order noise shaping
  1355. */
  1356. LIBOPENMPT_API const char * openmpt_module_get_ctls( openmpt_module * mod );
  1357. /*! \brief Get current ctl value
  1358. *
  1359. * \param mod The module handle to work on.
  1360. * \param ctl The ctl key whose value should be retrieved.
  1361. * \return The associated ctl value, or NULL on failure.
  1362. * \sa openmpt_module_get_ctls
  1363. * \deprecated Please use openmpt_module_ctl_get_boolean(), openmpt_module_ctl_get_integer(), openmpt_module_ctl_get_floatingpoint(), or openmpt_module_ctl_get_text().
  1364. */
  1365. LIBOPENMPT_API LIBOPENMPT_DEPRECATED const char * openmpt_module_ctl_get( openmpt_module * mod, const char * ctl );
  1366. /*! \brief Get current ctl boolean value
  1367. *
  1368. * \param mod The module handle to work on.
  1369. * \param ctl The ctl key whose value should be retrieved.
  1370. * \return The associated ctl value, or NULL on failure.
  1371. * \sa openmpt_module_get_ctls
  1372. * \since 0.5.0
  1373. */
  1374. LIBOPENMPT_API int openmpt_module_ctl_get_boolean( openmpt_module * mod, const char * ctl );
  1375. /*! \brief Get current ctl integer value
  1376. *
  1377. * \param mod The module handle to work on.
  1378. * \param ctl The ctl key whose value should be retrieved.
  1379. * \return The associated ctl value, or NULL on failure.
  1380. * \sa openmpt_module_get_ctls
  1381. * \since 0.5.0
  1382. */
  1383. LIBOPENMPT_API int64_t openmpt_module_ctl_get_integer( openmpt_module * mod, const char * ctl );
  1384. /*! \brief Get current ctl floatingpoint value
  1385. *
  1386. * \param mod The module handle to work on.
  1387. * \param ctl The ctl key whose value should be retrieved.
  1388. * \return The associated ctl value, or NULL on failure.
  1389. * \sa openmpt_module_get_ctls
  1390. * \since 0.5.0
  1391. */
  1392. LIBOPENMPT_API double openmpt_module_ctl_get_floatingpoint( openmpt_module * mod, const char * ctl );
  1393. /*! \brief Get current ctl string value
  1394. *
  1395. * \param mod The module handle to work on.
  1396. * \param ctl The ctl key whose value should be retrieved.
  1397. * \return The associated ctl value, or NULL on failure.
  1398. * \sa openmpt_module_get_ctls
  1399. * \since 0.5.0
  1400. */
  1401. LIBOPENMPT_API const char * openmpt_module_ctl_get_text( openmpt_module * mod, const char * ctl );
  1402. /*! \brief Set ctl value
  1403. *
  1404. * \param mod The module handle to work on.
  1405. * \param ctl The ctl key whose value should be set.
  1406. * \param value The value that should be set.
  1407. * \return 1 if successful, 0 in case the value is not sensible (e.g. negative tempo factor) or the ctl is not recognized.
  1408. * \sa openmpt_module_get_ctls
  1409. * \deprecated Please use openmpt_module_ctl_set_boolean(), openmpt_module_ctl_set_integer(), openmpt_module_ctl_set_floatingpoint(), or openmpt_module_ctl_set_text().
  1410. */
  1411. LIBOPENMPT_API LIBOPENMPT_DEPRECATED int openmpt_module_ctl_set( openmpt_module * mod, const char * ctl, const char * value );
  1412. /*! \brief Set ctl boolean value
  1413. *
  1414. * \param mod The module handle to work on.
  1415. * \param ctl The ctl key whose value should be set.
  1416. * \param value The value that should be set.
  1417. * \return 1 if successful, 0 in case the value is not sensible (e.g. negative tempo factor) or the ctl is not recognized.
  1418. * \sa openmpt_module_get_ctls
  1419. * \since 0.5.0
  1420. */
  1421. LIBOPENMPT_API int openmpt_module_ctl_set_boolean( openmpt_module * mod, const char * ctl, int value );
  1422. /*! \brief Set ctl integer value
  1423. *
  1424. * \param mod The module handle to work on.
  1425. * \param ctl The ctl key whose value should be set.
  1426. * \param value The value that should be set.
  1427. * \return 1 if successful, 0 in case the value is not sensible (e.g. negative tempo factor) or the ctl is not recognized.
  1428. * \sa openmpt_module_get_ctls
  1429. * \since 0.5.0
  1430. */
  1431. LIBOPENMPT_API int openmpt_module_ctl_set_integer( openmpt_module * mod, const char * ctl, int64_t value );
  1432. /*! \brief Set ctl floatingpoint value
  1433. *
  1434. * \param mod The module handle to work on.
  1435. * \param ctl The ctl key whose value should be set.
  1436. * \param value The value that should be set.
  1437. * \return 1 if successful, 0 in case the value is not sensible (e.g. negative tempo factor) or the ctl is not recognized.
  1438. * \sa openmpt_module_get_ctls
  1439. * \since 0.5.0
  1440. */
  1441. LIBOPENMPT_API int openmpt_module_ctl_set_floatingpoint( openmpt_module * mod, const char * ctl, double value );
  1442. /*! \brief Set ctl string value
  1443. *
  1444. * \param mod The module handle to work on.
  1445. * \param ctl The ctl key whose value should be set.
  1446. * \param value The value that should be set.
  1447. * \return 1 if successful, 0 in case the value is not sensible (e.g. negative tempo factor) or the ctl is not recognized.
  1448. * \sa openmpt_module_get_ctls
  1449. * \since 0.5.0
  1450. */
  1451. LIBOPENMPT_API int openmpt_module_ctl_set_text( openmpt_module * mod, const char * ctl, const char * value );
  1452. /* remember to add new functions to both C and C++ interfaces and to increase OPENMPT_API_VERSION_MINOR */
  1453. #ifdef __cplusplus
  1454. }
  1455. #endif
  1456. /*!
  1457. * @}
  1458. */
  1459. #endif /* LIBOPENMPT_H */