1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +00:00

Bring that Whole New World to the Old Continent too

Applies the clang-format style to the 2.1 branch as done for master in
5dbf1809c6.
This commit is contained in:
Rémi Verschelde
2017-03-19 00:36:26 +01:00
parent 1d418afe86
commit f8db8a3faa
1308 changed files with 147754 additions and 174357 deletions

View File

@@ -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;
output_format = OUTPUT_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 = (ad->output_format == OUTPUT_MONO ? 1 : 2);
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");
};
@@ -251,4 +249,3 @@ AudioDriverBB10::~AudioDriverBB10() {
memdelete(mutex);
mutex = NULL;
};