diff options
author | Peter Schlaile <peter@schlaile.de> | 2007-10-01 12:03:11 +0400 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2007-10-01 12:03:11 +0400 |
commit | 5b1d6690068876843c5bec284056b17db3af9f0b (patch) | |
tree | 9a49117282c1ab016189a2aedcc388a69956c2c9 /source/blender/src/seqaudio.c | |
parent | 2182f53a9a5e69c76d9efbbee46134935df242a6 (diff) |
== Sequencer ==
This patch adds prefetch buffering to the sequencer
(see the tracker for additional details:
https://projects.blender.org/tracker/?func=detail&aid=7307&group_id=9&atid=127
)
We create seperate render threads (currently one, because of the fact,
that sequence rendering modifies global structures...), that
render up to the defined userpref value "Prefetch frames" in advance.
(Pressing Alt-A will _first_ fill the buffer and then start playing.)
Bassam and I did some extensive testing, so it should work.
If you don't configure your number of prefetch frames, prefetching is disabled!
(Sane defaults... :)
Also: if the machine is definitely too slow and runs out of the prefetch
area, prefetching is disabled automatically and we are back to good old
frame skipping mode.
My Dual Athlon is able to handle 4 parallel DV streams at once (sometimes
a little bit choppy, but prefetching is never disabled!)
I fixed also a long standing bug in the audio code, that made playback run
backwards at the beginning...
Diffstat (limited to 'source/blender/src/seqaudio.c')
-rw-r--r-- | source/blender/src/seqaudio.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/src/seqaudio.c b/source/blender/src/seqaudio.c index 4bac7fdb250..f050906efa5 100644 --- a/source/blender/src/seqaudio.c +++ b/source/blender/src/seqaudio.c @@ -95,6 +95,7 @@ static int audio_pos; static int audio_scrub=0; static int audio_playing=0; static int audio_initialised=0; +static int audio_startframe=0; ///// // /* local protos ------------------- */ @@ -506,8 +507,9 @@ void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown) } } - audio_pos = ( ((int)( (((float)startframe) - /(float)G.scene->r.frs_sec) + audio_startframe = startframe; + audio_pos = ( ((int)( (( (double)startframe) + /(double)G.scene->r.frs_sec) *(G.scene->audio.mixrate)*4 )) & (~3) ); audio_scrub = duration; @@ -537,8 +539,11 @@ int audiostream_pos(void) { int pos; - pos = (int) ( ((float)(audio_pos-U.mixbufsize)/( G.scene->audio.mixrate*4 ))*(float)G.scene->r.frs_sec ); - if (pos<1) pos=1; + pos = (int) (((double)(audio_pos-U.mixbufsize) + / ( G.scene->audio.mixrate*4 )) + * (double)G.scene->r.frs_sec ); + + if (pos < audio_startframe) pos = audio_startframe; return ( pos ); } |