[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21770] branches/soundsystem: blender sound structure internals update:

Jörg Müller nexyon at gmail.com
Tue Jul 21 15:21:14 CEST 2009


Revision: 21770
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21770
Author:   nexyon
Date:     2009-07-21 15:21:14 +0200 (Tue, 21 Jul 2009)

Log Message:
-----------
blender sound structure internals update:
* file writing/loading
* bSample removed
* blenkernel/BKE_sound.h updated
* fixed a bug in AUD_OpenALDevice that crashed the app if quitted after no sound played

Modified Paths:
--------------
    branches/soundsystem/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
    branches/soundsystem/source/blender/blenkernel/BKE_packedFile.h
    branches/soundsystem/source/blender/blenkernel/BKE_sound.h
    branches/soundsystem/source/blender/blenkernel/CMakeLists.txt
    branches/soundsystem/source/blender/blenkernel/SConscript
    branches/soundsystem/source/blender/blenkernel/intern/blender.c
    branches/soundsystem/source/blender/blenkernel/intern/library.c
    branches/soundsystem/source/blender/blenkernel/intern/packedFile.c
    branches/soundsystem/source/blender/blenkernel/intern/sound.c
    branches/soundsystem/source/blender/blenloader/intern/readfile.c
    branches/soundsystem/source/blender/blenloader/intern/writefile.c
    branches/soundsystem/source/blender/windowmanager/CMakeLists.txt
    branches/soundsystem/source/blender/windowmanager/SConscript
    branches/soundsystem/source/blender/windowmanager/intern/wm_init_exit.c
    branches/soundsystem/source/gameengine/Converter/KX_ConvertActuators.cpp
    branches/soundsystem/source/gameengine/Ketsji/KX_SoundActuator.cpp

Modified: branches/soundsystem/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
===================================================================
--- branches/soundsystem/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2009-07-21 13:20:39 UTC (rev 21769)
+++ branches/soundsystem/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2009-07-21 13:21:14 UTC (rev 21770)
@@ -229,6 +229,7 @@
 		{
 			unlock();
 			m_playing = false;
+			m_thread = 0;
 			pthread_exit(NULL);
 		}
 
@@ -295,6 +296,7 @@
 	m_specs = specs;
 	m_buffersize = buffersize;
 	m_playing = false;
+	m_thread = 0;
 
 	m_playingSounds = new std::list<AUD_OpenALHandle*>(); AUD_NEW("list")
 	m_pausedSounds = new std::list<AUD_OpenALHandle*>(); AUD_NEW("list")
@@ -360,7 +362,8 @@
 	unlock();
 
 	// wait for the thread to stop
-	pthread_join(m_thread, NULL);
+	if(m_thread != 0)
+		pthread_join(m_thread, NULL);
 
 	// quit OpenAL
 	alcMakeContextCurrent(NULL);

Modified: branches/soundsystem/source/blender/blenkernel/BKE_packedFile.h
===================================================================
--- branches/soundsystem/source/blender/blenkernel/BKE_packedFile.h	2009-07-21 13:20:39 UTC (rev 21769)
+++ branches/soundsystem/source/blender/blenkernel/BKE_packedFile.h	2009-07-21 13:21:14 UTC (rev 21770)
@@ -1,8 +1,8 @@
 /**
  * blenlib/BKE_packedFile.h (mar-2001 nzc)
- *	
- * $Id$ 
  *
+ * $Id$
+ *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -34,7 +34,6 @@
 #define RET_OK		0
 #define RET_ERROR	1
 
-struct bSample;
 struct bSound;
 struct Image;
 struct Main;
@@ -51,7 +50,8 @@
 /* unpack */
 char *unpackFile(struct ReportList *reports, char *abs_name, char *local_name, struct PackedFile *pf, int how);
 int unpackVFont(struct ReportList *reports, struct VFont *vfont, int how);
-int unpackSample(struct ReportList *reports, struct bSample *sample, int how);
+// AUD_XXX int unpackSample(struct ReportList *reports, struct bSample *sample, int how);
+int unpackSound(struct ReportList *reports, struct bSound *sound, int how);
 int unpackImage(struct ReportList *reports, struct Image *ima, int how);
 void unpackAll(struct Main *bmain, struct ReportList *reports, int how);
 

Modified: branches/soundsystem/source/blender/blenkernel/BKE_sound.h
===================================================================
--- branches/soundsystem/source/blender/blenkernel/BKE_sound.h	2009-07-21 13:20:39 UTC (rev 21769)
+++ branches/soundsystem/source/blender/blenkernel/BKE_sound.h	2009-07-21 13:21:14 UTC (rev 21770)
@@ -1,8 +1,8 @@
 /**
  * sound.h (mar-2001 nzc)
- *	
- * $Id$ 
  *
+ * $Id$
+ *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -33,20 +33,30 @@
 
 struct PackedFile;
 struct bSound;
-struct bSample;
-struct ListBase;
+// AUD_XXX struct bSample;
 
 /* bad bad global... */
-extern struct ListBase *samples;
+// AUD_XXX
+/*extern struct ListBase *samples;
 
-void sound_free_all_samples(void);
+void sound_free_all_samples(void);*/
 
 /*  void *sound_get_listener(void); implemented in src!also declared there now  */
 
-void sound_set_packedfile(struct bSample* sample, struct PackedFile* pf);
+// AUD_XXX
+/*void sound_set_packedfile(struct bSample* sample, struct PackedFile* pf);
 struct PackedFile* sound_find_packedfile(struct bSound* sound);
 void sound_free_sample(struct bSample* sample);
-void sound_free_sound(struct bSound* sound);
+void sound_free_sound(struct bSound* sound);*/
 
+// AUD_XXX
+void sound_init();
+
+void sound_exit();
+
+void sound_load(struct bSound* sound);
+
+void sound_free(struct bSound* sound);
+
 #endif
 

Modified: branches/soundsystem/source/blender/blenkernel/CMakeLists.txt
===================================================================
--- branches/soundsystem/source/blender/blenkernel/CMakeLists.txt	2009-07-21 13:20:39 UTC (rev 21769)
+++ branches/soundsystem/source/blender/blenkernel/CMakeLists.txt	2009-07-21 13:21:14 UTC (rev 21770)
@@ -34,6 +34,7 @@
   ../../../extern/bullet2/src
   ../nodes ../../../extern/glew/include ../gpu ../makesrna
   ../../../intern/bsp/extern
+  ../../../intern/audaspace
   ${SDL_INC}
   ${ZLIB_INC}
 )

Modified: branches/soundsystem/source/blender/blenkernel/SConscript
===================================================================
--- branches/soundsystem/source/blender/blenkernel/SConscript	2009-07-21 13:20:39 UTC (rev 21769)
+++ branches/soundsystem/source/blender/blenkernel/SConscript	2009-07-21 13:21:14 UTC (rev 21770)
@@ -10,6 +10,7 @@
 incs += ' #/extern/bullet2/src'
 incs += ' #/intern/opennl/extern #/intern/bsp/extern'
 incs += ' ../gpu #/extern/glew/include'
+incs += ' #intern/audaspace'
 
 incs += ' ' + env['BF_OPENGL_INC']
 incs += ' ' + env['BF_ZLIB_INC']

Modified: branches/soundsystem/source/blender/blenkernel/intern/blender.c
===================================================================
--- branches/soundsystem/source/blender/blenkernel/intern/blender.c	2009-07-21 13:20:39 UTC (rev 21769)
+++ branches/soundsystem/source/blender/blenkernel/intern/blender.c	2009-07-21 13:21:14 UTC (rev 21770)
@@ -1,7 +1,7 @@
 /*  blender.c   jan 94     MIXED MODEL
- * 
+ *
  * common help functions and data
- * 
+ *
  * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
@@ -30,7 +30,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef _WIN32 
+#ifndef _WIN32
 	#include <unistd.h> // for read close
 	#include <sys/param.h> // for MAXPATHLEN
 #else
@@ -88,8 +88,8 @@
 #include "BLI_editVert.h"
 
 #include "BLO_undofile.h"
-#include "BLO_readfile.h" 
-#include "BLO_writefile.h" 
+#include "BLO_readfile.h"
+#include "BLO_writefile.h"
 
 #include "BKE_utildefines.h" // O_BINARY FALSE
 
@@ -114,7 +114,7 @@
 void pushdata(void *data, int len)
 {
 	PushPop *pp;
-	
+
 	pp= MEM_mallocN(sizeof(PushPop), "pushpop");
 	BLI_addtail(&ppmain, pp);
 	pp->data= MEM_mallocN(len, "pushpop");
@@ -125,7 +125,7 @@
 void popfirst(void *data)
 {
 	PushPop *pp;
-	
+
 	pp= ppmain.first;
 	if(pp) {
 		memcpy(data, pp->data, pp->len);
@@ -139,7 +139,7 @@
 void poplast(void *data)
 {
 	PushPop *pp;
-	
+
 	pp= ppmain.last;
 	if(pp) {
 		memcpy(data, pp->data, pp->len);
@@ -159,7 +159,7 @@
 		BLI_remlink(&ppmain, pp);
 		MEM_freeN(pp->data);
 		MEM_freeN(pp);
-	}	
+	}
 }
 
 void pushpop_test()
@@ -176,22 +176,22 @@
 void free_blender(void)
 {
 	/* samples are in a global list..., also sets G.main->sound->sample NULL */
-	sound_free_all_samples();
-	
+// AUD_XXX	sound_free_all_samples();
+
 	free_main(G.main);
 	G.main= NULL;
 
 	BKE_spacetypes_free();		/* after free main, it uses space callbacks */
-	
+
 	IMB_freeImBufdata();		/* imbuf lib */
-	
-	free_nodesystem();	
+
+	free_nodesystem();
 }
 
 void initglobals(void)
 {
 	memset(&G, 0, sizeof(Global));
-	
+
 	U.savetime= 1;
 
 	G.main= MEM_callocN(sizeof(Main), "initglobals");
@@ -217,17 +217,17 @@
 
 /***/
 
-static void clear_global(void) 
+static void clear_global(void)
 {
 //	extern short winqueue_break;	/* screen.c */
 
 	fastshade_free_render();	/* lamps hang otherwise */
 	free_main(G.main);			/* free all lib data */
-	
+
 //	free_vertexpaint();
 
 	G.main= NULL;
-	
+
 	G.f &= ~(G_WEIGHTPAINT + G_VERTEXPAINT + G_FACESELECT + G_PARTICLEEDIT);
 }
 
@@ -240,17 +240,17 @@
 	Editing *ed;
 	Sequence *seq;
 	Strip *strip;
-	
+
 	while(image) {
 		BLI_clean(image->name);
 		image= image->id.next;
 	}
-	
+
 	while(sound) {
 		BLI_clean(sound->name);
 		sound= sound->id.next;
 	}
-	
+
 	while(scene) {
 		ed= seq_give_editing(scene, 0);
 		if(ed) {
@@ -269,7 +269,7 @@
 		}
 		BLI_clean(scene->r.backbuf);
 		BLI_clean(scene->r.pic);
-		
+
 		scene= scene->id.next;
 	}
 }
@@ -277,31 +277,31 @@
 /* context matching */
 /* handle no-ui case */
 
-static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename) 
+static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
 {
 	Object *ob;
 	bScreen *curscreen= NULL;
 	Scene *curscene= NULL;
 	char mode;
-	
+
 	/* 'u' = undo save, 'n' = no UI load */
 	if(bfd->main->screen.first==NULL) mode= 'u';
 	else if(G.fileflags & G_FILE_NO_UI) mode= 'n';
 	else mode= 0;
-	
+
 	clean_paths(bfd->main);
-	
+
 	/* XXX here the complex windowmanager matching */
-	
+
 	/* no load screens? */
 	if(mode) {
 		/* comes from readfile.c */
 		extern void lib_link_screen_restore(Main *, bScreen *, Scene *);
-		
+
 		SWAP(ListBase, G.main->wm, bfd->main->wm);
 		SWAP(ListBase, G.main->screen, bfd->main->screen);
 		SWAP(ListBase, G.main->script, bfd->main->script);
-		
+
 		/* we re-use current screen */
 		curscreen= CTX_wm_screen(C);
 		/* but use new Scene pointer */
@@ -313,26 +313,26 @@
 		/* clear_global will free G.main, here we can still restore pointers */
 		lib_link_screen_restore(bfd->main, curscreen, curscene);
 	}
-	
+
 	/* free G.main Main database */
-	clear_global();	
-	
+	clear_global();
+
 	G.main= bfd->main;
 
 	CTX_data_main_set(C, G.main);
-	
+
 	if (bfd->user) {
-		
+
 		/* only here free userdef themes... */
 		BKE_userdef_free();
-		
+
 		U= *bfd->user;
 		MEM_freeN(bfd->user);
 	}
-	
+
 	/* samples is a global list... */
-	sound_free_all_samples();
-	
+// AUD_XXX	sound_free_all_samples();
+
 	/* case G_FILE_NO_UI or no screens in file */
 	if(mode) {
 		/* leave entire context further unaltered? */
@@ -342,14 +342,14 @@
 		G.winpos= bfd->winpos;
 		G.displaymode= bfd->displaymode;
 		G.fileflags= bfd->fileflags;
-		
+
 		CTX_wm_screen_set(C, bfd->curscreen);
 		CTX_data_scene_set(C, bfd->curscreen->scene);
 		CTX_wm_area_set(C, NULL);
 		CTX_wm_region_set(C, NULL);
 		CTX_wm_menu_set(C, NULL);
 	}
-	
+
 	/* this can happen when active scene was lib-linked, and doesnt exist anymore */
 	if(CTX_data_scene(C)==NULL) {
 		CTX_data_scene_set(C, bfd->main->scene.first);
@@ -370,11 +370,11 @@
 	if (!G.background) {
 		//setscreen(G.curscreen);
 	}
-	
+
 	// XXX temporarily here
 	if(G.main->versionfile < 250)
 		do_versions_ipos_to_animato(G.main); // XXX fixme... complicated versionpatching
-	
+
 	/* baseflags, groups, make depsgraph, etc */
 	set_scene_bg(CTX_data_scene(C));
 
@@ -383,30 +383,30 @@
 		if(ob->type==OB_ARMATURE)
 			if(ob->recalc) object_handle_update(CTX_data_scene(C), ob);
 	}
-	
+
 	/* now tag update flags, to ensure deformers get calculated on redraw */
 	DAG_scene_update_flags(CTX_data_scene(C), CTX_data_scene(C)->lay);
-	
+
 	if (G.f & G_DOSCRIPTLINKS) {
 		/* there's an onload scriptlink to execute in screenmain */
 // XXX		mainqenter(ONLOAD_SCRIPT, 1);
 	}
 	if (G.sce != filename) /* these are the same at times, should never copy to the same location */
 		strcpy(G.sce, filename);
-	
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list