diff options
-rw-r--r-- | Alc/ALc.c | 1 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 | ||||
-rw-r--r-- | OpenAL32/alSoundfont.c | 35 |
3 files changed, 38 insertions, 0 deletions
@@ -285,6 +285,7 @@ static const ALCfunction alcFunctions[] = { DECL(alDeleteSoundfontsSOFT), DECL(alIsSoundfontSOFT), DECL(alSoundfontSamplesSOFT), + DECL(alGetSoundfontSamplesSOFT), DECL(alSoundfontMapSamplesSOFT), DECL(alSoundfontUnmapSamplesSOFT), DECL(alGetSoundfontivSOFT), diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 6ded14fd..95f6a719 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -139,6 +139,7 @@ typedef void (AL_APIENTRY*LPALGENSOUNDFONTSSOFT)(ALsizei n, ALuint *ids); typedef void (AL_APIENTRY*LPALDELETESOUNDFONTSSOFT)(ALsizei n, const ALuint *ids); typedef ALboolean (AL_APIENTRY*LPALISSOUNDFONTSOFT)(ALuint id); typedef void (AL_APIENTRY*LPALSOUNDFONTSAMPLESSOFT)(ALuint sfid, ALenum type, ALsizei count, const ALvoid *samples); +typedef void (AL_APIENTRY*LPALGETSOUNDFONTSAMPLESSOFT)(ALuint id, ALsizei offset, ALsizei count, ALenum type, ALvoid *samples); typedef ALvoid* (AL_APIENTRY*LPALSOUNDFONTMAPSAMPLESSOFT)(ALuint sfid, ALsizei offset, ALsizei length); typedef void (AL_APIENTRY*LPALSOUNDFONTUNMAPSAMPLESSOFT)(ALuint sfid); typedef void (AL_APIENTRY*LPALGETSOUNDFONTIVSOFT)(ALuint id, ALenum param, ALint *values); @@ -176,6 +177,7 @@ AL_API void AL_APIENTRY alGenSoundfontsSOFT(ALsizei n, ALuint *ids); AL_API void AL_APIENTRY alDeleteSoundfontsSOFT(ALsizei n, const ALuint *ids); AL_API ALboolean AL_APIENTRY alIsSoundfontSOFT(ALuint id); AL_API void AL_APIENTRY alSoundfontSamplesSOFT(ALuint sfid, ALenum type, ALsizei count, const ALvoid *samples); +AL_API void AL_APIENTRY alGetSoundfontSamplesSOFT(ALuint id, ALsizei offset, ALsizei count, ALenum type, ALvoid *samples); AL_API ALvoid* AL_APIENTRY alSoundfontMapSamplesSOFT(ALuint sfid, ALsizei offset, ALsizei length); AL_API void AL_APIENTRY alSoundfontUnmapSamplesSOFT(ALuint sfid); AL_API void AL_APIENTRY alGetSoundfontivSOFT(ALuint id, ALenum param, ALint *values); diff --git a/OpenAL32/alSoundfont.c b/OpenAL32/alSoundfont.c index 17812610..355c5b41 100644 --- a/OpenAL32/alSoundfont.c +++ b/OpenAL32/alSoundfont.c @@ -176,6 +176,41 @@ done: ALCcontext_DecRef(context); } +AL_API void AL_APIENTRY alGetSoundfontSamplesSOFT(ALuint id, ALsizei offset, ALsizei count, ALenum type, ALvoid *samples) +{ + ALCdevice *device; + ALCcontext *context; + ALsoundfont *sfont; + + context = GetContextRef(); + if(!context) return; + + device = context->Device; + if(id == 0) + sfont = ALsoundfont_getDefSoundfont(context); + else 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); + if(offset < 0 || count <= 0) + SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + + ReadLock(&sfont->Lock); + if(offset >= sfont->NumSamples || count > (sfont->NumSamples-offset)) + alSetError(context, AL_INVALID_VALUE); + else if(sfont->Mapped) + alSetError(context, AL_INVALID_OPERATION); + else + { + /* TODO: Allow conversion. */ + memcpy(samples, sfont->Samples + offset*sizeof(ALshort), count * sizeof(ALshort)); + } + ReadUnlock(&sfont->Lock); + +done: + ALCcontext_DecRef(context); +} + AL_API ALvoid* AL_APIENTRY alSoundfontMapSamplesSOFT(ALuint id, ALsizei offset, ALsizei length) { ALCdevice *device; |