/**************************************************************************/1/* audio_stream_player.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 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/**************************************************************************/2930#pragma once3132#include "scene/main/node.h"33#include "servers/audio_server.h"3435struct AudioFrame;36class AudioStream;37class AudioStreamPlayback;38class AudioStreamPlayerInternal;3940class AudioStreamPlayer : public Node {41GDCLASS(AudioStreamPlayer, Node);4243public:44enum MixTarget {45MIX_TARGET_STEREO,46MIX_TARGET_SURROUND,47MIX_TARGET_CENTER48};4950private:51AudioStreamPlayerInternal *internal = nullptr;5253MixTarget mix_target = MIX_TARGET_STEREO;5455void _set_playing(bool p_enable);56bool _is_active() const;5758Vector<AudioFrame> _get_volume_vector();5960protected:61void _validate_property(PropertyInfo &p_property) const;62void _notification(int p_what);63static void _bind_methods();6465bool _set(const StringName &p_name, const Variant &p_value);66bool _get(const StringName &p_name, Variant &r_ret) const;67void _get_property_list(List<PropertyInfo> *p_list) const;6869#ifndef DISABLE_DEPRECATED70bool _is_autoplay_enabled_bind_compat_86907();71static void _bind_compatibility_methods();72#endif // DISABLE_DEPRECATED7374public:75void set_stream(Ref<AudioStream> p_stream);76Ref<AudioStream> get_stream() const;7778void set_volume_db(float p_volume);79float get_volume_db() const;8081void set_volume_linear(float p_volume);82float get_volume_linear() const;8384void set_pitch_scale(float p_pitch_scale);85float get_pitch_scale() const;8687void set_max_polyphony(int p_max_polyphony);88int get_max_polyphony() const;8990void play(float p_from_pos = 0.0);91void seek(float p_seconds);92void stop();93bool is_playing() const;94float get_playback_position();9596void set_bus(const StringName &p_bus);97StringName get_bus() const;9899void set_autoplay(bool p_enable);100bool is_autoplay_enabled() const;101102void set_mix_target(MixTarget p_target);103MixTarget get_mix_target() const;104105void set_stream_paused(bool p_pause);106bool get_stream_paused() const;107108bool has_stream_playback();109Ref<AudioStreamPlayback> get_stream_playback();110111AudioServer::PlaybackType get_playback_type() const;112void set_playback_type(AudioServer::PlaybackType p_playback_type);113114AudioStreamPlayer();115~AudioStreamPlayer();116};117118VARIANT_ENUM_CAST(AudioStreamPlayer::MixTarget)119120121