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>2009-08-10 01:16:39 +0400
committerJoerg Mueller <nexyon@gmail.com>2009-08-10 01:16:39 +0400
commit6c5c58e05799f2b593cd81fcff57e6ef72ad57fb (patch)
tree8add929ef94d03fc69aecce6ef2baf283505782f /source/gameengine/Converter
parentc1ca2ab5dceb8d5355215a3c7a80b171f394e487 (diff)
2.5: Sound branch merge!
See mailing list for additional information.
Diffstat (limited to 'source/gameengine/Converter')
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp21
-rw-r--r--source/gameengine/Converter/CMakeLists.txt1
-rw-r--r--source/gameengine/Converter/KX_ConvertActuators.cpp154
-rw-r--r--source/gameengine/Converter/SConscript1
4 files changed, 31 insertions, 146 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index e148861ca5a..2c7df80a3fc 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -101,9 +101,6 @@
#include "KX_KetsjiEngine.h"
#include "KX_BlenderSceneConverter.h"
-#include"SND_Scene.h"
-#include "SND_SoundListener.h"
-
/* This little block needed for linking to Blender... */
#ifdef WIN32
#include "BLI_winstuff.h"
@@ -2616,23 +2613,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
}
}
- sumolist->Release();
-
- // convert global sound stuff
-
- /* XXX, glob is the very very wrong place for this
- * to be, re-enable once the listener has been moved into
- * the scene. */
-#if 1
- SND_Scene* soundscene = kxscene->GetSoundScene();
- SND_SoundListener* listener = soundscene->GetListener();
- if (listener && G.listener)
- {
- listener->SetDopplerFactor(G.listener->dopplerfactor);
- listener->SetDopplerVelocity(G.listener->dopplervelocity);
- listener->SetGain(G.listener->gain);
- }
-#endif
+ sumolist->Release();
// convert world
KX_WorldInfo* worldinfo = new BlenderWorldInfo(blenderscene->world);
diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt
index 031c2234ea8..f4aa50cd837 100644
--- a/source/gameengine/Converter/CMakeLists.txt
+++ b/source/gameengine/Converter/CMakeLists.txt
@@ -32,6 +32,7 @@ SET(INC
../../../intern/string
../../../intern/guardedalloc
../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
+ ../../../intern/audaspace
../../../intern/SoundSystem
../../../intern/SoundSystem/include
../../../intern/SoundSystem/openal
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index c18e4fce8a5..1afadac5c0a 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -38,7 +38,7 @@
#include "KX_BlenderSceneConverter.h"
#include "KX_ConvertActuators.h"
-#include "SND_Scene.h"
+#include "AUD_C-API.h"
// Actuators
//SCA logiclibrary native logicbricks
#include "SCA_PropertyActuator.h"
@@ -347,8 +347,7 @@ void BL_ConvertActuators(char* maggiename,
{
bSoundActuator* soundact = (bSoundActuator*) bact->data;
/* get type, and possibly a start and end frame */
- short startFrame = soundact->sta, stopFrame = soundact->end;
- KX_SoundActuator::KX_SOUNDACT_TYPE
+ KX_SoundActuator::KX_SOUNDACT_TYPE
soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF;
switch(soundact->type) {
@@ -378,114 +377,38 @@ void BL_ConvertActuators(char* maggiename,
if (soundActuatorType != KX_SoundActuator::KX_SOUNDACT_NODEF)
{
- SND_Scene* soundscene = scene->GetSoundScene();
- STR_String samplename = "";
- bool sampleisloaded = false;
-
- if (soundact->sound) {
- /* Need to convert the samplename into absolute path
- * before checking if its loaded */
- char fullpath[FILE_MAX];
-
- /* dont modify soundact->sound->name, only change a copy */
- BLI_strncpy(fullpath, soundact->sound->name, sizeof(fullpath));
- BLI_convertstringcode(fullpath, maggiename);
- samplename = fullpath;
-
- /* let's see if the sample was already loaded */
- if (soundscene->IsSampleLoaded(samplename))
- {
- sampleisloaded = true;
- }
- else {
- /* if not, make it so */
- PackedFile* pf = soundact->sound->newpackedfile;
-
- /* but we need a packed file then */
- if (pf)
- {
- if (soundscene->LoadSample(samplename, pf->data, pf->size) > -1)
- sampleisloaded = true;
- }
- /* or else load it from disk */
- else
- {
- if (soundscene->LoadSample(samplename, NULL, 0) > -1) {
- sampleisloaded = true;
- }
- else {
- std::cout << "WARNING: Sound actuator \"" << bact->name <<
- "\" from object \"" << blenderobject->id.name+2 <<
- "\" failed to load sample." << std::endl;
- }
- }
- }
- } else {
+ bSound* sound = soundact->sound;
+ bool is3d = soundact->flag & ACT_SND_3D_SOUND ? true : false;
+ AUD_Sound* snd_sound = NULL;
+ KX_3DSoundSettings settings;
+ settings.cone_inner_angle = soundact->sound3D.cone_inner_angle;
+ settings.cone_outer_angle = soundact->sound3D.cone_outer_angle;
+ settings.cone_outer_gain = soundact->sound3D.cone_outer_gain;
+ settings.max_distance = soundact->sound3D.max_distance;
+ settings.max_gain = soundact->sound3D.max_gain;
+ settings.min_gain = soundact->sound3D.min_gain;
+ settings.reference_distance = soundact->sound3D.reference_distance;
+ settings.rolloff_factor = soundact->sound3D.rolloff_factor;
+
+ if(!sound)
+ {
std::cout << "WARNING: Sound actuator \"" << bact->name <<
"\" from object \"" << blenderobject->id.name+2 <<
"\" has no sound datablock." << std::endl;
}
-
- /* Note, allowing actuators for sounds that are not there was added since 2.47
- * This is because python may expect the actuator and raise an exception if it dosnt find it
- * better just to add a dummy sound actuator. */
- SND_SoundObject* sndobj = NULL;
- if (sampleisloaded)
- {
- /* setup the SND_SoundObject */
- sndobj = new SND_SoundObject();
- sndobj->SetSampleName(samplename.Ptr());
- sndobj->SetObjectName(bact->name);
- if (soundact->sound) {
- sndobj->SetRollOffFactor(soundact->sound->attenuation);
- sndobj->SetGain(soundact->sound->volume);
- sndobj->SetPitch(exp((soundact->sound->pitch / 12.0) * log(2.0)));
- // sndobj->SetLoopStart(soundact->sound->loopstart);
- // sndobj->SetLoopStart(soundact->sound->loopend);
- if (soundact->sound->flags & SOUND_FLAGS_LOOP)
- {
- if (soundact->sound->flags & SOUND_FLAGS_BIDIRECTIONAL_LOOP)
- sndobj->SetLoopMode(SND_LOOP_BIDIRECTIONAL);
- else
- sndobj->SetLoopMode(SND_LOOP_NORMAL);
- }
- else {
- sndobj->SetLoopMode(SND_LOOP_OFF);
- }
-
- if (soundact->sound->flags & SOUND_FLAGS_PRIORITY)
- sndobj->SetHighPriority(true);
- else
- sndobj->SetHighPriority(false);
-
- if (soundact->sound->flags & SOUND_FLAGS_3D)
- sndobj->Set3D(true);
- else
- sndobj->Set3D(false);
- }
- else {
- /* dummy values for a NULL sound
- * see editsound.c - defaults are unlikely to change soon */
- sndobj->SetRollOffFactor(1.0);
- sndobj->SetGain(1.0);
- sndobj->SetPitch(1.0);
- sndobj->SetLoopMode(SND_LOOP_OFF);
- sndobj->SetHighPriority(false);
- sndobj->Set3D(false);
- }
- }
- KX_SoundActuator* tmpsoundact =
- new KX_SoundActuator(gameobj,
- sndobj,
- scene->GetSoundScene(), // needed for replication!
- soundActuatorType,
- startFrame,
- stopFrame);
-
+ else
+ snd_sound = sound->cache ? sound->cache : sound->snd_sound;
+ KX_SoundActuator* tmpsoundact =
+ new KX_SoundActuator(gameobj,
+ snd_sound,
+ soundact->volume,
+ exp((soundact->pitch / 12.0) * log(2.0)),
+ is3d,
+ settings,
+ soundActuatorType);
+
tmpsoundact->SetName(bact->name);
baseact = tmpsoundact;
- if (sndobj)
- soundscene->AddObject(sndobj);
}
break;
}
@@ -525,27 +448,6 @@ void BL_ConvertActuators(char* maggiename,
/* This is an error!!! */
cdActuatorType = KX_CDActuator::KX_CDACT_NODEF;
}
-
- if (cdActuatorType != KX_CDActuator::KX_CDACT_NODEF)
- {
- SND_CDObject* pCD = SND_CDObject::Instance();
-
- if (pCD)
- {
- pCD->SetGain(cdact->volume);
-
- KX_CDActuator* tmpcdact =
- new KX_CDActuator(gameobj,
- scene->GetSoundScene(), // needed for replication!
- cdActuatorType,
- cdact->track,
- startFrame,
- stopFrame);
-
- tmpcdact->SetName(bact->name);
- baseact = tmpcdact;
- }
- }
break;
}
case ACT_PROPERTY:
diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript
index 05ea01c902a..1c03179ea07 100644
--- a/source/gameengine/Converter/SConscript
+++ b/source/gameengine/Converter/SConscript
@@ -6,6 +6,7 @@ defs = []
incs = '. #source/kernel/gen_system #intern/string #intern/guardedalloc'
incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer'
+incs += ' #intern/audaspace'
incs += ' #intern/SoundSystem #intern/SoundSystem/include #intern/SoundSystem/openal'
incs += ' #intern/SoundSystem/dummy #intern/SoundSystem/intern #source/gameengine/Converter'
incs += ' #source/gameengine/BlenderRoutines #source/blender/imbuf'