Try not being so lame with the sound initialization.
This commit is contained in:
parent
fc69f56b9a
commit
c11821b898
1 changed files with 22 additions and 14 deletions
12
src/openal.c
12
src/openal.c
|
@ -169,6 +169,7 @@ openal.c TODO:
|
||||||
*/
|
*/
|
||||||
int PlatStartSoundSys()
|
int PlatStartSoundSys()
|
||||||
{
|
{
|
||||||
|
int initSources;
|
||||||
int i;
|
int i;
|
||||||
char buf[42];
|
char buf[42];
|
||||||
ALfloat pos[] = { 0.0, 0.0, 0.0 },
|
ALfloat pos[] = { 0.0, 0.0, 0.0 },
|
||||||
|
@ -244,17 +245,22 @@ int PlatStartSoundSys()
|
||||||
PlatSetEnviroment(EAX_ENVIRONMENT_DEFAULT, EAX_REVERBMIX_USEDISTANCE);
|
PlatSetEnviroment(EAX_ENVIRONMENT_DEFAULT, EAX_REVERBMIX_USEDISTANCE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset( ActiveSounds, 0, sizeof(ActiveSounds) );
|
initSources = 1;
|
||||||
|
|
||||||
for (i = 0; i < SOUND_MAXACTIVE; i++) {
|
for (i = 0; i < SOUND_MAXACTIVE; i++) {
|
||||||
ALuint p;
|
ALuint p;
|
||||||
|
|
||||||
|
if( initSources ) {
|
||||||
alGenSources (1, &p);
|
alGenSources (1, &p);
|
||||||
if (alGetError () != AL_NO_ERROR) {
|
if (alGetError () != AL_NO_ERROR) {
|
||||||
// TODO - need to figure out how many sources we are allowed to make
|
// TODO - need to figure out how many sources we are allowed to make
|
||||||
//fprintf (stderr, "alGenSources () error = ...");
|
//fprintf (stderr, "alGenSources () error = ...");
|
||||||
//return -1;
|
//return -1;
|
||||||
break;
|
initSources = 0;
|
||||||
|
p = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove the incorrectly named PropSetP variables
|
// TODO: remove the incorrectly named PropSetP variables
|
||||||
|
@ -268,6 +274,7 @@ int PlatStartSoundSys()
|
||||||
ActiveSounds[i].PropSetP_vel[1] = 0.0;
|
ActiveSounds[i].PropSetP_vel[1] = 0.0;
|
||||||
ActiveSounds[i].PropSetP_vel[2] = 0.0;
|
ActiveSounds[i].PropSetP_vel[2] = 0.0;
|
||||||
|
|
||||||
|
if( initSources ) {
|
||||||
alSourcef(p, AL_PITCH, 1.0f);
|
alSourcef(p, AL_PITCH, 1.0f);
|
||||||
alSourcef(p, AL_GAIN, 1.0f);
|
alSourcef(p, AL_GAIN, 1.0f);
|
||||||
alSourcefv(p, AL_POSITION, ActiveSounds[i].PropSetP_pos);
|
alSourcefv(p, AL_POSITION, ActiveSounds[i].PropSetP_pos);
|
||||||
|
@ -276,6 +283,7 @@ int PlatStartSoundSys()
|
||||||
alSourcef(p, AL_ROLLOFF_FACTOR, 0.01f);
|
alSourcef(p, AL_ROLLOFF_FACTOR, 0.01f);
|
||||||
alSourcef(p, AL_REFERENCE_DISTANCE, 1.0f);
|
alSourcef(p, AL_REFERENCE_DISTANCE, 1.0f);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SoundActivated = 1;
|
SoundActivated = 1;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue