Blender V5.3
MOD_sound_pitch.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLT_translation.hh"
10#include <fmt/format.h>
11
12#include "DNA_sequence_types.h"
13
14#include "SEQ_modifier.hh"
15
16#include "RNA_access.hh"
17
18#include "UI_interface.hh"
20
21#include "modifier.hh"
22
23namespace blender::seq {
24
26{
27 PitchModifierData *pmd = reinterpret_cast<PitchModifierData *>(smd);
29 pmd->semitones = 0;
30 pmd->cents = 0;
31 pmd->ratio = 1;
32 pmd->preserve_formant = false;
34}
35
36static void pitchmodifier_draw(const bContext * /*C*/, Panel *panel)
37{
38 ui::Layout &layout = *panel->layout;
40
41 layout.use_property_split_set(true);
42
43 ui::Layout &col = layout.column(false);
44
45 col.prop(ptr, "mode", UI_ITEM_NONE, std::nullopt, ICON_NONE);
46
47 int mode = RNA_enum_get(ptr, "mode");
49 col.prop(ptr, "semitones", UI_ITEM_NONE, std::nullopt, ICON_NONE);
50 col.prop(ptr, "cents", UI_ITEM_NONE, std::nullopt, ICON_NONE);
51 }
52 else if (mode == ePitchMode::PITCH_MODE_RATIO) {
53 col.prop(ptr, "ratio", UI_ITEM_NONE, std::nullopt, ICON_NONE);
54 }
55
56 col.prop(ptr, "preserve_formant", UI_ITEM_NONE, std::nullopt, ICON_NONE);
57 col.prop(ptr, "quality", UI_ITEM_NONE, std::nullopt, ICON_NONE);
58}
59
64
66 /*idname*/ "Pitch",
67 /*name*/ CTX_N_(BLT_I18NCONTEXT_ID_SEQUENCE, "Pitch"),
68 /*struct_name*/ "PitchModifierData",
69 /*struct_size*/ sizeof(PitchModifierData),
70 /*init_data*/ pitchmodifier_init_data,
71 /*free_data*/ nullptr,
72 /*copy_data*/ nullptr,
73 /*apply*/ nullptr,
74 /*panel_register*/ pitchmodifier_register,
75 /*blend_write*/ nullptr,
76 /*blend_read*/ nullptr,
77};
78
79}; // namespace blender::seq
#define CTX_N_(context, msgid)
#define BLT_I18NCONTEXT_ID_SEQUENCE
#define UI_ITEM_NONE
static void pitchmodifier_register(ARegionType *region_type)
static void pitchmodifier_init_data(StripModifierData *smd)
StripModifierTypeInfo seqModifierType_Pitch
static void pitchmodifier_draw(const bContext *, Panel *panel)
PanelType * modifier_panel_register(ARegionType *region_type, const eStripModifierType type, PanelDrawFn draw)
PointerRNA * panel_custom_data_get(const Panel *panel)
int RNA_enum_get(PointerRNA *ptr, const char *name)
ui::Layout * layout
void use_property_split_set(bool is_sep)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
Layout & column(bool align)