From c3d90b226bdd83592d08704aa918f155f4c757e2 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 18 Jul 2008 22:07:46 +0000 Subject: reset spacedust on ship change, audio distance model changes (should fix win32 ui sound dissapearing in the distance) --- src/audio/audio.cc | 5 +++++ src/audio/sources.cc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/audio') diff --git a/src/audio/audio.cc b/src/audio/audio.cc index 20f6b1d..8b65879 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -84,6 +84,9 @@ void play(const char *name) Buffers::bind(source, buffer); alSourcef(source, AL_PITCH, 1.0); alSourcef(source, AL_GAIN, 1.0); + alSourcei(source, AL_SOURCE_RELATIVE, AL_TRUE); + ALfloat location[] = {0.0f, 0.0f, 0.0f}; + alSourcefv(source, AL_POSITION, location); alSourceRewind(source); alSourcePlay(source); return; @@ -108,6 +111,8 @@ void loop( size_t source_index, const char *name, float pitch, float gain) ALuint source = Sources::source(source_index); Buffers::bind(source, Buffers::load(std::string(name))); + alSourcef(source, AL_REFERENCE_DISTANCE, 4.0f); + alSourcei(source, AL_SOURCE_RELATIVE, AL_FALSE); alSourcef(source, AL_PITCH, pitch); alSourcef(source, AL_GAIN, gain); diff --git a/src/audio/sources.cc b/src/audio/sources.cc index 3a6b3fc..b52c5a4 100644 --- a/src/audio/sources.cc +++ b/src/audio/sources.cc @@ -59,7 +59,7 @@ size_t Sources::get() if (source_available[i]) { source_available[i] = false; alSourcef(sources[i], AL_PITCH, 1.0); - alSourcef(sources[i], AL_GAIN, 1.0); + alSourcef(sources[i], AL_GAIN, 0.0); //con_debug << "reserved source " << i << std::endl; return i; } -- cgit v1.2.3