From 6c5c58e05799f2b593cd81fcff57e6ef72ad57fb Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sun, 9 Aug 2009 21:16:39 +0000 Subject: 2.5: Sound branch merge! See mailing list for additional information. --- source/blender/editors/CMakeLists.txt | 1 + source/blender/editors/animation/anim_ops.c | 5 + source/blender/editors/screen/screen_ops.c | 6 +- source/blender/editors/screen/screendump.c | 2 +- source/blender/editors/space_file/filelist.c | 22 +++- source/blender/editors/space_logic/logic_window.c | 17 ++- source/blender/editors/space_outliner/outliner.c | 4 +- source/blender/editors/space_sequencer/SConscript | 1 + .../editors/space_sequencer/sequencer_add.c | 140 ++++++++++++--------- .../editors/space_sequencer/sequencer_draw.c | 15 +-- .../editors/space_sequencer/sequencer_edit.c | 53 ++++---- .../editors/space_sequencer/sequencer_select.c | 4 +- 12 files changed, 168 insertions(+), 102 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt index 28cfcb3ff6e..fdee568c350 100644 --- a/source/blender/editors/CMakeLists.txt +++ b/source/blender/editors/CMakeLists.txt @@ -36,6 +36,7 @@ SET(INC ../windowmanager ../../kernel/gen_system ../../../intern/SoundSystem ../readstreamglue ../quicktime ../../../intern/elbeem/extern ../../../intern/ghost ../../../intern/opennl/extern ../../../extern/glew/include ../../../intern/smoke/extern + ../../../intern/audaspace ../nodes ../gpu ../blenfont diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 9c039693b72..ffa44e60d00 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -56,6 +56,8 @@ #include "ED_markers.h" #include "ED_screen.h" +#include "BKE_sound.h" + /* ********************** frame change operator ***************************/ /* Set any flags that are necessary to indicate modal time-changing operation */ @@ -91,6 +93,8 @@ static void change_frame_apply(bContext *C, wmOperator *op) if (cfra < MINAFRAME) cfra= MINAFRAME; CFRA= cfra; + sound_scrub(C); + WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); } @@ -121,6 +125,7 @@ static int change_frame_exec(bContext *C, wmOperator *op) change_frame_apply(C, op); change_frame_exit(C, op); + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f04e4c5b347..f882a25c363 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -56,6 +56,7 @@ #include "BKE_report.h" #include "BKE_screen.h" #include "BKE_utildefines.h" +#include "BKE_sound.h" #include "WM_api.h" #include "WM_types.h" @@ -2277,7 +2278,9 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) /* since we follow drawflags, we can't send notifier but tag regions ourselves */ ED_update_for_newframe(C, 1); - + + sound_update_playing(C); + for(sa= screen->areabase.first; sa; sa= sa->next) { ARegion *ar; for(ar= sa->regionbase.first; ar; ar= ar->next) { @@ -2322,6 +2325,7 @@ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event) if(screen->animtimer) { ED_screen_animation_timer(C, 0, 0); + sound_stop_all(C); } else { ScrArea *sa= CTX_wm_area(C); diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 2ae2712d02d..5ae1bdf84aa 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -228,7 +228,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update) rd.frs_sec_base= 1.0f; if(BKE_imtype_is_movie(rd.imtype)) - mh->start_movie(&rd, sj->dumpsx, sj->dumpsy); + mh->start_movie(sj->scene, &rd, sj->dumpsx, sj->dumpsy); else mh= NULL; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 7ebc8c4338f..538c1e4fce7 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -840,7 +840,16 @@ void filelist_setfiletypes(struct FileList* filelist, short has_quicktime) || BLI_testextensie(file->relname, ".mv")) { file->flags |= MOVIEFILE; } - else if(BLI_testextensie(file->relname, ".wav")) { + else if(BLI_testextensie(file->relname, ".wav") + || BLI_testextensie(file->relname, ".ogg") + || BLI_testextensie(file->relname, ".oga") + || BLI_testextensie(file->relname, ".mp3") + || BLI_testextensie(file->relname, ".mp2") + || BLI_testextensie(file->relname, ".ac3") + || BLI_testextensie(file->relname, ".aac") + || BLI_testextensie(file->relname, ".flac") + || BLI_testextensie(file->relname, ".wma") + || BLI_testextensie(file->relname, ".eac3")) { file->flags |= SOUNDFILE; } } else { // no quicktime @@ -875,7 +884,16 @@ void filelist_setfiletypes(struct FileList* filelist, short has_quicktime) || BLI_testextensie(file->relname, ".mv")) { file->flags |= MOVIEFILE; } - else if(BLI_testextensie(file->relname, ".wav")) { + else if(BLI_testextensie(file->relname, ".wav") + || BLI_testextensie(file->relname, ".ogg") + || BLI_testextensie(file->relname, ".oga") + || BLI_testextensie(file->relname, ".mp3") + || BLI_testextensie(file->relname, ".mp2") + || BLI_testextensie(file->relname, ".ac3") + || BLI_testextensie(file->relname, ".aac") + || BLI_testextensie(file->relname, ".flac") + || BLI_testextensie(file->relname, ".wma") + || BLI_testextensie(file->relname, ".eac3")) { file->flags |= SOUNDFILE; } } diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 274f5f47e43..96f491c9a8a 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -1984,11 +1984,14 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh } case ACT_SOUND: { - ysize = 70; - sa = act->data; sa->sndnr = 0; + if(sa->flag & ACT_SND_3D_SOUND) + ysize = 114; + else + ysize = 92; + wval = (width-20)/2; glRects(xco, yco-ysize, xco+width, yco); uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); @@ -2003,8 +2006,14 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4"; uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,width-40,19, sa->sound->id.name+2, 0.0, 21.0, 0, 0, ""); uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19, &sa->type, 0.0, 0.0, 0, 0, ""); - uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->sound->volume, 0.0, 1.0, 0, 0, "Sets the volume of this sound"); - uiDefButF(block, NUM, 0, "Pitch:",xco+wval+10,yco-66,wval, 19, &sa->sound->pitch,-12.0, 12.0, 0, 0, "Sets the pitch of this sound"); + uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->volume, 0.0, 1.0, 0, 0, "Sets the volume of this sound"); + uiDefButF(block, NUM, 0, "Pitch:",xco+wval+10,yco-66,wval, 19, &sa->pitch,-12.0, 12.0, 0, 0, "Sets the pitch of this sound"); + uiDefButS(block, TOG | BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19, &sa->flag, 0.0, 1.0, 0.0, 0.0, "Plays the sound positioned in 3D space."); + if(sa->flag & ACT_SND_3D_SOUND) + { + uiDefButF(block, NUM, 0, "Rolloff: ", xco+10, yco-110, wval, 19, &sa->sound3D.rolloff_factor, 0.0, 5.0, 0.0, 0.0, "The rolloff factor defines the influence factor on volume depending on distance."); + uiDefButF(block, NUM, 0, "Reference distance: ", xco+wval+10, yco-110, wval, 19, &sa->sound3D.reference_distance, 0.0, 1000.0, 0.0, 0.0, "The reference distance is the distance where the sound has a gain of 1.0."); + } } MEM_freeN(str); } diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 84dea679767..51cc8507ff8 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -4178,13 +4178,13 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen 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)) + 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_SOUND) UI_icon_draw(x, y, ICON_SOUND); else if(te->idcode==SEQ_IMAGE) UI_icon_draw(x, y, ICON_IMAGE_COL); diff --git a/source/blender/editors/space_sequencer/SConscript b/source/blender/editors/space_sequencer/SConscript index ab51068a529..9e7ea185c25 100644 --- a/source/blender/editors/space_sequencer/SConscript +++ b/source/blender/editors/space_sequencer/SConscript @@ -6,5 +6,6 @@ sources = env.Glob('*.c') incs = '../include ../../blenlib ../../blenkernel ../../blenfont ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../makesrna' +incs += ' #/intern/audaspace' env.BlenderLib ( 'bf_editors_space_sequencer', sources, Split(incs), [], libtype=['core'], priority=[100] ) diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 99a13c8d9e0..5d58ea431a9 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -89,6 +89,9 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "BKE_sound.h" +#include "AUD_C-API.h" + /* own include */ #include "sequencer_intern.h" @@ -224,24 +227,80 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot) 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(CTX_data_main(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; + } + + 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) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, TRUE); - + 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); an = openanim(filename, IB_rect); @@ -271,10 +330,19 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op) 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)); @@ -310,24 +378,15 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot) 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) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, TRUE); - - bSound *sound; - char filename[FILE_MAX]; - + Scene *scene= CTX_data_scene(C); Sequence *seq; /* generic strip vars */ - Strip *strip; - StripElem *se; - int start_frame, channel; /* operator props */ start_frame= RNA_int_get(op->ptr, "start_frame"); @@ -335,47 +394,16 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filename", filename); - /* XXX if(sfile->flag & FILE_STRINGCODE) { - BLI_makestringcode(G.sce, str); - }*/ - -// XXX sound= sound_new_sound(filename); - sound= NULL; - - if (sound==NULL || sound->sample->type == SAMPLE_INVALID) { - BKE_report(op->reports, RPT_ERROR, "Unsupported audio format"); - return OPERATOR_CANCELLED; - } + seq = sequencer_add_sound_strip(C, op, start_frame, channel, filename); - if (sound==NULL || sound->sample->bits != 16) { - BKE_report(op->reports, RPT_ERROR, "Only 16 bit audio is supported"); + if(seq == NULL) 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"); - strip->len = seq->len = (int) ( ((float)(sound->streamlen-1) / ( (float)scene->r.audio.mixrate*4.0 ))* FPS); - strip->us= 1; - - strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); - - BLI_split_dirfile_basic(filename, strip->dir, se->name); RNA_string_get(op->ptr, "name", seq->name); - - calc_sequence_disp(seq); - sort_seq(scene); - - /* last active name */ - strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR-1); + + if (RNA_boolean_get(op->ptr, "cache")) { + sound_cache(seq->sound, 0); + } if (RNA_boolean_get(op->ptr, "replace_sel")) { deselect_all_seq(scene); @@ -416,7 +444,7 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot) WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE); sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); - RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Load the sound as streaming audio"); // XXX need to impliment this + RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory."); } /* add image operator */ @@ -585,7 +613,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_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 3b90039335e..3d0d908d3f6 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -173,8 +173,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, char *col) case SEQ_PLUGIN: UI_GetThemeColor3ubv(TH_SEQ_PLUGIN, col); break; - case SEQ_HD_SOUND: - case SEQ_RAM_SOUND: + case SEQ_SOUND: UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col); blendcol[0] = blendcol[1] = blendcol[2] = 128; if(seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20); @@ -546,11 +545,8 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float else sprintf(str, "%d | %s", seq->len, give_seqname(seq)); } - else if (seq->type == SEQ_RAM_SOUND) { - sprintf(str, "%d | %s", seq->len, seq->strip->stripdata->name); - } - else if (seq->type == SEQ_HD_SOUND) { - sprintf(str, "%d | %s", seq->len, seq->strip->stripdata->name); + else if (seq->type == SEQ_SOUND) { + sprintf(str, "%d | %s", seq->len, seq->sound->name); } else if (seq->type == SEQ_MOVIE) { sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name); @@ -664,8 +660,9 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence * draw_shadedstrip(seq, background_col, x1, y1, x2, y2); /* draw additional info and controls */ - if (seq->type == SEQ_RAM_SOUND) - drawseqwave(scene, v2d, seq, x1, y1, x2, y2, ar->winx); +// XXX +/* if (seq->type == SEQ_SOUND) + drawseqwave(scene, v2d, seq, x1, y1, x2, y2, ar->winx);*/ if (!is_single_image) draw_seq_extensions(scene, sseq, seq); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 036c0769c1e..1555784f470 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -65,6 +65,7 @@ #include "BKE_scene.h" #include "BKE_utildefines.h" #include "BKE_report.h" +#include "BKE_sound.h" #include "WM_api.h" #include "WM_types.h" @@ -166,7 +167,7 @@ Sequence *get_foreground_frame_seq(Scene *scene, int frame) if(seq->flag & SEQ_MUTE || seq->startdisp > frame || seq->enddisp <= frame) continue; /* only use elements you can see - not */ - if (ELEM6(seq->type, SEQ_IMAGE, SEQ_META, SEQ_SCENE, SEQ_MOVIE, SEQ_MOVIE_AND_HD_SOUND, SEQ_COLOR)) { + if (ELEM5(seq->type, SEQ_IMAGE, SEQ_META, SEQ_SCENE, SEQ_MOVIE, SEQ_COLOR)) { if (seq->machine > best_machine) { best_seq = seq; best_machine = seq->machine; @@ -563,7 +564,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 +604,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); @@ -722,7 +723,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen for(seq=ed->seqbasep->first; seq; seq=seq->next) { if(seq->flag & SELECT) { - if (seq->type == SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND) { + if (seq->type == SEQ_SOUND) { *error_str= "Can't apply effects to audio sequence strips"; return 0; } @@ -849,7 +850,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); @@ -857,20 +857,20 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de while(seq) { seqn= seq->next; if((seq->flag & flag) || deleteall) { - if(seq->type==SEQ_RAM_SOUND && seq->sound) + if(seq->type==SEQ_SOUND && seq->sound) seq->sound->id.us--; BLI_remlink(lb, seq); 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; @@ -936,14 +936,13 @@ static Sequence *dupli_seq(Sequence *seq) seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); seqn->anim= 0; - } else if(seq->type == SEQ_RAM_SOUND) { - seqn->strip->stripdata = + } else if(seq->type == SEQ_SOUND) { + 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) { - seqn->strip->stripdata = - MEM_dupallocN(seq->strip->stripdata); - seqn->hdaudio = 0; } else if(seq->type == SEQ_IMAGE) { seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); @@ -970,13 +969,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 +994,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 +1060,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 +1149,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 +1492,13 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op) if(selected){ /* mute unselected */ if (seq->flag & SELECT) { seq->flag |= SEQ_MUTE; + seq_update_sound(seq); } } else { if ((seq->flag & SELECT)==0) { seq->flag |= SEQ_MUTE; + seq_update_sound(seq); } } } @@ -1544,11 +1545,13 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op) if(selected){ /* unmute unselected */ if (seq->flag & SELECT) { seq->flag &= ~SEQ_MUTE; + seq_update_sound(seq); } } else { if ((seq->flag & SELECT)==0) { seq->flag &= ~SEQ_MUTE; + seq_update_sound(seq); } } } @@ -2007,7 +2010,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; @@ -2130,7 +2133,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) while(seq) { if(seq->flag & SELECT) { tot++; - if (seq->type == SEQ_RAM_SOUND) { + if (seq->type == SEQ_SOUND) { BKE_report(op->reports, RPT_ERROR, "Can't make Meta Strip from audio"); return OPERATOR_CANCELLED;; } @@ -2242,7 +2245,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) diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 335652235c6..dda5837e5f5 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -153,7 +153,7 @@ void select_single_seq(Scene *scene, Sequence *seq, int deselect_all) /* BRING B if(seq->strip) strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1); } - else if((seq->type==SEQ_HD_SOUND) || (seq->type==SEQ_RAM_SOUND)) { + else if(seq->type==SEQ_SOUND) { if(seq->strip) strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1); } @@ -336,7 +336,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1); } } else - if (seq->type == SEQ_HD_SOUND || seq->type == SEQ_RAM_SOUND) { + if (seq->type == SEQ_SOUND) { if(seq->strip) { strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1); } -- cgit v1.2.3