Blender V5.0
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
31static void rna_def_speaker(BlenderRNA *brna)
32{
33 StructRNA *srna;
34 PropertyRNA *prop;
35
36 srna = RNA_def_struct(brna, "Speaker", "ID");
37 RNA_def_struct_ui_text(srna, "Speaker", "Speaker data-block for 3D audio speaker objects");
38 RNA_def_struct_ui_icon(srna, ICON_SPEAKER);
39
40 prop = RNA_def_property(srna, "muted", PROP_BOOLEAN, PROP_NONE);
41 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPK_MUTED);
43 RNA_def_property_ui_text(prop, "Mute", "Mute the speaker");
45# if 0
46 RNA_def_property_update(prop, 0, "rna_Speaker_update");
47# endif
48
49 prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
50 RNA_def_property_struct_type(prop, "Sound");
54 RNA_def_property_ui_text(prop, "Sound", "Sound data-block used by this speaker");
55# if 0
56 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_sound_set", nullptr);
57 RNA_def_property_update(prop, 0, "rna_Speaker_update");
58# endif
59
60 prop = RNA_def_property(srna, "volume_max", PROP_FLOAT, PROP_FACTOR);
62 RNA_def_property_range(prop, 0.0f, 1.0f);
64 prop, "Maximum Volume", "Maximum volume, no matter how near the object is");
65# if 0
66 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_volume_max_set", nullptr);
67 RNA_def_property_update(prop, 0, "rna_Speaker_update");
68# endif
69
70 prop = RNA_def_property(srna, "volume_min", PROP_FLOAT, PROP_FACTOR);
72 RNA_def_property_range(prop, 0.0f, 1.0f);
74 prop, "Minimum Volume", "Minimum volume, no matter how far away the object is");
75# if 0
76 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_volume_min_set", nullptr);
77 RNA_def_property_update(prop, 0, "rna_Speaker_update");
78# endif
79
80 prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
84 prop,
85 "Maximum Distance",
86 "Maximum distance for volume calculation, no matter how far away the object is");
87# if 0
88 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_distance_max_set", nullptr);
89 RNA_def_property_update(prop, 0, "rna_Speaker_update");
90# endif
91
92 prop = RNA_def_property(srna, "distance_reference", PROP_FLOAT, PROP_NONE);
96 prop, "Reference Distance", "Reference distance at which volume is 100%");
97# if 0
98 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_distance_reference_set", nullptr);
99 RNA_def_property_update(prop, 0, "rna_Speaker_update");
100# endif
101
102 prop = RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE);
104 RNA_def_property_range(prop, 0.0f, FLT_MAX);
106 prop, "Attenuation", "How strong the distance affects volume, depending on distance model");
107# if 0
108 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_attenuation_set", nullptr);
109 RNA_def_property_update(prop, 0, "rna_Speaker_update");
110# endif
111
112 prop = RNA_def_property(srna, "cone_angle_outer", PROP_FLOAT, PROP_NONE);
114 RNA_def_property_range(prop, 0.0f, 360.0f);
116 prop,
117 "Outer Cone Angle",
118 "Angle of the outer cone, in degrees, outside this cone the volume is "
119 "the outer cone volume, between inner and outer cone the volume is interpolated");
120# if 0
121 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_cone_angle_outer_set", nullptr);
122 RNA_def_property_update(prop, 0, "rna_Speaker_update");
123# endif
124
125 prop = RNA_def_property(srna, "cone_angle_inner", PROP_FLOAT, PROP_NONE);
127 RNA_def_property_range(prop, 0.0f, 360.0f);
129 prop,
130 "Inner Cone Angle",
131 "Angle of the inner cone, in degrees, inside the cone the volume is 100%");
132# if 0
133 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_cone_angle_inner_set", nullptr);
134 RNA_def_property_update(prop, 0, "rna_Speaker_update");
135# endif
136
137 prop = RNA_def_property(srna, "cone_volume_outer", PROP_FLOAT, PROP_FACTOR);
139 RNA_def_property_range(prop, 0.0f, 1.0f);
140 RNA_def_property_ui_text(prop, "Outer Cone Volume", "Volume outside the outer cone");
141# if 0
142 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_cone_volume_outer_set", nullptr);
143 RNA_def_property_update(prop, 0, "rna_Speaker_update");
144# endif
145
146 prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_FACTOR);
147 RNA_def_property_range(prop, 0.0f, 1.0f);
148 RNA_def_property_ui_text(prop, "Volume", "How loud the sound is");
150# if 0
151 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_volume_set", nullptr);
152 RNA_def_property_update(prop, 0, "rna_Speaker_update");
153# endif
154
155 prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
156 RNA_def_property_range(prop, 0.1f, 10.0f);
157 RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
159# if 0
160 RNA_def_property_float_funcs(prop, nullptr, "rna_Speaker_pitch_set", nullptr);
161 RNA_def_property_update(prop, 0, "rna_Speaker_update");
162# endif
163
164 /* common */
166}
167
169{
170 rna_def_speaker(brna);
171}
172
173#endif
#define BLT_I18NCONTEXT_ID_SOUND
@ SPK_MUTED
Read Guarded memory(de)allocation.
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:503
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_FACTOR
Definition RNA_types.hh:251
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
static void rna_def_speaker(BlenderRNA *brna)
void RNA_def_speaker(BlenderRNA *brna)
#define FLT_MAX
Definition stdcycles.h:14