diff options
author | Kent Mein <mein@cs.umn.edu> | 2006-06-23 19:08:13 +0400 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2006-06-23 19:08:13 +0400 |
commit | 6d79aed0f21468b22c399464182c2b0729f64241 (patch) | |
tree | c22082ba42f95b961fea0350e48943a3e752ea23 /source/blender/src/seqaudio.c | |
parent | 619d0dc9ca6957e157642532ee781b934bacb66b (diff) |
Patch(s) provied by Fabien Devaux
This fixes bug# 4421
http://projects.blender.org/tracker/index.php?func=detail&aid=4421&group_id=9&atid=125
Initalizes audio in scrub mode properly.
also avoids playing back some samples twice.
Kent
Diffstat (limited to 'source/blender/src/seqaudio.c')
-rw-r--r-- | source/blender/src/seqaudio.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/src/seqaudio.c b/source/blender/src/seqaudio.c index be70124fd7f..e7a7710cdd6 100644 --- a/source/blender/src/seqaudio.c +++ b/source/blender/src/seqaudio.c @@ -90,6 +90,7 @@ void audio_fill(void *mixdown, Uint8 *sstream, int len); static int audio_pos; static int audio_scrub=0; static int audio_playing=0; +static int audio_initialised=0; ///// // /* local protos ------------------- */ @@ -445,11 +446,12 @@ static int audio_init(SDL_AudioSpec *desired) if (obtained) MEM_freeN(obtained); return 0; } + audio_initialised = 1; hardware_spec=obtained; MEM_freeN(obtained); - SDL_PauseAudio(1); + SDL_PauseAudio(0); return 1; } @@ -510,7 +512,7 @@ void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown) sound_init_audio(); } - if (!(duration + mixdown)) { + if (!audio_initialised || !(duration + mixdown)) { desired.freq=G.scene->audio.mixrate; desired.format=AUDIO_S16SYS; desired.channels=2; @@ -520,6 +522,7 @@ void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown) U.mixbufsize = 0; /* no audio */ } } + audio_pos = ( ((int)( (((float)startframe) /(float)G.scene->r.frs_sec) *(G.scene->audio.mixrate)*4 )) & (~3) ); |