diff options
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/audio.cc | 5 | ||||
-rw-r--r-- | src/audio/sources.cc | 2 |
2 files changed, 6 insertions, 1 deletions
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; } |