OpenShot Library | libopenshot  0.3.2
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
Header file for EffectBase class.
Header file for TextReader class.
Header file for JSON class.
Header file for the Keyframe class.
This class adds a compressor into the audio.
Definition: Compressor.h:36
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Compressor.cpp:183
Keyframe makeup_gain
Definition: Compressor.h:47
Compressor()
Default constructor.
Definition: Compressor.cpp:19
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
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Compressor.cpp:123
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Compressor.cpp:157
juce::AudioBuffer< float > mixed_down_input
Definition: Compressor.h:50
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Compressor.cpp:140
std::string Json() const override
Generate JSON string of this object.
Definition: Compressor.cpp:116
float calculateAttackOrRelease(float value)
Definition: Compressor.cpp:107
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:53
This class represents a single frame of video (i.e. image & audio data)
Definition: Frame.h:91
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition: KeyFrame.h:53
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:29