summaryrefslogtreecommitdiff
path: root/servers/audio/effects/audio_effect_pitch_shift.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
committerRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /servers/audio/effects/audio_effect_pitch_shift.cpp
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
A Whole New World (clang-format edition)
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
Diffstat (limited to 'servers/audio/effects/audio_effect_pitch_shift.cpp')
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp
index e00755e1a0..6a14ba7155 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.cpp
+++ b/servers/audio/effects/audio_effect_pitch_shift.cpp
@@ -28,8 +28,8 @@
/*************************************************************************/
#include "audio_effect_pitch_shift.h"
-#include "servers/audio_server.h"
#include "math_funcs.h"
+#include "servers/audio_server.h"
/* Thirdparty code, so disable clang-format with Godot style */
/* clang-format off */
@@ -281,34 +281,31 @@ void SMBPitchShift::smbFft(float *fftBuffer, long fftFrameSize, long sign)
/* Godot code again */
/* clang-format on */
-void AudioEffectPitchShiftInstance::process(const AudioFrame *p_src_frames,AudioFrame *p_dst_frames,int p_frame_count) {
+void AudioEffectPitchShiftInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
float sample_rate = AudioServer::get_singleton()->get_mix_rate();
- float *in_l = (float*)p_src_frames;
+ float *in_l = (float *)p_src_frames;
float *in_r = in_l + 1;
- float *out_l = (float*)p_dst_frames;
+ float *out_l = (float *)p_dst_frames;
float *out_r = out_l + 1;
- shift_l.PitchShift(base->pitch_scale,p_frame_count,2048,4,sample_rate,in_l,out_l,2);
- shift_r.PitchShift(base->pitch_scale,p_frame_count,2048,4,sample_rate,in_r,out_r,2);
-
+ shift_l.PitchShift(base->pitch_scale, p_frame_count, 2048, 4, sample_rate, in_l, out_l, 2);
+ shift_r.PitchShift(base->pitch_scale, p_frame_count, 2048, 4, sample_rate, in_r, out_r, 2);
}
-
Ref<AudioEffectInstance> AudioEffectPitchShift::instance() {
Ref<AudioEffectPitchShiftInstance> ins;
ins.instance();
- ins->base=Ref<AudioEffectPitchShift>(this);
-
+ ins->base = Ref<AudioEffectPitchShift>(this);
return ins;
}
void AudioEffectPitchShift::set_pitch_scale(float p_adjust) {
- pitch_scale=p_adjust;
+ pitch_scale = p_adjust;
}
float AudioEffectPitchShift::get_pitch_scale() const {
@@ -316,17 +313,14 @@ float AudioEffectPitchShift::get_pitch_scale() const {
return pitch_scale;
}
-
void AudioEffectPitchShift::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_pitch_scale","rate"),&AudioEffectPitchShift::set_pitch_scale);
- ClassDB::bind_method(D_METHOD("get_pitch_scale"),&AudioEffectPitchShift::get_pitch_scale);
-
- ADD_PROPERTY(PropertyInfo(Variant::REAL,"pitch_scale",PROPERTY_HINT_RANGE,"0.01,16,0.01"),"set_pitch_scale","get_pitch_scale");
+ ClassDB::bind_method(D_METHOD("set_pitch_scale", "rate"), &AudioEffectPitchShift::set_pitch_scale);
+ ClassDB::bind_method(D_METHOD("get_pitch_scale"), &AudioEffectPitchShift::get_pitch_scale);
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_pitch_scale", "get_pitch_scale");
}
AudioEffectPitchShift::AudioEffectPitchShift() {
- pitch_scale=1.0;
-
+ pitch_scale = 1.0;
}