aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-01-12 12:27:46 -0800
committerChris Robinson <[email protected]>2014-01-12 12:27:46 -0800
commita5bfc1e30b333d0767138d9a42033cabd2dd71c5 (patch)
tree976ab08c54cc532faff4539676e78d81c1623214
parent9a57aca8d4ff8784e0bccf4f38a856f301c38050 (diff)
Add a method to get the current MIDI state
-rw-r--r--Alc/midi/base.c1
-rw-r--r--Alc/midi/base.h1
-rw-r--r--OpenAL32/Include/alMain.h1
-rw-r--r--OpenAL32/alState.c26
4 files changed, 29 insertions, 0 deletions
diff --git a/Alc/midi/base.c b/Alc/midi/base.c
index 0a88c909..cfeda001 100644
--- a/Alc/midi/base.c
+++ b/Alc/midi/base.c
@@ -189,6 +189,7 @@ ALenum MidiSynth_selectSoundfonts(MidiSynth *self, ALCcontext *context, ALsizei
extern inline void MidiSynth_setGain(MidiSynth *self, ALfloat gain);
extern inline ALfloat MidiSynth_getGain(const MidiSynth *self);
extern inline void MidiSynth_setState(MidiSynth *self, ALenum state);
+extern inline ALenum MidiSynth_getState(const MidiSynth *self);
void MidiSynth_stop(MidiSynth *self)
{
diff --git a/Alc/midi/base.h b/Alc/midi/base.h
index ec2627cc..f900c941 100644
--- a/Alc/midi/base.h
+++ b/Alc/midi/base.h
@@ -56,6 +56,7 @@ ALenum MidiSynth_selectSoundfonts(MidiSynth *self, ALCcontext *context, ALsizei
inline void MidiSynth_setGain(MidiSynth *self, ALfloat gain) { self->Gain = gain; }
inline ALfloat MidiSynth_getGain(const MidiSynth *self) { return self->Gain; }
inline void MidiSynth_setState(MidiSynth *self, ALenum state) { ExchangeInt(&self->State, state); }
+inline ALenum MidiSynth_getState(const MidiSynth *self) { return self->State; }
void MidiSynth_stop(MidiSynth *self);
inline void MidiSynth_reset(MidiSynth *self) { MidiSynth_stop(self); }
ALuint64 MidiSynth_getTime(const MidiSynth *self);
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 828e2baa..6ded14fd 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -30,6 +30,7 @@
#ifndef ALC_SOFT_midi_interface
#define ALC_SOFT_midi_interface 1
#define AL_MIDI_CLOCK_SOFT 0x9999
+#define AL_MIDI_STATE_SOFT 0x9986
#define AL_MIDI_GAIN_SOFT 0x9998
#define AL_MIDI_PRESET_SOFT 0x9997
#define AL_MIDI_BANK_SOFT 0x9996
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 6a528519..280dd896 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -191,6 +191,12 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname)
case AL_MIDI_GAIN_SOFT:
device = context->Device;
value = (ALdouble)MidiSynth_getGain(device->Synth);
+ break;
+
+ case AL_MIDI_STATE_SOFT:
+ device = context->Device;
+ value = (ALdouble)MidiSynth_getState(device->Synth);
+ break;
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
@@ -236,6 +242,12 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname)
case AL_MIDI_GAIN_SOFT:
device = context->Device;
value = MidiSynth_getGain(device->Synth);
+ break;
+
+ case AL_MIDI_STATE_SOFT:
+ device = context->Device;
+ value = (ALfloat)MidiSynth_getState(device->Synth);
+ break;
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
@@ -285,6 +297,11 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname)
value = synth->NumSoundfonts;
break;
+ case AL_MIDI_STATE_SOFT:
+ device = context->Device;
+ value = MidiSynth_getState(device->Synth);
+ break;
+
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}
@@ -340,6 +357,11 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname)
value = (ALint64SOFT)synth->NumSoundfonts;
break;
+ case AL_MIDI_STATE_SOFT:
+ device = context->Device;
+ value = (ALint64SOFT)MidiSynth_getState(device->Synth);
+ break;
+
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}
@@ -397,6 +419,7 @@ AL_API ALvoid AL_APIENTRY alGetDoublev(ALenum pname, ALdouble *values)
case AL_SPEED_OF_SOUND:
case AL_DEFERRED_UPDATES_SOFT:
case AL_MIDI_GAIN_SOFT:
+ case AL_MIDI_STATE_SOFT:
values[0] = alGetDouble(pname);
return;
}
@@ -431,6 +454,7 @@ AL_API ALvoid AL_APIENTRY alGetFloatv(ALenum pname, ALfloat *values)
case AL_SPEED_OF_SOUND:
case AL_DEFERRED_UPDATES_SOFT:
case AL_MIDI_GAIN_SOFT:
+ case AL_MIDI_STATE_SOFT:
values[0] = alGetFloat(pname);
return;
}
@@ -468,6 +492,7 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values)
case AL_SPEED_OF_SOUND:
case AL_DEFERRED_UPDATES_SOFT:
case AL_SOUNDFONTS_SIZE_SOFT:
+ case AL_MIDI_STATE_SOFT:
values[0] = alGetInteger(pname);
return;
}
@@ -516,6 +541,7 @@ AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values)
case AL_DEFERRED_UPDATES_SOFT:
case AL_MIDI_CLOCK_SOFT:
case AL_SOUNDFONTS_SIZE_SOFT:
+ case AL_MIDI_STATE_SOFT:
values[0] = alGetInteger64SOFT(pname);
return;
}