aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h16
-rw-r--r--OpenAL32/alMidi.c32
-rw-r--r--OpenAL32/alState.c52
3 files changed, 92 insertions, 8 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index a471fb92..184a1fcd 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -33,10 +33,12 @@
#define AL_MIDI_GAIN_SOFT 0x9998
#define AL_MIDI_PRESET_SOFT 0x9997
#define AL_MIDI_BANK_SOFT 0x9996
-#define AL_PRESETS_SIZE_SOFT 0x9995
-#define AL_PRESETS_SOFT 0x9994
-#define AL_FONTSOUNDS_SIZE_SOFT 0x9993
-#define AL_FONTSOUNDS_SOFT 0x9992
+#define AL_SOUNDFONTS_SIZE_SOFT 0x9995
+#define AL_SOUNDFONTS_SOFT 0x9994
+#define AL_PRESETS_SIZE_SOFT 0x9993
+#define AL_PRESETS_SOFT 0x9992
+#define AL_FONTSOUNDS_SIZE_SOFT 0x9991
+#define AL_FONTSOUNDS_SOFT 0x9990
#define AL_SAMPLE_START_SOFT 0x2000
#define AL_SAMPLE_END_SOFT 0x2001
#define AL_SAMPLE_LOOP_START_SOFT 0x2002
@@ -79,6 +81,7 @@ typedef void (AL_APIENTRY*LPALFONTSOUND2ISOFT)(ALuint id, ALenum param, ALint va
typedef void (AL_APIENTRY*LPALFONTSOUNDIVSOFT)(ALuint id, ALenum param, const ALint *values);
typedef void (AL_APIENTRY*LPALGETFONTSOUNDIVSOFT)(ALuint id, ALenum param, ALint *values);
typedef void (AL_APIENTRY*LPALMIDISOUNDFONTSOFT)(const char *filename);
+typedef void (AL_APIENTRY*LPALMIDISOUNDFONTSSOFT)(ALsizei count, const ALuint *ids);
typedef void (AL_APIENTRY*LPALMIDIEVENTSOFT)(ALuint64SOFT time, ALenum event, ALsizei channel, ALsizei param1, ALsizei param2);
typedef void (AL_APIENTRY*LPALMIDISYSEXSOFT)(ALuint64SOFT time, const ALbyte *data, ALsizei size);
typedef void (AL_APIENTRY*LPALMIDIPLAYSOFT)(void);
@@ -115,6 +118,7 @@ AL_API void AL_APIENTRY alFontsoundivSOFT(ALuint id, ALenum param, const ALint *
AL_API void AL_APIENTRY alGetFontsoundivSOFT(ALuint id, ALenum param, ALint *values);
AL_API void AL_APIENTRY alMidiSoundfontSOFT(const char *filename);
+AL_API void AL_APIENTRY alMidiSoundfontsSOFT(ALsizei count, const ALuint *ids);
AL_API void AL_APIENTRY alMidiEventSOFT(ALuint64SOFT time, ALenum event, ALsizei channel, ALsizei param1, ALsizei param2);
AL_API void AL_APIENTRY alMidiSysExSOFT(ALuint64SOFT time, const ALbyte *data, ALsizei size);
AL_API void AL_APIENTRY alMidiPlaySOFT(void);
@@ -215,6 +219,10 @@ rettype T1##_##func(T1 *obj, argtype1 a) \
rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b) \
{ return T2##_##func(STATIC_CAST(T2, obj), a, b); }
+#define DECLARE_FORWARD3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \
+rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b, argtype3 c) \
+{ return T2##_##func(STATIC_CAST(T2, obj), a, b, c); }
+
#define GET_VTABLE1(T1) (&(T1##_vtable))
#define GET_VTABLE2(T1, T2) (&(T1##_##T2##_vtable))
diff --git a/OpenAL32/alMidi.c b/OpenAL32/alMidi.c
index 19cfb179..29e9e974 100644
--- a/OpenAL32/alMidi.c
+++ b/OpenAL32/alMidi.c
@@ -52,6 +52,38 @@ AL_API void AL_APIENTRY alMidiSoundfontSOFT(const char *filename)
ALCcontext_DecRef(context);
}
+AL_API void AL_APIENTRY alMidiSoundfontsSOFT(ALsizei count, const ALuint *ids)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+ MidiSynth *synth;
+ ALenum err;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ if(count < 0)
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+
+ device = context->Device;
+ synth = device->Synth;
+
+ WriteLock(&synth->Lock);
+ if(synth->State == AL_PLAYING || synth->State == AL_PAUSED)
+ alSetError(context, AL_INVALID_OPERATION);
+ else
+ {
+ err = V(synth,selectSoundfonts)(device, count, ids);
+ if(err != AL_NO_ERROR)
+ alSetError(context, err);
+ }
+ WriteUnlock(&synth->Lock);
+
+done:
+ ALCcontext_DecRef(context);
+}
+
+
AL_API void AL_APIENTRY alMidiEventSOFT(ALuint64SOFT time, ALenum event, ALsizei channel, ALsizei param1, ALsizei param2)
{
ALCdevice *device;
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 8d96018b..6a528519 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -28,6 +28,7 @@
#include "alError.h"
#include "alSource.h"
#include "alAuxEffectSlot.h"
+#include "alMidi.h"
#include "midi/base.h"
@@ -249,6 +250,8 @@ done:
AL_API ALint AL_APIENTRY alGetInteger(ALenum pname)
{
ALCcontext *context;
+ ALCdevice *device;
+ MidiSynth *synth;
ALint value = 0;
context = GetContextRef();
@@ -276,6 +279,12 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname)
value = (ALint)context->DeferUpdates;
break;
+ case AL_SOUNDFONTS_SIZE_SOFT:
+ device = context->Device;
+ synth = device->Synth;
+ value = synth->NumSoundfonts;
+ break;
+
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}
@@ -290,6 +299,7 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname)
{
ALCcontext *context;
ALCdevice *device;
+ MidiSynth *synth;
ALint64SOFT value = 0;
context = GetContextRef();
@@ -324,6 +334,12 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname)
ALCdevice_Unlock(device);
break;
+ case AL_SOUNDFONTS_SIZE_SOFT:
+ device = context->Device;
+ synth = device->Synth;
+ value = (ALint64SOFT)synth->NumSoundfonts;
+ break;
+
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}
@@ -438,6 +454,9 @@ done:
AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values)
{
ALCcontext *context;
+ ALCdevice *device;
+ MidiSynth *synth;
+ ALsizei i;
if(values)
{
@@ -448,6 +467,7 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values)
case AL_DISTANCE_MODEL:
case AL_SPEED_OF_SOUND:
case AL_DEFERRED_UPDATES_SOFT:
+ case AL_SOUNDFONTS_SIZE_SOFT:
values[0] = alGetInteger(pname);
return;
}
@@ -456,10 +476,20 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values)
context = GetContextRef();
if(!context) return;
- if(!(values))
- SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
switch(pname)
{
+ case AL_SOUNDFONTS_SOFT:
+ device = context->Device;
+ synth = device->Synth;
+ if(synth->NumSoundfonts > 0)
+ {
+ if(!(values))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+ for(i = 0;i < synth->NumSoundfonts;i++)
+ values[i] = synth->Soundfonts[i]->id;
+ }
+ break;
+
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}
@@ -471,6 +501,9 @@ done:
AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values)
{
ALCcontext *context;
+ ALCdevice *device;
+ MidiSynth *synth;
+ ALsizei i;
if(values)
{
@@ -482,6 +515,7 @@ AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values)
case AL_SPEED_OF_SOUND:
case AL_DEFERRED_UPDATES_SOFT:
case AL_MIDI_CLOCK_SOFT:
+ case AL_SOUNDFONTS_SIZE_SOFT:
values[0] = alGetInteger64SOFT(pname);
return;
}
@@ -490,10 +524,20 @@ AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values)
context = GetContextRef();
if(!context) return;
- if(!(values))
- SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
switch(pname)
{
+ case AL_SOUNDFONTS_SOFT:
+ device = context->Device;
+ synth = device->Synth;
+ if(synth->NumSoundfonts > 0)
+ {
+ if(!(values))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+ for(i = 0;i < synth->NumSoundfonts;i++)
+ values[i] = (ALint64SOFT)synth->Soundfonts[i]->id;
+ }
+ break;
+
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}