Debian Codegraph @

scene/audio/audio_stream_player.h

raw symbols SCIP
1 /**************************************************************************/
2 /* audio_stream_player.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #pragma once
32
33 #include "scene/main/node.h"
34 #include "servers/audio/audio_server.h"
35
36 struct AudioFrame;
37 class AudioStream;
38 class AudioStreamPlayback;
39 class AudioStreamPlayerInternal;
40
41 class AudioStreamPlayer : public Node {
42 GDCLASS(AudioStreamPlayer, Node);
43
44 public:
45 enum MixTarget {
46 MIX_TARGET_STEREO,
47 MIX_TARGET_SURROUND,
48 MIX_TARGET_CENTER
49 };
50
51 private:
52 AudioStreamPlayerInternal *internal = nullptr;
53
54 MixTarget mix_target = MIX_TARGET_STEREO;
55
56 void _set_playing(bool p_enable);
57 bool _is_active() const;
58
59 Vector<AudioFrame> _get_volume_vector();
60
61 protected:
62 void _validate_property(PropertyInfo &p_property) const;
63 void _notification(int p_what);
64 static void _bind_methods();
65
66 bool _set(const StringName &p_name, const Variant &p_value);
67 bool _get(const StringName &p_name, Variant &r_ret) const;
68 void _get_property_list(List<PropertyInfo> *p_list) const;
69
70 #ifndef DISABLE_DEPRECATED
71 bool _is_autoplay_enabled_bind_compat_86907();
72 static void _bind_compatibility_methods();
73 #endif // DISABLE_DEPRECATED
74
75 public:
76 void set_stream(Ref<AudioStream> p_stream);
77 Ref<AudioStream> get_stream() const;
78
79 void set_volume_db(float p_volume);
80 float get_volume_db() const;
81
82 void set_volume_linear(float p_volume);
83 float get_volume_linear() const;
84
85 void set_pitch_scale(float p_pitch_scale);
86 float get_pitch_scale() const;
87
88 void set_max_polyphony(int p_max_polyphony);
89 int get_max_polyphony() const;
90
91 void play(float p_from_pos = 0.0);
92 void seek(float p_seconds);
93 void stop();
94 bool is_playing() const;
95 float get_playback_position();
96
97 void set_bus(const StringName &p_bus);
98 StringName get_bus() const;
99
100 void set_autoplay(bool p_enable);
101 bool is_autoplay_enabled() const;
102
103 void set_mix_target(MixTarget p_target);
104 MixTarget get_mix_target() const;
105
106 void set_stream_paused(bool p_pause);
107 bool get_stream_paused() const;
108
109 bool has_stream_playback();
110 Ref<AudioStreamPlayback> get_stream_playback();
111
112 AudioServer::PlaybackType get_playback_type() const;
113 void set_playback_type(AudioServer::PlaybackType p_playback_type);
114
115 AudioStreamPlayer();
116 ~AudioStreamPlayer();
117 };
118
119 VARIANT_ENUM_CAST(AudioStreamPlayer::MixTarget)