Small fixups

find -> std::find
AL_EXT_loop_points -> AL_SOFT_loop_points
This commit is contained in:
Chris Robinson 2013-06-30 01:32:48 -07:00
parent 4f2e367ec6
commit 5d1cd7b7fe
2 changed files with 16 additions and 16 deletions

View File

@ -224,7 +224,7 @@ public:
virtual ~OpenALSoundStream() virtual ~OpenALSoundStream()
{ {
Renderer->Streams.erase(find(Renderer->Streams.begin(), Renderer->Streams.erase(std::find(Renderer->Streams.begin(),
Renderer->Streams.end(), this)); Renderer->Streams.end(), this));
Renderer = NULL; Renderer = NULL;
} }
@ -288,7 +288,7 @@ OpenALSoundRenderer::OpenALSoundRenderer()
Printf("I_InitSound: Initializing OpenAL\n"); Printf("I_InitSound: Initializing OpenAL\n");
if(snd_aldevice != "Default") if(strcmp(snd_aldevice, "Default") != 0)
{ {
Device = alcOpenDevice(*snd_aldevice); Device = alcOpenDevice(*snd_aldevice);
if(!Device) if(!Device)
@ -348,7 +348,7 @@ OpenALSoundRenderer::OpenALSoundRenderer()
DPrintf(" Extensions: "TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS)); DPrintf(" Extensions: "TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS));
SrcDistanceModel = alIsExtensionPresent("AL_EXT_source_distance_model"); SrcDistanceModel = alIsExtensionPresent("AL_EXT_source_distance_model");
LoopPoints = alIsExtensionPresent("AL_EXT_loop_points"); LoopPoints = alIsExtensionPresent("AL_SOFT_loop_points");
alDopplerFactor(0.5f); alDopplerFactor(0.5f);
alSpeedOfSound(343.3f * 96.0f); alSpeedOfSound(343.3f * 96.0f);
@ -642,7 +642,7 @@ SoundHandle OpenALSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int length, int fre
ALint loops[2] = { loopstart, loopend }; ALint loops[2] = { loopstart, loopend };
Printf("Setting loop points %d -> %d\n", loops[0], loops[1]); Printf("Setting loop points %d -> %d\n", loops[0], loops[1]);
alBufferiv(buffer, AL_LOOP_POINTS, loops); alBufferiv(buffer, AL_LOOP_POINTS_SOFT, loops);
getALError(); getALError();
} }
else if(loopstart > 0 || loopend > 0) else if(loopstart > 0 || loopend > 0)
@ -690,7 +690,7 @@ SoundHandle OpenALSoundRenderer::LoadSound(BYTE *sfxdata, int length)
if(LoopPoints && decoder.LoopPts[1] > decoder.LoopPts[0]) if(LoopPoints && decoder.LoopPts[1] > decoder.LoopPts[0])
{ {
alBufferiv(buffer, AL_LOOP_POINTS, decoder.LoopPts); alBufferiv(buffer, AL_LOOP_POINTS_SOFT, decoder.LoopPts);
getALError(); getALError();
} }
else if(decoder.LoopPts[1] > decoder.LoopPts[0]) else if(decoder.LoopPts[1] > decoder.LoopPts[0])
@ -821,7 +821,7 @@ FISoundChannel *OpenALSoundRenderer::StartSound(SoundHandle sfx, float vol, int
} }
ALuint buffer = *((ALuint*)sfx.data); ALuint buffer = *((ALuint*)sfx.data);
ALuint &source = *find(Sources.begin(), Sources.end(), FreeSfx.back()); ALuint &source = *std::find(Sources.begin(), Sources.end(), FreeSfx.back());
alSource3f(source, AL_POSITION, 0.f, 0.f, 0.f); alSource3f(source, AL_POSITION, 0.f, 0.f, 0.f);
alSource3f(source, AL_VELOCITY, 0.f, 0.f, 0.f); alSource3f(source, AL_VELOCITY, 0.f, 0.f, 0.f);
alSource3f(source, AL_DIRECTION, 0.f, 0.f, 0.f); alSource3f(source, AL_DIRECTION, 0.f, 0.f, 0.f);
@ -930,7 +930,7 @@ FISoundChannel *OpenALSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener
ALint channels = 1; ALint channels = 1;
alGetBufferi(buffer, AL_CHANNELS, &channels); alGetBufferi(buffer, AL_CHANNELS, &channels);
ALuint &source = *find(Sources.begin(), Sources.end(), FreeSfx.back()); ALuint &source = *std::find(Sources.begin(), Sources.end(), FreeSfx.back());
alSource3f(source, AL_POSITION, pos[0], pos[1], -pos[2]); alSource3f(source, AL_POSITION, pos[0], pos[1], -pos[2]);
alSource3f(source, AL_VELOCITY, vel[0], vel[1], -vel[2]); alSource3f(source, AL_VELOCITY, vel[0], vel[1], -vel[2]);
alSource3f(source, AL_DIRECTION, 0.f, 0.f, 0.f); alSource3f(source, AL_DIRECTION, 0.f, 0.f, 0.f);
@ -1075,12 +1075,12 @@ void OpenALSoundRenderer::StopChannel(FISoundChannel *chan)
std::vector<ALuint>::iterator i; std::vector<ALuint>::iterator i;
i = find(PausableSfx.begin(), PausableSfx.end(), source); i = std::find(PausableSfx.begin(), PausableSfx.end(), source);
if(i != PausableSfx.end()) PausableSfx.erase(i); if(i != PausableSfx.end()) PausableSfx.erase(i);
i = find(ReverbSfx.begin(), ReverbSfx.end(), source); i = std::find(ReverbSfx.begin(), ReverbSfx.end(), source);
if(i != ReverbSfx.end()) ReverbSfx.erase(i); if(i != ReverbSfx.end()) ReverbSfx.erase(i);
SfxGroup.erase(find(SfxGroup.begin(), SfxGroup.end(), source)); SfxGroup.erase(std::find(SfxGroup.begin(), SfxGroup.end(), source));
FreeSfx.push_back(source); FreeSfx.push_back(source);
} }
@ -1148,7 +1148,7 @@ void OpenALSoundRenderer::Sync(bool sync)
std::vector<ALuint>::iterator i = toplay.begin(); std::vector<ALuint>::iterator i = toplay.begin();
while(i != toplay.end()) while(i != toplay.end())
{ {
if(find(PausableSfx.begin(), PausableSfx.end(), *i) != PausableSfx.end()) if(std::find(PausableSfx.begin(), PausableSfx.end(), *i) != PausableSfx.end())
i = toplay.erase(i); i = toplay.erase(i);
else else
i++; i++;
@ -1419,7 +1419,7 @@ void OpenALSoundRenderer::PrintDriversList()
return; return;
} }
Printf("%c%s%2d. %s\n", ' ', ((snd_aldevice=="Default") ? TEXTCOLOR_BOLD : ""), 0, Printf("%c%s%2d. %s\n", ' ', ((strcmp(snd_aldevice, "Default") == 0) ? TEXTCOLOR_BOLD : ""), 0,
"Default"); "Default");
for(int i = 1;*drivers;i++) for(int i = 1;*drivers;i++)
{ {

View File

@ -30,9 +30,9 @@
#define AL_SOURCE_DISTANCE_MODEL 0x200 #define AL_SOURCE_DISTANCE_MODEL 0x200
#endif #endif
#ifndef AL_EXT_loop_points #ifndef AL_SOFT_loop_points
#define AL_EXT_loop_points 1 #define AL_SOFT_loop_points 1
#define AL_LOOP_POINTS 0x2015 #define AL_LOOP_POINTS_SOFT 0x2015
#endif #endif
#ifndef AL_EXT_float32 #ifndef AL_EXT_float32