| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 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 |
| 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) |