Blender V5.3
rna_speaker.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "RNA_define.hh"
12#include "RNA_enum_types.hh"
13
14#include "rna_internal.hh"
15
16#include "DNA_speaker_types.h"
17
18#include "BLT_translation.hh"
19
20#ifdef RNA_RUNTIME
21
22# include "MEM_guardedalloc.h"
23
24# include "BKE_main.hh"
25
26# include "WM_api.hh"
27# include "WM_types.hh"
28
29#else
30
31namespace blender {
32
33static void rna_def_speaker(BlenderRNA *brna)
34{
35 StructRNA *srna;
36 PropertyRNA *prop;
37
38 srna = RNA_def_struct(brna, "Speaker", "ID");
39 RNA_def_struct_ui_text(srna, "Speaker", "Speaker data-block for 3D audio speaker objects");
40 RNA_def_struct_ui_icon(srna, ICON_SPEAKER);
41
42 prop = RNA_def_property(srna, "muted", PROP_BOOLEAN, PROP_NONE);
43 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPK_MUTED);
45 RNA_def_property_ui_text(prop, "Mute", "Mute the speaker");
47# if 0
48 RNA_def_property_update(prop, 0, "rna_Speaker_update");
49# endif
50
51 prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
52 RNA_def_property_struct_type(prop, "Sound");
56 RNA_def_property_ui_text(prop, "Sound", "Sound data-block used by this speaker");
57# if 0
58 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_sound_set", nullptr);
59 RNA_def_property_update(prop, 0, "rna_Speaker_update");
60# endif
61
62 prop = RNA_def_property(srna, "volume_max", PROP_FLOAT, PROP_FACTOR);
64 RNA_def_property_range(prop, 0.0f, 1.0f);
66 prop, "Maximum Volume", "Maximum volume, no matter how near the object is");
67# if 0
68 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_volume_max_set", nullptr);
69 RNA_def_property_update(prop, 0, "rna_Speaker_update");
70# endif
71
72 prop = RNA_def_property(srna, "volume_min", PROP_FLOAT, PROP_FACTOR);
74 RNA_def_property_range(prop, 0.0f, 1.0f);
76 prop, "Minimum Volume", "Minimum volume, no matter how far away the object is");
77# if 0
78 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_volume_min_set", nullptr);
79 RNA_def_property_update(prop, 0, "rna_Speaker_update");
80# endif
81
82 prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
86 prop,
87 "Maximum Distance",
88 "Maximum distance for volume calculation, no matter how far away the object is");
89# if 0
90 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_distance_max_set", nullptr);
91 RNA_def_property_update(prop, 0, "rna_Speaker_update");
92# endif
93
94 prop = RNA_def_property(srna, "distance_reference", PROP_FLOAT, PROP_NONE);
98 prop, "Reference Distance", "Reference distance at which volume is 100%");
99# if 0
100 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_distance_reference_set", nullptr);
101 RNA_def_property_update(prop, 0, "rna_Speaker_update");
102# endif
103
104 prop = RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE);
106 RNA_def_property_range(prop, 0.0f, FLT_MAX);
108 prop, "Attenuation", "How strong the distance affects volume, depending on distance model");
109# if 0
110 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_attenuation_set", nullptr);
111 RNA_def_property_update(prop, 0, "rna_Speaker_update");
112# endif
113
114 prop = RNA_def_property(srna, "cone_angle_outer", PROP_FLOAT, PROP_NONE);
116 RNA_def_property_range(prop, 0.0f, 360.0f);
118 prop,
119 "Outer Cone Angle",
120 "Angle of the outer cone, in degrees, outside this cone the volume is "
121 "the outer cone volume, between inner and outer cone the volume is interpolated");
122# if 0
123 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_cone_angle_outer_set", nullptr);
124 RNA_def_property_update(prop, 0, "rna_Speaker_update");
125# endif
126
127 prop = RNA_def_property(srna, "cone_angle_inner", PROP_FLOAT, PROP_NONE);
129 RNA_def_property_range(prop, 0.0f, 360.0f);
131 prop,
132 "Inner Cone Angle",
133 "Angle of the inner cone, in degrees, inside the cone the volume is 100%");
134# if 0
135 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_cone_angle_inner_set", nullptr);
136 RNA_def_property_update(prop, 0, "rna_Speaker_update");
137# endif
138
139 prop = RNA_def_property(srna, "cone_volume_outer", PROP_FLOAT, PROP_FACTOR);
141 RNA_def_property_range(prop, 0.0f, 1.0f);
142 RNA_def_property_ui_text(prop, "Outer Cone Volume", "Volume outside the outer cone");
143# if 0
144 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_cone_volume_outer_set", nullptr);
145 RNA_def_property_update(prop, 0, "rna_Speaker_update");
146# endif
147
148 prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_FACTOR);
149 RNA_def_property_range(prop, 0.0f, 1.0f);
150 RNA_def_property_ui_text(prop, "Volume", "How loud the sound is");
152# if 0
153 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_volume_set", nullptr);
154 RNA_def_property_update(prop, 0, "rna_Speaker_update");
155# endif
156
157 prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
158 RNA_def_property_range(prop, 0.1f, 10.0f);
159 RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
161# if 0
162 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_pitch_set", nullptr);
163 RNA_def_property_update(prop, 0, "rna_Speaker_update");
164# endif
165
166 /* common */
168}
169
171{
172 rna_def_speaker(brna);
173}
174
175} // namespace blender
176
177#endif
#define BLT_I18NCONTEXT_ID_SOUND
Read Blender memory allocation and freeing.
#define FLT_MAX
BMesh Iterators.
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:588
void rna_def_animdata_common(StructRNA *srna)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
@ PROP_BOOLEAN
Definition RNA_types.hh:210
@ PROP_POINTER
Definition RNA_types.hh:215
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
static void rna_def_speaker(BlenderRNA *brna)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_ANIMATABLE
Definition RNA_types.hh:389
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
@ PROP_FACTOR
Definition RNA_types.hh:308
void RNA_def_speaker(BlenderRNA *brna)