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.
intern/AUD_ReadDevice.h
intern/AUD_Reference.h
intern/AUD_ReferenceHandler.cpp
+ intern/AUD_ResampleFactory.h
intern/AUD_ResampleReader.cpp
intern/AUD_ResampleReader.h
intern/AUD_SequencerEntry.cpp
void sound_read_waveform(struct bSound* sound);
-int sound_get_channels(struct bSound* sound);
-
void sound_update_scene(struct Scene* scene);
void* sound_get_factory(void* sound);
}
}
-int sound_get_channels(struct bSound* sound)
-{
- AUD_SoundInfo info;
-
- info = AUD_getInfo(sound->playback_handle);
-
- return info.specs.channels;
-}
-
void sound_update_scene(struct Scene* scene)
{
Object* ob;
float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; }
int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; }
int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
-int sound_get_channels(struct bSound* UNUSED(sound)) { return 1; }
#endif // WITH_AUDASPACE
#ifdef WITH_AUDASPACE
# include "AUD_C-API.h"
+# include "AUD_ChannelMapperFactory.h"
#endif
// Actuators
"\" 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,