Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_sound.h3
-rw-r--r--source/blender/blenkernel/intern/sound.c15
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c64
3 files changed, 67 insertions, 15 deletions
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index ec1b6577469..64f0b97c3f0 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -47,6 +47,7 @@ typedef struct SoundWaveform {
} SoundWaveform;
void sound_init_once(void);
+void sound_exit_once(void);
void sound_init(struct Main *main);
@@ -139,4 +140,6 @@ void *sound_get_factory(void *sound);
float sound_get_length(struct bSound *sound);
+int sound_is_jack_supported(void);
+
#endif
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index af9d21d8cbc..feff8f95fd7 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -172,7 +172,7 @@ void sound_force_device(int device)
void sound_init_once(void)
{
AUD_initOnce();
- atexit(sound_exit);
+ atexit(sound_exit_once);
}
void sound_init(struct Main *bmain)
@@ -221,6 +221,12 @@ void sound_exit(void)
AUD_exit();
}
+void sound_exit_once(void)
+{
+ AUD_exit();
+ AUD_exitOnce();
+}
+
// XXX unused currently
#if 0
bSound *sound_new_buffer(struct Main *bmain, bSound *source)
@@ -766,6 +772,11 @@ float sound_get_length(bSound *sound)
return info.length;
}
+int sound_is_jack_supported(void)
+{
+ return AUD_isJackSupported();
+}
+
#else // WITH_AUDASPACE
#include "BLI_utildefines.h"
@@ -775,6 +786,7 @@ void sound_force_device(int UNUSED(device)) {}
void sound_init_once(void) {}
void sound_init(struct Main *UNUSED(bmain)) {}
void sound_exit(void) {}
+void sound_exit_once(void) {}
void sound_cache(struct bSound *UNUSED(sound)) { }
void sound_delete_cache(struct bSound *UNUSED(sound)) {}
void sound_load(struct Main *UNUSED(bmain), struct bSound *UNUSED(sound)) {}
@@ -807,4 +819,5 @@ void sound_set_scene_sound_pan(void *handle, float pan, char animated) { (void)h
void sound_set_scene_volume(struct Scene *scene, float volume) { (void)scene; (void)volume; }
void sound_set_scene_sound_pitch(void *handle, float pitch, char animated) { (void)handle; (void)pitch; (void)animated; }
float sound_get_length(struct bSound *sound) { (void)sound; return 0; }
+int sound_is_jack_supported(void) { return 0; }
#endif // WITH_AUDASPACE
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index d5fc3d2050d..a279ec375a9 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -58,6 +58,20 @@ static EnumPropertyItem compute_device_type_items[] = {
};
#endif
+static EnumPropertyItem audio_device_items[] = {
+ {0, "NONE", 0, "None", "Null device - there will be no audio output"},
+#ifdef WITH_SDL
+ {1, "SDL", 0, "SDL", "SDL device - simple direct media layer, recommended for sequencer usage"},
+#endif
+#ifdef WITH_OPENAL
+ {2, "OPENAL", 0, "OpenAL", "OpenAL device - supports 3D audio, recommended for game engine usage"},
+#endif
+#ifdef WITH_JACK
+ {3, "JACK", 0, "Jack", "JACK - Audio Connection Kit, recommended for pro audio users"},
+#endif
+ {0, NULL, 0, NULL, NULL}
+};
+
#ifdef RNA_RUNTIME
#include "DNA_object_types.h"
@@ -434,6 +448,41 @@ static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), P
}
#endif
+static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), int *free)
+{
+#ifdef WITH_JACK
+ int jack_supported = sound_is_jack_supported();
+
+ if (jack_supported) {
+ return audio_device_items;
+ }
+ else {
+ int index = 0;
+ int totitem = 0;
+ EnumPropertyItem *item = NULL;
+
+ /* NONE */
+ RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]);
+
+#ifdef WITH_SDL
+ RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]);
+#endif
+
+#ifdef WITH_OPENAL
+ RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]);
+#endif
+
+ RNA_enum_item_end(&item, &totitem);
+ *free = 1;
+
+ return item;
+ }
+#else
+ return audio_device_items;
+#endif
+}
+
#ifdef WITH_INTERNATIONAL
static EnumPropertyItem *rna_lang_enum_properties_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop), int *free)
@@ -3234,20 +3283,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
- static EnumPropertyItem audio_device_items[] = {
- {0, "NONE", 0, "None", "Null device - there will be no audio output"},
-#ifdef WITH_SDL
- {1, "SDL", 0, "SDL", "SDL device - simple direct media layer, recommended for sequencer usage"},
-#endif
-#ifdef WITH_OPENAL
- {2, "OPENAL", 0, "OpenAL", "OpenAL device - supports 3D audio, recommended for game engine usage"},
-#endif
-#ifdef WITH_JACK
- {3, "JACK", 0, "Jack", "JACK - Audio Connection Kit, recommended for pro audio users"},
-#endif
- {0, NULL, 0, NULL, NULL}
- };
-
static EnumPropertyItem audio_rate_items[] = {
/* {8000, "RATE_8000", 0, "8 kHz", "Set audio sampling rate to 8000 samples per second"}, */
/* {11025, "RATE_11025", 0, "11.025 kHz", "Set audio sampling rate to 11025 samples per second"}, */
@@ -3524,6 +3559,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "audio_device", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "audiodevice");
RNA_def_property_enum_items(prop, audio_device_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_audio_device_itemf");
RNA_def_property_ui_text(prop, "Audio Device", "Audio output device");
RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");