[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22089] branches/soundsystem/source/ blender: Updated sequencer; now you can load movie and sound together.
Jörg Müller
nexyon at gmail.com
Fri Jul 31 17:58:15 CEST 2009
Revision: 22089
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22089
Author: nexyon
Date: 2009-07-31 17:58:15 +0200 (Fri, 31 Jul 2009)
Log Message:
-----------
Updated sequencer; now you can load movie and sound together. Also removed the difference between RAM and HD sound.
Modified Paths:
--------------
branches/soundsystem/source/blender/blenkernel/intern/sequence.c
branches/soundsystem/source/blender/blenlib/intern/bpath.c
branches/soundsystem/source/blender/editors/space_outliner/outliner.c
branches/soundsystem/source/blender/editors/space_sequencer/sequencer_add.c
branches/soundsystem/source/blender/editors/space_sequencer/sequencer_draw.c
branches/soundsystem/source/blender/editors/space_sequencer/sequencer_edit.c
branches/soundsystem/source/blender/editors/space_sequencer/sequencer_select.c
branches/soundsystem/source/blender/makesdna/DNA_sequence_types.h
branches/soundsystem/source/blender/makesrna/intern/rna_sequence.c
Modified: branches/soundsystem/source/blender/blenkernel/intern/sequence.c
===================================================================
--- branches/soundsystem/source/blender/blenkernel/intern/sequence.c 2009-07-31 15:36:14 UTC (rev 22088)
+++ branches/soundsystem/source/blender/blenkernel/intern/sequence.c 2009-07-31 15:58:15 UTC (rev 22089)
@@ -455,6 +455,9 @@
else if(seq->enddisp-seq->startdisp > 250) {
seq->handsize= (float)((seq->enddisp-seq->startdisp)/25);
}
+
+ // AUD_XXX
+ seq_update_sound(seq);
}
void calc_sequence(Sequence *seq)
@@ -519,9 +522,6 @@
}
calc_sequence_disp(seq);
}
-
- // AUD_XXX
- seq_update_sound(seq);
}
void reload_sequence_new_file(Scene *scene, Sequence * seq)
@@ -529,7 +529,7 @@
char str[FILE_MAXDIR+FILE_MAXFILE];
if (!(seq->type == SEQ_MOVIE || seq->type == SEQ_IMAGE ||
- seq->type == SEQ_HD_SOUND || seq->type == SEQ_RAM_SOUND ||
+ seq->type == SEQ_SOUND ||
seq->type == SEQ_SCENE || seq->type == SEQ_META)) {
return;
}
@@ -572,6 +572,8 @@
seq->len = 0;
}
seq->strip->len = seq->len;
+// AUD_XXX
+#if 0
} else if (seq->type == SEQ_HD_SOUND) {
// XXX if(seq->hdaudio) sound_close_hdaudio(seq->hdaudio);
// seq->hdaudio = sound_open_hdaudio(str);
@@ -590,12 +592,10 @@
seq->len = 0;
}
seq->strip->len = seq->len;
- } else if (seq->type == SEQ_RAM_SOUND) {
+#endif
// AUD_XXX
+ } else if (seq->type == SEQ_SOUND) {
seq->len = AUD_getInfo(seq->sound->snd_sound).length * FPS;
-/* seq->len = (int) ( ((float)(seq->sound->streamlen-1)/
- ((float)scene->audio.mixrate*4.0 ))
- * FPS);*/
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
@@ -714,8 +714,9 @@
case SEQ_IMAGE: return "Image";
case SEQ_SCENE: return "Scene";
case SEQ_MOVIE: return "Movie";
- case SEQ_RAM_SOUND: return "Audio (RAM)";
- case SEQ_HD_SOUND: return "Audio (HD)";
+ case SEQ_SOUND: return "Audio";
+// AUD_XXX case SEQ_RAM_SOUND: return "Audio (RAM)";
+// AUD_XXX case SEQ_HD_SOUND: return "Audio (HD)";
case SEQ_CROSS: return "Cross";
case SEQ_GAMCROSS: return "Gamma Cross";
case SEQ_ADD: return "Add";
@@ -1094,8 +1095,9 @@
{
return (seq
&& !(seq->flag & SEQ_MUTE)
- && seq->type != SEQ_RAM_SOUND
- && seq->type != SEQ_HD_SOUND);
+// AUD_XXX && seq->type != SEQ_RAM_SOUND
+// AUD_XXX && seq->type != SEQ_HD_SOUND);
+ && seq->type != SEQ_SOUND);
}
static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Sequence ** seq_arr_out)
@@ -3383,7 +3385,8 @@
}
/* sounds cannot be extended past their endpoints */
- if (seq->type == SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND) {
+// AUD_XXX if (seq->type == SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND) {
+ if (seq->type == SEQ_SOUND) {
seq->startstill= 0;
seq->endstill= 0;
}
@@ -3484,7 +3487,7 @@
// AUD_XXX
void seq_update_sound(struct Sequence *seq)
{
- if(seq->type == SEQ_RAM_SOUND)
+ if(seq->type == SEQ_SOUND)
{
seq->sound_handle->startframe = seq->startdisp;
seq->sound_handle->endframe = seq->enddisp;
Modified: branches/soundsystem/source/blender/blenlib/intern/bpath.c
===================================================================
--- branches/soundsystem/source/blender/blenlib/intern/bpath.c 2009-07-31 15:36:14 UTC (rev 22088)
+++ branches/soundsystem/source/blender/blenlib/intern/bpath.c 2009-07-31 15:58:15 UTC (rev 22089)
@@ -51,7 +51,8 @@
/* for sequence */
//XXX #include "BSE_sequence.h"
//XXX define below from BSE_sequence.h - otherwise potentially odd behaviour
-#define SEQ_HAS_PATH(seq) (seq->type==SEQ_MOVIE || seq->type==SEQ_HD_SOUND || seq->type==SEQ_RAM_SOUND || seq->type==SEQ_IMAGE)
+// AUD_XXX #define SEQ_HAS_PATH(seq) (seq->type==SEQ_MOVIE || seq->type==SEQ_HD_SOUND || seq->type==SEQ_RAM_SOUND || seq->type==SEQ_IMAGE)
+#define SEQ_HAS_PATH(seq) (seq->type==SEQ_MOVIE || seq->type==SEQ_IMAGE)
/* path/file handeling stuff */
#ifndef WIN32
Modified: branches/soundsystem/source/blender/editors/space_outliner/outliner.c
===================================================================
--- branches/soundsystem/source/blender/editors/space_outliner/outliner.c 2009-07-31 15:36:14 UTC (rev 22088)
+++ branches/soundsystem/source/blender/editors/space_outliner/outliner.c 2009-07-31 15:58:15 UTC (rev 22089)
@@ -4178,13 +4178,15 @@
case TSE_POSEGRP_BASE:
UI_icon_draw(x, y, ICON_VERTEXSEL); break;
case TSE_SEQUENCE:
- if((te->idcode==SEQ_MOVIE) || (te->idcode==SEQ_MOVIE_AND_HD_SOUND))
+// AUD_XXX if((te->idcode==SEQ_MOVIE) || (te->idcode==SEQ_MOVIE_AND_HD_SOUND))
+ if(te->idcode==SEQ_MOVIE)
UI_icon_draw(x, y, ICON_SEQUENCE);
else if(te->idcode==SEQ_META)
UI_icon_draw(x, y, ICON_DOT);
else if(te->idcode==SEQ_SCENE)
UI_icon_draw(x, y, ICON_SCENE);
- else if((te->idcode==SEQ_RAM_SOUND) || (te->idcode==SEQ_HD_SOUND))
+// else if((te->idcode==SEQ_RAM_SOUND) || (te->idcode==SEQ_HD_SOUND))
+ else if(te->idcode==SEQ_SOUND)
UI_icon_draw(x, y, ICON_SOUND);
else if(te->idcode==SEQ_IMAGE)
UI_icon_draw(x, y, ICON_IMAGE_COL);
Modified: branches/soundsystem/source/blender/editors/space_sequencer/sequencer_add.c
===================================================================
--- branches/soundsystem/source/blender/editors/space_sequencer/sequencer_add.c 2009-07-31 15:36:14 UTC (rev 22088)
+++ branches/soundsystem/source/blender/editors/space_sequencer/sequencer_add.c 2009-07-31 15:58:15 UTC (rev 22089)
@@ -228,6 +228,63 @@
RNA_def_string(ot->srna, "scene", "", MAX_ID_NAME-2, "Scene Name", "Scene name to add as a strip");
}
+static Sequence* sequencer_add_sound_strip(bContext *C, wmOperator *op, int start_frame, int channel, char* filename)
+{
+ Scene *scene= CTX_data_scene(C);
+ Editing *ed= seq_give_editing(scene, TRUE);
+
+ bSound *sound;
+
+ Sequence *seq; /* generic strip vars */
+ Strip *strip;
+ StripElem *se;
+
+ AUD_SoundInfo info;
+
+ sound = sound_new_file(C, filename);
+
+ if (sound==NULL || sound->snd_sound == NULL) {
+ if(op)
+ BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
+ return NULL;
+ }
+
+ info = AUD_getInfo(sound->snd_sound);
+
+ if (info.specs.format == AUD_FORMAT_INVALID) {
+ sound_delete(C, sound);
+ if(op)
+ BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
+ return NULL;
+ }
+
+ sound->flags |= SOUND_FLAGS_SEQUENCE;
+
+ seq = alloc_sequence(ed->seqbasep, start_frame, channel);
+
+ seq->type= SEQ_SOUND;
+ seq->sound= sound;
+
+ /* basic defaults */
+ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+ strip->len = seq->len = (int) (info.length * FPS);
+ strip->us= 1;
+
+ strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
+
+ BLI_split_dirfile_basic(filename, strip->dir, se->name);
+
+ seq->sound_handle = sound_new_handle(scene, sound, start_frame, start_frame + strip->len, 0);
+
+ calc_sequence_disp(seq);
+ sort_seq(scene);
+
+ /* last active name */
+ strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR-1);
+
+ return seq;
+}
+
/* add movie operator */
static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
{
@@ -237,14 +294,15 @@
struct anim *an;
char filename[FILE_MAX];
- Sequence *seq; /* generic strip vars */
+ Sequence *seq, *soundseq; /* generic strip vars */
Strip *strip;
StripElem *se;
- int start_frame, channel; /* operator props */
+ int start_frame, channel, sound; /* operator props */
start_frame= RNA_int_get(op->ptr, "start_frame");
channel= RNA_int_get(op->ptr, "channel");
+ sound = RNA_boolean_get(op->ptr, "sound");
RNA_string_get(op->ptr, "filename", filename);
@@ -275,10 +333,19 @@
calc_sequence_disp(seq);
sort_seq(scene);
+ if(sound)
+ {
+ soundseq = sequencer_add_sound_strip(C, NULL, start_frame, channel+1, filename);
+ if(soundseq != NULL)
+ RNA_string_get(op->ptr, "name", soundseq->name);
+ }
+
if (RNA_boolean_get(op->ptr, "replace_sel")) {
deselect_all_seq(scene);
set_last_seq(scene, seq);
seq->flag |= SELECT;
+ if(soundseq)
+ soundseq->flag |= SELECT;
}
ED_area_tag_redraw(CTX_wm_area(C));
@@ -314,26 +381,15 @@
WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
- RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load hd sound with the movie"); // XXX need to impliment this
+ RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie");
}
-
/* add sound operator */
static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
{
+ char filename[FILE_MAX];
Scene *scene= CTX_data_scene(C);
- Editing *ed= seq_give_editing(scene, TRUE);
-
- bSound *sound;
-
- char filename[FILE_MAX];
-
Sequence *seq; /* generic strip vars */
- Strip *strip;
- StripElem *se;
-
- AUD_SoundInfo info;
-
int start_frame, channel; /* operator props */
start_frame= RNA_int_get(op->ptr, "start_frame");
@@ -341,66 +397,13 @@
RNA_string_get(op->ptr, "filename", filename);
- /* XXX if(sfile->flag & FILE_STRINGCODE) {
- BLI_makestringcode(G.sce, str);
- }*/
+ seq = sequencer_add_sound_strip(C, op, start_frame, channel, filename);
-// XXX sound= sound_new_sound(filename);
-
- // AUD_XXX
- sound = sound_new_file(C, filename);
-
-// sound= NULL;
-
-// AUD_XXX if (sound==NULL || sound->sample->type == SAMPLE_INVALID) {
- if (sound==NULL || sound->snd_sound == NULL) {
- BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
+ if(seq == NULL)
return OPERATOR_CANCELLED;
- }
- // AUD_XXX
- info = AUD_getInfo(sound->snd_sound);
-
- if (info.specs.format == AUD_FORMAT_INVALID) {
- sound_delete(C, sound);
- BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
- return OPERATOR_CANCELLED;
- }
-
-/* if (sound==NULL || sound->sample->bits != 16) {
- BKE_report(op->reports, RPT_ERROR, "Only 16 bit audio is supported");
- return OPERATOR_CANCELLED;
- }*/
-
- sound->flags |= SOUND_FLAGS_SEQUENCE;
-// XXX audio_makestream(sound);
-
- seq = alloc_sequence(ed->seqbasep, start_frame, channel);
-
- seq->type= SEQ_RAM_SOUND;
- seq->sound= sound;
-
- /* basic defaults */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
-// AUD_XXX strip->len = seq->len = (int) ( ((float)(sound->streamlen-1) / ( (float)scene->r.audio.mixrate*4.0 ))* FPS);
- strip->len = seq->len = (int) (info.length * FPS);
- strip->us= 1;
-
- strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list