Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-08-30 14:09:10 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-08-30 14:09:10 +0400
commit947d4a654b7ec3b7f413f2132a0524ab2e2e5c9e (patch)
tree0310e5355bff26eeca500908755fb72f346c0528 /source/gameengine/Converter/KX_ConvertActuators.cpp
parentb3704f45c4e165618e898b5b7d1a7391ad14dc50 (diff)
Fix for [#25062] Sound Actuator - Positional Audio.
Now all sounds that are not mono but have 3D checked automatically get reduced to mono during BGE conversion time. Also removed the now unneeded function sound_get_channels and added a missing header file to audaspace's CMakeLists.txt.
Diffstat (limited to 'source/gameengine/Converter/KX_ConvertActuators.cpp')
-rw-r--r--source/gameengine/Converter/KX_ConvertActuators.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index 7b9cba7770b..9621d05b5cc 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -46,6 +46,7 @@
#ifdef WITH_AUDASPACE
# include "AUD_C-API.h"
+# include "AUD_ChannelMapperFactory.h"
#endif
// Actuators
@@ -406,7 +407,23 @@ void BL_ConvertActuators(char* maggiename,
"\" has no sound datablock." << std::endl;
}
else
+ {
snd_sound = *reinterpret_cast<AUD_Reference<AUD_IFactory>*>(sound->playback_handle);
+
+ // if sound shall be 3D but isn't mono, we have to make it mono!
+ if(is3d)
+ {
+ AUD_Reference<AUD_IReader> reader = snd_sound->createReader();
+ if(reader->getSpecs().channels != AUD_CHANNELS_MONO)
+ {
+ AUD_DeviceSpecs specs;
+ specs.channels = AUD_CHANNELS_MONO;
+ specs.rate = AUD_RATE_INVALID;
+ specs.format = AUD_FORMAT_INVALID;
+ snd_sound = new AUD_ChannelMapperFactory(snd_sound, specs);
+ }
+ }
+ }
KX_SoundActuator* tmpsoundact =
new KX_SoundActuator(gameobj,
snd_sound,