diff options
-rw-r--r-- | Alc/ALc.c | 13 | ||||
-rw-r--r-- | Alc/midi/base.c | 191 | ||||
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 10 | ||||
-rw-r--r-- | OpenAL32/Include/alMidi.h | 64 | ||||
-rw-r--r-- | OpenAL32/alInstrument.c | 134 |
6 files changed, 0 insertions, 413 deletions
@@ -295,9 +295,6 @@ static const ALCfunction alcFunctions[] = { DECL(alPresetiSOFT), DECL(alPresetivSOFT), DECL(alGetPresetivSOFT), - DECL(alGenInstrumentsSOFT), - DECL(alDeleteInstrumentsSOFT), - DECL(alIsInstrumentSOFT), DECL(alGenFontsoundsSOFT), DECL(alDeleteFontsoundsSOFT), DECL(alIsFontsoundSOFT), @@ -1980,13 +1977,6 @@ static ALCvoid FreeDevice(ALCdevice *device) } ResetUIntMap(&device->PresetMap); - if(device->InstrumentMap.size > 0) - { - WARN("(%p) Deleting %d Instrument(s)\n", device, device->InstrumentMap.size); - ReleaseALInstruments(device); - } - ResetUIntMap(&device->InstrumentMap); - if(device->FontsoundMap.size > 0) { WARN("(%p) Deleting %d Fontsound(s)\n", device, device->FontsoundMap.size); @@ -2932,7 +2922,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) InitUIntMap(&device->FilterMap, ~0); InitUIntMap(&device->SfontMap, ~0); InitUIntMap(&device->PresetMap, ~0); - InitUIntMap(&device->InstrumentMap, ~0); InitUIntMap(&device->FontsoundMap, ~0); //Set output format @@ -3220,7 +3209,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, InitUIntMap(&device->FilterMap, ~0); InitUIntMap(&device->SfontMap, ~0); InitUIntMap(&device->PresetMap, ~0); - InitUIntMap(&device->InstrumentMap, ~0); InitUIntMap(&device->FontsoundMap, ~0); device->DeviceName = NULL; @@ -3401,7 +3389,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN InitUIntMap(&device->FilterMap, ~0); InitUIntMap(&device->SfontMap, ~0); InitUIntMap(&device->PresetMap, ~0); - InitUIntMap(&device->InstrumentMap, ~0); InitUIntMap(&device->FontsoundMap, ~0); factory = ALCloopbackFactory_getFactory(); diff --git a/Alc/midi/base.c b/Alc/midi/base.c index f3f89743..dfa6d1ec 100644 --- a/Alc/midi/base.c +++ b/Alc/midi/base.c @@ -243,184 +243,6 @@ ALenum MidiSynth_insertSysExEvent(MidiSynth *self, ALuint64 time, const ALbyte * } -void ALsfzone_Construct(ALsfzone *self) -{ - self->Generators = NULL; - self->NumGenerators = 0; - self->GeneratorsMax = 0; - - self->Modulators = NULL; - self->NumModulators = 0; - self->ModulatorsMax = 0; - - self->Object = NULL; -} - -void ALsfzone_Destruct(ALsfzone *self) -{ - self->Object = NULL; - - free(self->Modulators); - self->Modulators = NULL; - self->NumModulators = 0; - self->ModulatorsMax = 0; - - free(self->Generators); - self->Generators = NULL; - self->NumGenerators = 0; - self->GeneratorsMax = 0; -} - -ALenum ALsfzone_addGenerator(ALsfzone *self, ALenum generator, ALint value) -{ - ALsizei i; - for(i = 0;i < self->NumGenerators;i++) - { - if(self->Generators[i].Generator == generator) - { - self->Generators[i].Value = value; - return AL_NO_ERROR; - } - } - - if(self->NumGenerators == self->GeneratorsMax) - { - ALsizei newmax = 0; - ALvoid *temp = NULL; - - newmax = (self->GeneratorsMax ? self->GeneratorsMax<<1 : 1); - if(newmax > self->GeneratorsMax) - temp = realloc(self->Generators, newmax * sizeof(ALsfgenerator)); - if(!temp) return AL_OUT_OF_MEMORY; - - self->Generators = temp; - self->GeneratorsMax = newmax; - } - - /* Make sure key range generator is first in the list. */ - if(generator == 43/*key range*/ && self->NumGenerators > 0) - { - memmove(&self->Generators[1], &self->Generators[0], self->NumGenerators); - self->Generators[0].Generator = generator; - self->Generators[0].Value = value; - self->NumGenerators++; - - return AL_NO_ERROR; - } - - /* Make sure velocity range generator is second only to key range. */ - if(generator == 44/*vel range*/ && self->NumGenerators > 0) - { - ALsizei base = 0; - if(self->Generators[0].Generator == 43/*key range*/) - base = 1; - if(self->NumGenerators > base) - { - memmove(&self->Generators[base+1], &self->Generators[base], self->NumGenerators-base); - self->Generators[base].Generator = generator; - self->Generators[base].Value = value; - self->NumGenerators++; - - return AL_NO_ERROR; - } - } - - self->Generators[self->NumGenerators].Generator = generator; - self->Generators[self->NumGenerators].Value = value; - self->NumGenerators++; - - return AL_NO_ERROR; -} - -ALenum ALsfzone_addModulator(ALsfzone *self, ALenum sourceop, ALenum destop, ALint amount, ALenum amtsourceop, ALenum transop) -{ - ALsizei i; - for(i = 0;i < self->NumModulators;i++) - { - if(self->Modulators[i].SourceOp == sourceop && self->Modulators[i].DestOp == destop && - self->Modulators[i].AmountSourceOp == amtsourceop && - self->Modulators[i].TransformOp == transop) - { - self->Modulators[i].Amount = amount; - return AL_NO_ERROR; - } - } - - if(self->NumModulators == self->ModulatorsMax) - { - ALsizei newmax = 0; - ALvoid *temp = NULL; - - newmax = (self->ModulatorsMax ? self->ModulatorsMax<<1 : 1); - if(newmax > self->ModulatorsMax) - temp = realloc(self->Modulators, newmax * sizeof(ALsfmodulator)); - if(!temp) return AL_OUT_OF_MEMORY; - - self->Modulators = temp; - self->ModulatorsMax = newmax; - } - - self->Modulators[self->NumModulators].SourceOp = sourceop; - self->Modulators[self->NumModulators].DestOp = destop; - self->Modulators[self->NumModulators].Amount = amount; - self->Modulators[self->NumModulators].AmountSourceOp = amtsourceop; - self->Modulators[self->NumModulators].TransformOp = transop; - self->NumModulators++; - - return AL_NO_ERROR; -} - -/* Stores a new object pointer in the zone. Returns the old object pointer. */ -ALvoid *ALsfzone_setRefObject(ALsfzone *self, ALvoid *object) -{ - ALvoid *oldobj = self->Object; - self->Object = object; - return oldobj; -} - - -void ALsfsample_Construct(ALsfsample *self) -{ - self->ref = 0; - - self->id = 0; -} - -void ALsfsample_Destruct(ALsfsample *self) -{ - self->id = 0; -} - - -void ALsfinstrument_Construct(ALsfinstrument *self) -{ - self->ref = 0; - - self->Zones = NULL; - self->NumZones = 0; - - self->id = 0; -} - -void ALsfinstrument_Destruct(ALsfinstrument *self) -{ - ALsizei i; - - FreeThunkEntry(self->id); - self->id = 0; - - for(i = 0;i < self->NumZones;i++) - { - if(self->Zones[i].Object) - DecrementRef(&((ALsfsample*)self->Zones[i].Object)->ref); - ALsfzone_Destruct(&self->Zones[i]); - } - free(self->Zones); - self->Zones = NULL; - self->NumZones = 0; -} - - void ALfontsound_Construct(ALfontsound *self) { self->ref = 0; @@ -546,28 +368,15 @@ void ALsfpreset_Construct(ALsfpreset *self) self->Preset = 0; self->Bank = 0; - self->Zones = NULL; - self->NumZones = 0; self->id = 0; } void ALsfpreset_Destruct(ALsfpreset *self) { - ALsizei i; - FreeThunkEntry(self->id); self->id = 0; - for(i = 0;i < self->NumZones;i++) - { - if(self->Zones[i].Object) - DecrementRef(&((ALsfinstrument*)self->Zones[i].Object)->ref); - ALsfzone_Destruct(&self->Zones[i]); - } - free(self->Zones); - self->Zones = NULL; - self->NumZones = 0; } diff --git a/CMakeLists.txt b/CMakeLists.txt index f335a899..8306559c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -492,7 +492,6 @@ SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c OpenAL32/alExtension.c OpenAL32/alFilter.c OpenAL32/alFontsound.c - OpenAL32/alInstrument.c OpenAL32/alListener.c OpenAL32/alMidi.c OpenAL32/alPreset.c diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index aafe6c90..2718b6c0 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -57,9 +57,6 @@ typedef ALboolean (AL_APIENTRY*LPALISPRESETSOFT)(ALuint id); typedef void (AL_APIENTRY*LPALPRESETISOFT)(ALuint id, ALenum param, ALint value); typedef void (AL_APIENTRY*LPALPRESETIVSOFT)(ALuint id, ALenum param, const ALint *values); typedef void (AL_APIENTRY*LPALGETPRESETIVSOFT)(ALuint id, ALenum param, ALint *values); -typedef void (AL_APIENTRY*LPALGENINSTRUMENTSSOFT)(ALsizei n, ALuint *ids); -typedef void (AL_APIENTRY*LPALDELETEINSTRUMENTSSOFT)(ALsizei n, const ALuint *ids); -typedef ALboolean (AL_APIENTRY*LPALISINSTRUMENTSOFT)(ALuint id); typedef void (AL_APIENTRY*LPALGENFONTSOUNDSSOFT)(ALsizei n, ALuint *ids); typedef void (AL_APIENTRY*LPALDELETEFONTSOUNDSSOFT)(ALsizei n, const ALuint *ids); typedef ALboolean (AL_APIENTRY*LPALISFONTSOUNDSOFT)(ALuint id); @@ -90,10 +87,6 @@ AL_API void AL_APIENTRY alPresetiSOFT(ALuint id, ALenum param, ALint value); AL_API void AL_APIENTRY alPresetivSOFT(ALuint id, ALenum param, const ALint *values); AL_API void AL_APIENTRY alGetPresetivSOFT(ALuint id, ALenum param, ALint *values); -AL_API void AL_APIENTRY alGenInstrumentsSOFT(ALsizei n, ALuint *ids); -AL_API void AL_APIENTRY alDeleteInstrumentsSOFT(ALsizei n, const ALuint *ids); -AL_API ALboolean AL_APIENTRY alIsInstrumentSOFT(ALuint id); - AL_API void AL_APIENTRY alGenFontsoundsSOFT(ALsizei n, ALuint *ids); AL_API void AL_APIENTRY alDeleteFontsoundsSOFT(ALsizei n, const ALuint *ids); AL_API ALboolean AL_APIENTRY alIsFontsoundSOFT(ALuint id); @@ -477,9 +470,6 @@ struct ALCdevice_struct // Map of Presets for this device UIntMap PresetMap; - // Map of Instruments for this device - UIntMap InstrumentMap; - // Map of Fontsounds for this device UIntMap FontsoundMap; diff --git a/OpenAL32/Include/alMidi.h b/OpenAL32/Include/alMidi.h index 9b195d26..38042693 100644 --- a/OpenAL32/Include/alMidi.h +++ b/OpenAL32/Include/alMidi.h @@ -21,68 +21,6 @@ typedef struct ALsfmodulator { ALenum TransformOp; } ALsfmodulator; -typedef struct ALsfzone { - ALsfgenerator *Generators; - ALsizei NumGenerators; - ALsizei GeneratorsMax; - - ALsfmodulator *Modulators; - ALsizei NumModulators; - ALsizei ModulatorsMax; - - /* NOTE: Preset zones may have a reference to an ALsfinstrument. Instrument - * zones may have a reference to an ALsfsample. */ - ALvoid *Object; -} ALsfzone; - -void ALsfzone_Construct(ALsfzone *self); -void ALsfzone_Destruct(ALsfzone *self); -ALenum ALsfzone_addGenerator(ALsfzone *self, ALenum generator, ALint value); -ALenum ALsfzone_addModulator(ALsfzone *self, ALenum sourceop, ALenum destop, ALint amount, ALenum amtsourceop, ALenum transop); -/* Stores a new object pointer in the zone. Returns the old object pointer. */ -ALvoid *ALsfzone_setRefObject(ALsfzone *self, ALvoid *object); - - -typedef struct ALsfsample { - volatile RefCount ref; - - ALuint Start; - ALuint End; - ALuint LoopStart; - ALuint LoopEnd; - ALuint SampleRate; - ALubyte PitchKey; - ALbyte PitchCorrection; - ALushort SampleLink; - ALenum SampleType; - - ALuint id; -} ALsfsample; - -void ALsfsample_Construct(ALsfsample *self); -void ALsfsample_Destruct(ALsfsample *self); - - -typedef struct ALsfinstrument { - volatile RefCount ref; - - ALsfzone *Zones; - ALsizei NumZones; - - ALuint id; -} ALsfinstrument; - -void ALsfinstrument_Construct(ALsfinstrument *self); -void ALsfinstrument_Destruct(ALsfinstrument *self); - - -inline struct ALsfinstrument *LookupInstrument(ALCdevice *device, ALuint id) -{ return (struct ALsfinstrument*)LookupUIntMapKey(&device->InstrumentMap, id); } -inline struct ALsfinstrument *RemoveInstrument(ALCdevice *device, ALuint id) -{ return (struct ALsfinstrument*)RemoveUIntMapKey(&device->InstrumentMap, id); } - -void ReleaseALInstruments(ALCdevice *device); - typedef struct ALfontsound { volatile RefCount ref; @@ -131,8 +69,6 @@ typedef struct ALsfpreset { ALint Preset; /* a.k.a. MIDI program number */ ALint Bank; /* MIDI bank 0...127, or percussion (bank 128) */ - ALsfzone *Zones; - ALsizei NumZones; ALuint id; } ALsfpreset; diff --git a/OpenAL32/alInstrument.c b/OpenAL32/alInstrument.c deleted file mode 100644 index cd186475..00000000 --- a/OpenAL32/alInstrument.c +++ /dev/null @@ -1,134 +0,0 @@ - -#include "config.h" - -#include <stdlib.h> -#include <string.h> - -#include "alMain.h" -#include "alMidi.h" -#include "alError.h" -#include "alThunk.h" - -#include "midi/base.h" - - -extern inline struct ALsfinstrument *LookupInstrument(ALCdevice *device, ALuint id); -extern inline struct ALsfinstrument *RemoveInstrument(ALCdevice *device, ALuint id); - - -AL_API void AL_APIENTRY alGenInstrumentsSOFT(ALsizei n, ALuint *ids) -{ - ALCdevice *device; - ALCcontext *context; - ALsizei cur = 0; - ALenum err; - - context = GetContextRef(); - if(!context) return; - - if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - device = context->Device; - for(cur = 0;cur < n;cur++) - { - ALsfinstrument *inst = calloc(1, sizeof(ALsfinstrument)); - if(!inst) - { - alDeleteInstrumentsSOFT(cur, ids); - SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); - } - ALsfinstrument_Construct(inst); - - err = NewThunkEntry(&inst->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&device->InstrumentMap, inst->id, inst); - if(err != AL_NO_ERROR) - { - ALsfinstrument_Destruct(inst); - memset(inst, 0, sizeof(*inst)); - free(inst); - - alDeleteInstrumentsSOFT(cur, ids); - SET_ERROR_AND_GOTO(context, err, done); - } - - ids[cur] = inst->id; - } - -done: - ALCcontext_DecRef(context); -} - -AL_API ALvoid AL_APIENTRY alDeleteInstrumentsSOFT(ALsizei n, const ALuint *ids) -{ - ALCdevice *device; - ALCcontext *context; - ALsfinstrument *inst; - ALsizei i; - - context = GetContextRef(); - if(!context) return; - - if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - device = context->Device; - for(i = 0;i < n;i++) - { - /* Check for valid ID */ - if((inst=LookupInstrument(device, ids[i])) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(inst->ref != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); - } - - for(i = 0;i < n;i++) - { - if((inst=RemoveInstrument(device, ids[i])) == NULL) - continue; - - ALsfinstrument_Destruct(inst); - - memset(inst, 0, sizeof(*inst)); - free(inst); - } - -done: - ALCcontext_DecRef(context); -} - -AL_API ALboolean AL_APIENTRY alIsInstrumentSOFT(ALuint id) -{ - ALCcontext *context; - ALboolean ret; - - context = GetContextRef(); - if(!context) return AL_FALSE; - - ret = LookupInstrument(context->Device, id) ? AL_TRUE : AL_FALSE; - - ALCcontext_DecRef(context); - - return ret; -} - - -/* ReleaseALInstruments - * - * Called to destroy any instruments that still exist on the device - */ -void ReleaseALInstruments(ALCdevice *device) -{ - ALsizei i; - for(i = 0;i < device->InstrumentMap.size;i++) - { - ALsfinstrument *temp = device->InstrumentMap.array[i].value; - device->InstrumentMap.array[i].value = NULL; - - ALsfinstrument_Destruct(temp); - - memset(temp, 0, sizeof(*temp)); - free(temp); - } -} |