aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/alMidi.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-11-27 05:12:11 -0800
committerChris Robinson <[email protected]>2013-11-27 05:12:11 -0800
commit3a1613253b4e68d67165279be3b0912010b7c104 (patch)
treef7315409f015166c2ab0b1230c37186559b0a384 /OpenAL32/Include/alMidi.h
parent6a76f50fa3814de466e9a803e0d2051335222341 (diff)
Add a base MidiSynth struct
Diffstat (limited to 'OpenAL32/Include/alMidi.h')
-rw-r--r--OpenAL32/Include/alMidi.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMidi.h b/OpenAL32/Include/alMidi.h
new file mode 100644
index 00000000..b6504706
--- /dev/null
+++ b/OpenAL32/Include/alMidi.h
@@ -0,0 +1,64 @@
+#ifndef ALMIDI_H
+#define ALMIDI_H
+
+#include "alMain.h"
+#include "evtqueue.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct MidiSynthVtable;
+
+typedef struct MidiSynth {
+ EvtQueue EventQueue;
+
+ ALuint64 LastEvtTime;
+ ALuint64 NextEvtTime;
+ ALdouble SamplesSinceLast;
+ ALdouble SamplesToNext;
+
+ ALuint SampleRate;
+ ALdouble SamplesPerTick;
+
+ volatile ALenum State;
+
+ char *FontName;
+
+ const struct MidiSynthVtable *vtbl;
+} MidiSynth;
+
+
+struct MidiSynthVtable {
+ void (*const Destruct)(MidiSynth *self);
+
+ void (*const setState)(MidiSynth *self, ALenum state);
+ void (*const update)(MidiSynth *self, ALCdevice *device);
+ void (*const process)(MidiSynth *self, ALuint samples, ALfloat (*restrict DryBuffer)[BUFFERSIZE]);
+
+ void (*const Delete)(MidiSynth *self);
+};
+
+#define DEFINE_MIDISYNTH_VTABLE(T) \
+DECLARE_THUNK(T, MidiSynth, void, Destruct) \
+DECLARE_THUNK1(T, MidiSynth, void, setState, ALenum) \
+DECLARE_THUNK1(T, MidiSynth, void, update, ALCdevice*) \
+DECLARE_THUNK2(T, MidiSynth, void, process, ALuint, ALfloatBUFFERSIZE*restrict) \
+DECLARE_THUNK(T, MidiSynth, void, Delete) \
+ \
+static const struct MidiSynthVtable T##_MidiSynth_vtable = { \
+ T##_MidiSynth_Destruct, \
+ \
+ T##_MidiSynth_setState, \
+ T##_MidiSynth_update, \
+ T##_MidiSynth_process, \
+ \
+ T##_MidiSynth_Delete, \
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ALMIDI_H */