libopenmpt_ext.bi 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /'
  2. ' libopenmpt_ext.bi
  3. ' -----------------
  4. ' Purpose: libopenmpt public FreeBASIC interface for libopenmpt extensions
  5. ' Notes : (currently none)
  6. ' Authors: Johannes Schultz
  7. ' OpenMPT Devs
  8. ' The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
  9. '/
  10. #Pragma Once
  11. #Include Once "libopenmpt.bi"
  12. Extern "C"
  13. '* \brief Opaque type representing a libopenmpt extension module
  14. Type openmpt_module_ext
  15. opaque As Any Ptr
  16. End Type
  17. /'* \brief Construct an openmpt_module_ext
  18. \param stream_callbacks Input stream callback operations.
  19. \param stream Input stream to load the module from.
  20. \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module_ext. May be NULL.
  21. \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc)
  22. \param errfunc Error function to define error behaviour. May be NULL.
  23. \param erruser Error function user context.
  24. \param errorcode Pointer to an integer where an error may get stored. May be NULL.
  25. \param error_message Pointer to a string pointer where an error message may get stored. May be NULL.
  26. \param ctls A map of initial ctl values, see openmpt_module_get_ctls.
  27. \return A pointer to the constructed openmpt_module_ext, or NULL on failure.
  28. \remarks The input data can be discarded after an openmpt_module_ext has been constructed successfully.
  29. \sa openmpt_stream_callbacks
  30. \since 0.3.0
  31. '/
  32. Declare Function openmpt_module_ext_create(ByVal stream_callbacks As openmpt_stream_callbacks, ByVal stream As Any Ptr, ByVal logfunc As openmpt_log_func, ByVal loguser As Any Ptr, ByVal errfunc As openmpt_error_func, ByVal erruser As Any Ptr, ByVal Error As Long Ptr, ByVal error_message As Const ZString Ptr Ptr, ByVal ctls As Const openmpt_module_initial_ctl Ptr) As openmpt_module_ext Ptr
  33. /'* \brief Construct an openmpt_module_ext
  34. \param filedata Data to load the module from.
  35. \param filesize Amount of data available.
  36. \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module_ext.
  37. \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc)
  38. \param errfunc Error function to define error behaviour. May be NULL.
  39. \param erruser Error function user context.
  40. \param errorcode Pointer to an integer where an error may get stored. May be NULL.
  41. \param error_message Pointer to a string pointer where an error message may get stored. May be NULL.
  42. \param ctls A map of initial ctl values, see openmpt_module_get_ctls.
  43. \return A pointer to the constructed openmpt_module_ext, or NULL on failure.
  44. \remarks The input data can be discarded after an openmpt_module_ext has been constructed successfully.
  45. \since 0.3.0
  46. '/
  47. Declare Function openmpt_module_ext_create_from_memory(ByVal filedata As Const Any Ptr, ByVal filesize As UInteger, ByVal logfunc As openmpt_log_func, ByVal loguser As Any Ptr, ByVal errfunc As openmpt_error_func, ByVal erruser As Any Ptr, ByVal Error As Long Ptr, ByVal error_message As Const ZString Ptr Ptr, ByVal ctls As Const openmpt_module_initial_ctl Ptr) As openmpt_module_ext Ptr
  48. /'* \brief Unload a previously created openmpt_module_ext from memory.
  49. \param mod_ext The module to unload.
  50. \since 0.3.0
  51. '/
  52. Declare Sub openmpt_module_ext_destroy(ByVal mod_ext As openmpt_module_ext Ptr)
  53. /'* \brief Retrieve the openmpt_module handle from an openmpt_module_ext handle.
  54. \param mod_ext The extension module handle to convert
  55. \return An equivalent openmpt_module handle to pass to standard libopenmpt functions
  56. \since 0.3.0
  57. '/
  58. Declare Function openmpt_module_ext_get_module(ByVal mod_ext As openmpt_module_ext Ptr) As openmpt_module Ptr
  59. /'* Retrieve a libopenmpt extension.
  60. \param mod_ext The module handle to work on.
  61. \param interface_id The name of the extension interface to retrieve (e.g. LIBOPENMPT_EXT_C_INTERFACE_PATTERN_VIS).
  62. \param interface Appropriate structure of interface function pointers which is to be filled by this function (e.g. a pointer to a openmpt_module_ext_interface_pattern_vis structure).
  63. \param interface_size Size of the interface's structure of function pointers (e.g. sizeof(openmpt_module_ext_interface_pattern_vis)).
  64. \return 1 on success, 0 if the interface was not found.
  65. \since 0.3.0
  66. '/
  67. Declare Function openmpt_module_ext_get_interface(ByVal mod_ext As openmpt_module_ext Ptr, ByVal interface_id As Const ZString Ptr, ByVal interface As Any Ptr, ByVal interface_size As UInteger) As Long
  68. #define LIBOPENMPT_EXT_C_INTERFACE_PATTERN_VIS "pattern_vis"
  69. '* Pattern command type
  70. Const OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_UNKNOWN = 0
  71. Const OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_GENERAL = 1
  72. Const OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_GLOBAL = 2
  73. Const OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_VOLUME = 3
  74. Const OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_PANNING = 4
  75. Const OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_PITCH = 5
  76. Type openmpt_module_ext_interface_pattern_vis
  77. /'* Get pattern command type for pattern highlighting
  78. \param mod_ext The module handle to work on.
  79. \param pattern The pattern whose data should be retrieved.
  80. \param row The row from which the data should be retrieved.
  81. \param channel The channel from which the data should be retrieved.
  82. \return The command type in the effect column at the given pattern position (see OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_*)
  83. \sa get_pattern_row_channel_effect_type
  84. '/
  85. get_pattern_row_channel_volume_effect_type As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal pattern As Long, ByVal row As Long, ByVal channel As Long) As Long
  86. /'* Get pattern command type for pattern highlighting
  87. \param mod_ext The module handle to work on.
  88. \param pattern The pattern whose data should be retrieved.
  89. \param row The row from which the data should be retrieved.
  90. \param channel The channel from which the data should be retrieved.
  91. \return The command type in the effect column at the given pattern position (see OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_*)
  92. \sa get_pattern_row_channel_volume_effect_type
  93. '/
  94. get_pattern_row_channel_effect_type As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal pattern As Long, ByVal row As Long, ByVal channel As Long) As Long
  95. End Type
  96. #define LIBOPENMPT_EXT_C_INTERFACE_INTERACTIVE "interactive"
  97. Type openmpt_module_ext_interface_interactive
  98. /'* Set the current ticks per row (speed)
  99. \param mod_ext The module handle to work on.
  100. \param speed The new tick count in range [1, 65535].
  101. \throws openmpt::exception Throws an exception derived from openmpt::exception if the speed is outside the specified range.
  102. \return 1 on success, 0 on failure.
  103. \sa openmpt_module_get_current_speed
  104. '/
  105. set_current_speed As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal speed As Long) As Long
  106. /'* Set the current module tempo
  107. \param mod_ext The module handle to work on.
  108. \param tempo The new tempo in range [32, 512]. The exact meaning of the value depends on the tempo mode used by the module.
  109. \return 1 on success, 0 on failure.
  110. \remarks The tempo may be reset by pattern commands at any time. Use set_tempo_factor to apply a tempo factor that is independent of pattern commands.
  111. \sa openmpt_module_get_current_tempo
  112. '/
  113. set_current_tempo As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal tempo As Long) As Long
  114. /'* Set the current module tempo factor without affecting playback pitch
  115. \param mod_ext The module handle to work on.
  116. \param factor The new tempo factor in range ]0.0, 4.0] - 1.0 means unmodified tempo.
  117. \return 1 on success, 0 on failure.
  118. \remarks Modifying the tempo without applying the same pitch factor using set_pitch_factor may cause rhythmic samples (e.g. drum loops) to go out of sync.
  119. \sa openmpt_module_ext_interface_interactive.get_tempo_factor
  120. '/
  121. set_tempo_factor As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal factor As Double) As Long
  122. /'* Gets the current module tempo factor
  123. \param mod_ext The module handle to work on.
  124. \return The current tempo factor.
  125. \sa openmpt_module_ext_interface_interactive.set_tempo_factor
  126. '/
  127. get_tempo_factor As Function(ByVal mod_ext As openmpt_module_ext Ptr) As Double
  128. /'* Set the current module pitch factor without affecting playback speed
  129. \param mod_ext The module handle to work on.
  130. \param factor The new pitch factor in range ]0.0, 4.0] - 1.0 means unmodified pitch.
  131. \return 1 on success, 0 on failure.
  132. \remarks Modifying the pitch without applying the the same tempo factor using set_tempo_factor may cause rhythmic samples (e.g. drum loops) to go out of sync.
  133. \remarks To shift the pich by `n` semitones, the parameter can be calculated as follows: `2.0 ^ ( n / 12.0 )`
  134. \sa openmpt_module_ext_interface_interactive.get_pitch_factor
  135. '/
  136. set_pitch_factor As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal factor As Double) As Long
  137. /'* Gets the current module pitch factor
  138. \param mod_ext The module handle to work on.
  139. \return The current pitch factor.
  140. \sa openmpt_module_ext_interface_interactive.set_pitch_factor
  141. '/
  142. get_pitch_factor As Function(ByVal mod_ext As openmpt_module_ext Ptr) As Double
  143. /'* Set the current global volume
  144. \param mod_ext The module handle to work on.
  145. \param volume The new global volume in range [0.0, 1.0]
  146. \return 1 on success, 0 on failure.
  147. \remarks The global volume may be reset by pattern commands at any time. Use openmpt_module_set_render_param to apply a global overall volume factor that is independent of pattern commands.
  148. \sa openmpt_module_ext_interface_interactive.get_global_volume
  149. '/
  150. set_global_volume As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal volume As Double) As Long
  151. /'* Get the current global volume
  152. \param mod_ext The module handle to work on.
  153. \return The current global volume in range [0.0, 1.0]
  154. \sa openmpt_module_ext_interface_interactive.set_global_volume
  155. '/
  156. get_global_volume As Function(ByVal mod_ext As openmpt_module_ext Ptr) As Double
  157. /'* Set the current channel volume for a channel
  158. \param mod_ext The module handle to work on.
  159. \param channel The channel whose volume should be set, in range [0, openmpt_module_get_num_channels()[
  160. \param volume The new channel volume in range [0.0, 1.0]
  161. \return 1 on success, 0 on failure (channel out of range).
  162. \remarks The channel volume may be reset by pattern commands at any time.
  163. \sa openmpt_module_ext_interface_interactive.get_channel_volume
  164. '/
  165. set_channel_volume As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long, ByVal volume As Double) As Long
  166. /'* Get the current channel volume for a channel
  167. \param mod_ext The module handle to work on.
  168. \param channel The channel whose volume should be retrieved, in range [0, openmpt_module_get_num_channels()[
  169. \return The current channel volume in range [0.0, 1.0]
  170. \sa openmpt_module_ext_interface_interactive.set_channel_volume
  171. '/
  172. get_channel_volume As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long) As Double
  173. /'* Set the current mute status for a channel
  174. \param mod_ext The module handle to work on.
  175. \param channel The channel whose mute status should be set, in range [0, openmpt_module_get_num_channels()[
  176. \param mute The new mute status. true is muted, false is unmuted.
  177. \return 1 on success, 0 on failure (channel out of range).
  178. \sa openmpt_module_ext_interface_interactive.get_channel_mute_status
  179. '/
  180. set_channel_mute_status As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long, ByVal mute As Long) As Long
  181. /'* Get the current mute status for a channel
  182. \param mod_ext The module handle to work on.
  183. \param channel The channel whose mute status should be retrieved, in range [0, openmpt_module_get_num_channels()[
  184. \return The current channel mute status. true is muted, false is unmuted.
  185. \sa openmpt_module_ext_interface_interactive.set_channel_mute_status
  186. '/
  187. get_channel_mute_status As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long) As Long
  188. /'* Set the current mute status for an instrument
  189. \param mod_ext The module handle to work on.
  190. \param instrument The instrument whose mute status should be set, in range [0, openmpt_module_get_num_instruments()[ if openmpt_module_get_num_instruments is not 0, otherwise in [0, openmpt_module_get_num_samples()[
  191. \param mute The new mute status. true is muted, false is unmuted.
  192. \return 1 on success, 0 on failure (instrument out of range).
  193. \sa openmpt_module_ext_interface_interactive.get_instrument_mute_status
  194. '/
  195. set_instrument_mute_status As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal instrument As Long, ByVal mute As Long) As Long
  196. /'* Get the current mute status for an instrument
  197. \param mod_ext The module handle to work on.
  198. \param instrument The instrument whose mute status should be retrieved, in range [0, openmpt_module_get_num_instruments()[ if openmpt_module_get_num_instruments is not 0, otherwise in [0, openmpt_module_get_num_samples()[
  199. \return The current instrument mute status. 1 is muted, 0 is unmuted, -1 means the instrument was out of range.
  200. \sa openmpt_module_ext_interface_interactive.set_instrument_mute_status
  201. '/
  202. get_instrument_mute_status As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal instrument As Long) As Long
  203. /'* Play a note using the specified instrument
  204. \param mod_ext The module handle to work on.
  205. \param instrument The instrument that should be played, in range [0, openmpt_module_get_num_instruments()[ if openmpt_module_get_num_instruments is not 0, otherwise in [0, openmpt_module_get_num_samples()[
  206. \param note The note to play, in rage [0, 119]. 60 is the middle C.
  207. \param volume The volume at which the note should be triggered, in range [0.0, 1.0]
  208. \param panning The panning position at which the note should be triggered, in range [-1.0, 1.0], 0.0 is center.
  209. \return The channel on which the note is played. This can pe be passed to stop_note to stop the note. -1 means that no channel could be allocated and the note is not played.
  210. \sa openmpt_module_ext_interface_interactive.stop_note
  211. \sa openmpt_module_ext_interface_interactive2.note_off
  212. \sa openmpt_module_ext_interface_interactive2.note_fade
  213. '/
  214. play_note As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal instrument As Long, ByVal note As Long, ByVal volume As Double, ByVal panning As Double) As Long
  215. /'* Stop the note playing on the specified channel
  216. \param mod_ext The module handle to work on.
  217. \param channel The channel on which the note should be stopped. This is the value returned by a previous play_note call.
  218. \return 1 on success, 0 on failure (channel out of range).
  219. \sa openmpt_module_ext_interface_interactive.play_note
  220. \sa openmpt_module_ext_interface_interactive.note_off
  221. \sa openmpt_module_ext_interface_interactive2.note_fade
  222. '/
  223. stop_note As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long) As Long
  224. End Type
  225. #define LIBOPENMPT_EXT_C_INTERFACE_INTERACTIVE2 "interactive2"
  226. Type openmpt_module_ext_interface_interactive2
  227. /'* Sends a key-off command for the note playing on the specified channel
  228. \param mod_ext The module handle to work on.
  229. \param channel The channel on which the key-off event should be triggered. This is the value returned by a previous play_note call.
  230. \return 1 on success, 0 on failure (channel out of range).
  231. \remarks This method releases envelopes and sample sustain loops. If the sample has no sustain loop, or if the module does not use instruments, it does nothing.
  232. \sa openmpt_module_ext_interface_interactive.play_note
  233. \sa openmpt_module_ext_interface_interactive.stop_note
  234. \sa note_fade
  235. '/
  236. note_off As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long) As Long
  237. /'* Sends a note fade command for the note playing on the specified channel
  238. \param mod_ext The module handle to work on.
  239. \param channel The channel on which the note should be faded. This is the value returned by a previous play_note call.
  240. \return 1 on success, 0 on failure (channel out of range).
  241. \remarks This method uses the instrument's fade-out value. If the module does not use instruments, or the instrument's fade-out value is 0, it does nothing.
  242. \sa openmpt_module_ext_interface_interactive.play_note
  243. \sa openmpt_module_ext_interface_interactive.stop_note
  244. \sa note_fade
  245. '/
  246. note_fade As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long) As Long
  247. /'* Set the current panning for a channel
  248. \param mod_ext The module handle to work on.
  249. \param channel The channel that should be panned. This is the value returned by a previous play_note call.
  250. \param panning The panning position to set on the channel, in range [-1.0, 1.0], 0.0 is center.
  251. \return 1 on success, 0 on failure (channel out of range).
  252. \remarks This command affects subsequent notes played on the same channel, and may itself be overridden by subsequent panning commands encountered in the module itself.
  253. \sa openmpt_module_ext_interface_interactive2.get_channel_panning
  254. '/
  255. set_channel_panning As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long, ByVal panning As Double) As Long
  256. /'* Get the current panning position for a channel
  257. \param mod_ext The module handle to work on.
  258. \param channel The channel whose panning should be retrieved. This is the value returned by a previous play_note call.
  259. \return The current channel panning, in range [-1.0, 1.0], 0.0 is center.
  260. \sa openmpt_module_ext_interface_interactive2.set_channel_panning
  261. '/
  262. get_channel_panning As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long) As Double
  263. /'* Set the finetune for the currently playing note on a channel
  264. \param mod_ext The module handle to work on.
  265. \param channel The channel whose finetune will be changed, in range [0, openmpt::module::get_num_channels()[
  266. \param finetune The finetune to set on the channel, in range [-1.0, 1.0], 0.0 is center.
  267. \throws openmpt::exception Throws an exception derived from openmpt::exception if the channel index is invalid.
  268. \remarks The finetune range depends on the pitch wheel depth of the instrument playing on the current channel; for sample-based modules, the depth of this command is fixed to +/-1 semitone.
  269. \remarks This command does not affect subsequent notes played on the same channel, but may itself be overridden by subsequent finetune commands encountered in the module itself.
  270. \sa openmpt_module_ext_interface_interactive2.get_note_finetune
  271. '/
  272. set_note_finetune As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long, ByVal finetune As Double) As Long
  273. /'* Get the finetune for the currently playing note on a channel
  274. \param mod_ext The module handle to work on.
  275. \param channel The channel whose finetune should be retrieved, in range [0, openmpt::module::get_num_channels()[
  276. \return The current channel finetune, in range [-1.0, 1.0], 0.0 is center.
  277. \remarks The finetune range depends on the pitch wheel depth of the instrument playing on the current channel; for sample-based modules, the depth of this command is fixed to +/-1 semitone.
  278. \throws openmpt::exception Throws an exception derived from openmpt::exception if the channel is outside the specified range.
  279. \sa openmpt_module_ext_interface_interactive2.set_note_finetune
  280. '/
  281. get_note_finetune As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal channel As Long) As Double
  282. End Type
  283. End Extern
  284. /'* \brief Construct an openmpt_module_ext
  285. \param file The FreeBASIC file handle to load from.
  286. \param logfunc Logging function where warning and errors are written. May be NULL.
  287. \param loguser Logging function user context. Used to pass any user-defined data associated with this module to the logging function.
  288. \param errfunc Error function to define error behaviour. May be NULL.
  289. \param erruser Error function user context. Used to pass any user-defined data associated with this module to the error function.
  290. \param errorcode Pointer to an integer where an error may get stored. May be NULL.
  291. \param error_message Pointer to a string pointer where an error message may get stored. May be NULL.
  292. \param ctls A map of initial ctl values, see openmpt_module_get_ctls.
  293. \return A pointer to the constructed openmpt_module, or NULL on failure.
  294. \remarks The file handle can be closed after an openmpt_module has been constructed successfully.
  295. \sa openmpt_module_ext_create
  296. '/
  297. Function openmpt_module_ext_create_from_fbhandle(_
  298. ByVal file As Integer,_
  299. ByVal logfunc As openmpt_log_func = 0,_
  300. ByVal loguser As Any Ptr = 0,_
  301. ByVal errfunc As openmpt_error_func = 0,_
  302. ByVal erruser As Any Ptr = 0,_
  303. ByVal errorcode As Long Ptr = 0,_
  304. ByVal error_message As Const ZString Ptr Ptr = 0,_
  305. ByVal ctls As Const openmpt_module_initial_ctl Ptr = 0) As openmpt_module_ext Ptr
  306. Return openmpt_module_ext_create(openmpt_stream_get_file_callbacks(), Cast(FILE Ptr, FileAttr(file, fbFileAttrHandle)), logfunc, loguser, errfunc, erruser, errorcode, error_message, ctls)
  307. End Function
  308. /'* \brief Construct an openmpt_module_ext
  309. \param filename The file to load from.
  310. \param logfunc Logging function where warning and errors are written. May be NULL.
  311. \param loguser Logging function user context. Used to pass any user-defined data associated with this module to the logging function.
  312. \param errfunc Error function to define error behaviour. May be NULL.
  313. \param erruser Error function user context. Used to pass any user-defined data associated with this module to the error function.
  314. \param errorcode Pointer to an integer where an error may get stored. May be NULL.
  315. \param error_message Pointer to a string pointer where an error message may get stored. May be NULL.
  316. \param ctls A map of initial ctl values, see openmpt_module_get_ctls.
  317. \return A pointer to the constructed openmpt_module, or NULL on failure.
  318. \sa openmpt_module_ext_create
  319. '/
  320. Function openmpt_module_ext_create_from_filename(_
  321. ByRef filename As String,_
  322. ByVal logfunc As openmpt_log_func = 0,_
  323. ByVal loguser As Any Ptr = 0,_
  324. ByVal errfunc As openmpt_error_func = 0,_
  325. ByVal erruser As Any Ptr = 0,_
  326. ByVal errorcode As Long Ptr = 0,_
  327. ByVal error_message As Const ZString Ptr Ptr = 0,_
  328. ByVal ctls As Const openmpt_module_initial_ctl Ptr = 0) As openmpt_module_ext Ptr
  329. Var file = fopen(filename, "rb")
  330. Var retval = CPtr(openmpt_module Ptr, 0)
  331. If(file <> 0) Then
  332. retval = openmpt_module_ext_create(openmpt_stream_get_file_callbacks(), file, logfunc, loguser, errfunc, erruser, errorcode, error_message, ctls)
  333. fclose(file)
  334. EndIf
  335. Return retval
  336. End Function