diff options
Diffstat (limited to 'scene/3d/audio_stream_player_3d.h')
-rw-r--r-- | scene/3d/audio_stream_player_3d.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h index f915abad2b..697bbe2381 100644 --- a/scene/3d/audio_stream_player_3d.h +++ b/scene/3d/audio_stream_player_3d.h @@ -31,6 +31,7 @@ #ifndef AUDIO_STREAM_PLAYER_3D_H #define AUDIO_STREAM_PLAYER_3D_H +#include "core/os/mutex.h" #include "scene/3d/area_3d.h" #include "scene/3d/node_3d.h" #include "scene/3d/velocity_tracker_3d.h" @@ -50,11 +51,6 @@ public: ATTENUATION_DISABLED, }; - enum OutOfRangeMode { - OUT_OF_RANGE_MIX, - OUT_OF_RANGE_PAUSE, - }; - enum DopplerTracking { DOPPLER_TRACKING_DISABLED, DOPPLER_TRACKING_IDLE_STEP, @@ -68,10 +64,10 @@ private: }; - Ref<AudioStreamPlayback> stream_playback; + Vector<Ref<AudioStreamPlayback>> stream_playbacks; Ref<AudioStream> stream; - SafeFlag active; + SafeFlag active{ false }; SafeNumeric<float> setplay{ -1.0 }; AttenuationModel attenuation_model = ATTENUATION_INVERSE_DISTANCE; @@ -79,8 +75,11 @@ private: float unit_size = 10.0; float max_db = 3.0; float pitch_scale = 1.0; + // Internally used to take doppler tracking into account. + float actual_pitch_scale = 1.0; bool autoplay = false; - StringName bus = "Master"; + StringName bus = SNAME("Master"); + int max_polyphony = 1; uint64_t last_mix_count = -1; @@ -106,14 +105,14 @@ private: float attenuation_filter_cutoff_hz = 5000.0; float attenuation_filter_db = -24.0; + float linear_attenuation = 0; + float max_distance = 0.0; Ref<VelocityTracker3D> velocity_tracker; DopplerTracking doppler_tracking = DOPPLER_TRACKING_DISABLED; - OutOfRangeMode out_of_range_mode = OUT_OF_RANGE_MIX; - float _get_attenuation_db(float p_distance) const; protected: @@ -146,6 +145,9 @@ public: void set_bus(const StringName &p_bus); StringName get_bus() const; + void set_max_polyphony(int p_max_polyphony); + int get_max_polyphony() const; + void set_autoplay(bool p_enable); bool is_autoplay_enabled(); @@ -173,9 +175,6 @@ public: void set_attenuation_model(AttenuationModel p_model); AttenuationModel get_attenuation_model() const; - void set_out_of_range_mode(OutOfRangeMode p_mode); - OutOfRangeMode get_out_of_range_mode() const; - void set_doppler_tracking(DopplerTracking p_tracking); DopplerTracking get_doppler_tracking() const; @@ -189,6 +188,5 @@ public: }; VARIANT_ENUM_CAST(AudioStreamPlayer3D::AttenuationModel) -VARIANT_ENUM_CAST(AudioStreamPlayer3D::OutOfRangeMode) VARIANT_ENUM_CAST(AudioStreamPlayer3D::DopplerTracking) #endif // AUDIO_STREAM_PLAYER_3D_H |