diff options
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alBuffer.h | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 43 | ||||
-rw-r--r-- | OpenAL32/Include/alSource.h | 2 |
3 files changed, 38 insertions, 9 deletions
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h index 9035ccd6..9561b057 100644 --- a/OpenAL32/Include/alBuffer.h +++ b/OpenAL32/Include/alBuffer.h @@ -22,8 +22,6 @@ typedef struct ALbuffer // Index to itself ALuint buffer; - - struct ALbuffer *next; } ALbuffer; ALvoid ReleaseALBuffers(ALCdevice *device); diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 27c1f981..5f40bcc7 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -226,6 +226,41 @@ void alc_pulse_deinit(void); void alc_pulse_probe(int type); +typedef struct UIntMap { + struct { + ALuint key; + ALvoid *value; + } *array; + ALsizei size; + ALsizei maxsize; +} UIntMap; + +void InitUIntMap(UIntMap *map); +void ResetUIntMap(UIntMap *map); +ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value); +void RemoveUIntMapKey(UIntMap *map, ALuint key); + +static inline ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key) +{ + if(map->size > 0) + { + ALsizei low = 0; + ALsizei high = map->size - 1; + while(low < high) + { + ALsizei mid = low + (high-low)/2; + if(map->array[mid].key < key) + low = mid + 1; + else + high = mid; + } + if(map->array[low].key == key) + return map->array[low].value; + } + return NULL; +} + + struct ALCdevice_struct { ALCboolean Connected; @@ -249,9 +284,8 @@ struct ALCdevice_struct ALCuint NumStereoSources; ALuint NumAuxSends; - // Linked List of Buffers for this device - struct ALbuffer *BufferList; - ALuint BufferCount; + // Map of Buffers for this device + UIntMap BufferMap; // Linked List of Effects for this device struct ALeffect *EffectList; @@ -311,8 +345,7 @@ struct ALCcontext_struct { ALlistener Listener; - struct ALsource *SourceList; - ALuint SourceCount; + UIntMap SourceMap; struct ALeffectslot *EffectSlotList; ALuint EffectSlotCount; diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index d82ac1c0..0802cbaa 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -104,8 +104,6 @@ typedef struct ALsource // Index to itself ALuint source; - - struct ALsource *next; } ALsource; ALvoid ReleaseALSources(ALCcontext *Context); |