diff options
Diffstat (limited to 'source/gameengine/GamePlayer/ghost')
-rw-r--r-- | source/gameengine/GamePlayer/ghost/CMakeLists.txt | 77 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_Application.cpp | 26 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_Application.h | 3 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 11 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/SConscript | 12 |
5 files changed, 71 insertions, 58 deletions
diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index d50784cb967..e07a7fb26ad 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -25,49 +25,52 @@ # ***** END GPL LICENSE BLOCK ***** SET(SRC - GPG_Application.cpp - GPG_Canvas.cpp - GPG_ghost.cpp - GPG_KeyboardDevice.cpp - GPG_System.cpp + GPG_Application.cpp + GPG_Canvas.cpp + GPG_ghost.cpp + GPG_KeyboardDevice.cpp + GPG_System.cpp ) SET(INC - . - ../../../../intern/string - ../../../../intern/ghost - ../../../../intern/guardedalloc - ../../../../intern/moto/include - ../../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../../source/kernel/gen_system - ../../../../source/kernel/gen_messaging - ../../../../source/gameengine/Converter - ../../../../source/blender/imbuf - ../../../../source/gameengine/Ketsji - ../../../../source/blender/blenlib - ../../../../source/blender/blenkernel - ../../../../source/blender/readblenfile - ../../../../source/blender - ../../../../source/blender/include - ../../../../source/blender/makesdna - ../../../../source/blender/makesrna - ../../../../source/gameengine/Rasterizer - ../../../../source/gameengine/GameLogic - ../../../../source/gameengine/Expressions - ../../../../source/gameengine/Network - ../../../../source/gameengine/SceneGraph - ../../../../source/gameengine/Physics/common - ../../../../source/gameengine/Network/LoopBackNetwork - ../../../../source/gameengine/GamePlayer/common - ../../../../source/blender/misc - ../../../../source/blender/blenloader - ../../../../source/blender/gpu - ../../../../extern/glew/include - ${PYTHON_INC} + . + ../../../../intern/string + ../../../../intern/ghost + ../../../../intern/guardedalloc + ../../../../intern/moto/include + ../../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer + ../../../../source/kernel/gen_system + ../../../../source/kernel/gen_messaging + ../../../../source/gameengine/Converter + ../../../../source/blender/imbuf + ../../../../source/gameengine/Ketsji + ../../../../source/blender/blenlib + ../../../../source/blender/blenkernel + ../../../../source/blender/readblenfile + ../../../../source/blender + ../../../../source/blender/include + ../../../../source/blender/makesdna + ../../../../source/blender/makesrna + ../../../../source/gameengine/Rasterizer + ../../../../source/gameengine/GameLogic + ../../../../source/gameengine/Expressions + ../../../../source/gameengine/Network + ../../../../source/gameengine/SceneGraph + ../../../../source/gameengine/Physics/common + ../../../../source/gameengine/Physics/Sumo + ../../../../source/gameengine/Physics/Sumo/Fuzzics/include + ../../../../source/gameengine/Network/LoopBackNetwork + ../../../../source/gameengine/GamePlayer/common + ../../../../source/blender/misc + ../../../../source/blender/blenloader + ../../../../source/blender/gpu + ../../../../extern/solid + ../../../../extern/glew/include + ${PYTHON_INC} ) IF(WITH_FFMPEG) - ADD_DEFINITIONS(-DWITH_FFMPEG) + ADD_DEFINITIONS(-DWITH_FFMPEG) ENDIF(WITH_FFMPEG) BLENDERLIB_NOLIST(gp_ghost "${SRC}" "${INC}") diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 8ec41968042..c9a2e81bdae 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -57,7 +57,6 @@ extern "C" #include "BLO_readfile.h" #include "BKE_global.h" #include "BKE_main.h" -#include "BKE_sound.h" #include "IMB_imbuf.h" #include "DNA_scene_types.h" #ifdef __cplusplus @@ -85,6 +84,7 @@ extern "C" #include "KX_BlenderSceneConverter.h" #include "NG_LoopBackNetworkDeviceInterface.h" +#include "SND_DeviceManager.h" #include "GPC_MouseDevice.h" #include "GPC_RenderTools.h" @@ -125,7 +125,8 @@ GPG_Application::GPG_Application(GHOST_ISystem* system) m_rendertools(0), m_rasterizer(0), m_sceneconverter(0), - m_networkdevice(0), + m_networkdevice(0), + m_audiodevice(0), m_blendermat(0), m_blenderglslmat(0), m_pyGlobalDictString(0), @@ -583,8 +584,13 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) if (!m_networkdevice) goto initFailed; - sound_init(); - + // get an audiodevice + SND_DeviceManager::Subscribe(); + m_audiodevice = SND_DeviceManager::Instance(); + if (!m_audiodevice) + goto initFailed; + m_audiodevice->UseCD(); + // create a ketsjisystem (only needed for timing and stuff) m_kxsystem = new GPG_System (m_system); if (!m_kxsystem) @@ -601,7 +607,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) m_ketsjiengine->SetRenderTools(m_rendertools); m_ketsjiengine->SetRasterizer(m_rasterizer); m_ketsjiengine->SetNetworkDevice(m_networkdevice); - + m_ketsjiengine->SetAudioDevice(m_audiodevice); m_ketsjiengine->SetTimingDisplay(frameRate, false, false); CValue::SetDeprecationWarnings(nodepwarnings); @@ -614,8 +620,8 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) return m_engineInitialized; initFailed: - sound_exit(); delete m_kxsystem; + delete m_audiodevice; delete m_networkdevice; delete m_mouse; delete m_keyboard; @@ -628,6 +634,7 @@ initFailed: m_keyboard = NULL; m_mouse = NULL; m_networkdevice = NULL; + m_audiodevice = NULL; m_kxsystem = NULL; return false; } @@ -673,6 +680,7 @@ bool GPG_Application::startEngine(void) KX_Scene* startscene = new KX_Scene(m_keyboard, m_mouse, m_networkdevice, + m_audiodevice, startscenename, m_startScene); @@ -762,7 +770,6 @@ void GPG_Application::stopEngine() void GPG_Application::exitEngine() { - sound_exit(); if (m_ketsjiengine) { stopEngine(); @@ -774,6 +781,11 @@ void GPG_Application::exitEngine() delete m_kxsystem; m_kxsystem = 0; } + if (m_audiodevice) + { + SND_DeviceManager::Unsubscribe(); + m_audiodevice = 0; + } if (m_networkdevice) { delete m_networkdevice; diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h index 73430213078..845686f5770 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h @@ -38,6 +38,7 @@ class KX_KetsjiEngine; class KX_ISceneConverter; class NG_LoopBackNetworkDeviceInterface; +class SND_IAudioDevice; class RAS_IRasterizer; class GHOST_IEvent; class GHOST_ISystem; @@ -141,6 +142,8 @@ protected: KX_ISceneConverter* m_sceneconverter; /** Network interface. */ NG_LoopBackNetworkDeviceInterface* m_networkdevice; + /** Sound device. */ + SND_IAudioDevice* m_audiodevice; bool m_blendermat; bool m_blenderglslmat; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index fb2e1c72a85..2433c587179 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -61,16 +61,12 @@ extern "C" #include "BKE_report.h" #include "BLI_blenlib.h" #include "DNA_scene_types.h" -#include "DNA_userdef_types.h" #include "BLO_readfile.h" #include "BLO_readblenfile.h" #include "IMB_imbuf.h" int GHOST_HACK_getFirstFile(char buf[]); -extern char bprogname[]; /* holds a copy of argv[0], from creator.c */ -extern char btempdir[]; /* use this to store a valid temp directory */ - #ifdef __cplusplus } #endif // __cplusplus @@ -391,13 +387,6 @@ int main(int argc, char** argv) } } #endif - // XXX add the ability to change this values to the command line parsing. - U.mixbufsize = 2048; - U.audiodevice = 2; - U.audiorate = 44100; - U.audioformat = 0x24; - U.audiochannels = 2; - for (i = 1; (i < argc) && !error #ifdef WIN32 && scr_saver_mode == SCREEN_SAVER_MODE_NONE diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index fdd7792b72a..83bc61381c0 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -42,8 +42,14 @@ incs = ['.', incs += Split(env['BF_PYTHON_INC']) -defs = [] +cxxflags = [] +if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): + cxxflags.append ('/GR') + cxxflags.append ('/O2') + cxxflags.append ('/EHsc') + +defs = '' if env['WITH_BF_FFMPEG']: - defs.append('WITH_FFMPEG') + defs += ' WITH_FFMPEG' -env.BlenderLib (libname='gp_ghost', sources=source_files, includes = incs, defines = defs, libtype=['player'],priority=[0], cxx_compileflags=env['BGE_CXXFLAGS']) +env.BlenderLib (libname='gp_ghost', sources=source_files, includes = incs, defines = Split(defs), libtype='player',priority=5, cxx_compileflags=cxxflags) |