void Game::fireSound(int sound) {
float gLoc[3]={0,0,0};
float vel[3]={0,0,0};
- OPENAL_Sample_SetMinMaxDistance(samp[sound], 9999.0f, 99999.0f);
PlaySoundEx( sound, samp[sound], NULL, true);
OPENAL_3D_SetAttributes(channels[sound], gLoc, vel);
OPENAL_SetVolume(channels[sound], 256);
OPENAL_SetPaused(channels[sound], false);
- OPENAL_Sample_SetMinMaxDistance(samp[sound], 8.0f, 2000.0f);
}
void Game::inputText(char* str, int* charselected, int* nb_chars) {
if(targetlevel!=7){
float gLoc[3]={0,0,0};
float vel[3]={0,0,0};
- OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
OPENAL_SetVolume(channels[fireendsound], 256);
OPENAL_SetPaused(channels[fireendsound], false);
- OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
}
stillloading=0;
samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0);
samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone1.ogg"), OPENAL_HW3D, 0, 0);
samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone2.ogg"), OPENAL_HW3D, 0, 0);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
LoadTexture(":Data:Textures:snow.jpg",&terraintexture,1,0);
samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0);
samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0);
samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
LoadTexture(":Data:Textures:sand.jpg",&terraintexture,1,0);
samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepgrass2.ogg"), OPENAL_HW3D, 0, 0);
samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone1.ogg"), OPENAL_HW3D, 0, 0);
samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone2.ogg"), OPENAL_HW3D, 0, 0);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
- OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
LoadTexture(":Data:Textures:grassdirt.jpg",&terraintexture,1,0);
return true;
}
-AL_API signed char OPENAL_Sample_SetMinMaxDistance(OPENAL_SAMPLE *sptr, float mindist, float maxdist)
-{
- if (!initialized) return false;
- if (sptr == NULL) return false;
- // we ignore maxdist. It's not really important to this game, and the
- // FMOD docs suggest that it's worthless anyhow.
-
- // recalc sources to see if we need to adjust attenuation.
- for (int i = 0; i < num_channels; i++)
- {
- if (channels[i].sample == sptr)
- {
- const float *p = channels[i].position;
- set_channel_position(i, p[0], p[1], p[2]);
- }
- }
-
- return 0;
-}
-
AL_API signed char OPENAL_SetFrequency(int channel, int freq)
{
if (!initialized) return false;
AL_API OPENAL_SAMPLE *OPENAL_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length);
AL_API void OPENAL_Sample_Free(OPENAL_SAMPLE *sptr);
AL_API signed char OPENAL_Sample_SetMode(OPENAL_SAMPLE *sptr, unsigned int mode);
-AL_API signed char OPENAL_Sample_SetMinMaxDistance(OPENAL_SAMPLE *sptr, float mindist, float maxdist);
AL_API signed char OPENAL_SetFrequency(int channel, int freq);
AL_API signed char OPENAL_SetVolume(int channel, int vol);
AL_API signed char OPENAL_SetPaused(int channel, signed char paused);