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:
authorJoerg Mueller <nexyon@gmail.com>2009-08-26 22:20:17 +0400
committerJoerg Mueller <nexyon@gmail.com>2009-08-26 22:20:17 +0400
commitc30f54e326aa38c383c24dd288d3e0b8ce07d2d4 (patch)
treec719b4177869a709193b0d927e9cae181fba7128 /source
parent1e50c17f91cbd09929ab9624b045ba2e8ea0f979 (diff)
2.5 Sound: RNA for bSound.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_sound.h2
-rw-r--r--source/blender/blenkernel/intern/sound.c11
-rw-r--r--source/blender/makesrna/intern/rna_sound.c29
3 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index 84ecd79a008..e9f6eb21e36 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -54,6 +54,8 @@ void sound_delete(struct bContext *C, struct bSound* sound);
void sound_cache(struct bSound* sound, int ignore);
+void sound_delete_cache(struct bSound* sound);
+
void sound_load(struct Main *main, struct bSound* sound);
void sound_free(struct bSound* sound);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 070b5786a74..3794fbe90ef 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -163,6 +163,16 @@ void sound_cache(struct bSound* sound, int ignore)
AUD_unload(sound->cache);
sound->cache = AUD_bufferSound(sound->handle);
+ sound->changed = TRUE;
+}
+
+void sound_delete_cache(struct bSound* sound)
+{
+ if(sound->cache)
+ {
+ AUD_unload(sound->cache);
+ sound->cache = NULL;
+ }
}
void sound_load(struct Main *main, struct bSound* sound)
@@ -219,6 +229,7 @@ void sound_load(struct Main *main, struct bSound* sound)
break;
}
#endif
+ sound->changed = TRUE;
}
}
diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c
index a029ef85544..38e4d850c68 100644
--- a/source/blender/makesrna/intern/rna_sound.c
+++ b/source/blender/makesrna/intern/rna_sound.c
@@ -34,6 +34,29 @@
#ifdef RNA_RUNTIME
+#include "BKE_sound.h"
+#include "BKE_context.h"
+
+static void rna_Sound_filename_update(bContext *C, PointerRNA *ptr)
+{
+ sound_load(CTX_data_main(C), (bSound*)ptr->data);
+}
+
+static int rna_Sound_caching_get(PointerRNA *ptr)
+{
+ bSound *sound = (bSound*)(ptr->data);
+ return sound->cache != NULL;
+}
+
+static void rna_Sound_caching_set(PointerRNA *ptr, const int value)
+{
+ bSound *sound = (bSound*)(ptr->data);
+ if(value)
+ sound_cache(sound, 0);
+ else
+ sound_delete_cache(sound);
+}
+
#else
static void rna_def_sound(BlenderRNA *brna)
@@ -51,10 +74,16 @@ static void rna_def_sound(BlenderRNA *brna)
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_ui_text(prop, "Filename", "Sound sample file used by this Sound datablock.");
+ RNA_def_property_update(prop, 0, "rna_Sound_filename_update");
prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
RNA_def_property_ui_text(prop, "Packed File", "");
+
+ prop= RNA_def_property(srna, "caching", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Sound_caching_get", "rna_Sound_caching_set");
+ RNA_def_property_ui_text(prop, "Caching", "The sound file is decoded and loaded into RAM.");
+ RNA_def_property_update(prop, 0, "rna_Sound_filename_update");
}
void RNA_def_sound(BlenderRNA *brna)