diff options
author | kobewi <kobewi4e@gmail.com> | 2022-11-30 16:40:50 +0100 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-11-30 18:36:57 +0100 |
commit | 9a3960daa59a728f2620f64ad182aa332059489c (patch) | |
tree | 3234e83a17d4a7f66e9b8b96265aa876652119d5 /servers/audio | |
parent | cd491c6e47bb41ccf596189676c0c5d4a72226cc (diff) |
Simplify GDVIRTUAL_REQUIRED_CALL calls
Diffstat (limited to 'servers/audio')
-rw-r--r-- | servers/audio/audio_effect.cpp | 10 | ||||
-rw-r--r-- | servers/audio/audio_stream.cpp | 27 |
2 files changed, 12 insertions, 25 deletions
diff --git a/servers/audio/audio_effect.cpp b/servers/audio/audio_effect.cpp index ef0e3197e1..870a77806b 100644 --- a/servers/audio/audio_effect.cpp +++ b/servers/audio/audio_effect.cpp @@ -31,9 +31,7 @@ #include "audio_effect.h" void AudioEffectInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - if (GDVIRTUAL_REQUIRED_CALL(_process, p_src_frames, p_dst_frames, p_frame_count)) { - return; - } + GDVIRTUAL_REQUIRED_CALL(_process, p_src_frames, p_dst_frames, p_frame_count); } bool AudioEffectInstance::process_silence() const { bool ret = false; @@ -50,10 +48,8 @@ void AudioEffectInstance::_bind_methods() { Ref<AudioEffectInstance> AudioEffect::instantiate() { Ref<AudioEffectInstance> ret; - if (GDVIRTUAL_REQUIRED_CALL(_instantiate, ret)) { - return ret; - } - return Ref<AudioEffectInstance>(); + GDVIRTUAL_REQUIRED_CALL(_instantiate, ret); + return ret; } void AudioEffect::_bind_methods() { GDVIRTUAL_BIND(_instantiate); diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 33d4c816f2..4b68515e18 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -71,12 +71,9 @@ void AudioStreamPlayback::seek(double p_time) { } int AudioStreamPlayback::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_mix, p_buffer, p_rate_scale, p_frames, ret)) { - return ret; - } - - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_mix, p_buffer, p_rate_scale, p_frames, ret); + return ret; } void AudioStreamPlayback::tag_used_streams() { @@ -107,20 +104,14 @@ void AudioStreamPlaybackResampled::begin_resample() { } int AudioStreamPlaybackResampled::_mix_internal(AudioFrame *p_buffer, int p_frames) { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_mix_resampled, p_buffer, p_frames, ret)) { - return ret; - } - - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_mix_resampled, p_buffer, p_frames, ret); + return ret; } float AudioStreamPlaybackResampled::get_stream_sampling_rate() { - float ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_stream_sampling_rate, ret)) { - return ret; - } - - return 0; + float ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_stream_sampling_rate, ret); + return ret; } void AudioStreamPlaybackResampled::_bind_methods() { |