Skip to content

Commit

Permalink
Rename AudioStreamPlayer to AudioPlayer
Browse files Browse the repository at this point in the history
Also renames:
- AudioStreamPlayer2D to AudioPlayer2D
- AudioStreamPlayer3D to AudioPlayer3D
  • Loading branch information
madmiraal committed Mar 21, 2021
1 parent 07f076f commit f69b081
Show file tree
Hide file tree
Showing 20 changed files with 295 additions and 295 deletions.
2 changes: 1 addition & 1 deletion doc/classes/Animation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@
Bezier tracks are used to interpolate a value using custom curves. They can also be used to animate sub-properties of vectors and colors (e.g. alpha value of a [Color]).
</constant>
<constant name="TYPE_AUDIO" value="4" enum="TrackType">
Audio tracks are used to play an audio stream with either type of [AudioStreamPlayer]. The stream can be trimmed and previewed in the animation.
Audio tracks are used to play an audio stream with either type of [AudioPlayer]. The stream can be trimmed and previewed in the animation.
</constant>
<constant name="TYPE_ANIMATION" value="5" enum="TrackType">
Animation tracks play animations in other [AnimationPlayer] nodes.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioStreamPlayer" inherits="Node" version="4.0">
<class name="AudioPlayer" inherits="Node" version="4.0">
<brief_description>
Plays back audio non-positionally.
</brief_description>
Expand All @@ -26,7 +26,7 @@
<return type="AudioStreamPlayback">
</return>
<description>
Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer].
Returns the [AudioStreamPlayback] object associated with this [AudioPlayer].
</description>
</method>
<method name="play">
Expand Down Expand Up @@ -62,7 +62,7 @@
<member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="@&quot;Master&quot;">
Bus on which this audio is playing.
</member>
<member name="mix_target" type="int" setter="set_mix_target" getter="get_mix_target" enum="AudioStreamPlayer.MixTarget" default="0">
<member name="mix_target" type="int" setter="set_mix_target" getter="get_mix_target" enum="AudioPlayer.MixTarget" default="0">
If the audio configuration has more than two speakers, this sets the target channels. See [enum MixTarget] constants.
</member>
<member name="pitch_scale" type="float" setter="set_pitch_scale" getter="get_pitch_scale" default="1.0">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioStreamPlayer2D" inherits="Node2D" version="4.0">
<class name="AudioPlayer2D" inherits="Node2D" version="4.0">
<brief_description>
Plays audio in 2D.
</brief_description>
Expand All @@ -21,7 +21,7 @@
<return type="AudioStreamPlayback">
</return>
<description>
Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer2D].
Returns the [AudioStreamPlayback] object associated with this [AudioPlayer2D].
</description>
</method>
<method name="play">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioStreamPlayer3D" inherits="Node3D" version="4.0">
<class name="AudioPlayer3D" inherits="Node3D" version="4.0">
<brief_description>
Plays 3D sound in 3D space.
</brief_description>
Expand All @@ -22,7 +22,7 @@
<return type="AudioStreamPlayback">
</return>
<description>
Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer3D].
Returns the [AudioStreamPlayback] object associated with this [AudioPlayer3D].
</description>
</method>
<method name="play">
Expand Down Expand Up @@ -61,16 +61,16 @@
<member name="attenuation_filter_db" type="float" setter="set_attenuation_filter_db" getter="get_attenuation_filter_db" default="-24.0">
Amount how much the filter affects the loudness, in decibels.
</member>
<member name="attenuation_model" type="int" setter="set_attenuation_model" getter="get_attenuation_model" enum="AudioStreamPlayer3D.AttenuationModel" default="0">
<member name="attenuation_model" type="int" setter="set_attenuation_model" getter="get_attenuation_model" enum="AudioPlayer3D.AttenuationModel" default="0">
Decides if audio should get quieter with distance linearly, quadratically, logarithmically, or not be affected by distance, effectively disabling attenuation.
</member>
<member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled" default="false">
If [code]true[/code], audio plays when the AudioStreamPlayer3D node is added to scene tree.
If [code]true[/code], audio plays when the AudioPlayer3D node is added to scene tree.
</member>
<member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="@&quot;Master&quot;">
The bus on which this audio is playing.
</member>
<member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="AudioStreamPlayer3D.DopplerTracking" default="0">
<member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="AudioPlayer3D.DopplerTracking" default="0">
Decides in which step the Doppler effect should be calculated.
</member>
<member name="emission_angle_degrees" type="float" setter="set_emission_angle" getter="get_emission_angle" default="45.0">
Expand All @@ -88,7 +88,7 @@
<member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance" default="0.0">
Sets the distance from which the [member out_of_range_mode] takes effect. Has no effect if set to 0.
</member>
<member name="out_of_range_mode" type="int" setter="set_out_of_range_mode" getter="get_out_of_range_mode" enum="AudioStreamPlayer3D.OutOfRangeMode" default="0">
<member name="out_of_range_mode" type="int" setter="set_out_of_range_mode" getter="get_out_of_range_mode" enum="AudioPlayer3D.OutOfRangeMode" default="0">
Decides if audio should pause when source is outside of [member max_distance] range.
</member>
<member name="pitch_scale" type="float" setter="set_pitch_scale" getter="get_pitch_scale" default="1.0">
Expand Down Expand Up @@ -128,13 +128,13 @@
Logarithmic dampening of loudness according to distance.
</constant>
<constant name="ATTENUATION_DISABLED" value="3" enum="AttenuationModel">
No dampening of loudness according to distance. The sound will still be heard positionally, unlike an [AudioStreamPlayer].
No dampening of loudness according to distance. The sound will still be heard positionally, unlike an [AudioPlayer].
</constant>
<constant name="OUT_OF_RANGE_MIX" value="0" enum="OutOfRangeMode">
Mix this audio in, even when it's out of range. This increases CPU usage, but keeps the sound playing at the correct position if the camera leaves and enters the [AudioStreamPlayer3D]'s [member max_distance] radius.
Mix this audio in, even when it's out of range. This increases CPU usage, but keeps the sound playing at the correct position if the camera leaves and enters the [AudioPlayer3D]'s [member max_distance] radius.
</constant>
<constant name="OUT_OF_RANGE_PAUSE" value="1" enum="OutOfRangeMode">
Pause this audio when it gets out of range. This decreases CPU usage, but will cause the sound to restart if the camera leaves and enters the [AudioStreamPlayer3D]'s [member max_distance] radius.
Pause this audio when it gets out of range. This decreases CPU usage, but will cause the sound to restart if the camera leaves and enters the [AudioPlayer3D]'s [member max_distance] radius.
</constant>
<constant name="DOPPLER_TRACKING_DISABLED" value="0" enum="DopplerTracking">
Disables doppler tracking.
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/AudioStreamSample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Stores audio data loaded from WAV files.
</brief_description>
<description>
AudioStreamSample stores sound samples loaded from WAV files. To play the stored sound, use an [AudioStreamPlayer] (for non-positional audio) or [AudioStreamPlayer2D]/[AudioStreamPlayer3D] (for positional audio). The sound can be looped.
AudioStreamSample stores sound samples loaded from WAV files. To play the stored sound, use an [AudioPlayer] (for non-positional audio) or [AudioPlayer2D]/[AudioPlayer3D] (for positional audio). The sound can be looped.
This class can also be used to store dynamically-generated PCM audio data.
</description>
<tutorials>
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
34 changes: 17 additions & 17 deletions editor/node_3d_editor_gizmos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "core/math/geometry_2d.h"
#include "core/math/geometry_3d.h"
#include "core/math/quick_hull.h"
#include "scene/3d/audio_stream_player_3d.h"
#include "scene/3d/audio_player_3d.h"
#include "scene/3d/baked_lightmap.h"
#include "scene/3d/collision_polygon_3d.h"
#include "scene/3d/collision_shape_3d.h"
Expand Down Expand Up @@ -1049,7 +1049,7 @@ void Light3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
//////

//// player gizmo
AudioStreamPlayer3DGizmoPlugin::AudioStreamPlayer3DGizmoPlugin() {
AudioPlayer3DGizmoPlugin::AudioPlayer3DGizmoPlugin() {
Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/stream_player_3d", Color(0.4, 0.8, 1));

create_icon_material("stream_player_3d_icon", Node3DEditor::get_singleton()->get_theme_icon("Gizmo3DSamplePlayer", "EditorIcons"));
Expand All @@ -1058,29 +1058,29 @@ AudioStreamPlayer3DGizmoPlugin::AudioStreamPlayer3DGizmoPlugin() {
create_handle_material("handles");
}

bool AudioStreamPlayer3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
return Object::cast_to<AudioStreamPlayer3D>(p_spatial) != nullptr;
bool AudioPlayer3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
return Object::cast_to<AudioPlayer3D>(p_spatial) != nullptr;
}

String AudioStreamPlayer3DGizmoPlugin::get_gizmo_name() const {
return "AudioStreamPlayer3D";
String AudioPlayer3DGizmoPlugin::get_gizmo_name() const {
return "AudioPlayer3D";
}

int AudioStreamPlayer3DGizmoPlugin::get_priority() const {
int AudioPlayer3DGizmoPlugin::get_priority() const {
return -1;
}

String AudioStreamPlayer3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
String AudioPlayer3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
return "Emission Radius";
}

Variant AudioStreamPlayer3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const {
AudioStreamPlayer3D *player = Object::cast_to<AudioStreamPlayer3D>(p_gizmo->get_spatial_node());
Variant AudioPlayer3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const {
AudioPlayer3D *player = Object::cast_to<AudioPlayer3D>(p_gizmo->get_spatial_node());
return player->get_emission_angle();
}

void AudioStreamPlayer3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
AudioStreamPlayer3D *player = Object::cast_to<AudioStreamPlayer3D>(p_gizmo->get_spatial_node());
void AudioPlayer3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
AudioPlayer3D *player = Object::cast_to<AudioPlayer3D>(p_gizmo->get_spatial_node());

Transform gt = player->get_global_transform();
Transform gi = gt.affine_inverse();
Expand Down Expand Up @@ -1116,23 +1116,23 @@ void AudioStreamPlayer3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int
}
}

void AudioStreamPlayer3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) {
AudioStreamPlayer3D *player = Object::cast_to<AudioStreamPlayer3D>(p_gizmo->get_spatial_node());
void AudioPlayer3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) {
AudioPlayer3D *player = Object::cast_to<AudioPlayer3D>(p_gizmo->get_spatial_node());

if (p_cancel) {
player->set_emission_angle(p_restore);

} else {
UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo();
ur->create_action(TTR("Change AudioStreamPlayer3D Emission Angle"));
ur->create_action(TTR("Change AudioPlayer3D Emission Angle"));
ur->add_do_method(player, "set_emission_angle", player->get_emission_angle());
ur->add_undo_method(player, "set_emission_angle", p_restore);
ur->commit_action();
}
}

void AudioStreamPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
const AudioStreamPlayer3D *player = Object::cast_to<AudioStreamPlayer3D>(p_gizmo->get_spatial_node());
void AudioPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
const AudioPlayer3D *player = Object::cast_to<AudioPlayer3D>(p_gizmo->get_spatial_node());

p_gizmo->clear();

Expand Down
6 changes: 3 additions & 3 deletions editor/node_3d_editor_gizmos.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class Light3DGizmoPlugin : public EditorNode3DGizmoPlugin {
Light3DGizmoPlugin();
};

class AudioStreamPlayer3DGizmoPlugin : public EditorNode3DGizmoPlugin {
GDCLASS(AudioStreamPlayer3DGizmoPlugin, EditorNode3DGizmoPlugin);
class AudioPlayer3DGizmoPlugin : public EditorNode3DGizmoPlugin {
GDCLASS(AudioPlayer3DGizmoPlugin, EditorNode3DGizmoPlugin);

public:
bool has_gizmo(Node3D *p_spatial) override;
Expand All @@ -67,7 +67,7 @@ class AudioStreamPlayer3DGizmoPlugin : public EditorNode3DGizmoPlugin {
void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false) override;
void redraw(EditorNode3DGizmo *p_gizmo) override;

AudioStreamPlayer3DGizmoPlugin();
AudioPlayer3DGizmoPlugin();
};

class Camera3DGizmoPlugin : public EditorNode3DGizmoPlugin {
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/audio_stream_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void AudioStreamEditor::_bind_methods() {
AudioStreamEditor::AudioStreamEditor() {
set_custom_minimum_size(Size2(1, 100) * EDSCALE);

_player = memnew(AudioStreamPlayer);
_player = memnew(AudioPlayer);
_player->connect("finished", callable_mp(this, &AudioStreamEditor::_on_finished));
add_child(_player);

Expand Down
4 changes: 2 additions & 2 deletions editor/plugins/audio_stream_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@

#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/audio/audio_stream_player.h"
#include "scene/audio/audio_player.h"
#include "scene/gui/color_rect.h"
#include "scene/resources/texture.h"

class AudioStreamEditor : public ColorRect {
GDCLASS(AudioStreamEditor, ColorRect);

Ref<AudioStream> stream;
AudioStreamPlayer *_player = nullptr;
AudioPlayer *_player = nullptr;
ColorRect *_preview = nullptr;
Control *_indicator = nullptr;
Label *_current_label = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6439,7 +6439,7 @@ void Node3DEditor::_node_removed(Node *p_node) {
void Node3DEditor::_register_all_gizmos() {
add_gizmo_plugin(Ref<Camera3DGizmoPlugin>(memnew(Camera3DGizmoPlugin)));
add_gizmo_plugin(Ref<Light3DGizmoPlugin>(memnew(Light3DGizmoPlugin)));
add_gizmo_plugin(Ref<AudioStreamPlayer3DGizmoPlugin>(memnew(AudioStreamPlayer3DGizmoPlugin)));
add_gizmo_plugin(Ref<AudioPlayer3DGizmoPlugin>(memnew(AudioPlayer3DGizmoPlugin)));
add_gizmo_plugin(Ref<MeshInstance3DGizmoPlugin>(memnew(MeshInstance3DGizmoPlugin)));
add_gizmo_plugin(Ref<SoftBody3DGizmoPlugin>(memnew(SoftBody3DGizmoPlugin)));
add_gizmo_plugin(Ref<Sprite3DGizmoPlugin>(memnew(Sprite3DGizmoPlugin)));
Expand Down
Loading

0 comments on commit f69b081

Please sign in to comment.