Audaspace: Sequencer sound bugfix and mono UI.

- Fixed a bug that the sound when changed in the properties panel was not updated.
- Added the option to make a sound mono while adding a sound strip.
- Added the option to make a sound mono in the sequencer properties panel.

Related bug report: T47140
This commit is contained in:
Joerg Mueller 2016-01-09 02:35:30 +01:00
parent f39aa17058
commit 85d6759636
Notes: blender-bot 2023-02-14 08:42:53 +01:00
Referenced by issue #47140, Sequencer strip audio pan not working
6 changed files with 26 additions and 6 deletions

View File

@ -795,6 +795,8 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel):
row.prop(sound, "use_memory_cache")
layout.prop(sound, "use_mono")
if st.waveform_draw_type == 'DEFAULT_WAVEFORMS':
layout.prop(strip, "show_waveform")

View File

@ -387,6 +387,7 @@ typedef struct SeqLoadInfo {
#define SEQ_LOAD_MOVIE_SOUND (1 << 2)
#define SEQ_LOAD_SOUND_CACHE (1 << 3)
#define SEQ_LOAD_SYNC_FPS (1 << 4)
#define SEQ_LOAD_SOUND_MONO (1 << 5)
/* seq_dupli' flags */

View File

@ -4968,7 +4968,7 @@ Mask *BKE_sequencer_mask_get(Scene *scene)
/* api like funcs for adding */
static void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
static void seq_load_apply(Main *bmain, Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
{
if (seq) {
BLI_strncpy_utf8(seq->name + 2, seq_load->name, sizeof(seq->name) - 2);
@ -4984,6 +4984,11 @@ static void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
BKE_sequencer_active_set(scene, seq);
}
if (seq_load->flag & SEQ_LOAD_SOUND_MONO) {
seq->sound->flags |= SOUND_FLAGS_MONO;
BKE_sound_load(bmain, seq->sound);
}
if (seq_load->flag & SEQ_LOAD_SOUND_CACHE) {
if (seq->sound)
BKE_sound_cache(seq->sound);
@ -5081,7 +5086,7 @@ Sequence *BKE_sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoad
seq->views_format = seq_load->views_format;
seq->flag |= seq_load->flag & SEQ_USE_VIEWS;
seq_load_apply(scene, seq, seq_load);
seq_load_apply(CTX_data_main(C), scene, seq, seq_load);
return seq;
}
@ -5147,7 +5152,7 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
/* last active name */
BLI_strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR);
seq_load_apply(scene, seq, seq_load);
seq_load_apply(bmain, scene, seq, seq_load);
return seq;
}
@ -5284,7 +5289,7 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
}
/* can be NULL */
seq_load_apply(scene, seq, seq_load);
seq_load_apply(CTX_data_main(C), scene, seq, seq_load);
MEM_freeN(anim_arr);
return seq;

View File

@ -188,7 +188,7 @@ static void SOUND_OT_open(wmOperatorType *ot)
WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_SOUND | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
RNA_def_boolean(ot->srna, "cache", false, "Cache", "Cache the sound in memory");
RNA_def_boolean(ot->srna, "mono", false, "Mono", "Mixdown the sound to mono");
RNA_def_boolean(ot->srna, "mono", false, "Mono", "Merge all the sound's channels into one");
}
static void SOUND_OT_open_mono(wmOperatorType *ot)

View File

@ -207,6 +207,9 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
if ((prop = RNA_struct_find_property(op->ptr, "cache")) && RNA_property_boolean_get(op->ptr, prop))
seq_load->flag |= SEQ_LOAD_SOUND_CACHE;
if ((prop = RNA_struct_find_property(op->ptr, "mono")) && RNA_property_boolean_get(op->ptr, prop))
seq_load->flag |= SEQ_LOAD_SOUND_MONO;
if ((prop = RNA_struct_find_property(op->ptr, "sound")) && RNA_property_boolean_get(op->ptr, prop))
seq_load->flag |= SEQ_LOAD_MOVIE_SOUND;
@ -767,6 +770,7 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
RNA_def_boolean(ot->srna, "cache", false, "Cache", "Cache the sound in memory");
RNA_def_boolean(ot->srna, "mono", false, "Mono", "Merge all the sound's channels into one");
}
int sequencer_image_seq_get_minmax_frame(wmOperator *op, int sfra, int *r_minframe, int *r_numdigits)

View File

@ -721,6 +721,14 @@ static void rna_Sequence_filepath_update(Main *bmain, Scene *UNUSED(scene), Poin
rna_Sequence_update(bmain, scene, ptr);
}
static void rna_Sequence_sound_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Sequence *seq = (Sequence *) ptr->data;
BKE_sound_update_scene_sound(seq->scene_sound, seq->sound);
rna_Sequence_update(bmain, scene, ptr);
}
static int seqproxy_seq_cmp_cb(Sequence *seq, void *arg_pt)
{
SequenceSearchData *data = arg_pt;
@ -2024,7 +2032,7 @@ static void rna_def_sound(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Sound");
RNA_def_property_ui_text(prop, "Sound", "Sound data-block used by this sequence");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_sound_update");
prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "volume");