Scene audio naming cleanup:

Remane sound_scene_handle to playback handle.
sound_scene_handle was a part of scene so we could see code like scene-
often in the same function.

If I understand things correctly, in audaspace lingo, the
playback_handle corresponds to a Reader while the scene_sound
corresponds to a Factory.

More cleanups will be done here later, but changing this now because my
brain hurts trying to remember which is which...
This commit is contained in:
Antony Riakiotakis 2015-05-15 16:51:17 +02:00
parent 3d658bf7a7
commit ce0d3112e4
2 changed files with 29 additions and 29 deletions

View File

@ -139,8 +139,8 @@ static void sound_sync_callback(void *data, int mode, float time)
BKE_sound_play_scene(scene);
else
BKE_sound_stop_scene(scene);
if (scene->sound_scene_handle)
AUD_seek(scene->sound_scene_handle, time);
if (scene->playback_handle)
AUD_seek(scene->playback_handle, time);
}
scene = scene->id.next;
}
@ -383,15 +383,15 @@ void BKE_sound_create_scene(struct Scene *scene)
scene->sound_scene = AUD_createSequencer(FPS, scene->audio.flag & AUDIO_MUTE);
AUD_updateSequencerData(scene->sound_scene, scene->audio.speed_of_sound,
scene->audio.doppler_factor, scene->audio.distance_model);
scene->sound_scene_handle = NULL;
scene->playback_handle = NULL;
scene->sound_scrub_handle = NULL;
scene->speaker_handles = NULL;
}
void BKE_sound_destroy_scene(struct Scene *scene)
{
if (scene->sound_scene_handle)
AUD_stop(scene->sound_scene_handle);
if (scene->playback_handle)
AUD_stop(scene->playback_handle);
if (scene->sound_scrub_handle)
AUD_stop(scene->sound_scrub_handle);
if (scene->sound_scene)
@ -524,13 +524,13 @@ void BKE_sound_update_sequencer(struct Main *main, bSound *sound)
static void sound_start_play_scene(struct Scene *scene)
{
if (scene->sound_scene_handle)
AUD_stop(scene->sound_scene_handle);
if (scene->playback_handle)
AUD_stop(scene->playback_handle);
AUD_setSequencerDeviceSpecs(scene->sound_scene);
if ((scene->sound_scene_handle = AUD_play(scene->sound_scene, 1)))
AUD_setLoop(scene->sound_scene_handle, -1);
if ((scene->playback_handle = AUD_play(scene->sound_scene, 1)))
AUD_setLoop(scene->playback_handle, -1);
}
void BKE_sound_play_scene(struct Scene *scene)
@ -540,20 +540,20 @@ void BKE_sound_play_scene(struct Scene *scene)
AUD_lock();
status = scene->sound_scene_handle ? AUD_getStatus(scene->sound_scene_handle) : AUD_STATUS_INVALID;
status = scene->playback_handle ? AUD_getStatus(scene->playback_handle) : AUD_STATUS_INVALID;
if (status == AUD_STATUS_INVALID) {
sound_start_play_scene(scene);
if (!scene->sound_scene_handle) {
if (!scene->playback_handle) {
AUD_unlock();
return;
}
}
if (status != AUD_STATUS_PLAYING) {
AUD_seek(scene->sound_scene_handle, cur_time);
AUD_resume(scene->sound_scene_handle);
AUD_seek(scene->playback_handle, cur_time);
AUD_resume(scene->playback_handle);
}
if (scene->audio.flag & AUDIO_SYNC)
@ -564,8 +564,8 @@ void BKE_sound_play_scene(struct Scene *scene)
void BKE_sound_stop_scene(struct Scene *scene)
{
if (scene->sound_scene_handle) {
AUD_pause(scene->sound_scene_handle);
if (scene->playback_handle) {
AUD_pause(scene->playback_handle);
if (scene->audio.flag & AUDIO_SYNC)
AUD_stopPlayback();
@ -583,17 +583,17 @@ void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
AUD_lock();
status = scene->sound_scene_handle ? AUD_getStatus(scene->sound_scene_handle) : AUD_STATUS_INVALID;
status = scene->playback_handle ? AUD_getStatus(scene->playback_handle) : AUD_STATUS_INVALID;
if (status == AUD_STATUS_INVALID) {
sound_start_play_scene(scene);
if (!scene->sound_scene_handle) {
if (!scene->playback_handle) {
AUD_unlock();
return;
}
AUD_pause(scene->sound_scene_handle);
AUD_pause(scene->playback_handle);
}
animation_playing = 0;
@ -606,13 +606,13 @@ void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
if (scene->audio.flag & AUDIO_SCRUB && !animation_playing) {
if (scene->audio.flag & AUDIO_SYNC) {
AUD_seek(scene->sound_scene_handle, cur_time);
AUD_seekSequencer(scene->sound_scene_handle, cur_time);
AUD_seek(scene->playback_handle, cur_time);
AUD_seekSequencer(scene->playback_handle, cur_time);
}
else {
AUD_seek(scene->sound_scene_handle, cur_time);
AUD_seek(scene->playback_handle, cur_time);
}
AUD_resume(scene->sound_scene_handle);
AUD_resume(scene->playback_handle);
if (scene->sound_scrub_handle && AUD_getStatus(scene->sound_scrub_handle) != AUD_STATUS_INVALID) {
AUD_seek(scene->sound_scrub_handle, 0);
}
@ -620,16 +620,16 @@ void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
if (scene->sound_scrub_handle) {
AUD_stop(scene->sound_scrub_handle);
}
scene->sound_scrub_handle = AUD_pauseAfter(scene->sound_scene_handle, one_frame);
scene->sound_scrub_handle = AUD_pauseAfter(scene->playback_handle, one_frame);
}
}
else {
if (scene->audio.flag & AUDIO_SYNC) {
AUD_seekSequencer(scene->sound_scene_handle, cur_time);
AUD_seekSequencer(scene->playback_handle, cur_time);
}
else {
if (status == AUD_STATUS_PLAYING) {
AUD_seek(scene->sound_scene_handle, cur_time);
AUD_seek(scene->playback_handle, cur_time);
}
}
}
@ -639,11 +639,11 @@ void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
float BKE_sound_sync_scene(struct Scene *scene)
{
if (scene->sound_scene_handle) {
if (scene->playback_handle) {
if (scene->audio.flag & AUDIO_SYNC)
return AUD_getSequencerPosition(scene->sound_scene_handle);
return AUD_getSequencerPosition(scene->playback_handle);
else
return AUD_getPosition(scene->sound_scene_handle);
return AUD_getPosition(scene->playback_handle);
}
return NAN_FLT;
}

View File

@ -1394,7 +1394,7 @@ typedef struct Scene {
ListBase transform_spaces;
void *sound_scene;
void *sound_scene_handle;
void *playback_handle;
void *sound_scrub_handle;
void *speaker_handles;