Cancel audio peak analysis when destroying AudioRegionEditor

This speeds up selection changes when the Region Properties
are show in the bottom attachment and long regions are
selected.

The RegionEditor is destroyed when selection changes and has/had
to wait for the peak analysis thread to complete.
This commit is contained in:
Robin Gareus 2025-03-27 17:21:36 +01:00
parent 8b389ee829
commit b98884a54c
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 7 additions and 2 deletions

View file

@ -146,7 +146,9 @@ AudioRegionEditor::AudioRegionEditor (Session* s, AudioRegionView* arv)
AudioRegionEditor::~AudioRegionEditor ()
{
void* v;
_peak_amplitude_connection.disconnect ();
_peak_channel.deliver ('t');
Progress::cancel ();
pthread_join (_peak_amplitude_thread_handle, &v);
}
@ -235,7 +237,7 @@ AudioRegionEditor::peak_amplitude_thread ()
Temporal::TempoMap::fetch ();
/* compute peak amplitude and signal the fact */
PeakAmplitudeFound (accurate_coefficient_to_dB (_audio_region->maximum_amplitude ())); /* EMIT SIGNAL */
PeakAmplitudeFound (accurate_coefficient_to_dB (_audio_region->maximum_amplitude (this))); /* EMIT SIGNAL */
}
}