aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-01-04 04:48:41 -0800
committerChris Robinson <[email protected]>2014-01-04 04:49:10 -0800
commitbb54743425c92856347c8c3f04ac07e319ff0fcd (patch)
tree0f71a8a0a65a80dd00e94a5b94db53ccc0bb38e6 /OpenAL32
parent86f250a3f5d19a031ae9020e2d41cff1882de9c1 (diff)
Allow querying default soundfont properties
Any attempts to modify it or its held objects will result in an AL_INVALID_OPERATION error.
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alSoundfont.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/OpenAL32/alSoundfont.c b/OpenAL32/alSoundfont.c
index dde4b991..60a18ea5 100644
--- a/OpenAL32/alSoundfont.c
+++ b/OpenAL32/alSoundfont.c
@@ -117,7 +117,7 @@ AL_API ALboolean AL_APIENTRY alIsSoundfontSOFT(ALuint id)
return ret;
}
-AL_API ALvoid AL_APIENTRY alSoundfontSamplesSOFT(ALuint sfid, ALenum type, ALsizei count, const ALvoid *samples)
+AL_API ALvoid AL_APIENTRY alSoundfontSamplesSOFT(ALuint id, ALenum type, ALsizei count, const ALvoid *samples)
{
ALCdevice *device;
ALCcontext *context;
@@ -128,7 +128,9 @@ AL_API ALvoid AL_APIENTRY alSoundfontSamplesSOFT(ALuint sfid, ALenum type, ALsiz
if(!context) return;
device = context->Device;
- if(!(sfont=LookupSfont(device, sfid)))
+ if(id == 0)
+ SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
+ if(!(sfont=LookupSfont(device, id)))
SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
if(type != AL_SHORT_SOFT)
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
@@ -155,7 +157,7 @@ done:
ALCcontext_DecRef(context);
}
-AL_API ALvoid* AL_APIENTRY alSoundfontMapSamplesSOFT(ALuint sfid, ALsizei offset, ALsizei length)
+AL_API ALvoid* AL_APIENTRY alSoundfontMapSamplesSOFT(ALuint id, ALsizei offset, ALsizei length)
{
ALCdevice *device;
ALCcontext *context;
@@ -166,7 +168,9 @@ AL_API ALvoid* AL_APIENTRY alSoundfontMapSamplesSOFT(ALuint sfid, ALsizei offset
if(!context) return NULL;
device = context->Device;
- if(!(sfont=LookupSfont(device, sfid)))
+ if(id == 0)
+ SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
+ if(!(sfont=LookupSfont(device, id)))
SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
if(offset < 0 || (ALuint)offset > sfont->NumSamples*sizeof(ALshort))
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
@@ -188,7 +192,7 @@ done:
return ptr;
}
-AL_API ALvoid AL_APIENTRY alSoundfontUnmapSamplesSOFT(ALuint sfid)
+AL_API ALvoid AL_APIENTRY alSoundfontUnmapSamplesSOFT(ALuint id)
{
ALCdevice *device;
ALCcontext *context;
@@ -198,7 +202,9 @@ AL_API ALvoid AL_APIENTRY alSoundfontUnmapSamplesSOFT(ALuint sfid)
if(!context) return;
device = context->Device;
- if(!(sfont=LookupSfont(device, sfid)))
+ if(id == 0)
+ SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
+ if(!(sfont=LookupSfont(device, id)))
SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
if(ExchangeInt(&sfont->Mapped, AL_FALSE) == AL_FALSE)
SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
@@ -218,7 +224,9 @@ AL_API void AL_APIENTRY alGetSoundfontivSOFT(ALuint id, ALenum param, ALint *val
if(!context) return;
device = context->Device;
- if(!(sfont=LookupSfont(device, id)))
+ if(id == 0)
+ sfont = MidiSynth_getDefSoundfont(context);
+ else if(!(sfont=LookupSfont(device, id)))
SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
switch(param)
{
@@ -259,6 +267,8 @@ AL_API void AL_APIENTRY alSoundfontPresetsSOFT(ALuint id, ALsizei count, const A
if(!context) return;
device = context->Device;
+ if(id == 0)
+ SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
if(!(sfont=LookupSfont(device, id)))
SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
if(count < 0)
@@ -319,6 +329,8 @@ AL_API void AL_APIENTRY alLoadSoundfontSOFT(ALuint id, size_t(*cb)(ALvoid*,size_
if(!context) return;
device = context->Device;
+ if(id == 0)
+ SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
if(!(sfont=LookupSfont(device, id)))
SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);