diff options
Diffstat (limited to 'source/gameengine/Converter/KX_ConvertActuators.cpp')
-rw-r--r-- | source/gameengine/Converter/KX_ConvertActuators.cpp | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index f6ed3366625..3b36e094a75 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -42,8 +42,7 @@ #include "KX_ConvertActuators.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" -# include "AUD_ChannelMapperFactory.h" +# include AUD_SOUND_H #endif // Actuators @@ -75,7 +74,7 @@ #include "KX_Scene.h" #include "KX_KetsjiEngine.h" -#include "IntValue.h" +#include "EXP_IntValue.h" #include "KX_GameObject.h" /* This little block needed for linking to Blender... */ @@ -385,7 +384,7 @@ void BL_ConvertActuators(const char* maggiename, { bSound* sound = soundact->sound; bool is3d = soundact->flag & ACT_SND_3D_SOUND ? true : false; - boost::shared_ptr<AUD_IFactory> snd_sound; + AUD_Sound* snd_sound = NULL; KX_3DSoundSettings settings; settings.cone_inner_angle = RAD2DEGF(soundact->sound3D.cone_inner_angle); settings.cone_outer_angle = RAD2DEGF(soundact->sound3D.cone_outer_angle); @@ -404,27 +403,12 @@ void BL_ConvertActuators(const char* maggiename, } else { - snd_sound = *reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(sound->playback_handle); + snd_sound = sound->playback_handle; // if sound shall be 3D but isn't mono, we have to make it mono! if (is3d) { - try - { - boost::shared_ptr<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 = boost::shared_ptr<AUD_IFactory>(new AUD_ChannelMapperFactory(snd_sound, specs)); - } - } - catch(AUD_Exception&) - { - // sound cannot be played... ignore - } + snd_sound = AUD_Sound_rechannel(snd_sound, AUD_CHANNELS_MONO); } } KX_SoundActuator* tmpsoundact = @@ -436,6 +420,10 @@ void BL_ConvertActuators(const char* maggiename, settings, soundActuatorType); + // if we made it mono, we have to free it + if(snd_sound != sound->playback_handle && snd_sound != NULL) + AUD_Sound_free(snd_sound); + tmpsoundact->SetName(bact->name); baseact = tmpsoundact; } @@ -1087,11 +1075,12 @@ void BL_ConvertActuators(const char* maggiename, bool enableVisualization = (stAct->flag & ACT_STEERING_ENABLEVISUALIZATION) !=0; short facingMode = (stAct->flag & ACT_STEERING_AUTOMATICFACING) ? stAct->facingaxis : 0; bool normalup = (stAct->flag & ACT_STEERING_NORMALUP) !=0; + bool lockzvel = (stAct->flag & ACT_STEERING_LOCKZVEL) !=0; KX_SteeringActuator *tmpstact = new KX_SteeringActuator(gameobj, mode, targetob, navmeshob,stAct->dist, stAct->velocity, stAct->acceleration, stAct->turnspeed, selfTerminated, stAct->updateTime, - scene->GetObstacleSimulation(), facingMode, normalup, enableVisualization); + scene->GetObstacleSimulation(), facingMode, normalup, enableVisualization, lockzvel); baseact = tmpstact; break; } |