aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/midi/base.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-12-28 09:58:55 -0800
committerChris Robinson <[email protected]>2013-12-28 09:58:55 -0800
commitfe55cd6de8b316f5e3869b88e9d64846847fb2a7 (patch)
tree12db75aa91abade4157e67efaf702271fbfb8ed3 /Alc/midi/base.h
parent7156f4439c9f582eb74e50637a81c3c6a421b5a8 (diff)
Add alLoadSoundfontSOFT to load a soundfont via callback
Some hefty caveats: This function is not thread-safe. In particular, the current context affecting the thread must not be changed, and the provided soundfont must not be altered while the function is executing. Ideally, this will be fixed. Error handling is poor. Some RIFF structure errors may not be caught (e.g. sub- chunks with sizes greater than the parent chunk allows for), and generated AL errors are ignored, possibly leading to resource leaks in certain situations. These should be fixed in time. There is minimal error checking on the provided soundfont ID. It does not ensure a valid ID has been provided, nor does it ensure the provided soundfont can be modified. These short-comings should be fixed eventually. Proper cleanup is the responsibility of the caller. The caller must get the preset objects from the soundfont before deleting it, and the fontsound objects from each preset before deleting them, to make sure all resources are properly deleted.
Diffstat (limited to 'Alc/midi/base.h')
-rw-r--r--Alc/midi/base.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/Alc/midi/base.h b/Alc/midi/base.h
index d038eebc..a5b76dfe 100644
--- a/Alc/midi/base.h
+++ b/Alc/midi/base.h
@@ -9,6 +9,18 @@
extern "C" {
#endif
+typedef size_t (*ReaderCb)(void *ptr, size_t size, void *stream);
+typedef struct Reader {
+ ReaderCb cb;
+ void *ptr;
+ int error;
+} Reader;
+#define READ(x_, buf_, len_) ((x_)->cb((buf_), (len_), (x_)->ptr))
+#define READERR(x_) ((x_)->error)
+
+ALboolean loadSf2(Reader *stream, ALuint sfid);
+
+
struct MidiSynthVtable;
typedef struct MidiSynth {