== Ipo ==

This fixes [#11118] Record Mouse in IPO Curve Editor 2.46rc3
and adds thereby a new feature: correct audio sync to IPO mouse recording :)
This commit is contained in:
Peter Schlaile 2008-05-12 17:16:54 +00:00
parent c471b6db74
commit d2fcba7f65
3 changed files with 32 additions and 13 deletions

@ -59,7 +59,7 @@ void drawview3d_render(struct View3D *v3d, int winx, int winy, float winmat[][4]
void draw_depth(struct ScrArea *sa, void *spacedata);
void view3d_update_depths(struct View3D *v3d);
int update_time(void);
int update_time(int cfra);
void calc_viewborder(struct View3D *v3d, struct rctf *viewborder_r);
void view3d_set_1_to_1_viewborder(struct View3D *v3d);

@ -3398,12 +3398,12 @@ static float redrawtimes_fps[REDRAW_FRAME_AVERAGE];
static short redrawtime_index;
int update_time(void)
int update_time(int cfra)
{
static double ltime;
double time;
if ((audiostream_pos() != CFRA)
if ((audiostream_pos() != cfra)
&& (G.scene->audio.flag & AUDIO_SYNC)) {
return 0;
}
@ -3641,7 +3641,7 @@ void inner_play_anim_loop(int init, int mode)
/* make sure that swaptime passed by */
tottime -= swaptime;
while (update_time()) {
while (update_time(CFRA)) {
PIL_sleep_ms(1);
}
@ -3700,7 +3700,7 @@ int play_anim(int mode)
inner_play_prefetch_startup(mode);
update_time();
update_time(CFRA);
inner_play_anim_loop(1, mode); /* 1==init */

@ -116,6 +116,7 @@
#include "BSE_headerbuttons.h"
#include "BSE_node.h"
#include "BSE_sequence.h"
#include "BSE_seqaudio.h"
#include "BSE_time.h"
#include "blendef.h"
@ -5671,6 +5672,7 @@ void ipo_record(void)
}
sa= sa->next;
}
if(sa) areawinset(sa->win);
/* can we? */
@ -5689,6 +5691,10 @@ void ipo_record(void)
cfra=efra= SFRA;
sfra= EFRA;
if (G.scene->audio.flag & AUDIO_SYNC) {
audiostream_start(cfra);
}
while(afbreek==0) {
getmouseco_areawin(mval);
@ -5729,7 +5735,7 @@ void ipo_record(void)
/* minimal wait swaptime */
tottime -= swaptime;
while (update_time()) PIL_sleep_ms(1);
while (update_time(cfra)) PIL_sleep_ms(1);
screen_swapbuffers();
@ -5739,8 +5745,18 @@ void ipo_record(void)
mvalo[1]= mval[1];
if(anim || (G.qual & LR_CTRLKEY)) {
if (G.scene->audio.flag & AUDIO_SYNC) {
cfra = audiostream_pos();
} else {
cfra++;
if(cfra>EFRA) cfra= SFRA;
}
if(cfra>EFRA) {
cfra= SFRA;
if (G.scene->audio.flag & AUDIO_SYNC) {
audiostream_stop();
audiostream_start( cfra );
}
}
}
}
@ -5793,6 +5809,9 @@ void ipo_record(void)
editipo_changed(G.sipo, 0);
do_ipo(G.sipo->ipo);
waitcursor(0);
if (G.scene->audio.flag & AUDIO_SYNC) {
audiostream_stop();
}
allqueue(REDRAWVIEW3D, 0);
if(sa) scrarea_queue_headredraw(sa); /* headerprint */