diff options
author | Joerg Mueller <nexyon@gmail.com> | 2009-07-28 22:42:26 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2009-07-28 22:42:26 +0400 |
commit | f7b291790890580b5a297405cc32421c11b9a3cf (patch) | |
tree | 2607d5320144468cee6ce01a487ad2d3fd0742f4 /source/blender/editors | |
parent | 154c7c97f4fb0b2a54c13c4155b1dd33c3b2f9dc (diff) |
Sound Branch
Sequencer audio update, still not perfect, but improving.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 49 |
4 files changed, 46 insertions, 32 deletions
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 4e669a01e09..58e0d10fe14 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -57,7 +57,7 @@ #include "ED_screen.h" // AUD_XXX -#include "BKE_sequence.h" +//#include "BKE_sound.h" /* ********************** frame change operator ***************************/ @@ -94,9 +94,9 @@ static void change_frame_apply(bContext *C, wmOperator *op) if (cfra < MINAFRAME) cfra= MINAFRAME; CFRA= cfra; - // AUD XXX - if(scene->audio.flag & AUDIO_SCRUB) - seq_update_audio(C, CFRA); + // AUD_XXX +/* if(scene->audio.flag & AUDIO_SCRUB) + seq_update_audio(C, CFRA);*/ WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index c4580674186..a9b830b7a94 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -55,6 +55,8 @@ #include "BKE_report.h" #include "BKE_screen.h" #include "BKE_utildefines.h" +// AUD_XXX +#include "BKE_sound.h" #include "WM_api.h" #include "WM_types.h" @@ -2228,7 +2230,7 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) ED_update_for_newframe(C, 1); // AUD_XXX - seq_update_audio(C, CFRA); + sound_update_playing(C); for(sa= screen->areabase.first; sa; sa= sa->next) { ARegion *ar; @@ -2271,7 +2273,7 @@ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event) if(screen->animtimer) { ED_screen_animation_timer(C, 0, 0); // AUD_XXX - seq_stop_audio(C); + sound_stop_all(C); } else { int mode= (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1; @@ -2283,10 +2285,6 @@ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event) ScreenAnimData *sad= wt->customdata; sad->ar= CTX_wm_region(C); - - // AUD_XXX - if(mode == 1) - seq_play_audio(C); } } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index cc9716f3001..361503de755 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -351,18 +351,18 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op) // XXX sound= sound_new_sound(filename); // AUD_XXX - sound = sound_new(C, filename); + sound = sound_new_file(C, filename); // sound= NULL; // AUD_XXX if (sound==NULL || sound->sample->type == SAMPLE_INVALID) { - if (sound==NULL || sound->stream == NULL) { + if (sound==NULL || sound->snd_sound == NULL) { BKE_report(op->reports, RPT_ERROR, "Unsupported audio format"); return OPERATOR_CANCELLED; } // AUD_XXX - info = AUD_getInfo(sound->stream); + info = AUD_getInfo(sound->snd_sound); if (info.specs.format == AUD_FORMAT_INVALID) { sound_delete(C, sound); @@ -398,6 +398,9 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op) calc_sequence_disp(seq); sort_seq(scene); + // AUD_XXX + seq->sound_handle = sound_new_handle(scene, sound, seq->startdisp, seq->enddisp, seq->startofs); + /* last active name */ strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR-1); @@ -607,7 +610,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) if(seq->plugin==NULL) { BLI_remlink(ed->seqbasep, seq); - seq_free_sequence(ed, seq); + seq_free_sequence(scene, seq); BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load.", filename); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 868897b76ac..c76a87f63a4 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -65,6 +65,8 @@ #include "BKE_scene.h" #include "BKE_utildefines.h" #include "BKE_report.h" +// AUD_XXX +#include "BKE_sound.h" #include "WM_api.h" #include "WM_types.h" @@ -563,7 +565,7 @@ static void reload_sound_strip(Scene *scene, char *name) calc_sequence(seqact); seq->strip= 0; - seq_free_sequence(ed, seq); + seq_free_sequence(scene, seq); BLI_remlink(ed->seqbasep, seq); seq= ed->seqbasep->first; @@ -603,7 +605,7 @@ static void reload_image_strip(Scene *scene, char *name) calc_sequence(seqact); seq->strip= 0; - seq_free_sequence(ed, seq); + seq_free_sequence(scene, seq); BLI_remlink(ed->seqbasep, seq); update_changed_seq_and_deps(scene, seqact, 1, 1); @@ -849,7 +851,6 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq) static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short deleteall) { - Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq, *seqn; Sequence *last_seq = get_last_seq(scene); @@ -864,13 +865,13 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de if(seq==last_seq) set_last_seq(scene, NULL); if(seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1); if(seq->ipo) seq->ipo->id.us--; - seq_free_sequence(ed, seq); + seq_free_sequence(scene, seq); } seq= seqn; } } -static Sequence *dupli_seq(Sequence *seq) +static Sequence *dupli_seq(struct Scene *scene, Sequence *seq) { Sequence *seqn = MEM_dupallocN(seq); // XXX animato: ID *id; @@ -937,13 +938,17 @@ static Sequence *dupli_seq(Sequence *seq) MEM_dupallocN(seq->strip->stripdata); seqn->anim= 0; } else if(seq->type == SEQ_RAM_SOUND) { - seqn->strip->stripdata = + // AUD_XXX + seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); + if(seq->sound_handle) + seqn->sound_handle = sound_new_handle(scene, seqn->sound, seq->sound_handle->startframe, seq->sound_handle->endframe, seq->sound_handle->frameskip); + seqn->sound->id.us++; - } else if(seq->type == SEQ_HD_SOUND) { +/* AUD_XXX } else if(seq->type == SEQ_HD_SOUND) { seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); - seqn->hdaudio = 0; + seqn->hdaudio = 0;*/ } else if(seq->type == SEQ_IMAGE) { seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); @@ -970,13 +975,13 @@ static Sequence *dupli_seq(Sequence *seq) return seqn; } -static Sequence * deep_dupli_seq(Sequence * seq) +static Sequence * deep_dupli_seq(struct Scene *scene, Sequence * seq) { - Sequence * seqn = dupli_seq(seq); + Sequence * seqn = dupli_seq(scene, seq); if (seq->type == SEQ_META) { Sequence * s; for(s= seq->seqbase.first; s; s = s->next) { - Sequence * n = deep_dupli_seq(s); + Sequence * n = deep_dupli_seq(scene, s); if (n) { BLI_addtail(&seqn->seqbase, n); } @@ -995,7 +1000,7 @@ static void recurs_dupli_seq(Scene *scene, ListBase *old, ListBase *new) for(seq= old->first; seq; seq= seq->next) { seq->tmp= NULL; if(seq->flag & SELECT) { - seqn = dupli_seq(seq); + seqn = dupli_seq(scene, seq); if (seqn) { /*should never fail */ seq->flag &= SEQ_DESEL; seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL+SEQ_LOCK); @@ -1061,10 +1066,10 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) reload_sequence_new_file(scene, seq); calc_sequence(seq); - + if (!skip_dup) { /* Duplicate AFTER the first change */ - seqn = deep_dupli_seq(seq); + seqn = deep_dupli_seq(scene, seq); } if (seqn) { @@ -1150,10 +1155,10 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) } calc_sequence(seq); - + if (!skip_dup) { /* Duplicate AFTER the first change */ - seqn = deep_dupli_seq(seq); + seqn = deep_dupli_seq(scene, seq); } if (seqn) { @@ -1493,11 +1498,15 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op) if(selected){ /* mute unselected */ if (seq->flag & SELECT) { seq->flag |= SEQ_MUTE; + // AUD_XXX + seq_update_sound(seq); } } else { if ((seq->flag & SELECT)==0) { seq->flag |= SEQ_MUTE; + // AUD_XXX + seq_update_sound(seq); } } } @@ -1544,11 +1553,15 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op) if(selected){ /* unmute unselected */ if (seq->flag & SELECT) { seq->flag &= ~SEQ_MUTE; + // AUD_XXX + seq_update_sound(seq); } } else { if ((seq->flag & SELECT)==0) { seq->flag &= ~SEQ_MUTE; + // AUD_XXX + seq_update_sound(seq); } } } @@ -2007,7 +2020,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) start_ofs += step; } - seq_free_sequence(ed, seq); + seq_free_sequence(scene, seq); seq = seq->next; } else { seq = seq->next; @@ -2242,7 +2255,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *op) last_seq->seqbase.last= 0; BLI_remlink(ed->seqbasep, last_seq); - seq_free_sequence(ed, last_seq); + seq_free_sequence(scene, last_seq); /* emtpy meta strip, delete all effects depending on it */ for(seq=ed->seqbasep->first; seq; seq=seq->next) |