[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10988] branches/soc-2007-hcube/source: sequence_sound.c renamed to seqaudio.c and BAU_sound.h is also added.
Csaba Hruska
csaba.hruska at gmail.com
Wed Jun 20 18:22:31 CEST 2007
Revision: 10988
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10988
Author: hcube
Date: 2007-06-20 18:22:30 +0200 (Wed, 20 Jun 2007)
Log Message:
-----------
sequence_sound.c renamed to seqaudio.c and BAU_sound.h is also added.
Modified Paths:
--------------
branches/soc-2007-hcube/source/blender/src/buttons_scene.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/header_sound.c
branches/soc-2007-hcube/source/blender/src/header_time.c
branches/soc-2007-hcube/source/blender/src/usiblender.c
branches/soc-2007-hcube/source/creator/creator.c
Added Paths:
-----------
branches/soc-2007-hcube/source/blender/include/BAU_sound.h
branches/soc-2007-hcube/source/blender/include/BSE_seqaudio.h
branches/soc-2007-hcube/source/blender/src/seqaudio.c
branches/soc-2007-hcube/source/blender/src/soundsystem.c
Removed Paths:
-------------
branches/soc-2007-hcube/source/blender/include/BSE_sound.h
branches/soc-2007-hcube/source/blender/src/sequence_sound.c
branches/soc-2007-hcube/source/blender/src/soundsystem.c
Added: branches/soc-2007-hcube/source/blender/include/BAU_sound.h
===================================================================
--- branches/soc-2007-hcube/source/blender/include/BAU_sound.h (rev 0)
+++ branches/soc-2007-hcube/source/blender/include/BAU_sound.h 2007-06-20 16:22:30 UTC (rev 10988)
@@ -0,0 +1,18 @@
+#ifndef BAU_SOUND_H
+#define BAU_SOUND_H
+
+#include "DNA_sound_types.h"
+
+void sound_initialize(void);
+int sound_is_initialized(void);
+void sound_finalize(void);
+
+struct bSound* sound_new_sound(char *name);
+
+void sound_play_sound(struct bSound *sound);
+void sound_stop_sound(struct bSound *sound);
+
+void sound_stop_all_sounds(void);
+
+// these functions are implemented in soundsystem.c
+#endif
Added: branches/soc-2007-hcube/source/blender/include/BSE_seqaudio.h
===================================================================
--- branches/soc-2007-hcube/source/blender/include/BSE_seqaudio.h (rev 0)
+++ branches/soc-2007-hcube/source/blender/include/BSE_seqaudio.h 2007-06-20 16:22:30 UTC (rev 10988)
@@ -0,0 +1,12 @@
+#ifndef BSE_SEQAUDIO_H
+#define BSE_SEQAUDIO_H
+
+void seqaudio_initialize(void);
+void seqaudio_finalize(void);
+
+void seqaudio_play(void);
+void seqaudio_stop(void);
+void seqaudio_update(void);
+
+// these functions are implemented in seqaudio.c
+#endif
Deleted: branches/soc-2007-hcube/source/blender/include/BSE_sound.h
===================================================================
--- branches/soc-2007-hcube/source/blender/include/BSE_sound.h 2007-06-20 16:21:16 UTC (rev 10987)
+++ branches/soc-2007-hcube/source/blender/include/BSE_sound.h 2007-06-20 16:22:30 UTC (rev 10988)
@@ -1,28 +0,0 @@
-#ifndef BSE_SOUND_H
-#define BSE_SOUND_H
-
-#include "DNA_sound_types.h"
-
-// internal state, unusable for user
-typedef enum
-{
- SEQAUDIO_STOP = 0,
- SEQAUDIO_PLAY = 1
-
-} SeqAudioState;
-
-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_sound(struct bSound *sound);
-
-void sound_stop_all_sounds(void);
-
-void sound_play_seq(void);
-void sound_stop_seq(void);
-void sound_update_seq(void);
-
-#endif
Modified: branches/soc-2007-hcube/source/blender/src/buttons_scene.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/buttons_scene.c 2007-06-20 16:21:16 UTC (rev 10987)
+++ branches/soc-2007-hcube/source/blender/src/buttons_scene.c 2007-06-20 16:22:30 UTC (rev 10988)
@@ -53,7 +53,7 @@
#include "BKE_utildefines.h"
#include "BKE_sound.h"
-#include "BSE_sound.h"
+#include "BAU_sound.h"
#include "BLI_blenlib.h"
Modified: branches/soc-2007-hcube/source/blender/src/drawview.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/drawview.c 2007-06-20 16:21:16 UTC (rev 10987)
+++ branches/soc-2007-hcube/source/blender/src/drawview.c 2007-06-20 16:22:30 UTC (rev 10988)
@@ -138,7 +138,7 @@
#include "BSE_trans_types.h"
#include "BSE_time.h"
#include "BSE_view.h"
-#include "BSE_sound.h"
+#include "BSE_seqaudio.h"
#include "BPY_extern.h"
@@ -3187,7 +3187,7 @@
}
// update sound seqences
- sound_update_seq();
+ seqaudio_update();
/* make sure that swaptime passed by */
tottime -= swaptime;
@@ -3197,8 +3197,8 @@
if (tottime > 0.0) tottime = 0.0;
CFRA= PSFRA;
// by hcube
- sound_stop_seq();
- sound_play_seq();
+ seqaudio_stop();
+ seqaudio_play();
//audiostream_stop();
//audiostream_start( CFRA );
}
@@ -3237,7 +3237,7 @@
oldsa= curarea;
// by hcube
//audiostream_start( CFRA );
- sound_play_seq();
+ seqaudio_play();
if (curarea && curarea->spacetype == SPACE_SEQ) {
SpaceSeq *sseq = curarea->spacedata.first;
@@ -3286,7 +3286,7 @@
else CFRA= cfraont;
// by hcube
//audiostream_stop();
- sound_stop_seq();
+ seqaudio_stop();
if(oldsa!=curarea) areawinset(oldsa->win);
Modified: branches/soc-2007-hcube/source/blender/src/editscreen.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/editscreen.c 2007-06-20 16:21:16 UTC (rev 10987)
+++ branches/soc-2007-hcube/source/blender/src/editscreen.c 2007-06-20 16:22:30 UTC (rev 10988)
@@ -104,7 +104,7 @@
#include "BSE_filesel.h"
#include "BSE_headerbuttons.h"
#include "BSE_view.h"
-#include "BSE_sound.h"
+#include "BSE_seqaudio.h"
#include "BPY_extern.h"
#include "mydevice.h"
@@ -1083,8 +1083,8 @@
// by hcube
//audiostream_stop();
//audiostream_start( CFRA );
- sound_stop_seq();
- sound_play_seq();
+ seqaudio_stop();
+ seqaudio_play();
}
else {
// by hcube
Modified: branches/soc-2007-hcube/source/blender/src/editseq.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/editseq.c 2007-06-20 16:21:16 UTC (rev 10987)
+++ branches/soc-2007-hcube/source/blender/src/editseq.c 2007-06-20 16:22:30 UTC (rev 10988)
@@ -71,7 +71,7 @@
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_scene.h"
-#include "BSE_sound.h"
+#include "BAU_sound.h"
#include "BIF_space.h"
#include "BIF_interface.h"
Modified: branches/soc-2007-hcube/source/blender/src/header_sound.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/header_sound.c 2007-06-20 16:21:16 UTC (rev 10987)
+++ branches/soc-2007-hcube/source/blender/src/header_sound.c 2007-06-20 16:22:30 UTC (rev 10988)
@@ -65,7 +65,7 @@
#include "BIF_butspace.h"
#include "BKE_global.h"
-#include "BSE_sound.h"
+#include "BAU_sound.h"
#include "BKE_main.h"
#include "BSE_drawipo.h"
Modified: branches/soc-2007-hcube/source/blender/src/header_time.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/header_time.c 2007-06-20 16:21:16 UTC (rev 10987)
+++ branches/soc-2007-hcube/source/blender/src/header_time.c 2007-06-20 16:22:30 UTC (rev 10988)
@@ -63,6 +63,7 @@
#include "BSE_filesel.h"
#include "BSE_headerbuttons.h"
#include "BSE_time.h"
+#include "BSE_seqaudio.h"
#include "blendef.h"
#include "butspace.h"
@@ -81,7 +82,7 @@
case B_TL_PLAY:
add_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM, stime->redraws);
if(stime->redraws & TIME_WITH_SEQ_AUDIO)
- sound_play_seq();
+ seqaudio_play();
// by hcube
//audiostream_start( CFRA );
@@ -89,7 +90,7 @@
case B_TL_STOP:
rem_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM);
if(stime->redraws & TIME_WITH_SEQ_AUDIO)
- sound_stop_seq();
+ seqaudio_stop();
//by hcube
//audiostream_stop();
allqueue(REDRAWALL, 0);
Added: branches/soc-2007-hcube/source/blender/src/seqaudio.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/seqaudio.c (rev 0)
+++ branches/soc-2007-hcube/source/blender/src/seqaudio.c 2007-06-20 16:22:30 UTC (rev 10988)
@@ -0,0 +1,251 @@
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_ipo_types.h"
+#include "DNA_sequence_types.h"
+#include "DNA_packedFile_types.h"
+
+#include "BKE_utildefines.h"
+#include "BKE_global.h"
+#include "BKE_ipo.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_sound.h"
+#include "BKE_packedFile.h"
+
+#include "BAU_sound.h"
+#include "BSE_seqaudio.h"
+
+/*
+ Depends only on functions from BAU_sound.h
+ Handles blender structures: Sequence
+*/
+
+typedef enum
+{
+ SEQAUDIO_STOP = 0,
+ SEQAUDIO_PLAY = 1
+
+} SeqAudioState;
+
+SeqAudioState gSeqAudioState = SEQAUDIO_STOP;
+
+////////////////////////////////////
+// sequencing code NEW
+////////////////////////////////////
+void seqaudio_initialize(void)
+{
+ gSeqAudioState = SEQAUDIO_STOP;
+}
+
+void seqaudio_finalize(void)
+{
+}
+
+void seqaudio_play(void)
+{
+ if( !sound_is_initialized() )
+ {
+ return;
+ }
+ gSeqAudioState = SEQAUDIO_PLAY;
+ seqaudio_update();
+}
+
+void seqaudio_stop(void)
+{
+ if( !sound_is_initialized() )
+ {
+ return;
+ }
+ gSeqAudioState = SEQAUDIO_STOP;
+ seqaudio_update();
+}
+
+// this will be called before mixing has been done by tinySND
+static void do_seqaudio_update_ipo_cb( void *userData )
+{
+ Sequence *seq = (Sequence*)userData;
+ float facf;
+
+ if( seq->ipo && seq->ipo->curve.first )
+ {
+ do_seq_ipo(seq);
+ facf = seq->facf0;
+ }
+ else
+ {
+ facf = 1.0;
+ }
+ /*
+ cvtbuf = malloc(len);
+ memcpy(cvtbuf, ((Uint8*)sound->stream)+(seq->curpos & (~3)), len);
+ audio_levels(cvtbuf, len, seq->level, facf, seq->pan);
+ if (!mixdown) {
+ SDL_MixAudio(sstream, cvtbuf, len, SDL_MIX_MAXVOLUME);
+ } else {
+ SDL_MixAudio((Uint8*)mixdown, cvtbuf, len, SDL_MIX_MAXVOLUME);
+ }
+ */
+}
+
+static void do_seqaudio_update( Sequence *seq )
+{
+ while( seq )
+ {
+ if( seq->type == SEQ_META )
+ {
+ do_seqaudio_update( seq->seqbase.first );
+ }
+
+ if( (seq->type == SEQ_RAM_SOUND) || (seq->type == SEQ_HD_SOUND) )
+ {
+ /*
+ seq->curpos = (int)( (((float)((float)startframe
+ -(float)seq->start)
+ / (float)G.scene->r.frs_sec)
+ * ((float)G.scene->audio.mixrate)
+ * 4 ));
+ */
+ //only Play/Stop
+ if( gSeqAudioState == SEQAUDIO_STOP )
+ {
+ sound_stop_sound( seq->sound );
+ }
+ else
+ {
+ //if ((seq->curpos<sound->streamlen -len) && (seq->curpos>=0) &&
+ // (seq->startdisp <= CFRA) && ((seq->enddisp) > CFRA))
+ }
+ }
+ seq = seq->next;
+ }
+}
+
+void seqaudio_update(void)
+{
+ Editing *ed;
+
+ assert( gSeqAudioState == SEQAUDIO_STOP || gSeqAudioState == SEQAUDIO_PLAY );
+
+ ed = G.scene->ed;
+ if( !sound_is_initialized() || !ed )
+ {
+ return;
+ }
+ do_seqaudio_update( ed->seqbasep->first );
+}
+
+////////////////////////////////////
+// sequencing code OLD
+////////////////////////////////////
+/*
+static int audiostream_play_seq(Sequence * seq, Uint32 startframe)
+{
+ char name[FILE_MAXDIR+FILE_MAXFILE];
+ int have_sound = 0;
+
+ while(seq) {
+ if (seq->type == SEQ_META) {
+ if (audiostream_play_seq(
+ seq->seqbase.first, startframe)) {
+ have_sound = 1;
+ }
+ }
+ if ((seq->type == SEQ_RAM_SOUND) && (seq->sound)) {
+ have_sound = 1;
+ seq->curpos = (int)( (((float)((float)startframe
+ -(float)seq->start)
+ / (float)G.scene->r.frs_sec)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list