From 733073550f61cf4fbbe21aab33e9271915325109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= Date: Tue, 4 Mar 2014 13:44:15 +0100 Subject: Audaspace: use standalone library. - Added the cmake configuration option WITH_EXTERNAL_AUDASPACE. - Fixes to build without standalone library as well. --- source/blender/blenkernel/BKE_sound.h | 8 +++++- source/blender/blenkernel/CMakeLists.txt | 7 +++++ source/blender/blenkernel/intern/blender.c | 2 -- source/blender/blenkernel/intern/nla.c | 6 ++++- source/blender/blenkernel/intern/sequencer.c | 6 ++++- source/blender/blenkernel/intern/sound.c | 30 +++++++++++++++------- source/blender/blenkernel/intern/writeffmpeg.c | 7 ++++- source/blender/editors/sound/CMakeLists.txt | 10 +++++--- source/blender/editors/sound/sound_ops.c | 6 ++++- source/blender/editors/space_graph/CMakeLists.txt | 10 +++++--- source/blender/editors/space_graph/graph_edit.c | 6 ++++- .../blender/editors/space_sequencer/CMakeLists.txt | 10 +++++--- .../editors/space_sequencer/sequencer_add.c | 6 ++++- source/blender/makesrna/intern/CMakeLists.txt | 7 +++++ source/blender/makesrna/intern/rna_scene.c | 6 ++++- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 6 ++++- source/gameengine/BlenderRoutines/CMakeLists.txt | 10 +++++--- source/gameengine/Converter/CMakeLists.txt | 10 +++++--- .../gameengine/Converter/KX_ConvertActuators.cpp | 6 ++++- source/gameengine/GamePlayer/ghost/CMakeLists.txt | 10 +++++--- .../GamePlayer/ghost/GPG_Application.cpp | 6 ++++- source/gameengine/Ketsji/CMakeLists.txt | 14 +++++++--- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 4 --- source/gameengine/Ketsji/KX_SoundActuator.cpp | 11 ++++++-- source/gameengine/Ketsji/KX_SoundActuator.h | 7 ++++- 25 files changed, 160 insertions(+), 51 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 819b49da8e9..7d2d23e1d39 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -35,6 +35,12 @@ #define SOUND_WAVE_SAMPLES_PER_SECOND 250 +#ifdef WITH_AUDASPACE +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# endif +#endif + struct bSound; struct Main; struct Sequence; @@ -75,7 +81,7 @@ void BKE_sound_load(struct Main *main, struct bSound *sound); void BKE_sound_free(struct bSound *sound); -#ifdef __AUD_C_API_H__ +#if defined(__AUD_C_API_H__) || defined(WITH_EXTERNAL_AUDASPACE) AUD_Device *BKE_sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume); #endif diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 349d1303da3..dd5fcafd964 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -315,6 +315,13 @@ if(WITH_AUDASPACE) ../../../intern/audaspace/intern ) add_definitions(-DWITH_AUDASPACE) + + if(WITH_EXTERNAL_AUDASPACE) + add_definitions(-DWITH_EXTERNAL_AUDASPACE) + list(APPEND INC_SYS + ${CAUDASPACE_INCLUDE_DIRS} + ) + endif() endif() if(WITH_BULLET) diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 37bd9c5db5c..0923ac7e743 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -309,8 +309,6 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath CTX_data_main_set(C, G.main); - BKE_sound_init_main(G.main); - if (bfd->user) { /* only here free userdef themes... */ diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 1ad6446eb05..25629e7db94 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -59,7 +59,11 @@ #include "BKE_library.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# else +# include "AUD_C-API.h" +# endif #endif #include "RNA_access.h" diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index db07344ee93..b087d809e82 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -88,7 +88,11 @@ #include "BKE_sound.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# else +# include "AUD_C-API.h" +# endif #endif static ImBuf *seq_render_strip_stack(const SeqRenderData *context, ListBase *seqbasep, float cfra, int chanshown); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 3accf2119a4..0eaae45c008 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -48,7 +48,15 @@ #include "DNA_speaker_types.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# include +# include +# include +# include "AUD_Set.h" +# else +# include "AUD_C-API.h" +# endif #endif #include "BKE_global.h" @@ -150,13 +158,13 @@ static void sound_sync_callback(void *data, int mode, float time) int BKE_sound_define_from_str(const char *str) { if (BLI_strcaseeq(str, "NULL")) - return AUD_NULL_DEVICE; + return 0; if (BLI_strcaseeq(str, "SDL")) - return AUD_SDL_DEVICE; + return 1; if (BLI_strcaseeq(str, "OPENAL")) - return AUD_OPENAL_DEVICE; + return 2; if (BLI_strcaseeq(str, "JACK")) - return AUD_JACK_DEVICE; + return 3; return -1; } @@ -189,13 +197,13 @@ void BKE_sound_init(struct Main *bmain) switch(device) { - case AUD_SDL_DEVICE: + case 1: device_name = "SDL"; break; - case AUD_OPENAL_DEVICE: + case 2: device_name = "OpenAL"; break; - case AUD_JACK_DEVICE: + case 3: device_name = "Jack"; break; default: @@ -204,7 +212,7 @@ void BKE_sound_init(struct Main *bmain) } if (buffersize < 128) - buffersize = AUD_DEFAULT_BUFFER_SIZE; + buffersize = 1024; if (specs.rate < AUD_RATE_8000) specs.rate = AUD_RATE_44100; @@ -821,7 +829,11 @@ float BKE_sound_get_length(bSound *sound) bool BKE_sound_is_jack_supported(void) { +#ifdef WITH_EXTERNAL_AUDASPACE + return 1; +#else return (bool)AUD_isJackSupported(); +#endif } #else /* WITH_AUDASPACE */ diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index af71f19c226..af33e688dc4 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -45,7 +45,12 @@ #include "BLI_blenlib.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# include +# else +# include "AUD_C-API.h" +# endif #endif #include "BLI_utildefines.h" diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt index 245ee657bc3..c3ef0f8851f 100644 --- a/source/blender/editors/sound/CMakeLists.txt +++ b/source/blender/editors/sound/CMakeLists.txt @@ -39,10 +39,14 @@ set(SRC ) if(WITH_AUDASPACE) - list(APPEND INC - ../../../../intern/audaspace/intern - ) add_definitions(-DWITH_AUDASPACE) + + if(WITH_EXTERNAL_AUDASPACE) + add_definitions(-DWITH_EXTERNAL_AUDASPACE) + list(APPEND INC_SYS ${CAUDASPACE_INCLUDE_DIRS}) + else() + list(APPEND INC ../../../../intern/audaspace/intern) + endif() endif() if(WITH_CODEC_FFMPEG) diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 8a3b48125d0..1fd48dd7e00 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -67,7 +67,11 @@ #include "WM_types.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# else +# include "AUD_C-API.h" +# endif #endif #include "ED_sound.h" diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt index 0a29810ff3d..b911f9effbe 100644 --- a/source/blender/editors/space_graph/CMakeLists.txt +++ b/source/blender/editors/space_graph/CMakeLists.txt @@ -48,10 +48,14 @@ set(SRC ) if(WITH_AUDASPACE) - list(APPEND INC - ../../../../intern/audaspace/intern - ) add_definitions(-DWITH_AUDASPACE) + + if(WITH_EXTERNAL_AUDASPACE) + add_definitions(-DWITH_EXTERNAL_AUDASPACE) + list(APPEND INC_SYS ${CAUDASPACE_INCLUDE_DIRS}) + else() + list(APPEND INC ../../../../intern/audaspace/intern) + endif() endif() if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 3de3ecebc44..1f2b02dcf31 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -36,7 +36,11 @@ #include #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# else +# include "AUD_C-API.h" +# endif #endif #include "MEM_guardedalloc.h" diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index d9aff2781f0..ea12ee3b751 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -53,10 +53,14 @@ set(SRC ) if(WITH_AUDASPACE) - list(APPEND INC - ../../../../intern/audaspace/intern - ) add_definitions(-DWITH_AUDASPACE) + + if(WITH_EXTERNAL_AUDASPACE) + add_definitions(-DWITH_EXTERNAL_AUDASPACE) + list(APPEND INC_SYS ${CAUDASPACE_INCLUDE_DIRS}) + else() + list(APPEND INC ../../../../intern/audaspace/intern) + endif() endif() if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index edf8a41b5a8..7ffed70d7b8 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -66,7 +66,11 @@ #include "BKE_sound.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# else +# include "AUD_C-API.h" +# endif #endif /* own include */ diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index bef2fa3084e..967ec3aeaf8 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -225,6 +225,13 @@ endif() if(WITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE) + + if(WITH_EXTERNAL_AUDASPACE) + add_definitions(-DWITH_EXTERNAL_AUDASPACE) + list(APPEND INC_SYS ${CAUDASPACE_INCLUDE_DIRS}) + else() + list(APPEND INC ../../../intern/audaspace/intern) + endif() endif() if(WITH_CODEC_QUICKTIME) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index e990ff1ec29..9c4fcd927c8 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -59,7 +59,11 @@ #ifdef WITH_QUICKTIME # include "quicktime_export.h" # ifdef WITH_AUDASPACE -# include "AUD_Space.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# else +# include "AUD_Space.h" +# endif # endif #endif diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index f275d0a0f0c..4d30bc51280 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -101,7 +101,11 @@ typedef void * wmUIHandlerRemoveFunc; } #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# else +# include "AUD_C-API.h" +# endif #endif static BlendFileData *load_game_data(char *filename) diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt index 1a2809cc8ab..324babf9fa9 100644 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ b/source/gameengine/BlenderRoutines/CMakeLists.txt @@ -56,10 +56,14 @@ set(SRC add_definitions(${GL_DEFINITIONS}) if(WITH_AUDASPACE) - list(APPEND INC - ../../../intern/audaspace/intern - ) add_definitions(-DWITH_AUDASPACE) + + if(WITH_EXTERNAL_AUDASPACE) + add_definitions(-DWITH_EXTERNAL_AUDASPACE) + list(APPEND INC_SYS ${CAUDASPACE_INCLUDE_DIRS}) + else() + list(APPEND INC ../../../intern/audaspace/intern) + endif() endif() if(WITH_CODEC_FFMPEG) diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index 6d681dd166e..dba3f4da050 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -113,10 +113,14 @@ if(WITH_BULLET) endif() if(WITH_AUDASPACE) - list(APPEND INC - ../../../intern/audaspace/intern - ) add_definitions(-DWITH_AUDASPACE) + + if(WITH_EXTERNAL_AUDASPACE) + add_definitions(-DWITH_EXTERNAL_AUDASPACE) + list(APPEND INC_SYS ${CAUDASPACE_INCLUDE_DIRS}) + else() + list(APPEND INC ../../../intern/audaspace/intern) + endif() endif() blender_add_lib(ge_converter "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 1acbd0b1608..e5e86cd4ee6 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -42,7 +42,11 @@ #include "KX_ConvertActuators.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# else +# include "AUD_C-API.h" +# endif #endif // Actuators diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index a1bc7e88840..58e47bc4440 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -85,10 +85,14 @@ if(WITH_INTERNATIONAL) endif() if(WITH_AUDASPACE) - list(APPEND INC - ../../../../intern/audaspace/intern - ) add_definitions(-DWITH_AUDASPACE) + + if(WITH_EXTERNAL_AUDASPACE) + add_definitions(-DWITH_EXTERNAL_AUDASPACE) + list(APPEND INC_SYS ${CAUDASPACE_INCLUDE_DIRS}) + else() + list(APPEND INC ../../../../intern/audaspace/intern) + endif() endif() if(WITH_SDL AND WITH_SDL_DYNLOAD) diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index f06a153431e..75a301211a2 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -100,7 +100,11 @@ extern "C" #include "GHOST_Rect.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# else +# include "AUD_C-API.h" +# endif #endif static void frameTimerProc(GHOST_ITimerTask* task, GHOST_TUns64 time); diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 44532e5d737..f938994f86a 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -248,11 +248,17 @@ if(WITH_CODEC_FFMPEG) endif() if(WITH_AUDASPACE) - list(APPEND INC - ../../../intern/audaspace/intern - ../../../intern/audaspace/FX - ) + list(APPEND INC ../../../intern/audaspace/intern) + add_definitions(-DWITH_AUDASPACE) + + if(WITH_EXTERNAL_AUDASPACE) + add_definitions(-DWITH_EXTERNAL_AUDASPACE) + list(APPEND INC_SYS + ${CAUDASPACE_INCLUDE_DIRS} + ${PYAUDASPACE_INCLUDE_DIRS} + ) + endif() endif() if(WITH_BULLET) diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index acf65817c49..c7cf556a2d3 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -62,10 +62,6 @@ #include "KX_PyConstraintBinding.h" #include "PHY_IPhysicsEnvironment.h" -#ifdef WITH_AUDASPACE -# include "AUD_C-API.h" -#endif - #include "NG_NetworkScene.h" #include "NG_NetworkDeviceInterface.h" diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 611467d7167..a14cb9a2897 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -37,7 +37,14 @@ #include "KX_SoundActuator.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +typedef float sample_t; +# include +# include +# include +# include +# include +# endif #endif #include "KX_GameObject.h" @@ -554,7 +561,7 @@ int KX_SoundActuator::pyattr_set_sound(void *self, const struct KX_PYATTRIBUTE_D if (!PyArg_Parse(value, "O", &sound)) return PY_SET_ATTR_FAIL; - AUD_Sound *snd = AUD_getSoundFromPython((void *)sound); + AUD_Sound *snd = AUD_getSoundFromPython(sound); if (snd) { diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h index bd7b28680f6..83d22142bda 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.h +++ b/source/gameengine/Ketsji/KX_SoundActuator.h @@ -35,7 +35,12 @@ #include "SCA_IActuator.h" #ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# ifdef WITH_EXTERNAL_AUDASPACE +# include +# include +# else +# include "AUD_C-API.h" +# endif #endif #include "BKE_sound.h" -- cgit v1.2.3