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 /platform/bb10/audio_driver_bb10.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 'platform/bb10/audio_driver_bb10.cpp')
| -rw-r--r-- | platform/bb10/audio_driver_bb10.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/platform/bb10/audio_driver_bb10.cpp b/platform/bb10/audio_driver_bb10.cpp index b6ea0bc26..5416fc5f0 100644 --- a/platform/bb10/audio_driver_bb10.cpp +++ b/platform/bb10/audio_driver_bb10.cpp @@ -34,11 +34,11 @@ Error AudioDriverBB10::init() { return init(NULL); }; -Error AudioDriverBB10::init(const char* p_name) { +Error AudioDriverBB10::init(const char *p_name) { - active=false; - thread_exited=false; - exit_thread=false; + active = false; + thread_exited = false; + exit_thread = false; pcm_open = false; samples_in = NULL; samples_out = NULL; @@ -46,11 +46,11 @@ Error AudioDriverBB10::init(const char* p_name) { mix_rate = 44100; speaker_mode = SPEAKER_MODE_STEREO; - char* dev_name; + char *dev_name; if (p_name == NULL) { dev_name = "pcmPreferred"; } else { - dev_name = (char *) p_name; + dev_name = (char *)p_name; } printf("******** reconnecting to device %s\n", dev_name); int ret = snd_pcm_open_name(&pcm_handle, dev_name, SND_PCM_OPEN_PLAYBACK); @@ -58,7 +58,7 @@ Error AudioDriverBB10::init(const char* p_name) { pcm_open = true; snd_pcm_channel_info_t cinfo; - zeromem(&cinfo, sizeof (cinfo)); + zeromem(&cinfo, sizeof(cinfo)); cinfo.channel = SND_PCM_CHANNEL_PLAYBACK; snd_pcm_plugin_info(pcm_handle, &cinfo); @@ -117,9 +117,9 @@ Error AudioDriverBB10::init(const char* p_name) { return OK; }; -void AudioDriverBB10::thread_func(void* p_udata) { +void AudioDriverBB10::thread_func(void *p_udata) { - AudioDriverBB10* ad = (AudioDriverBB10*)p_udata; + AudioDriverBB10 *ad = (AudioDriverBB10 *)p_udata; int channels = speaker_mode; int frame_count = ad->sample_buf_count / channels; @@ -127,10 +127,9 @@ void AudioDriverBB10::thread_func(void* p_udata) { while (!ad->exit_thread) { - if (!ad->active) { - for (int i=0; i < ad->sample_buf_count; i++) { + for (int i = 0; i < ad->sample_buf_count; i++) { ad->samples_out[i] = 0; }; @@ -142,20 +141,19 @@ void AudioDriverBB10::thread_func(void* p_udata) { ad->unlock(); - for(int i=0;i<frame_count*channels;i++) { + for (int i = 0; i < frame_count * channels; i++) { - ad->samples_out[i]=ad->samples_in[i]>>16; + ad->samples_out[i] = ad->samples_in[i] >> 16; } }; - int todo = bytes_out; int total = 0; while (todo) { - uint8_t* src = (uint8_t*)ad->samples_out; - int wrote = snd_pcm_plugin_write(ad->pcm_handle, (void*)(src + total), todo); + uint8_t *src = (uint8_t *)ad->samples_out; + int wrote = snd_pcm_plugin_write(ad->pcm_handle, (void *)(src + total), todo); if (wrote < 0) { // error? break; @@ -179,7 +177,7 @@ void AudioDriverBB10::thread_func(void* p_udata) { break; }; if (status.status == SND_PCM_STATUS_READY || - status.status == SND_PCM_STATUS_UNDERRUN) { + status.status == SND_PCM_STATUS_UNDERRUN) { snd_pcm_plugin_prepare(ad->pcm_handle, SND_PCM_CHANNEL_PLAYBACK); } else { break; @@ -188,9 +186,9 @@ void AudioDriverBB10::thread_func(void* p_udata) { }; }; - snd_pcm_plugin_flush (ad->pcm_handle, SND_PCM_CHANNEL_PLAYBACK); + snd_pcm_plugin_flush(ad->pcm_handle, SND_PCM_CHANNEL_PLAYBACK); - ad->thread_exited=true; + ad->thread_exited = true; printf("**************** audio thread exit\n"); }; @@ -253,4 +251,3 @@ AudioDriverBB10::~AudioDriverBB10() { memdelete(mutex); mutex = NULL; }; - |
