waveforms: moved waveform to track rather than block
This is a much more robust and thread-safe system of storing the waveforms.
This commit is contained in:
@@ -28,13 +28,6 @@ OLIVE_NAMESPACE_ENTER
|
||||
|
||||
/**
|
||||
* @brief A Node that represents a block of time, also displayable on a Timeline
|
||||
*
|
||||
* This is an abstract function. Since different types of Block will provide their lengths in different ways, it's
|
||||
* necessary to subclass and override the length() function for a Block to be usable.
|
||||
*
|
||||
* When overriding Node::copy(), the derivative class should also call Block::CopyParameters() on the new Block instance
|
||||
* which will copy the block's name, length, and media in point. It does not copy any node-specific parameters like any
|
||||
* input values or connections as per standard with Node::copy().
|
||||
*/
|
||||
class Block : public Node
|
||||
{
|
||||
|
||||
@@ -59,26 +59,6 @@ NodeInput *ClipBlock::texture_input() const
|
||||
return texture_input_;
|
||||
}
|
||||
|
||||
void ClipBlock::LengthChangedEvent(const rational &old_length, const rational &new_length, const Timeline::MovementMode &mode)
|
||||
{
|
||||
// Positive if made longer, negative if made shorter
|
||||
rational diff = new_length - old_length;
|
||||
|
||||
if (diff < rational()) {
|
||||
if (mode == Timeline::kTrimIn) {
|
||||
waveform().TrimIn(-diff);
|
||||
} else {
|
||||
waveform().TrimOut(-diff);
|
||||
}
|
||||
} else {
|
||||
if (mode == Timeline::kTrimIn) {
|
||||
waveform().PrependSilence(diff);
|
||||
} else {
|
||||
waveform().AppendSilence(diff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ClipBlock::InvalidateCache(const TimeRange &range, NodeInput *from, NodeInput *source)
|
||||
{
|
||||
// If signal is from texture input, transform all times from media time to sequence time
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#ifndef CLIPBLOCK_H
|
||||
#define CLIPBLOCK_H
|
||||
|
||||
#include "audio/audiovisualwaveform.h"
|
||||
#include "node/block/block.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
@@ -57,31 +56,9 @@ public:
|
||||
|
||||
virtual void Hash(QCryptographicHash &hash, const rational &time) const override;
|
||||
|
||||
AudioVisualWaveform& waveform()
|
||||
{
|
||||
return waveform_;
|
||||
}
|
||||
|
||||
void set_waveform(const AudioVisualWaveform& wave)
|
||||
{
|
||||
waveform_ = wave;
|
||||
|
||||
emit PreviewUpdated();
|
||||
}
|
||||
|
||||
signals:
|
||||
void PreviewUpdated();
|
||||
|
||||
protected:
|
||||
virtual void LengthChangedEvent(const rational& old_length,
|
||||
const rational& new_length,
|
||||
const Timeline::MovementMode& mode) override;
|
||||
|
||||
private:
|
||||
NodeInput* texture_input_;
|
||||
|
||||
AudioVisualWaveform waveform_;
|
||||
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
Reference in New Issue
Block a user