Blender V2.61 - r43446

rna_speaker.c

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * Contributor(s): Jörg Müller.
00019  *
00020  * ***** END GPL LICENSE BLOCK *****
00021  */
00022 
00028 #include <stdlib.h>
00029 
00030 #include "RNA_define.h"
00031 #include "RNA_enum_types.h"
00032 
00033 #include "rna_internal.h"
00034 
00035 #include "DNA_speaker_types.h"
00036 #include "DNA_sound_types.h"
00037 
00038 #ifdef RNA_RUNTIME
00039 
00040 #include "MEM_guardedalloc.h"
00041 
00042 #include "BKE_depsgraph.h"
00043 #include "BKE_main.h"
00044 
00045 #include "WM_api.h"
00046 #include "WM_types.h"
00047 
00048 
00049 #else
00050 
00051 static void rna_def_speaker(BlenderRNA *brna)
00052 {
00053     StructRNA *srna;
00054     PropertyRNA *prop;
00055 
00056     srna= RNA_def_struct(brna, "Speaker", "ID");
00057     RNA_def_struct_ui_text(srna, "Speaker", "Speaker datablock for 3D audio speaker objects");
00058     RNA_def_struct_ui_icon(srna, ICON_SPEAKER);
00059 
00060     prop= RNA_def_property(srna, "muted", PROP_BOOLEAN, PROP_NONE);
00061     RNA_def_property_boolean_sdna(prop, NULL, "flag", SPK_MUTED);
00062     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00063     RNA_def_property_ui_text(prop, "Mute", "Mute the speaker");
00064     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00065 
00066     /* This shouldn't be changed actually, hiding it!
00067     prop= RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
00068     RNA_def_property_boolean_sdna(prop, NULL, "flag", SPK_RELATIVE);
00069     RNA_def_property_ui_text(prop, "Relative", "Whether the source is relative to the camera or not");
00070     // RNA_def_property_update(prop, 0, "rna_Speaker_update");*/
00071 
00072     prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
00073     RNA_def_property_pointer_sdna(prop, NULL, "sound");
00074     RNA_def_property_struct_type(prop, "Sound");
00075     RNA_def_property_flag(prop, PROP_EDITABLE);
00076     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00077     RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this speaker");
00078     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_sound_set", NULL);
00079     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00080 
00081     prop= RNA_def_property(srna, "volume_max", PROP_FLOAT, PROP_NONE);
00082     RNA_def_property_float_sdna(prop, NULL, "volume_max");
00083     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00084     RNA_def_property_range(prop, 0.0f, 1.0f);
00085     RNA_def_property_ui_text(prop, "Maximum Volume", "Maximum volume, no matter how near the object is");
00086     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_max_set", NULL);
00087     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00088 
00089     prop= RNA_def_property(srna, "volume_min", PROP_FLOAT, PROP_NONE);
00090     RNA_def_property_float_sdna(prop, NULL, "volume_min");
00091     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00092     RNA_def_property_range(prop, 0.0f, 1.0f);
00093     RNA_def_property_ui_text(prop, "Minimum Volume", "Minimum volume, no matter how far away the object is");
00094     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_min_set", NULL);
00095     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00096 
00097     prop= RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
00098     RNA_def_property_float_sdna(prop, NULL, "distance_max");
00099     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00100     RNA_def_property_range(prop, 0.0f, FLT_MAX);
00101     RNA_def_property_ui_text(prop, "Maximum Distance",
00102                              "Maximum distance for volume calculation, no matter how far away the object is");
00103     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_distance_max_set", NULL);
00104     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00105 
00106     prop= RNA_def_property(srna, "distance_reference", PROP_FLOAT, PROP_NONE);
00107     RNA_def_property_float_sdna(prop, NULL, "distance_reference");
00108     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00109     RNA_def_property_range(prop, 0.0f, FLT_MAX);
00110     RNA_def_property_ui_text(prop, "Reference Distance", "Reference distance at which volume is 100 %");
00111     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_distance_reference_set", NULL);
00112     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00113 
00114     prop= RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE);
00115     RNA_def_property_float_sdna(prop, NULL, "attenuation");
00116     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00117     RNA_def_property_range(prop, 0.0f, FLT_MAX);
00118     RNA_def_property_ui_text(prop, "Attenuation", "How strong the distance affects volume, depending on distance model");
00119     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_attenuation_set", NULL);
00120     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00121 
00122     prop= RNA_def_property(srna, "cone_angle_outer", PROP_FLOAT, PROP_NONE);
00123     RNA_def_property_float_sdna(prop, NULL, "cone_angle_outer");
00124     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00125     RNA_def_property_range(prop, 0.0f, 360.0f);
00126     RNA_def_property_ui_text(prop, "Outer Cone Angle",
00127                              "Angle of the outer cone, in degrees, outside this cone the volume is "
00128                              "the outer cone volume, between inner and outer cone the volume is interpolated");
00129     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_outer_set", NULL);
00130     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00131 
00132     prop= RNA_def_property(srna, "cone_angle_inner", PROP_FLOAT, PROP_NONE);
00133     RNA_def_property_float_sdna(prop, NULL, "cone_angle_inner");
00134     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00135     RNA_def_property_range(prop, 0.0f, 360.0f);
00136     RNA_def_property_ui_text(prop, "Inner Cone Angle",
00137                              "Angle of the inner cone, in degrees, inside the cone the volume is 100 %");
00138     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_inner_set", NULL);
00139     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00140 
00141     prop= RNA_def_property(srna, "cone_volume_outer", PROP_FLOAT, PROP_NONE);
00142     RNA_def_property_float_sdna(prop, NULL, "cone_volume_outer");
00143     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00144     RNA_def_property_range(prop, 0.0f, 1.0f);
00145     RNA_def_property_ui_text(prop, "Outer Cone Volume", "Volume outside the outer cone");
00146     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_volume_outer_set", NULL);
00147     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00148 
00149     prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
00150     RNA_def_property_float_sdna(prop, NULL, "volume");
00151     RNA_def_property_range(prop, 0.0f, 1.0f);
00152     RNA_def_property_ui_text(prop, "Volume", "How loud the sound is");
00153     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_set", NULL);
00154     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00155 
00156     prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
00157     RNA_def_property_float_sdna(prop, NULL, "pitch");
00158     RNA_def_property_range(prop, 0.1f, 10.0f);
00159     RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
00160     // RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_pitch_set", NULL);
00161     // RNA_def_property_update(prop, 0, "rna_Speaker_update");
00162 
00163     /* common */
00164     rna_def_animdata_common(srna);
00165 }
00166 
00167 
00168 void RNA_def_speaker(BlenderRNA *brna)
00169 {
00170     rna_def_speaker(brna);
00171 }
00172 
00173 #endif
00174