diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 13:23:58 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch) | |
tree | a27e497da7104dd0a64f98a04fa3067668735e91 /scene/audio | |
parent | 710b34b70227becdc652b4ae027fe0ac47409642 (diff) |
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.
This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.
There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).
Part of #33027.
Diffstat (limited to 'scene/audio')
-rw-r--r-- | scene/audio/audio_stream_player.cpp | 32 | ||||
-rw-r--r-- | scene/audio/audio_stream_player.h | 1 |
2 files changed, 0 insertions, 33 deletions
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp index f612944a62..6cd4914519 100644 --- a/scene/audio/audio_stream_player.cpp +++ b/scene/audio/audio_stream_player.cpp @@ -33,7 +33,6 @@ #include "core/engine.h" void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames, int p_amount) { - int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus); AudioFrame *targets[4] = { nullptr, nullptr, nullptr, nullptr }; @@ -66,7 +65,6 @@ void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames, int p_amount) { } void AudioStreamPlayer::_mix_internal(bool p_fadeout) { - //get data AudioFrame *buffer = mix_buffer.ptrw(); int buffer_size = mix_buffer.size(); @@ -95,7 +93,6 @@ void AudioStreamPlayer::_mix_internal(bool p_fadeout) { } void AudioStreamPlayer::_mix_audio() { - if (use_fadeout) { _mix_to_bus(fadeout_buffer.ptr(), fadeout_buffer.size()); use_fadeout = false; @@ -122,7 +119,6 @@ void AudioStreamPlayer::_mix_audio() { if (setseek >= 0.0 && !stop_has_priority) { if (stream_playback->is_playing()) { - //fade out to avoid pops _mix_internal(true); } @@ -138,9 +134,7 @@ void AudioStreamPlayer::_mix_audio() { } void AudioStreamPlayer::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { - AudioServer::get_singleton()->add_callback(_mix_audios, this); if (autoplay && !Engine::get_singleton()->is_editor_hint()) { play(); @@ -148,7 +142,6 @@ void AudioStreamPlayer::_notification(int p_what) { } if (p_what == NOTIFICATION_INTERNAL_PROCESS) { - if (!active || (setseek < 0 && !stream_playback->is_playing())) { active = false; set_process_internal(false); @@ -157,7 +150,6 @@ void AudioStreamPlayer::_notification(int p_what) { } if (p_what == NOTIFICATION_EXIT_TREE) { - AudioServer::get_singleton()->remove_callback(_mix_audios, this); } @@ -174,7 +166,6 @@ void AudioStreamPlayer::_notification(int p_what) { } void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) { - AudioServer::get_singleton()->lock(); if (active && stream_playback.is_valid() && !stream_paused) { @@ -222,16 +213,13 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) { } Ref<AudioStream> AudioStreamPlayer::get_stream() const { - return stream; } void AudioStreamPlayer::set_volume_db(float p_volume) { - volume_db = p_volume; } float AudioStreamPlayer::get_volume_db() const { - return volume_db; } @@ -244,7 +232,6 @@ float AudioStreamPlayer::get_pitch_scale() const { } void AudioStreamPlayer::play(float p_from_pos) { - if (stream_playback.is_valid()) { //mix_volume_db = volume_db; do not reset volume ramp here, can cause clicks setseek = p_from_pos; @@ -255,14 +242,12 @@ void AudioStreamPlayer::play(float p_from_pos) { } void AudioStreamPlayer::seek(float p_seconds) { - if (stream_playback.is_valid()) { setseek = p_seconds; } } void AudioStreamPlayer::stop() { - if (stream_playback.is_valid() && active) { setstop = true; stop_has_priority = true; @@ -270,7 +255,6 @@ void AudioStreamPlayer::stop() { } bool AudioStreamPlayer::is_playing() const { - if (stream_playback.is_valid()) { return active && !setstop; //&& stream_playback->is_playing(); } @@ -279,7 +263,6 @@ bool AudioStreamPlayer::is_playing() const { } float AudioStreamPlayer::get_playback_position() { - if (stream_playback.is_valid()) { return stream_playback->get_playback_position(); } @@ -288,14 +271,12 @@ float AudioStreamPlayer::get_playback_position() { } void AudioStreamPlayer::set_bus(const StringName &p_bus) { - //if audio is active, must lock this AudioServer::get_singleton()->lock(); bus = p_bus; AudioServer::get_singleton()->unlock(); } StringName AudioStreamPlayer::get_bus() const { - for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) { if (AudioServer::get_singleton()->get_bus_name(i) == bus) { return bus; @@ -305,38 +286,31 @@ StringName AudioStreamPlayer::get_bus() const { } void AudioStreamPlayer::set_autoplay(bool p_enable) { - autoplay = p_enable; } bool AudioStreamPlayer::is_autoplay_enabled() { - return autoplay; } void AudioStreamPlayer::set_mix_target(MixTarget p_target) { - mix_target = p_target; } AudioStreamPlayer::MixTarget AudioStreamPlayer::get_mix_target() const { - return mix_target; } void AudioStreamPlayer::_set_playing(bool p_enable) { - if (p_enable) play(); else stop(); } bool AudioStreamPlayer::_is_active() const { - return active; } void AudioStreamPlayer::set_stream_paused(bool p_pause) { - if (p_pause != stream_paused) { stream_paused = p_pause; stream_paused_fade = p_pause; @@ -344,14 +318,11 @@ void AudioStreamPlayer::set_stream_paused(bool p_pause) { } bool AudioStreamPlayer::get_stream_paused() const { - return stream_paused; } void AudioStreamPlayer::_validate_property(PropertyInfo &property) const { - if (property.name == "bus") { - String options; for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) { if (i > 0) @@ -365,7 +336,6 @@ void AudioStreamPlayer::_validate_property(PropertyInfo &property) const { } void AudioStreamPlayer::_bus_layout_changed() { - _change_notify(); } @@ -374,7 +344,6 @@ Ref<AudioStreamPlayback> AudioStreamPlayer::get_stream_playback() { } void AudioStreamPlayer::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer::set_stream); ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer::get_stream); @@ -425,7 +394,6 @@ void AudioStreamPlayer::_bind_methods() { } AudioStreamPlayer::AudioStreamPlayer() { - mix_volume_db = 0; pitch_scale = 1.0; volume_db = 0; diff --git a/scene/audio/audio_stream_player.h b/scene/audio/audio_stream_player.h index 0f6d855d0e..6769f1bb48 100644 --- a/scene/audio/audio_stream_player.h +++ b/scene/audio/audio_stream_player.h @@ -35,7 +35,6 @@ #include "servers/audio/audio_stream.h" class AudioStreamPlayer : public Node { - GDCLASS(AudioStreamPlayer, Node); public: |