[Bf-blender-cvs] [b41ce0d] master: Remove 'locked' parameter from sound_read_waveform()

Nicholas Bishop noreply at git.blender.org
Thu Jan 15 14:01:56 CET 2015


Commit: b41ce0d1b95973c64bb4300a20c1b89506fe32d0
Author: Nicholas Bishop
Date:   Thu Jan 15 12:28:08 2015 +0100
Branches: master
https://developer.blender.org/rBb41ce0d1b95973c64bb4300a20c1b89506fe32d0

Remove 'locked' parameter from sound_read_waveform()

This parameter was confusing in three ways:

1. It should have been named "lock" because it was used to take and
   release the sound mutex, not to indicate whether it was locked.

2. In the one place this function gets called the locked argument was
   set to "true", so not much point in having it optional.

3. I can't imagine that it would ever be a good idea to skip taking
   and releasing the mutex.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D988

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

M	source/blender/blenkernel/BKE_sound.h
M	source/blender/blenkernel/intern/sound.c
M	source/blender/editors/space_sequencer/sequencer_preview.c

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

diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index f318c74..a4182b8 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -130,7 +130,7 @@ int sound_scene_playing(struct Scene *scene);
 
 void sound_free_waveform(struct bSound *sound);
 
-void sound_read_waveform(struct bSound *sound, bool locked, short *stop);
+void sound_read_waveform(struct bSound *sound, short *stop);
 
 void sound_update_scene(struct Main *bmain, struct Scene *scene);
 
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 3c7b01f..5c5b2cc 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -681,7 +681,7 @@ void sound_free_waveform(bSound *sound)
 	sound->waveform = NULL;
 }
 
-void sound_read_waveform(bSound *sound, bool locked, short *stop)
+void sound_read_waveform(bSound *sound, short *stop)
 {
 	AUD_SoundInfo info;
 	SoundWaveform *waveform = NULL;
@@ -698,23 +698,19 @@ void sound_read_waveform(bSound *sound, bool locked, short *stop)
 		if (*stop) {
 			MEM_freeN(waveform->data);
 			MEM_freeN(waveform);
-			if (locked)
-				BLI_mutex_lock(sound->mutex);
+			BLI_mutex_lock(sound->mutex);
 			sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING;
-			if (locked)
-				BLI_mutex_unlock(sound->mutex);
+			BLI_mutex_unlock(sound->mutex);
 			return;
 		}
 		
 		sound_free_waveform(sound);
 	}
 	
-	if (locked)
-		BLI_mutex_lock(sound->mutex);
+	BLI_mutex_lock(sound->mutex);
 	sound->waveform = waveform;
 	sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING;
-	if (locked)
-		BLI_mutex_unlock(sound->mutex);
+	BLI_mutex_unlock(sound->mutex);
 }
 
 void sound_update_scene(Main *bmain, struct Scene *scene)
@@ -849,7 +845,7 @@ void sound_stop_scene(struct Scene *UNUSED(scene)) {}
 void sound_seek_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) {}
 float sound_sync_scene(struct Scene *UNUSED(scene)) { return NAN_FLT; }
 int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; }
-void sound_read_waveform(struct bSound *sound, bool locked, short *stop) { UNUSED_VARS(sound, locked, stop); }
+void sound_read_waveform(struct bSound *sound, short *stop) { UNUSED_VARS(sound, stop); }
 void sound_init_main(struct Main *UNUSED(bmain)) {}
 void sound_set_cfra(int UNUSED(cfra)) {}
 void sound_update_sequencer(struct Main *UNUSED(main), struct bSound *UNUSED(sound)) {}
diff --git a/source/blender/editors/space_sequencer/sequencer_preview.c b/source/blender/editors/space_sequencer/sequencer_preview.c
index dd6349e..da00b0f 100644
--- a/source/blender/editors/space_sequencer/sequencer_preview.c
+++ b/source/blender/editors/space_sequencer/sequencer_preview.c
@@ -85,7 +85,7 @@ static void preview_startjob(void *data, short *stop, short *do_update, float *p
 		PreviewJobAudio *preview_next;
 		bSound *sound = previewjb->sound;
 		
-		sound_read_waveform(sound, true, stop);
+		sound_read_waveform(sound, stop);
 
 		if (*stop || G.is_break) {
 			BLI_mutex_lock(pj->mutex);




More information about the Bf-blender-cvs mailing list