mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
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
This commit is contained in:
@@ -31,9 +31,7 @@
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
|
||||
static inline float undenormalise(volatile float f)
|
||||
{
|
||||
static inline float undenormalise(volatile float f) {
|
||||
union {
|
||||
uint32_t i;
|
||||
float f;
|
||||
@@ -46,42 +44,71 @@ static inline float undenormalise(volatile float f)
|
||||
return (v.i & 0x7f800000) < 0x08000000 ? 0.0f : f;
|
||||
}
|
||||
|
||||
|
||||
struct AudioFrame {
|
||||
|
||||
//left and right samples
|
||||
float l,r;
|
||||
float l, r;
|
||||
|
||||
_ALWAYS_INLINE_ const float& operator[](int idx) const { return idx==0?l:r; }
|
||||
_ALWAYS_INLINE_ float& operator[](int idx) { return idx==0?l:r; }
|
||||
_ALWAYS_INLINE_ const float &operator[](int idx) const { return idx == 0 ? l : r; }
|
||||
_ALWAYS_INLINE_ float &operator[](int idx) { return idx == 0 ? l : r; }
|
||||
|
||||
_ALWAYS_INLINE_ AudioFrame operator+(const AudioFrame& p_frame) const { return AudioFrame(l+p_frame.l,r+p_frame.r); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator-(const AudioFrame& p_frame) const { return AudioFrame(l-p_frame.l,r-p_frame.r); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator*(const AudioFrame& p_frame) const { return AudioFrame(l*p_frame.l,r*p_frame.r); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator/(const AudioFrame& p_frame) const { return AudioFrame(l/p_frame.l,r/p_frame.r); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator+(const AudioFrame &p_frame) const { return AudioFrame(l + p_frame.l, r + p_frame.r); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator-(const AudioFrame &p_frame) const { return AudioFrame(l - p_frame.l, r - p_frame.r); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator*(const AudioFrame &p_frame) const { return AudioFrame(l * p_frame.l, r * p_frame.r); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator/(const AudioFrame &p_frame) const { return AudioFrame(l / p_frame.l, r / p_frame.r); }
|
||||
|
||||
_ALWAYS_INLINE_ AudioFrame operator+(float p_sample) const { return AudioFrame(l+p_sample,r+p_sample); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator-(float p_sample) const { return AudioFrame(l-p_sample,r-p_sample); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator*(float p_sample) const { return AudioFrame(l*p_sample,r*p_sample); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator/(float p_sample) const { return AudioFrame(l/p_sample,r/p_sample); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator+(float p_sample) const { return AudioFrame(l + p_sample, r + p_sample); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator-(float p_sample) const { return AudioFrame(l - p_sample, r - p_sample); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator*(float p_sample) const { return AudioFrame(l * p_sample, r * p_sample); }
|
||||
_ALWAYS_INLINE_ AudioFrame operator/(float p_sample) const { return AudioFrame(l / p_sample, r / p_sample); }
|
||||
|
||||
_ALWAYS_INLINE_ void operator+=(const AudioFrame& p_frame) { l+=p_frame.l; r+=p_frame.r; }
|
||||
_ALWAYS_INLINE_ void operator-=(const AudioFrame& p_frame) { l-=p_frame.l; r-=p_frame.r; }
|
||||
_ALWAYS_INLINE_ void operator*=(const AudioFrame& p_frame) { l*=p_frame.l; r*=p_frame.r; }
|
||||
_ALWAYS_INLINE_ void operator/=(const AudioFrame& p_frame) { l/=p_frame.l; r/=p_frame.r; }
|
||||
_ALWAYS_INLINE_ void operator+=(const AudioFrame &p_frame) {
|
||||
l += p_frame.l;
|
||||
r += p_frame.r;
|
||||
}
|
||||
_ALWAYS_INLINE_ void operator-=(const AudioFrame &p_frame) {
|
||||
l -= p_frame.l;
|
||||
r -= p_frame.r;
|
||||
}
|
||||
_ALWAYS_INLINE_ void operator*=(const AudioFrame &p_frame) {
|
||||
l *= p_frame.l;
|
||||
r *= p_frame.r;
|
||||
}
|
||||
_ALWAYS_INLINE_ void operator/=(const AudioFrame &p_frame) {
|
||||
l /= p_frame.l;
|
||||
r /= p_frame.r;
|
||||
}
|
||||
|
||||
_ALWAYS_INLINE_ void operator+=(float p_sample) { l+=p_sample; r+=p_sample; }
|
||||
_ALWAYS_INLINE_ void operator-=(float p_sample) { l-=p_sample; r-=p_sample; }
|
||||
_ALWAYS_INLINE_ void operator*=(float p_sample) { l*=p_sample; r*=p_sample; }
|
||||
_ALWAYS_INLINE_ void operator/=(float p_sample) { l/=p_sample; r/=p_sample; }
|
||||
_ALWAYS_INLINE_ void operator+=(float p_sample) {
|
||||
l += p_sample;
|
||||
r += p_sample;
|
||||
}
|
||||
_ALWAYS_INLINE_ void operator-=(float p_sample) {
|
||||
l -= p_sample;
|
||||
r -= p_sample;
|
||||
}
|
||||
_ALWAYS_INLINE_ void operator*=(float p_sample) {
|
||||
l *= p_sample;
|
||||
r *= p_sample;
|
||||
}
|
||||
_ALWAYS_INLINE_ void operator/=(float p_sample) {
|
||||
l /= p_sample;
|
||||
r /= p_sample;
|
||||
}
|
||||
|
||||
_ALWAYS_INLINE_ void undenormalise() {
|
||||
l = ::undenormalise(l);
|
||||
r = ::undenormalise(r);
|
||||
}
|
||||
|
||||
_ALWAYS_INLINE_ AudioFrame(float p_l, float p_r) {l=p_l; r=p_r;}
|
||||
_ALWAYS_INLINE_ AudioFrame(const AudioFrame& p_frame) {l=p_frame.l; r=p_frame.r;}
|
||||
_ALWAYS_INLINE_ AudioFrame(float p_l, float p_r) {
|
||||
l = p_l;
|
||||
r = p_r;
|
||||
}
|
||||
_ALWAYS_INLINE_ AudioFrame(const AudioFrame &p_frame) {
|
||||
l = p_frame.l;
|
||||
r = p_frame.r;
|
||||
}
|
||||
|
||||
_ALWAYS_INLINE_ AudioFrame() {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user