diff options
author | Chris Robinson <[email protected]> | 2010-11-24 17:10:41 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-11-24 17:10:41 -0800 |
commit | 3dd58cf7654c783ba7949ef6e941954da8852bc4 (patch) | |
tree | 45f56e390f9986ea9ba99b3cbc3f15cf6d3e4b23 /Alc/mixer.c | |
parent | cd8706174907b4e333258fb303c68a5728207873 (diff) |
Get rid of a useless union
Diffstat (limited to 'Alc/mixer.c')
-rw-r--r-- | Alc/mixer.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index 732f3b2b..ce220f2d 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -717,11 +717,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) j = 0; do { const ALbuffer *ALBuffer; - union { - ALfloat *p32; - ALshort *p16; - ALubyte *p8; - } Data = { NULL }; + ALubyte *Data = NULL; ALuint DataSize = 0; ALuint LoopStart = 0; ALuint LoopEnd = 0; @@ -731,7 +727,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) /* Get buffer info */ if((ALBuffer=BufferListItem->buffer) != NULL) { - Data.p8 = ALBuffer->data; + Data = ALBuffer->data; DataSize = ALBuffer->size; DataSize /= aluFrameSizeFromFormat(ALBuffer->format); Channels = aluChannelsFromFormat(ALBuffer->format); @@ -755,7 +751,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) if(DataPosInt >= DataSize) goto skipmix; - memset(&Data.p8[DataSize*Channels*Bytes], 0, BUFFER_PADDING*Channels*Bytes); + memset(&Data[DataSize*Channels*Bytes], 0, BUFFER_PADDING*Channels*Bytes); if(BufferListItem->next) { ALbuffer *NextBuf = BufferListItem->next->buffer; @@ -763,7 +759,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) { ALint ulExtraSamples = BUFFER_PADDING*Channels*Bytes; ulExtraSamples = min(NextBuf->size, ulExtraSamples); - memcpy(&Data.p8[DataSize*Channels*Bytes], + memcpy(&Data[DataSize*Channels*Bytes], NextBuf->data, ulExtraSamples); } } @@ -774,7 +770,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) { ALint ulExtraSamples = BUFFER_PADDING*Channels*Bytes; ulExtraSamples = min(NextBuf->size, ulExtraSamples); - memcpy(&Data.p8[DataSize*Channels*Bytes], + memcpy(&Data[DataSize*Channels*Bytes], &((ALubyte*)NextBuf->data)[LoopStart*Channels*Bytes], ulExtraSamples); } @@ -795,19 +791,19 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) { case POINT_RESAMPLER: Mix_point(Source, Device, - Data.p8, &DataPosInt, &DataPosFrac, LoopEnd, + Data, &DataPosInt, &DataPosFrac, LoopEnd, Channels, Bytes, j, SamplesToDo, BufferSize); break; case LINEAR_RESAMPLER: Mix_lerp(Source, Device, - Data.p8, &DataPosInt, &DataPosFrac, LoopEnd, + Data, &DataPosInt, &DataPosFrac, LoopEnd, Channels, Bytes, j, SamplesToDo, BufferSize); break; case COSINE_RESAMPLER: Mix_cos_lerp(Source, Device, - Data.p8, &DataPosInt, &DataPosFrac, LoopEnd, + Data, &DataPosInt, &DataPosFrac, LoopEnd, Channels, Bytes, j, SamplesToDo, BufferSize); break; |