[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10950] branches/soc-2007-hcube: Restuctured source.

Csaba Hruska csaba.hruska at gmail.com
Sun Jun 17 11:13:07 CEST 2007


Revision: 10950
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10950
Author:   hcube
Date:     2007-06-17 11:13:07 +0200 (Sun, 17 Jun 2007)

Log Message:
-----------
Restuctured source. Added every sound functions into Blender kernel (BKE).

Modified Paths:
--------------
    branches/soc-2007-hcube/config/linux2-config.py
    branches/soc-2007-hcube/intern/tinySND/SND_DataProvider.h
    branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp
    branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.cpp
    branches/soc-2007-hcube/source/blender/blenkernel/BKE_sound.h
    branches/soc-2007-hcube/source/blender/blenkernel/SConscript
    branches/soc-2007-hcube/source/blender/blenkernel/intern/sound.c
    branches/soc-2007-hcube/source/blender/blenkernel/intern/writeffmpeg.c
    branches/soc-2007-hcube/source/blender/python/api2_2x/Sound.c
    branches/soc-2007-hcube/source/blender/python/api2_2x/bpy_data.c
    branches/soc-2007-hcube/source/blender/src/buttons_editing.c
    branches/soc-2007-hcube/source/blender/src/buttons_logic.c
    branches/soc-2007-hcube/source/blender/src/buttons_scene.c
    branches/soc-2007-hcube/source/blender/src/drawseq.c
    branches/soc-2007-hcube/source/blender/src/drawsound.c
    branches/soc-2007-hcube/source/blender/src/drawview.c
    branches/soc-2007-hcube/source/blender/src/editscreen.c
    branches/soc-2007-hcube/source/blender/src/editseq.c
    branches/soc-2007-hcube/source/blender/src/editsound.c
    branches/soc-2007-hcube/source/blender/src/header_sound.c
    branches/soc-2007-hcube/source/blender/src/header_time.c
    branches/soc-2007-hcube/source/blender/src/headerbuttons.c
    branches/soc-2007-hcube/source/blender/src/sequence.c
    branches/soc-2007-hcube/source/blender/src/space.c
    branches/soc-2007-hcube/source/blender/src/toets.c
    branches/soc-2007-hcube/source/blender/src/usiblender.c
    branches/soc-2007-hcube/source/creator/creator.c

Removed Paths:
-------------
    branches/soc-2007-hcube/source/blender/include/BIF_editsound.h
    branches/soc-2007-hcube/source/blender/include/BSE_seqaudio.h
    branches/soc-2007-hcube/source/blender/src/hddaudio.c
    branches/soc-2007-hcube/source/blender/src/seqaudio.c

Modified: branches/soc-2007-hcube/config/linux2-config.py
===================================================================
--- branches/soc-2007-hcube/config/linux2-config.py	2007-06-16 21:03:11 UTC (rev 10949)
+++ branches/soc-2007-hcube/config/linux2-config.py	2007-06-17 09:13:07 UTC (rev 10950)
@@ -22,8 +22,13 @@
 WITH_BF_SDL = 'true'
 BF_SDL = '/usr' #$(shell sdl-config --prefix)
 BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
-BF_SDL_LIB = 'SDL portaudio portaudiocpp' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
+BF_SDL_LIB = 'SDL portaudio portaudiocpp sndfile' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
 
+#WITH_BF_TINYSND = 'true'
+#BF_TINYSND = '' #$(shell sdl-config --prefix)
+#BF_TINYSND_INC = '' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
+#BF_TINYSND_LIB = 'SDL portaudio portaudiocpp sndfile' 
+
 WITH_BF_FMOD = 'false'
 BF_FMOD = LIBDIR + '/fmod'
 

Modified: branches/soc-2007-hcube/intern/tinySND/SND_DataProvider.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/SND_DataProvider.h	2007-06-16 21:03:11 UTC (rev 10949)
+++ branches/soc-2007-hcube/intern/tinySND/SND_DataProvider.h	2007-06-17 09:13:07 UTC (rev 10950)
@@ -11,7 +11,7 @@
     virtual ~SND_DataProvider() {}
     
     // true if file loading is succed, false if there was an error
-    virtual bool isFormatSupported();
+    virtual bool isFormatSupported() = 0;
     
     int getNumFrames() const { return mNumFrames; }
     float getDuration() const { return mDuration; } // in sec

Modified: branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp	2007-06-16 21:03:11 UTC (rev 10949)
+++ branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp	2007-06-17 09:13:07 UTC (rev 10950)
@@ -45,12 +45,23 @@
  // hides various DataProvider backends
 SND_SoundIHandle SND_NewSound( char *filename )
 {
-    // we'll try all DataProvider we have ill one can open the file, if any then return 0
-    // if load succed we attach the FXSample to a FXMixer and return with new FXSample handle
+	// we'll try all DataProvider we have ill one can open the file, if any then return 0
+	// if load succed we attach the FXSample to a FXMixer and return with new FXSample handle
+	SND_DataProvider *dataProvider;
+	SND_FXSample *fxsample;
     
-    // sndfileProvider
-    
-    return (SND_SoundIHandle)0;
+	// sndfileProvider
+	dataProvider = new sndfileProvider( filename );
+	if( !dataProvider->isFormatSupported() )
+	{
+		delete dataProvider;
+		return (SND_SoundIHandle)0;
+	}
+
+	fxsample = new SND_FXSample( dataProvider, 1 );
+	gSamples.push_back( fxsample );
+	
+	return (SND_SoundIHandle)fxsample;
 }
 
 SND_SoundIHandle SND_CloneSound( SND_SoundIHandle sound )

Modified: branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.cpp	2007-06-16 21:03:11 UTC (rev 10949)
+++ branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.cpp	2007-06-17 09:13:07 UTC (rev 10950)
@@ -48,6 +48,7 @@
        return false;
     }
     
+    SDL_PauseAudio(1);
     return true;
 }
 

Modified: branches/soc-2007-hcube/source/blender/blenkernel/BKE_sound.h
===================================================================
--- branches/soc-2007-hcube/source/blender/blenkernel/BKE_sound.h	2007-06-16 21:03:11 UTC (rev 10949)
+++ branches/soc-2007-hcube/source/blender/blenkernel/BKE_sound.h	2007-06-17 09:13:07 UTC (rev 10950)
@@ -42,10 +42,15 @@
 /* bad bad global... */
 extern struct ListBase *samples;
 
+void sound_initialize(void);
+void sound_finalize(void);
+
+struct bSound* sound_new_sound(char *name);
+void sound_play_sound(struct bSound *sound);
+void sound_stop_all_sounds(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);
 struct PackedFile* sound_find_packedfile(struct bSound* sound);
 void sound_free_sample(struct bSample* sample);

Modified: branches/soc-2007-hcube/source/blender/blenkernel/SConscript
===================================================================
--- branches/soc-2007-hcube/source/blender/blenkernel/SConscript	2007-06-16 21:03:11 UTC (rev 10949)
+++ branches/soc-2007-hcube/source/blender/blenkernel/SConscript	2007-06-17 09:13:07 UTC (rev 10950)
@@ -3,7 +3,7 @@
 
 sources = env.Glob('intern/*.c')
 
-incs = '. #/intern/guardedalloc ../include ../blenlib ../makesdna'
+incs = '. #/intern/guardedalloc #/intern/tinySND/blender ../include ../blenlib ../makesdna'
 incs += ' ../python ../render/extern/include #/intern/decimation/extern'
 incs += ' ../imbuf ../avi #/intern/elbeem/extern ../nodes'
 incs += ' #/intern/iksolver/extern ../blenloader ../quicktime'

Modified: branches/soc-2007-hcube/source/blender/blenkernel/intern/sound.c
===================================================================
--- branches/soc-2007-hcube/source/blender/blenkernel/intern/sound.c	2007-06-16 21:03:11 UTC (rev 10949)
+++ branches/soc-2007-hcube/source/blender/blenkernel/intern/sound.c	2007-06-17 09:13:07 UTC (rev 10950)
@@ -6,6 +6,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <assert.h>
 
 #include "MEM_guardedalloc.h"
 
@@ -17,14 +18,23 @@
 
 #include "BKE_utildefines.h"
 #include "BKE_global.h"
+#include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_sound.h"
 #include "BKE_packedFile.h"
 
+#include "SND_C-api.h"
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+///////////////////////////////////////////////////////////
+// This is necessery if we cant change bSound and bSample
+// 
+///////////////////////////////////////////////////////////
+
+
 ListBase _samples = {0,0}, *samples = &_samples;
 
 void sound_free_sound(bSound *sound)
@@ -136,3 +146,59 @@
 	
 	return (pf);
 }
+
+bSound* sound_new_sound(char *name)
+{
+	bSound *sound = NULL;
+	SND_SoundIHandle soundHandle;
+//	char str[FILE_MAXDIR+FILE_MAXFILE];
+	
+	// allocate some memory for the sound 
+	sound = alloc_libblock(&G.main->sound, ID_SO, "sound");
+	strcpy(sound->name, name);
+		
+	soundHandle = SND_NewSound( name );
+	if (soundHandle == NULL)
+	{
+		free_libblock(&G.main->sound, sound);
+		sound = NULL;
+	} 
+	else
+	{
+		sound->volume = 1.0;
+		sound->attenuation = 1.0;
+		sound->distance = 1.0;
+		sound->min_gain = 0.0;
+		sound->max_gain = 1.0;
+		sound->snd_sound = soundHandle;
+	}
+	
+	return (sound);
+}
+
+void sound_play_sound(struct bSound *sound)
+{
+	assert( sound != NULL );
+	assert( sound->snd_sound != NULL );
+
+	SND_PlaySound( (SND_SoundIHandle)sound->snd_sound );
+}
+
+void sound_stop_all_sounds(void)
+{
+	SND_StopAllSounds();
+}
+
+void sound_initialize(void)
+{
+	SND_Initialize();
+}
+
+void sound_finalize(void)
+{
+	if( SND_IsInitialized() )
+	{
+		SND_Finalize();
+	}
+}
+

Modified: branches/soc-2007-hcube/source/blender/blenkernel/intern/writeffmpeg.c
===================================================================
--- branches/soc-2007-hcube/source/blender/blenkernel/intern/writeffmpeg.c	2007-06-16 21:03:11 UTC (rev 10949)
+++ branches/soc-2007-hcube/source/blender/blenkernel/intern/writeffmpeg.c	2007-06-17 09:13:07 UTC (rev 10950)
@@ -55,8 +55,6 @@
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
 
-#include "BSE_seqaudio.h"
-
 #include "DNA_scene_types.h"
 #include "blendef.h"
 

Deleted: branches/soc-2007-hcube/source/blender/include/BIF_editsound.h
===================================================================
--- branches/soc-2007-hcube/source/blender/include/BIF_editsound.h	2007-06-16 21:03:11 UTC (rev 10949)
+++ branches/soc-2007-hcube/source/blender/include/BIF_editsound.h	2007-06-17 09:13:07 UTC (rev 10950)
@@ -1,90 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License.  See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef BIF_EDITSOUND_H
-#define BIF_EDITSOUND_H
-
-struct bSound;
-struct bSample;
-struct ListBase;
-struct PackedFile;
-struct hdaudio;
-
-/*
-void sound_init_audio(void);
-void sound_initialize_sounds(void);
-void sound_exit_audio(void);
-int sound_get_mixrate(void);
-
-void* sound_get_audiodevice(void);
-void* sound_get_listener(void);
-
-int sound_set_sample(struct bSound* sound, struct bSample* sample);
-int sound_sample_is_null(struct bSound* sound);
-int sound_load_sample(struct bSound* sound);
-
-struct bSample* sound_find_sample(struct bSound* sound);
-struct bSample* sound_new_sample(struct bSound* sound);
-*/
-
-struct bSound* sound_new_sound(char *name);
-/*
-struct bSound* sound_make_copy(struct bSound* originalsound);
-void sound_end_all_sounds(void);
-
-void sound_initialize_sample(struct bSound * sound);
-void sound_load_samples(void);
-*/
-void sound_play_sound(struct bSound *sound);
-void sound_stop_all_sounds(void);
-/*
-void sound_set_position(void *object,
-			struct bSound *sound,
-			float obmatrix[4][4]);
-
-struct hdaudio * sound_open_hdaudio(char * name);
-struct hdaudio * sound_copy_hdaudio(struct hdaudio * c);
-
-long sound_hdaudio_get_duration(struct hdaudio * hdaudio, int frame_rate);
-void sound_hdaudio_extract(struct hdaudio * hdaudio, 
-			   short * target_buffer,

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list