Loading...
Searching...
No Matches
Distortion.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_DISTORTION_AUDIO_EFFECT_H
#define OPENSHOT_DISTORTION_AUDIO_EFFECT_H
#define _USE_MATH_DEFINES
#include "EffectBase.h"
#include "Json.h"
#include "KeyFrame.h"
#include "Enums.h"
#include <memory>
#include <string>
#include <AppConfig.h>
#include <juce_audio_basics/juce_audio_basics.h>
#include <juce_dsp/juce_dsp.h>
namespace openshot
{
class Frame;
class Distortion : public EffectBase
{
private:
void init_effect_details();
public:
openshot::DistortionType distortion_type;
Keyframe input_gain;
Keyframe output_gain;
Keyframe tone;
Distortion();
Distortion(openshot::DistortionType distortion_type,
Keyframe input_gain, Keyframe output_gain, Keyframe tone);
std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override {
return GetFrame(std::make_shared<openshot::Frame>(), frame_number);
}
std::shared_ptr<openshot::Frame> GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
// Get and Set JSON methods
std::string Json() const override;
void SetJson(const std::string value) override;
Json::Value JsonValue() const override;
void SetJsonValue(const Json::Value root) override;
std::string PropertiesJSON(int64_t requested_frame) const override;
class Filter : public juce::IIRFilter
{
public:
void updateCoefficients(const double discrete_frequency, const double gain);
};
juce::OwnedArray<Filter> filters;
void updateFilters(int64_t frame_number);
};
}
#endif
EffectBase.h
Header file for EffectBase class.
Enums.h
Header file for TextReader class.
Json.h
Header file for JSON class.
KeyFrame.h
Header file for the Keyframe class.
openshot::Distortion::Filter
Definition Distortion.h:71
openshot::Distortion::Filter::updateCoefficients
void updateCoefficients(const double discrete_frequency, const double gain)
Definition Distortion.cpp:149
openshot::Distortion
This class adds a distortion into the audio.
Definition Distortion.h:38
openshot::Distortion::distortion_type
openshot::DistortionType distortion_type
Definition Distortion.h:44
openshot::Distortion::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition Distortion.cpp:216
openshot::Distortion::GetFrame
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number) override
This method is required for all derived classes of ClipBase, and returns a new openshot::Frame object...
Definition Distortion.h:56
openshot::Distortion::filters
juce::OwnedArray< Filter > filters
Definition Distortion.h:76
openshot::Distortion::input_gain
Keyframe input_gain
Definition Distortion.h:45
openshot::Distortion::output_gain
Keyframe output_gain
Definition Distortion.h:46
openshot::Distortion::updateFilters
void updateFilters(int64_t frame_number)
Definition Distortion.cpp:133
openshot::Distortion::tone
Keyframe tone
Definition Distortion.h:47
openshot::Distortion::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition Distortion.cpp:164
openshot::Distortion::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition Distortion.cpp:179
openshot::Distortion::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition Distortion.cpp:196
openshot::Distortion::Distortion
Distortion()
Default constructor.
Definition Distortion.cpp:18
openshot::Distortion::Json
std::string Json() const override
Generate JSON string of this object.
Definition Distortion.cpp:143
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:53
openshot::Keyframe
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition KeyFrame.h:53
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29
openshot::DistortionType
DistortionType
This enumeration determines the distortion type of Distortion Effect.
Definition Enums.h:70