== Sequencer (Peach request) ==

Make the "Sync" button work when sound is disabled, Animators use this as a way to play animations at the right speed, could be renamed to "Drop Frames" and work even when blender built without audio enabled.

(do not forget to give credit to me :)
This commit is contained in:
Peter Schlaile
2007-12-23 17:01:44 +00:00
parent 9efe5e5b23
commit 74ebc77547
3 changed files with 15 additions and 10 deletions

View File

@@ -3274,8 +3274,7 @@ int update_time(void)
static double ltime;
double time;
if ((U.mixbufsize)
&& (audiostream_pos() != CFRA)
if ((audiostream_pos() != CFRA)
&& (G.scene->audio.flag & AUDIO_SYNC)) {
return 0;
}
@@ -3507,7 +3506,6 @@ void inner_play_anim_loop(int init, int mode)
cached = cached_dynamics(PSFRA,PEFRA);
} else {
if (cached
&& U.mixbufsize
&& (G.scene->audio.flag & AUDIO_SYNC)) {
CFRA = audiostream_pos();
} else {

View File

@@ -1086,7 +1086,7 @@ int has_screenhandler(bScreen *sc, short eventcode)
static void animated_screen(bScreen *sc, short val)
{
if (U.mixbufsize && (val & TIME_WITH_SEQ_AUDIO)) {
if ((val & TIME_WITH_SEQ_AUDIO)) {
if(CFRA>=PEFRA) {
CFRA= PSFRA;
audiostream_stop();

View File

@@ -96,6 +96,7 @@ static int audio_scrub=0;
static int audio_playing=0;
static int audio_initialised=0;
static int audio_startframe=0;
static double audio_starttime = 0.0;
/////
//
/* local protos ------------------- */
@@ -494,7 +495,7 @@ void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown)
sound_init_audio();
}
if (!audio_initialised && !(duration + mixdown)) {
if (U.mixbufsize && !audio_initialised && !(duration + mixdown)) {
desired.freq=G.scene->audio.mixrate;
desired.format=AUDIO_S16SYS;
desired.channels=2;
@@ -508,6 +509,7 @@ void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown)
audio_startframe = startframe;
audio_pos = ( ((int)( FRA2TIME(startframe)
*(G.scene->audio.mixrate)*4 )) & (~3) );
audio_starttime = PIL_check_seconds_timer();
audio_scrub = duration;
if (!mixdown) {
@@ -536,9 +538,14 @@ int audiostream_pos(void)
{
int pos;
if (U.mixbufsize) {
pos = (int) (((double)(audio_pos-U.mixbufsize)
/ ( G.scene->audio.mixrate*4 ))
* FPS );
} else { /* fallback to seconds_timer when no audio available */
pos = (int) ((PIL_check_seconds_timer() - audio_starttime)
* FPS);
}
if (pos < audio_startframe) pos = audio_startframe;
return ( pos );