OpenShot Library | libopenshot  0.3.3
Compressor.h
Go to the documentation of this file.
1 
9 // Copyright (c) 2008-2019 OpenShot Studios, LLC
10 //
11 // SPDX-License-Identifier: LGPL-3.0-or-later
12 
13 #ifndef OPENSHOT_COMPRESSOR_AUDIO_EFFECT_H
14 #define OPENSHOT_COMPRESSOR_AUDIO_EFFECT_H
15 
16 #include "EffectBase.h"
17 
18 #include "Json.h"
19 #include "KeyFrame.h"
20 #include "Enums.h"
21 
22 #include <memory>
23 #include <string>
24 
25 #include <AppConfig.h>
26 #include <juce_audio_basics/juce_audio_basics.h>
27 
28 namespace openshot
29 {
30  class Frame;
35  class Compressor : public EffectBase
36  {
37  private:
39  void init_effect_details();
40 
41 
42  public:
49 
51  float xl;
52  float yl;
53  float xg;
54  float yg;
55  float control;
56 
57  float input_level;
58  float yl_prev;
59 
61  float inverseE;
62 
64  Compressor();
65 
69 
70  float calculateAttackOrRelease(float value);
71 
72  std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override {
73  return GetFrame(std::make_shared<openshot::Frame>(), frame_number);
74  }
75 
76  std::shared_ptr<openshot::Frame>
77  GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
78 
79  // Get and Set JSON methods
80  std::string Json() const override;
81  void SetJson(const std::string value) override;
82  Json::Value JsonValue() const override;
83  void SetJsonValue(const Json::Value root) override;
84 
85  std::string PropertiesJSON(int64_t requested_frame) const override;
86  };
87 
88 }
89 
90 #endif
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:53
openshot::Compressor::xg
float xg
Definition: Compressor.h:53
openshot::Compressor::attack
Keyframe attack
Definition: Compressor.h:45
openshot::Compressor::Compressor
Compressor()
Default constructor.
Definition: Compressor.cpp:19
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Compressor::Json
std::string Json() const override
Generate JSON string of this object.
Definition: Compressor.cpp:116
openshot::Compressor::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Compressor.cpp:140
juce::AudioBuffer< float >
openshot::Compressor::ratio
Keyframe ratio
Definition: Compressor.h:44
openshot::Compressor::xl
float xl
Definition: Compressor.h:51
openshot::Compressor::input_level
float input_level
Definition: Compressor.h:57
openshot::Frame
This class represents a single frame of video (i.e. image & audio data)
Definition: Frame.h:90
openshot::Compressor::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Compressor.cpp:157
EffectBase.h
Header file for EffectBase class.
openshot::Compressor::calculateAttackOrRelease
float calculateAttackOrRelease(float value)
Definition: Compressor.cpp:107
KeyFrame.h
Header file for the Keyframe class.
openshot::Compressor::yl
float yl
Definition: Compressor.h:52
openshot::Compressor::yl_prev
float yl_prev
Definition: Compressor.h:58
openshot::Compressor::release
Keyframe release
Definition: Compressor.h:46
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::Compressor::yg
float yg
Definition: Compressor.h:54
openshot::Compressor::control
float control
Definition: Compressor.h:55
openshot::Compressor::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: Compressor.h:72
openshot::Compressor::makeup_gain
Keyframe makeup_gain
Definition: Compressor.h:47
openshot::Compressor::inverse_sample_rate
float inverse_sample_rate
Definition: Compressor.h:60
openshot::Compressor::bypass
Keyframe bypass
Definition: Compressor.h:48
Enums.h
Header file for TextReader class.
openshot::Compressor::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Compressor.cpp:183
openshot::Compressor::mixed_down_input
juce::AudioBuffer< float > mixed_down_input
Definition: Compressor.h:50
Json.h
Header file for JSON class.
openshot::Compressor::inverseE
float inverseE
Definition: Compressor.h:61
openshot::Compressor
This class adds a compressor into the audio.
Definition: Compressor.h:35
openshot::Compressor::threshold
Keyframe threshold
Definition: Compressor.h:43
openshot::Compressor::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Compressor.cpp:123