Sound Branch:
Readded scrubbing.
This commit is contained in:
@@ -74,6 +74,8 @@ void sound_delete_handle(struct Scene *scene, struct SoundHandle *handle);
|
||||
|
||||
void sound_update_playing(struct bContext *C);
|
||||
|
||||
void sound_scrub(struct bContext *C);
|
||||
|
||||
void sound_stop_all(struct bContext *C);
|
||||
|
||||
#endif
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_packedFile_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_global.h"
|
||||
@@ -481,3 +482,32 @@ void sound_update_playing(struct bContext *C)
|
||||
|
||||
AUD_unlock();
|
||||
}
|
||||
|
||||
void sound_scrub(struct bContext *C)
|
||||
{
|
||||
SoundHandle *handle;
|
||||
Scene* scene = CTX_data_scene(C);
|
||||
int cfra = CFRA;
|
||||
float fps = FPS;
|
||||
|
||||
if(scene->audio.flag & AUDIO_SCRUB && !CTX_wm_screen(C)->animtimer)
|
||||
{
|
||||
AUD_lock();
|
||||
|
||||
for(handle = scene->sound_handles.first; handle; handle = handle->next)
|
||||
{
|
||||
if(cfra >= handle->startframe && cfra < handle->endframe && !handle->mute)
|
||||
{
|
||||
if(handle->source && handle->source->snd_sound)
|
||||
{
|
||||
int frameskip = handle->frameskip + cfra - handle->startframe;
|
||||
AUD_Sound* limiter = AUD_limitSound(handle->source->snd_sound, frameskip / fps, (frameskip + 1)/fps);
|
||||
AUD_play(limiter, 0);
|
||||
AUD_unload(limiter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AUD_unlock();
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@
|
||||
#include "ED_screen.h"
|
||||
|
||||
// AUD_XXX
|
||||
//#include "BKE_sound.h"
|
||||
#include "BKE_sound.h"
|
||||
|
||||
/* ********************** frame change operator ***************************/
|
||||
|
||||
@@ -95,8 +95,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
|
||||
CFRA= cfra;
|
||||
|
||||
// AUD_XXX
|
||||
/* if(scene->audio.flag & AUDIO_SCRUB)
|
||||
seq_update_audio(C, CFRA);*/
|
||||
sound_scrub(C);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
|
||||
}
|
||||
|
Reference in New Issue
Block a user