[Bf-blender-cvs] [7543035] gooseberry: Test support for audio in internal player to showcase in weekly :)

Antony Riakiotakis noreply at git.blender.org
Fri May 15 17:33:46 CEST 2015


Commit: 7543035ffe954b2da11b41e35da3e1dffedd6645
Author: Antony Riakiotakis
Date:   Fri May 15 17:33:09 2015 +0200
Branches: gooseberry
https://developer.blender.org/rB7543035ffe954b2da11b41e35da3e1dffedd6645

Test support for audio in internal player to showcase in weekly :)

===================================================================

M	source/blender/windowmanager/CMakeLists.txt
M	source/blender/windowmanager/intern/wm_playanim.c
M	source/creator/creator.c

===================================================================

diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 75df966..d5e360d 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -84,6 +84,13 @@ set(SRC
 	3d_widgets/ui_widget_library.h
 )
 
+if(WITH_AUDASPACE)
+	list(APPEND INC
+		../../../intern/audaspace/intern
+	)
+	add_definitions(-DWITH_AUDASPACE)
+endif()
+
 add_definitions(${GL_DEFINITIONS})
 
 if(WITH_INTERNATIONAL)
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 66c502c..7d797fd 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -71,6 +71,10 @@
 
 #include "WM_api.h"  /* only for WM_main_playanim */
 
+#ifdef WITH_AUDASPACE
+#include "AUD_C-API.h"
+#endif
+
 struct PlayState;
 static void playanim_window_zoom(struct PlayState *ps, const float zoom_offset);
 
@@ -902,6 +906,21 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
 	
 	PlayState ps = {0};
 
+#ifdef WITH_AUDASPACE
+	AUD_Sound *source;
+	AUD_Handle *playback_handle;
+	AUD_DeviceSpecs specs;
+	float volume = 1.0f;
+
+	specs.rate = AUD_RATE_44100;
+	specs.format = AUD_FORMAT_S16;
+	specs.channels = AUD_CHANNELS_STEREO;
+
+	if (!AUD_init(AUD_OPENAL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE))
+		AUD_init(AUD_NULL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE);
+
+#endif
+
 	/* ps.doubleb   = true;*/ /* UNUSED */
 	ps.go        = true;
 	ps.direction = true;
@@ -1072,6 +1091,11 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
 
 	build_pict_list(&ps, filepath, (efra - sfra) + 1, ps.fstep, ps.fontid);
 
+#ifdef WITH_AUDASPACE
+	source = AUD_load(filepath);
+	playback_handle = AUD_play(source, 1);
+#endif
+
 	for (i = 2; i < argc; i++) {
 		BLI_strncpy(filepath, argv[i], sizeof(filepath));
 		build_pict_list(&ps, filepath, (efra - sfra) + 1, ps.fstep, ps.fontid);
@@ -1283,6 +1307,12 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
 		return filepath;
 	}
 	
+#ifdef WITH_AUDASPACE
+	AUD_stop(playback_handle);
+	AUD_unload(source);
+	AUD_exit();
+#endif
+
 	IMB_exit();
 	BKE_images_exit();
 	DAG_exit();
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 3bcaa41..206d535 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1719,6 +1719,9 @@ int main(
 	BKE_brush_system_init();
 	RE_init_texture_rng();
 	
+	/* Initialize ffmpeg if built in, also needed for bg mode if videos are
+	 * rendered via ffmpeg */
+	BKE_sound_init_once();
 
 	BLI_callback_global_init();
 
@@ -1779,10 +1782,6 @@ int main(
 	/* background render uses this font too */
 	BKE_vfont_builtin_register(datatoc_bfont_pfb, datatoc_bfont_pfb_size);
 
-	/* Initialize ffmpeg if built in, also needed for bg mode if videos are
-	 * rendered via ffmpeg */
-	BKE_sound_init_once();
-	
 	init_def_material();
 
 	if (G.background == 0) {




More information about the Bf-blender-cvs mailing list