Cleanup: style

This commit is contained in:
2015-07-29 10:43:32 +10:00
parent c6688aeddd
commit cff71fee21
3 changed files with 23 additions and 24 deletions

View File

@@ -51,7 +51,7 @@ typedef struct SoundWaveform {
void BKE_sound_init_once(void); void BKE_sound_init_once(void);
void BKE_sound_exit_once(void); void BKE_sound_exit_once(void);
void* BKE_sound_get_device(void); void *BKE_sound_get_device(void);
void BKE_sound_init(struct Main *main); void BKE_sound_init(struct Main *main);
@@ -141,7 +141,7 @@ void *BKE_sound_get_factory(void *sound);
float BKE_sound_get_length(struct bSound *sound); float BKE_sound_get_length(struct bSound *sound);
char** BKE_sound_get_device_names(void); char **BKE_sound_get_device_names(void);
bool BKE_sound_is_jack_supported(void); bool BKE_sound_is_jack_supported(void);

View File

@@ -68,7 +68,7 @@
#ifdef WITH_AUDASPACE #ifdef WITH_AUDASPACE
/* evil globals ;-) */ /* evil globals ;-) */
static int sound_cfra; static int sound_cfra;
static char** audio_device_names = NULL; static char **audio_device_names = NULL;
#endif #endif
bSound *BKE_sound_new_file(struct Main *bmain, const char *filename) bSound *BKE_sound_new_file(struct Main *bmain, const char *filename)
@@ -131,7 +131,7 @@ void BKE_sound_free(bSound *sound)
#ifdef WITH_AUDASPACE #ifdef WITH_AUDASPACE
static const char* force_device = NULL; static const char *force_device = NULL;
#ifdef WITH_JACK #ifdef WITH_JACK
static void sound_sync_callback(void *data, int mode, float time) static void sound_sync_callback(void *data, int mode, float time)
@@ -165,9 +165,9 @@ void BKE_sound_init_once(void)
atexit(BKE_sound_exit_once); atexit(BKE_sound_exit_once);
} }
static AUD_Device* sound_device; static AUD_Device *sound_device;
void* BKE_sound_get_device(void) void *BKE_sound_get_device(void)
{ {
return sound_device; return sound_device;
} }
@@ -176,7 +176,7 @@ void BKE_sound_init(struct Main *bmain)
{ {
AUD_DeviceSpecs specs; AUD_DeviceSpecs specs;
int device, buffersize; int device, buffersize;
const char* device_name; const char *device_name;
device = U.audiodevice; device = U.audiodevice;
buffersize = U.mixbufsize; buffersize = U.mixbufsize;
@@ -184,17 +184,18 @@ void BKE_sound_init(struct Main *bmain)
specs.format = U.audioformat; specs.format = U.audioformat;
specs.rate = U.audiorate; specs.rate = U.audiorate;
if (force_device == NULL) if (force_device == NULL) {
{
int i; int i;
char** names = BKE_sound_get_device_names(); char **names = BKE_sound_get_device_names();
device_name = names[0]; device_name = names[0];
// make sure device is within the bounds of the array /* make sure device is within the bounds of the array */
for(i = 0; names[i]; i++) for (i = 0; names[i]; i++) {
if(i == device) if (i == device) {
device_name = names[i]; device_name = names[i];
} }
}
}
else else
device_name = force_device; device_name = force_device;
@@ -238,11 +239,11 @@ void BKE_sound_exit_once(void)
AUD_exitOnce(); AUD_exitOnce();
#ifdef WITH_SYSTEM_AUDASPACE #ifdef WITH_SYSTEM_AUDASPACE
if(audio_device_names != NULL) if (audio_device_names != NULL) {
{
int i; int i;
for(i = 0; audio_device_names[i]; i++) for (i = 0; audio_device_names[i]; i++) {
free(audio_device_names[i]); free(audio_device_names[i]);
}
free(audio_device_names); free(audio_device_names);
audio_device_names = NULL; audio_device_names = NULL;
} }
@@ -834,17 +835,16 @@ float BKE_sound_get_length(bSound *sound)
return info.length; return info.length;
} }
char** BKE_sound_get_device_names(void) char **BKE_sound_get_device_names(void)
{ {
if(audio_device_names == NULL) if (audio_device_names == NULL) {
{
#ifdef WITH_SYSTEM_AUDASPACE #ifdef WITH_SYSTEM_AUDASPACE
audio_device_names = AUD_getDeviceNames(); audio_device_names = AUD_getDeviceNames();
#else #else
static const char* names[] = { static const char *names[] = {
"Null", "SDL", "OpenAL", "Jack", NULL "Null", "SDL", "OpenAL", "Jack", NULL
}; };
audio_device_names = (char**)names; audio_device_names = (char **)names;
#endif #endif
} }

View File

@@ -614,10 +614,9 @@ static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), Poi
#ifdef WITH_SYSTEM_AUDASPACE #ifdef WITH_SYSTEM_AUDASPACE
int i; int i;
char** names = BKE_sound_get_device_names(); char **names = BKE_sound_get_device_names();
for(i = 0; names[i]; i++) for (i = 0; names[i]; i++) {
{
EnumPropertyItem new_item = {i, names[i], 0, names[i], names[i]}; EnumPropertyItem new_item = {i, names[i], 0, names[i], names[i]};
RNA_enum_item_add(&item, &totitem, &new_item); RNA_enum_item_add(&item, &totitem, &new_item);
} }