X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2Fopenal_wrapper.cpp;h=e3757172536a15d416a72b7b2d7f4704504c4086;hb=5c8be15962d6b02d7fdfdb16acc10f55267bea0f;hp=1c3f2acd4d39351a57d63a000b9c1c88908a9cc1;hpb=de7834267e2ff8f28a2cb49647fc91e060686e93;p=lugaru.git diff --git a/Source/openal_wrapper.cpp b/Source/openal_wrapper.cpp index 1c3f2ac..e375717 100644 --- a/Source/openal_wrapper.cpp +++ b/Source/openal_wrapper.cpp @@ -112,7 +112,6 @@ typedef struct OPENAL_SAMPLE ALuint bid; // buffer id. int mode; int is2d; - float min_distance; } OPENAL_SAMPLE; typedef struct OPENAL_STREAM @@ -128,17 +127,6 @@ static OPENAL_Channels *channels = NULL; static bool initialized = false; static float listener_position[3]; -static inline bool source_too_close(const int channel) -{ - const OPENAL_Channels *chan = &channels[channel]; - const float *pos = chan->position; - const float distance = sqrtf(powf((pos[0] - listener_position[0]), 2.0f) + - powf((pos[1] - listener_position[1]), 2.0f) + - powf((pos[2] - listener_position[2]), 2.0f)); - return (distance <= chan->sample->min_distance); -} - - static void set_channel_position(const int channel, const float x, const float y, const float z) { @@ -153,7 +141,7 @@ static void set_channel_position(const int channel, const float x, return; const ALuint sid = chan->sid; - const bool no_attenuate = ((sptr->is2d) || (source_too_close(channel))); + const bool no_attenuate = sptr->is2d; if (no_attenuate) { @@ -521,27 +509,6 @@ AL_API signed char OPENAL_Sample_SetMode(OPENAL_SAMPLE *sptr, unsigned int mode) 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; - sptr->min_distance = mindist; - // 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;