diff options
author | Joerg Mueller <nexyon@gmail.com> | 2012-04-28 17:16:29 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2012-04-28 17:16:29 +0400 |
commit | ef3acaedc1eb530b263e9235d83d853f8282a278 (patch) | |
tree | 149e8ca079e8536bb05a175050327607c8e5b0f6 /source/blender | |
parent | c91fd5a0bf60a03a404fe9157bbf3fccb40e590b (diff) |
Audio:
* Fix for [#31099] Audio in Meta-Strips Plays Beyond Strip Cut
* Adding a split files option to the mixdown operator which then renders each channel into a separate file
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 26 | ||||
-rw-r--r-- | source/blender/editors/sound/sound_ops.c | 11 |
2 files changed, 29 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 1c06f1da018..470e1a1c529 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -515,8 +515,17 @@ void build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int *totseq, *seqar = tseqar; } +static int metaseq_start(Sequence *metaseq) +{ + return metaseq->start + metaseq->startofs; +} -static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq) +static int metaseq_end(Sequence *metaseq) +{ + return metaseq->start + metaseq->len - metaseq->endofs; +} + +static void seq_update_sound_bounds_recursive_rec(Scene *scene, Sequence *metaseq, int start, int end) { Sequence *seq; @@ -524,23 +533,28 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq) * since sound is played outside of evaluating the imbufs, */ for (seq = metaseq->seqbase.first; seq; seq = seq->next) { if (seq->type == SEQ_META) { - seq_update_sound_bounds_recursive(scene, seq); + seq_update_sound_bounds_recursive_rec(scene, seq, MAX2(start, metaseq_start(seq)), MIN2(end, metaseq_end(seq))); } else if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) { if (seq->scene_sound) { int startofs = seq->startofs; int endofs = seq->endofs; - if (seq->startofs + seq->start < metaseq->start + metaseq->startofs) - startofs = metaseq->start + metaseq->startofs - seq->start; + if (seq->startofs + seq->start < start) + startofs = start - seq->start; - if (seq->start + seq->len - seq->endofs > metaseq->start + metaseq->len - metaseq->endofs) - endofs = seq->start + seq->len - metaseq->start - metaseq->len + metaseq->endofs; + if (seq->start + seq->len - seq->endofs > end) + endofs = seq->start + seq->len - end; sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start + seq->len - endofs, startofs); } } } } +static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq) +{ + seq_update_sound_bounds_recursive_rec(scene, metaseq, metaseq_start(metaseq), metaseq_end(metaseq)); +} + void calc_sequence_disp(Scene *scene, Sequence *seq) { if (seq->startofs && seq->startstill) seq->startstill = 0; diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index c238789446f..49eb85d62b4 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -318,6 +318,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) char filename[FILE_MAX]; Scene *scene; Main *bmain; + int split; int bitrate, accuracy; AUD_DeviceSpecs specs; @@ -333,6 +334,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) specs.format = RNA_enum_get(op->ptr, "format"); container = RNA_enum_get(op->ptr, "container"); codec = RNA_enum_get(op->ptr, "codec"); + split = RNA_boolean_get(op->ptr, "split_channels"); scene = CTX_data_scene(C); bmain = CTX_data_main(C); specs.channels = scene->r.ffcodecdata.audio_channels; @@ -341,8 +343,12 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) BLI_strncpy(filename, path, sizeof(filename)); BLI_path_abs(filename, bmain->name); - result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS, - accuracy, filename, specs, container, codec, bitrate); + if(split) + result = AUD_mixdown_per_channel(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS, + accuracy, filename, specs, container, codec, bitrate); + else + result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS, + accuracy, filename, specs, container, codec, bitrate); if (result) { BKE_report(op->reports, RPT_ERROR, result); @@ -590,6 +596,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot) RNA_def_enum(ot->srna, "codec", codec_items, AUD_CODEC_FLAC, "Codec", "Audio Codec"); RNA_def_enum(ot->srna, "format", format_items, AUD_FORMAT_S16, "Format", "Sample format"); RNA_def_int(ot->srna, "bitrate", 192, 32, 512, "Bitrate", "Bitrate in kbit/s", 32, 512); + RNA_def_boolean(ot->srna, "split_channels", 0, "Split channels", "Each channel will be rendered into a mono file."); #endif // WITH_AUDASPACE } |