sound_room_params.h
1 /*************************************************************************/
2 /* sound_room_params.h */
3 /*************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* http://www.godotengine.org */
7 /*************************************************************************/
8 /* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
9 /* */
10 /* Permission is hereby granted, free of charge, to any person obtaining */
11 /* a copy of this software and associated documentation files (the */
12 /* "Software"), to deal in the Software without restriction, including */
13 /* without limitation the rights to use, copy, modify, merge, publish, */
14 /* distribute, sublicense, and/or sell copies of the Software, and to */
15 /* permit persons to whom the Software is furnished to do so, subject to */
16 /* the following conditions: */
17 /* */
18 /* The above copyright notice and this permission notice shall be */
19 /* included in all copies or substantial portions of the Software. */
20 /* */
21 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
22 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
23 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
24 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
25 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
26 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
27 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
28 /*************************************************************************/
29 #ifndef SOUND_ROOM_PARAMS_H
30 #define SOUND_ROOM_PARAMS_H
31 
32 #include "scene/main/node.h"
33 #include "servers/spatial_sound_server.h"
34 
35 
36 #ifndef _3D_DISABLED
37 
38 #include "scene/3d/room_instance.h"
39 class SoundRoomParams : public Node {
40 
41  OBJ_TYPE( SoundRoomParams, Node );
42 public:
43 
44  enum Params {
45  PARAM_SPEED_OF_SOUND_SCALE=SpatialSoundServer::ROOM_PARAM_SPEED_OF_SOUND_SCALE,
46  PARAM_DOPPLER_FACTOR=SpatialSoundServer::ROOM_PARAM_DOPPLER_FACTOR,
47  PARAM_PITCH_SCALE=SpatialSoundServer::ROOM_PARAM_PITCH_SCALE,
48  PARAM_VOLUME_SCALE_DB=SpatialSoundServer::ROOM_PARAM_VOLUME_SCALE_DB,
49  PARAM_REVERB_SEND=SpatialSoundServer::ROOM_PARAM_REVERB_SEND,
50  PARAM_CHORUS_SEND=SpatialSoundServer::ROOM_PARAM_CHORUS_SEND,
51  PARAM_ATTENUATION_SCALE=SpatialSoundServer::ROOM_PARAM_ATTENUATION_SCALE,
52  PARAM_ATTENUATION_HF_CUTOFF=SpatialSoundServer::ROOM_PARAM_ATTENUATION_HF_CUTOFF,
53  PARAM_ATTENUATION_HF_FLOOR_DB=SpatialSoundServer::ROOM_PARAM_ATTENUATION_HF_FLOOR_DB,
54  PARAM_ATTENUATION_HF_RATIO_EXP=SpatialSoundServer::ROOM_PARAM_ATTENUATION_HF_RATIO_EXP,
55  PARAM_ATTENUATION_REVERB_SCALE=SpatialSoundServer::ROOM_PARAM_ATTENUATION_REVERB_SCALE,
56  PARAM_MAX=SpatialSoundServer::ROOM_PARAM_MAX
57  };
58 
59  enum Reverb {
60  REVERB_SMALL,
61  REVERB_MEDIUM,
62  REVERB_LARGE,
63  REVERB_HALL
64  };
65 private:
66 
67  RID room;
68 
69  float params[PARAM_MAX];
70  Reverb reverb;
71  bool force_params_for_all_sources;
72  void _update_sound_room();
73 
74 
75 protected:
76 
77  void _notification(int p_what);
78  static void _bind_methods();
79 
80 public:
81 
82 
83  void set_param(Params p_param, float p_value);
84  float get_param(Params p_param) const;
85 
86  void set_reverb_mode(Reverb p_mode);
87  Reverb get_reverb_mode() const;
88 
89  void set_force_params_to_all_sources(bool p_force);
90  bool is_forcing_params_to_all_sources();
91 
93 };
94 
95 VARIANT_ENUM_CAST(SoundRoomParams::Params);
96 VARIANT_ENUM_CAST(SoundRoomParams::Reverb);
97 
98 #endif
99 
100 #endif // SOUND_ROOM_PARAMS_H
Definition: node.h:42
Definition: sound_room_params.h:39
Definition: rid.h:47