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:
authorJoerg Mueller <nexyon@gmail.com>2011-10-14 02:19:29 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-10-14 02:19:29 +0400
commit9e17ecf0100af4e95f32a7b03673e880a9fc8d1e (patch)
tree9e01ee9208ba5e5e900b6bf18a5c95cd2f67c4e4 /source/blender
parentd893ac690cfe34e922d34a65a1ca526f8297c129 (diff)
Fixing [#28907] Frozen playback.
Also fixing two more crashes when audio files don't exist/cannot be read and apply a changed file path of a sound, reported by Jens Verwiebe in IRC.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/sound.c11
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c3
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c13
4 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index f2d92154c66..649b4f0b724 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -295,7 +295,10 @@ void sound_cache(struct bSound* sound)
AUD_unload(sound->cache);
sound->cache = AUD_bufferSound(sound->handle);
- sound->playback_handle = sound->cache;
+ if(sound->cache)
+ sound->playback_handle = sound->cache;
+ else
+ sound->playback_handle = sound->handle;
}
void sound_cache_notifying(struct Main* main, struct bSound* sound)
@@ -332,6 +335,8 @@ void sound_load(struct Main *bmain, struct bSound* sound)
sound->playback_handle = NULL;
}
+ sound_free_waveform(sound);
+
// XXX unused currently
#if 0
switch(sound->type)
@@ -625,7 +630,7 @@ float sound_sync_scene(struct Scene *scene)
else
return AUD_getPosition(scene->sound_scene_handle);
}
- return 0.0f;
+ return .0f/.0f;
}
int sound_scene_playing(struct Scene *scene)
@@ -782,7 +787,7 @@ static void sound_start_play_scene(struct Scene *UNUSED(scene)) {}
void sound_play_scene(struct Scene *UNUSED(scene)) {}
void sound_stop_scene(struct Scene *UNUSED(scene)) {}
void sound_seek_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) {}
-float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; }
+float sound_sync_scene(struct Scene *UNUSED(scene)) { return .0f/.0f; }
int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; }
int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
void sound_read_waveform(struct bSound* sound) { (void)sound; }
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 8f1ea6fe254..13e54c9a4c0 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -192,6 +192,9 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
waveform = seq->sound->waveform;
+ if(!waveform)
+ return;
+
startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
samplestep = (endsample-startsample) * stepsize / (x2-x1);
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index a75166c3e99..92739148b99 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -453,6 +453,8 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value)
PointerRNA id_ptr;
RNA_id_pointer_create((ID *)seq->sound, &id_ptr);
RNA_string_set(&id_ptr, "filepath", value);
+ sound_load(G.main, seq->sound);
+ sound_update_scene_sound(seq->scene_sound, seq->sound);
}
BLI_split_dirfile(value, dir, name);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index cafee6b49ca..074151c9abe 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1790,11 +1790,14 @@ void wm_event_do_handlers(bContext *C)
}
if(playing == 0) {
- int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f;
- if(ncfra != scene->r.cfra) {
- scene->r.cfra = ncfra;
- ED_update_for_newframe(CTX_data_main(C), scene, win->screen, 1);
- WM_event_add_notifier(C, NC_WINDOW, NULL);
+ float time = sound_sync_scene(scene);
+ if(finite(time)) {
+ int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f;
+ if(ncfra != scene->r.cfra) {
+ scene->r.cfra = ncfra;
+ ED_update_for_newframe(CTX_data_main(C), scene, win->screen, 1);
+ WM_event_add_notifier(C, NC_WINDOW, NULL);
+ }
}
}