mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-31 12:30:32 +00:00
- fixed VOC loader. Its 16 bit code did not work because it set the variable to -16 instead of 16.
- removed a few MAX calls with std::max.
This commit is contained in:
parent
c3759f389c
commit
9c825ea090
4 changed files with 11 additions and 9 deletions
|
@ -409,7 +409,7 @@ std::pair<SoundHandle,bool> SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int le
|
||||||
if (codec == 0)
|
if (codec == 0)
|
||||||
bits = 8;
|
bits = 8;
|
||||||
else if (codec == 4)
|
else if (codec == 4)
|
||||||
bits = -16;
|
bits = 16;
|
||||||
else okay = false;
|
else okay = false;
|
||||||
len += blocksize - 2;
|
len += blocksize - 2;
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ std::pair<SoundHandle,bool> SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int le
|
||||||
if (codec == 0)
|
if (codec == 0)
|
||||||
bits = 8;
|
bits = 8;
|
||||||
else if (codec == 4)
|
else if (codec == 4)
|
||||||
bits = -16;
|
bits = 16;
|
||||||
else okay = false;
|
else okay = false;
|
||||||
len += blocksize - 12;
|
len += blocksize - 12;
|
||||||
} else okay = false;
|
} else okay = false;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define __SNDINT_H
|
#define __SNDINT_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "vectors.h"
|
#include "vectors.h"
|
||||||
#include "tarray.h"
|
#include "tarray.h"
|
||||||
|
|
|
@ -576,7 +576,7 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
||||||
// Make sure one source is capable of stereo output with the rest doing
|
// Make sure one source is capable of stereo output with the rest doing
|
||||||
// mono, without running out of voices
|
// mono, without running out of voices
|
||||||
attribs.Push(ALC_MONO_SOURCES);
|
attribs.Push(ALC_MONO_SOURCES);
|
||||||
attribs.Push(MAX<ALCint>(*snd_channels, 2) - 1);
|
attribs.Push(std::max<ALCint>(snd_channels, 2) - 1);
|
||||||
attribs.Push(ALC_STEREO_SOURCES);
|
attribs.Push(ALC_STEREO_SOURCES);
|
||||||
attribs.Push(1);
|
attribs.Push(1);
|
||||||
if(ALC.SOFT_HRTF)
|
if(ALC.SOFT_HRTF)
|
||||||
|
@ -686,7 +686,7 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
||||||
// At least Apple's OpenAL implementation returns zeroes,
|
// At least Apple's OpenAL implementation returns zeroes,
|
||||||
// although it can generate reasonable number of sources.
|
// although it can generate reasonable number of sources.
|
||||||
|
|
||||||
const int numChannels = MAX<int>(*snd_channels, 2);
|
const int numChannels = std::max<int>(snd_channels, 2);
|
||||||
int numSources = numMono + numStereo;
|
int numSources = numMono + numStereo;
|
||||||
|
|
||||||
if (0 == numSources)
|
if (0 == numSources)
|
||||||
|
@ -694,7 +694,7 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
||||||
numSources = numChannels;
|
numSources = numChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sources.Resize(MIN<int>(numChannels, numSources));
|
Sources.Resize(std::min<int>(numChannels, numSources));
|
||||||
for(unsigned i = 0;i < Sources.Size();i++)
|
for(unsigned i = 0;i < Sources.Size();i++)
|
||||||
{
|
{
|
||||||
alGenSources(1, &Sources[i]);
|
alGenSources(1, &Sources[i]);
|
||||||
|
@ -917,6 +917,7 @@ void OpenALSoundRenderer::SetSfxVolume(float volume)
|
||||||
{
|
{
|
||||||
SfxVolume = volume;
|
SfxVolume = volume;
|
||||||
|
|
||||||
|
if (!soundEngine) return;
|
||||||
FSoundChan *schan = soundEngine->GetChannels();
|
FSoundChan *schan = soundEngine->GetChannels();
|
||||||
while(schan)
|
while(schan)
|
||||||
{
|
{
|
||||||
|
@ -1523,7 +1524,7 @@ FISoundChannel *OpenALSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener
|
||||||
* distance that corresponds to the area radius. */
|
* distance that corresponds to the area radius. */
|
||||||
alSourcef(source, AL_SOURCE_RADIUS, (chanflags&SNDF_AREA) ?
|
alSourcef(source, AL_SOURCE_RADIUS, (chanflags&SNDF_AREA) ?
|
||||||
// Clamp in case the max distance is <= the area radius
|
// Clamp in case the max distance is <= the area radius
|
||||||
1.f/MAX<float>(GetRolloff(rolloff, AREA_SOUND_RADIUS), 0.00001f) : 0.f
|
1.f/std::max<float>(GetRolloff(rolloff, AREA_SOUND_RADIUS), 0.00001f) : 0.f
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if((chanflags&SNDF_AREA) && dist_sqr < AREA_SOUND_RADIUS*AREA_SOUND_RADIUS)
|
else if((chanflags&SNDF_AREA) && dist_sqr < AREA_SOUND_RADIUS*AREA_SOUND_RADIUS)
|
||||||
|
@ -1670,9 +1671,9 @@ void OpenALSoundRenderer::ChannelPitch(FISoundChannel *chan, float pitch)
|
||||||
|
|
||||||
ALuint source = GET_PTRID(chan->SysChannel);
|
ALuint source = GET_PTRID(chan->SysChannel);
|
||||||
if (WasInWater && !(chan->ChanFlags & CHANF_UI))
|
if (WasInWater && !(chan->ChanFlags & CHANF_UI))
|
||||||
alSourcef(source, AL_PITCH, MAX(pitch, 0.0001f)*PITCH_MULT);
|
alSourcef(source, AL_PITCH, std::max(pitch, 0.0001f)*PITCH_MULT);
|
||||||
else
|
else
|
||||||
alSourcef(source, AL_PITCH, MAX(pitch, 0.0001f));
|
alSourcef(source, AL_PITCH, std::max(pitch, 0.0001f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenALSoundRenderer::FreeSource(ALuint source)
|
void OpenALSoundRenderer::FreeSource(ALuint source)
|
||||||
|
|
|
@ -805,7 +805,7 @@ void SoundEngine::LoadSound3D(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
|
||||||
{
|
{
|
||||||
snd = GSnd->LoadSoundBuffered(pBuffer, true);
|
snd = GSnd->LoadSoundBuffered(pBuffer, true);
|
||||||
}
|
}
|
||||||
else
|
else if (sfx->lumpnum >= 0)
|
||||||
{
|
{
|
||||||
auto sfxdata = ReadSound(sfx->lumpnum);
|
auto sfxdata = ReadSound(sfx->lumpnum);
|
||||||
int size = sfxdata.Size();
|
int size = sfxdata.Size();
|
||||||
|
|
Loading…
Reference in a new issue