Merge branch 'master' into nodeview-redux

This commit is contained in:
itsmattkc
2021-05-27 13:21:10 +10:00
11 changed files with 48 additions and 26 deletions
+2 -2
View File
@@ -164,9 +164,9 @@ void AudioManager::SetOutputParams(const AudioParams &params)
// Refresh output device
SetOutputDevice(output_device_info_);
emit AudioParamsChanged(output_params_);
}
emit AudioParamsChanged(output_params_);
}
void AudioManager::SetInputDevice(const QAudioDeviceInfo &info)
+3 -1
View File
@@ -142,7 +142,9 @@ rational rational::flipped() const
void rational::flip()
{
std::swap(denom_, numer_);
if (!isNull()) {
std::swap(denom_, numer_);
}
}
bool rational::isNull() const
+5
View File
@@ -35,6 +35,11 @@ class AudioMonitorPanel : public PanelWidget
public:
AudioMonitorPanel(QWidget* parent = nullptr);
bool IsPlaying() const
{
return audio_monitor_->IsPlaying();
}
void SetParams(const AudioParams& params)
{
audio_monitor_->SetParams(params);
+3 -1
View File
@@ -79,7 +79,8 @@ private:
OpenGLRenderer::OpenGLRenderer(QObject* parent) :
Renderer(parent),
cache_timer_(this),
context_(nullptr)
context_(nullptr),
framebuffer_(0)
{
cache_timer_.setInterval(kTextureCacheMaxSize);
connect(&cache_timer_, &QTimer::timeout, this, &OpenGLRenderer::GarbageCollectTextureCache);
@@ -153,6 +154,7 @@ void OpenGLRenderer::DestroyInternal()
if (context_) {
// Delete framebuffer
functions_->glDeleteFramebuffers(1, &framebuffer_);
framebuffer_ = 0;
for (auto it=texture_cache_.cbegin(); it!=texture_cache_.cend(); it++) {
functions_->glDeleteTextures(1, &it->texture);
+2 -2
View File
@@ -311,8 +311,8 @@ QVariant RenderProcessor::ProcessVideoFootage(const FootageJob &stream, const ra
// See if we can make this divider larger (i.e. if the fooage is smaller)
int footage_divider = render_params.divider();
while (footage_divider > 1
&& VideoParams::GetScaledDimension(stream_data.width(), footage_divider-1) <= render_params.effective_width()
&& VideoParams::GetScaledDimension(stream_data.height(), footage_divider-1) <= render_params.effective_height()) {
&& VideoParams::GetScaledDimension(stream_data.width(), footage_divider-1) < render_params.effective_width()
&& VideoParams::GetScaledDimension(stream_data.height(), footage_divider-1) < render_params.effective_height()) {
footage_divider--;
}
+13 -11
View File
@@ -49,17 +49,19 @@ AudioMonitor::AudioMonitor(QWidget *parent) :
void AudioMonitor::SetParams(const AudioParams &params)
{
params_ = params;
if (params_ != params) {
params_ = params;
for (int i=0;i<values_.size();i++) {
values_[i].resize(params_.channel_count());
values_[i].fill(0);
for (int i=0;i<values_.size();i++) {
values_[i].resize(params_.channel_count());
values_[i].fill(0);
}
peaked_.resize(params_.channel_count());
peaked_.fill(false);
update();
}
peaked_.resize(params_.channel_count());
peaked_.fill(false);
update();
}
void AudioMonitor::OutputDeviceSet(AudioPlaybackCache *cache, qint64 offset, int playback_speed)
@@ -241,7 +243,7 @@ void AudioMonitor::paintGL()
QVector<double> v(params_.channel_count(), 0);
if (file_ || waveform_) {
if (IsPlaying()) {
// Determines how many milliseconds have passed since last update
qint64 current_time = QDateTime::currentMSecsSinceEpoch();
qint64 delta_time = current_time - last_time_;
@@ -308,7 +310,7 @@ void AudioMonitor::paintGL()
}
}
if (all_zeroes && !file_ && !waveform_) {
if (all_zeroes && !IsPlaying()) {
// Optimize by disabling the update loop
SetUpdateLoop(false);
}
+5
View File
@@ -38,6 +38,11 @@ class AudioMonitor : public QOpenGLWidget
public:
AudioMonitor(QWidget* parent = nullptr);
bool IsPlaying() const
{
return file_ || waveform_;
}
public slots:
void SetParams(const AudioParams& params);
+3 -1
View File
@@ -608,7 +608,9 @@ void KeyframeViewBase::AutoSelectKeyTimeNeighbors()
// Ensure this key is not already selected
KeyframeViewItem* item = item_map_.value(k);
item->setSelected(true);
if (item) {
item->setSelected(true);
}
}
}
@@ -197,12 +197,12 @@ void NodeParamViewWidgetBridge::SetInputValue(const QVariant &value, int track)
{
MultiUndoCommand* command = new MultiUndoCommand();
SetInputValueInternal(value, track, command);
SetInputValueInternal(value, track, command, true);
Core::instance()->undo_stack()->pushIfHasChildren(command);
}
void NodeParamViewWidgetBridge::SetInputValueInternal(const QVariant &value, int track, MultiUndoCommand *command)
void NodeParamViewWidgetBridge::SetInputValueInternal(const QVariant &value, int track, MultiUndoCommand *command, bool insert_on_all_tracks_if_no_key)
{
rational node_time = GetCurrentTimeAsNodeTime();
@@ -219,6 +219,8 @@ void NodeParamViewWidgetBridge::SetInputValueInternal(const QVariant &value, int
if (i == track) {
track_value = value;
} else if (!insert_on_all_tracks_if_no_key) {
continue;
} else {
track_value = input_.node()->GetSplitValueAtTimeOnTrack(input_.input(), node_time, i, input_.element());
}
@@ -339,10 +341,10 @@ void NodeParamViewWidgetBridge::WidgetCallback()
MultiUndoCommand* command = new MultiUndoCommand();
SetInputValueInternal(c.red(), 0, command);
SetInputValueInternal(c.green(), 1, command);
SetInputValueInternal(c.blue(), 2, command);
SetInputValueInternal(c.alpha(), 3, command);
SetInputValueInternal(c.red(), 0, command, false);
SetInputValueInternal(c.green(), 1, command, false);
SetInputValueInternal(c.blue(), 2, command, false);
SetInputValueInternal(c.alpha(), 3, command, false);
Node* n = input_.node();
n->blockSignals(true);
@@ -62,7 +62,7 @@ private:
void SetInputValue(const QVariant& value, int track);
void SetInputValueInternal(const QVariant& value, int track, MultiUndoCommand *command);
void SetInputValueInternal(const QVariant& value, int track, MultiUndoCommand *command, bool insert_on_all_tracks_if_no_key);
void ProcessSlider(NumericSliderBase* slider, const QVariant& value);
+3 -1
View File
@@ -710,7 +710,9 @@ void MainWindow::SaveCustomShortcuts()
void MainWindow::UpdateAudioMonitorParams(ViewerOutput *viewer)
{
audio_monitor_panel_->SetParams(viewer ? viewer->GetAudioParams() : AudioParams());
if (!audio_monitor_panel_->IsPlaying()) {
audio_monitor_panel_->SetParams(viewer ? viewer->GetAudioParams() : AudioParams());
}
}
void MainWindow::UpdateNodePanelContextFromTimelinePanel(TimelinePanel *panel)