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
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/intern/sound.c18
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/makesdna/DNA_sound_types.h10
3 files changed, 22 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 6aa44cde0e0..709a0022767 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -757,15 +757,19 @@ int BKE_sound_scene_playing(struct Scene *scene)
void BKE_sound_free_waveform(bSound *sound)
{
- SoundWaveform *waveform = sound->waveform;
- if (waveform) {
- if (waveform->data) {
- MEM_freeN(waveform->data);
+ if ((sound->tags & SOUND_TAGS_WAVEFORM_NO_RELOAD) == 0) {
+ SoundWaveform *waveform = sound->waveform;
+ if (waveform) {
+ if (waveform->data) {
+ MEM_freeN(waveform->data);
+ }
+ MEM_freeN(waveform);
}
- MEM_freeN(waveform);
- }
- sound->waveform = NULL;
+ sound->waveform = NULL;
+ }
+ /* This tag is only valid once. */
+ sound->tags &= ~SOUND_TAGS_WAVEFORM_NO_RELOAD;
}
void BKE_sound_read_waveform(bSound *sound, short *stop)
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 1def462b1ca..1d772a15efd 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7542,6 +7542,7 @@ static void direct_link_speaker(FileData *fd, Speaker *spk)
static void direct_link_sound(FileData *fd, bSound *sound)
{
+ sound->tags = 0;
sound->handle = NULL;
sound->playback_handle = NULL;
@@ -7553,6 +7554,7 @@ static void direct_link_sound(FileData *fd, bSound *sound)
if (fd->soundmap) {
sound->waveform = newsoundadr(fd, sound->waveform);
+ sound->tags |= SOUND_TAGS_WAVEFORM_NO_RELOAD;
}
else {
sound->waveform = NULL;
diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h
index aefe1a7d5a3..7778582b82d 100644
--- a/source/blender/makesdna/DNA_sound_types.h
+++ b/source/blender/makesdna/DNA_sound_types.h
@@ -65,13 +65,15 @@ typedef struct bSound {
*/
struct PackedFile *newpackedfile;
struct Ipo *ipo;
+
float volume;
float attenuation;
float pitch;
float min_gain;
float max_gain;
float distance;
- int flags;
+ short flags;
+ short tags; /* Runtime only, always reset in readfile. */
int pad;
/* unused currently
@@ -116,6 +118,7 @@ enum {
SND_CFRA_NUM = 2,
};
+/* bSound->flags */
enum {
#ifdef DNA_DEPRECATED
SOUND_FLAGS_3D = (1 << 3), /* deprecated! used for sound actuator loading */
@@ -125,6 +128,11 @@ enum {
SOUND_FLAGS_WAVEFORM_LOADING = (1 << 6),
};
+/* bSound->tags */
+enum {
+ SOUND_TAGS_WAVEFORM_NO_RELOAD = 1 << 0, /* Do not free/reset waveform on sound load, only used by undo code. */
+};
+
/* to DNA_sound_types.h*/
#endif