Fix audio waveform view scene rect and timebase refresh
- AudioWaveformView now uses the video frame rate as its timebase (falling back to the default sequence frame rate), preventing the enormous scene rect that froze the UI when it previously used the audio sample rate. - Call UpdateSceneRect() after changing the waveform timebase so the QGraphicsScene bounds are recomputed immediately. - Refresh the waveform view's viewer/timebase whenever the waveform visibility mode changes, ensuring the correct timebase is applied even if the node was connected earlier with a different setting.
This commit is contained in:
@@ -67,11 +67,12 @@ void AudioWaveformView::SetViewer(ViewerOutput *playback)
|
||||
connect(playback_, &ViewerOutput::ConnectedWaveformChanged, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
|
||||
SetTimebase(playback_->GetVideoParams().frame_rate_as_time_base());
|
||||
if (timebase().isNull()) {
|
||||
SetTimebase(
|
||||
playback_->GetAudioParams().sample_rate_as_time_base());
|
||||
rational tb = playback_->GetVideoParams().frame_rate_as_time_base();
|
||||
if (tb.isNull()) {
|
||||
tb = OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>().flipped();
|
||||
}
|
||||
SetTimebase(tb);
|
||||
UpdateSceneRect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -826,6 +826,12 @@ void ViewerWidget::UpdateWaveformViewFromMode()
|
||||
|
||||
if (GetConnectedNode()) {
|
||||
GetConnectedNode()->SetWaveformEnabled(waveform_view_->isVisible());
|
||||
|
||||
if (waveform_view_->isVisible()) {
|
||||
waveform_view_->SetViewer(GetConnectedNode());
|
||||
} else {
|
||||
waveform_view_->SetViewer(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user