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
+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);