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:
@@ -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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "widgets/ardour_dropdown.h"
|
||||
|
||||
#include "pbd/crossthread.h"
|
||||
#include "pbd/progress.h"
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "ardour_dialog.h"
|
||||
@@ -52,7 +53,7 @@ namespace ARDOUR {
|
||||
|
||||
class AudioRegionView;
|
||||
|
||||
class AudioRegionEditor : public RegionEditor
|
||||
class AudioRegionEditor : public RegionEditor, protected PBD::Progress
|
||||
{
|
||||
public:
|
||||
AudioRegionEditor (ARDOUR::Session*, AudioRegionView*);
|
||||
@@ -101,6 +102,8 @@ private:
|
||||
|
||||
PBD::Signal<void (double)> PeakAmplitudeFound;
|
||||
|
||||
void set_overall_progress (float) {}
|
||||
|
||||
pthread_t _peak_amplitude_thread_handle;
|
||||
PBD::ScopedConnection _peak_amplitude_connection;
|
||||
CrossThreadChannel _peak_channel;
|
||||
|
||||
Reference in New Issue
Block a user