diff options
| author | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
| commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
| tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /drivers/pulseaudio/audio_driver_pulseaudio.cpp | |
| parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
| download | godot-5dbf180.tar.gz godot-5dbf180.tar.zst godot-5dbf180.zip | |
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 'drivers/pulseaudio/audio_driver_pulseaudio.cpp')
| -rw-r--r-- | drivers/pulseaudio/audio_driver_pulseaudio.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index f5268f3eb..d33ec3ce3 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -43,7 +43,7 @@ Error AudioDriverPulseAudio::init() { samples_in = NULL; samples_out = NULL; - mix_rate = GLOBAL_DEF("audio/mix_rate",44100); + mix_rate = GLOBAL_DEF("audio/mix_rate", 44100); speaker_mode = SPEAKER_MODE_STEREO; channels = 2; @@ -64,23 +64,21 @@ Error AudioDriverPulseAudio::init() { attr.minreq = (uint32_t)-1; int error_code; - pulse = pa_simple_new( NULL, // default server - "Godot", // application name - PA_STREAM_PLAYBACK, - NULL, // default device - "Sound", // stream description - &spec, - NULL, // use default channel map - &attr, // use buffering attributes from above - &error_code - ); + pulse = pa_simple_new(NULL, // default server + "Godot", // application name + PA_STREAM_PLAYBACK, + NULL, // default device + "Sound", // stream description + &spec, + NULL, // use default channel map + &attr, // use buffering attributes from above + &error_code); if (pulse == NULL) { - fprintf(stderr, "PulseAudio ERR: %s\n", pa_strerror(error_code));\ + fprintf(stderr, "PulseAudio ERR: %s\n", pa_strerror(error_code)); ERR_FAIL_COND_V(pulse == NULL, ERR_CANT_OPEN); } - samples_in = memnew_arr(int32_t, buffer_size * channels); samples_out = memnew_arr(int16_t, buffer_size * channels); @@ -92,23 +90,23 @@ Error AudioDriverPulseAudio::init() { float AudioDriverPulseAudio::get_latency() { - if (latency==0) { //only do this once since it's approximate anyway + if (latency == 0) { //only do this once since it's approximate anyway int error_code; - pa_usec_t palat = pa_simple_get_latency( pulse,&error_code); - latency=double(palat)/1000000.0; + pa_usec_t palat = pa_simple_get_latency(pulse, &error_code); + latency = double(palat) / 1000000.0; } return latency; } -void AudioDriverPulseAudio::thread_func(void* p_udata) { +void AudioDriverPulseAudio::thread_func(void *p_udata) { print_line("thread"); - AudioDriverPulseAudio* ad = (AudioDriverPulseAudio*)p_udata; + AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)p_udata; while (!ad->exit_thread) { if (!ad->active) { - for (unsigned int i=0; i < ad->buffer_size * ad->channels; i++) { + for (unsigned int i = 0; i < ad->buffer_size * ad->channels; i++) { ad->samples_out[i] = 0; } @@ -119,7 +117,7 @@ void AudioDriverPulseAudio::thread_func(void* p_udata) { ad->unlock(); - for (unsigned int i=0; i < ad->buffer_size * ad->channels;i ++) { + for (unsigned int i = 0; i < ad->buffer_size * ad->channels; i++) { ad->samples_out[i] = ad->samples_in[i] >> 16; } } @@ -199,11 +197,10 @@ AudioDriverPulseAudio::AudioDriverPulseAudio() { mutex = NULL; thread = NULL; pulse = NULL; - latency=0; + latency = 0; } AudioDriverPulseAudio::~AudioDriverPulseAudio() { - } #endif |
