summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c9
-rw-r--r--OpenAL32/Include/alMain.h24
-rw-r--r--OpenAL32/alMidi.c61
-rw-r--r--OpenAL32/alState.c84
4 files changed, 177 insertions, 1 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index cc528052..dfc39ffb 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -280,6 +280,12 @@ static const ALCfunction alcFunctions[] = {
DECL(alGetSource3i64SOFT),
DECL(alGetSourcei64vSOFT),
+ DECL(alMidiEventSOFT),
+ DECL(alMidiPlaySOFT),
+ DECL(alMidiPauseSOFT),
+ DECL(alGetInteger64SOFT),
+ DECL(alGetInteger64vSOFT),
+
{ NULL, NULL }
};
#undef DECL
@@ -702,7 +708,8 @@ static const ALCchar alcNoDeviceExtList[] =
static const ALCchar alcExtensionList[] =
"ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE "
"ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX "
- "ALC_EXT_thread_local_context ALC_SOFTX_HRTF ALC_SOFT_loopback";
+ "ALC_EXT_thread_local_context ALC_SOFTX_HRTF ALC_SOFT_loopback "
+ "ALC_SOFTX_midi_interface";
static const ALCint alcMajorVersion = 1;
static const ALCint alcMinorVersion = 1;
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 2fad113d..de98b85c 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -27,6 +27,30 @@
#define ALC_HRTF_SOFT 0x1992
#endif
+#ifndef ALC_SOFT_midi_interface
+#define ALC_SOFT_midi_interface 1
+#define AL_MIDI_CLOCK_SOFT 0x9999
+#define AL_NOTEOFF_SOFT 0x0080
+#define AL_NOTEON_SOFT 0x0090
+#define AL_AFTERTOUCH_SOFT 0x00A0
+#define AL_CONTROLLERCHANGE_SOFT 0x00B0
+#define AL_PROGRAMCHANGE_SOFT 0x00C0
+#define AL_CHANNELPRESSURE_SOFT 0x00D0
+#define AL_PITCHBEND_SOFT 0x00E0
+typedef void (AL_APIENTRY*LPALMIDIEVENTSOFT)(ALuint64SOFT time, ALenum event, ALsizei channel, ALsizei param1, ALsizei param2);
+typedef void (AL_APIENTRY*LPALMIDIPLAYSOFT)(void);
+typedef void (AL_APIENTRY*LPALMIDIPAUSESOFT)(void);
+typedef ALint64SOFT (AL_APIENTRY*LPALGETINTEGER64SOFT)(ALenum pname);
+typedef void (AL_APIENTRY*LPALGETINTEGER64VSOFT)(ALenum pname, ALint64SOFT *values);
+#ifdef AL_ALEXT_PROTOTYPES
+AL_API void AL_APIENTRY alMidiEventSOFT(ALuint64SOFT time, ALenum event, ALsizei channel, ALsizei param1, ALsizei param2);
+AL_API void AL_APIENTRY alMidiPlaySOFT(void);
+AL_API void AL_APIENTRY alMidiPauseSOFT(void);
+AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname);
+AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values);
+#endif
+#endif
+
#ifdef IN_IDE_PARSER
/* KDevelop's parser doesn't recognize the C99-standard restrict keyword, but
diff --git a/OpenAL32/alMidi.c b/OpenAL32/alMidi.c
index b3356e64..3e75b805 100644
--- a/OpenAL32/alMidi.c
+++ b/OpenAL32/alMidi.c
@@ -196,6 +196,67 @@ MidiSynth *SynthCreate(ALCdevice *device)
}
+AL_API void AL_APIENTRY alMidiEventSOFT(ALuint64SOFT time, ALenum event, ALsizei channel, ALsizei param1, ALsizei param2)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+ ALenum err;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ if(!(event == AL_NOTEOFF_SOFT || event == AL_NOTEON_SOFT ||
+ event == AL_AFTERTOUCH_SOFT || event == AL_CONTROLLERCHANGE_SOFT ||
+ event == AL_PROGRAMCHANGE_SOFT || event == AL_CHANNELPRESSURE_SOFT ||
+ event == AL_PITCHBEND_SOFT))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
+ if(!(channel >= 0 && channel <= 15))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+ if(!(param1 >= 0 && param1 <= 127))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+ if(!(param2 >= 0 && param2 <= 127))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+
+ device = context->Device;
+ ALCdevice_Lock(device);
+ err = MidiSynth_insertEvent(device->Synth, time, event|channel, param1, param2);
+ ALCdevice_Unlock(device);
+ if(err != AL_NO_ERROR)
+ alSetError(context, err);
+
+done:
+ ALCcontext_DecRef(context);
+}
+
+AL_API void AL_APIENTRY alMidiPlaySOFT(void)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ device = context->Device;
+ V(device->Synth,setState)(AL_PLAYING);
+
+ ALCcontext_DecRef(context);
+}
+
+AL_API void AL_APIENTRY alMidiPauseSOFT(void)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ device = context->Device;
+ V(device->Synth,setState)(AL_PAUSED);
+
+ ALCcontext_DecRef(context);
+}
+
+
void InitEvtQueue(EvtQueue *queue)
{
queue->events = NULL;
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 6c58e314..5f88ff5e 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -23,10 +23,12 @@
#include <stdlib.h>
#include "alMain.h"
#include "AL/alc.h"
+#include "AL/al.h"
#include "AL/alext.h"
#include "alError.h"
#include "alSource.h"
#include "alAuxEffectSlot.h"
+#include "alMidi.h"
static const ALchar alVendor[] = "OpenAL Community";
@@ -273,6 +275,54 @@ done:
return value;
}
+AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname)
+{
+ ALCcontext *context;
+ ALCdevice *device;
+ ALint64SOFT value = 0;
+
+ context = GetContextRef();
+ if(!context) return 0;
+
+ switch(pname)
+ {
+ case AL_DOPPLER_FACTOR:
+ value = (ALint64SOFT)context->DopplerFactor;
+ break;
+
+ case AL_DOPPLER_VELOCITY:
+ value = (ALint64SOFT)context->DopplerVelocity;
+ break;
+
+ case AL_DISTANCE_MODEL:
+ value = (ALint64SOFT)context->DistanceModel;
+ break;
+
+ case AL_SPEED_OF_SOUND:
+ value = (ALint64SOFT)context->SpeedOfSound;
+ break;
+
+ case AL_DEFERRED_UPDATES_SOFT:
+ value = (ALint64SOFT)context->DeferUpdates;
+ break;
+
+ case AL_MIDI_CLOCK_SOFT:
+ device = context->Device;
+ ALCdevice_Lock(device);
+ value = MidiSynth_getTime(device->Synth);
+ ALCdevice_Unlock(device);
+ break;
+
+ default:
+ SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
+ }
+
+done:
+ ALCcontext_DecRef(context);
+
+ return value;
+}
+
AL_API ALvoid AL_APIENTRY alGetBooleanv(ALenum pname, ALboolean *values)
{
ALCcontext *context;
@@ -405,6 +455,40 @@ done:
ALCcontext_DecRef(context);
}
+AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values)
+{
+ ALCcontext *context;
+
+ if(values)
+ {
+ switch(pname)
+ {
+ case AL_DOPPLER_FACTOR:
+ case AL_DOPPLER_VELOCITY:
+ case AL_DISTANCE_MODEL:
+ case AL_SPEED_OF_SOUND:
+ case AL_DEFERRED_UPDATES_SOFT:
+ case AL_MIDI_CLOCK_SOFT:
+ values[0] = alGetInteger64SOFT(pname);
+ return;
+ }
+ }
+
+ context = GetContextRef();
+ if(!context) return;
+
+ if(!(values))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+ switch(pname)
+ {
+ default:
+ SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
+ }
+
+done:
+ ALCcontext_DecRef(context);
+}
+
AL_API const ALchar* AL_APIENTRY alGetString(ALenum pname)
{
const ALchar *value = NULL;