Fix: Audio plays back incorrectly after rendering to a video file

D2365
This commit is contained in:
Joerg Mueller 2017-01-06 18:18:20 +01:00
parent 62604c5c20
commit e713009e9b
Notes: blender-bot 2023-02-14 09:02:40 +01:00
Referenced by issue #50395, CUDA not available MacOS 10.12 Build e713009-x86_64
4 changed files with 18 additions and 6 deletions

View File

@ -90,6 +90,8 @@ void BKE_sound_create_scene(struct Scene *scene);
void BKE_sound_destroy_scene(struct Scene *scene);
void BKE_sound_reset_scene_specs(struct Scene *scene);
void BKE_sound_mute_scene(struct Scene *scene, int muted);
void BKE_sound_update_fps(struct Scene *scene);

View File

@ -454,6 +454,16 @@ void BKE_sound_destroy_scene(struct Scene *scene)
AUD_destroySet(scene->speaker_handles);
}
void BKE_sound_reset_scene_specs(struct Scene *scene)
{
AUD_Specs specs;
specs.channels = AUD_Device_getChannels(sound_device);
specs.rate = AUD_Device_getRate(sound_device);
AUD_Sequence_setSpecs(scene->sound_scene, specs);
}
void BKE_sound_mute_scene(struct Scene *scene, int muted)
{
if (scene->sound_scene)
@ -580,15 +590,10 @@ void BKE_sound_update_sequencer(struct Main *main, bSound *sound)
static void sound_start_play_scene(struct Scene *scene)
{
AUD_Specs specs;
if (scene->playback_handle)
AUD_Handle_stop(scene->playback_handle);
specs.channels = AUD_Device_getChannels(sound_device);
specs.rate = AUD_Device_getRate(sound_device);
AUD_Sequence_setSpecs(scene->sound_scene, specs);
BKE_sound_reset_scene_specs(scene);
if ((scene->playback_handle = AUD_Device_play(sound_device, scene->sound_scene, 1)))
AUD_Handle_setLoopCount(scene->playback_handle, -1);
@ -910,6 +915,7 @@ void BKE_sound_delete_cache(struct bSound *UNUSED(sound)) {}
void BKE_sound_load(struct Main *UNUSED(bmain), struct bSound *UNUSED(sound)) {}
void BKE_sound_create_scene(struct Scene *UNUSED(scene)) {}
void BKE_sound_destroy_scene(struct Scene *UNUSED(scene)) {}
void BKE_sound_reset_scene_specs(struct Scene *UNUSED(scene)) {}
void BKE_sound_mute_scene(struct Scene *UNUSED(scene), int UNUSED(muted)) {}
void *BKE_sound_scene_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence *UNUSED(sequence),
int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; }

View File

@ -383,6 +383,8 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA + 1) * specs.rate / FPS,
accuracy, filename, specs, container, codec, bitrate);
BKE_sound_reset_scene_specs(scene);
if (result) {
BKE_report(op->reports, RPT_ERROR, result);
return OPERATOR_CANCELLED;

View File

@ -74,6 +74,7 @@
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_sequencer.h"
#include "BKE_sound.h"
#include "BKE_writeavi.h" /* <------ should be replaced once with generic movie module */
#include "BKE_object.h"
@ -3791,6 +3792,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
re->flag &= ~R_ANIMATION;
BLI_callback_exec(re->main, (ID *)scene, G.is_break ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE);
BKE_sound_reset_scene_specs(scene);
/* UGLY WARNING */
G.is_rendering = false;