[Bf-blender-cvs] [ce0d311] master: Scene audio naming cleanup:

Antony Riakiotakis noreply at git.blender.org
Fri May 15 16:51:53 CEST 2015


Commit: ce0d3112e40fe54bd56926b758cda4e502fb782a
Author: Antony Riakiotakis
Date:   Fri May 15 16:51:17 2015 +0200
Branches: master
https://developer.blender.org/rBce0d3112e40fe54bd56926b758cda4e502fb782a

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...

===================================================================

M	source/blender/blenkernel/intern/sound.c
M	source/blender/makesdna/DNA_scene_types.h

===================================================================

diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 30c1777..46a5091 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -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;
 }
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 7ac00e1..ef0e98a 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -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;




More information about the Bf-blender-cvs mailing list