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
This commit is contained in:
Nicholas Bishop 2015-01-15 12:28:08 +01:00
parent 588656a568
commit b41ce0d1b9
3 changed files with 8 additions and 12 deletions

@ -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);

@ -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)) {}

@ -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);