audiomonitor: update parameters immediately when panels are focused
This commit is contained in:
@@ -58,6 +58,8 @@ void AudioMonitor::SetParams(const AudioParams ¶ms)
|
||||
|
||||
peaked_.resize(params_.channel_count());
|
||||
peaked_.fill(false);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void AudioMonitor::OutputDeviceSet(AudioPlaybackCache *cache, qint64 offset, int playback_speed)
|
||||
@@ -72,6 +74,11 @@ void AudioMonitor::OutputDeviceSet(AudioPlaybackCache *cache, qint64 offset, int
|
||||
return;
|
||||
}
|
||||
|
||||
if (offset > file_->size()) {
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
file_->seek(offset);
|
||||
|
||||
playback_speed_ = playback_speed;
|
||||
@@ -86,6 +93,8 @@ void AudioMonitor::Stop()
|
||||
delete file_;
|
||||
file_ = nullptr;
|
||||
waveform_ = nullptr;
|
||||
|
||||
SetUpdateLoop(false);
|
||||
}
|
||||
|
||||
void AudioMonitor::OutputPushed(const QByteArray &d)
|
||||
@@ -103,6 +112,10 @@ void AudioMonitor::OutputAudioVisualWaveformSet(const AudioVisualWaveform *wavef
|
||||
{
|
||||
Stop();
|
||||
|
||||
if (start >= waveform->length()) {
|
||||
return;
|
||||
}
|
||||
|
||||
waveform_ = waveform;
|
||||
waveform_time_ = start;
|
||||
|
||||
@@ -240,8 +253,16 @@ void AudioMonitor::paintGL()
|
||||
|
||||
if (file_) {
|
||||
UpdateValuesFromFile(v, delta_time);
|
||||
|
||||
if (file_->atEnd()) {
|
||||
Stop();
|
||||
}
|
||||
} else if (waveform_) {
|
||||
UpdateValuesFromWaveform(v, delta_time);
|
||||
|
||||
if (waveform_time_ >= waveform_->length()) {
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
|
||||
last_time_ = current_time;
|
||||
|
||||
Reference in New Issue
Block a user