OpenShot Library | libopenshot  0.3.1
Expander.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_EXPANDER_AUDIO_EFFECT_H
14 #define OPENSHOT_EXPANDER_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;
31 
36  class Expander : public EffectBase
37  {
38  private:
40  void init_effect_details();
41 
42 
43  public:
50 
52  float xl;
53  float yl;
54  float xg;
55  float yg;
56  float control;
57 
58  float input_level;
59  float yl_prev;
60 
62  float inverseE;
63 
65  Expander();
66 
68  Expander(Keyframe threshold, Keyframe ratio, Keyframe attack,
69  Keyframe release, Keyframe makeup_gain, Keyframe bypass);
70 
71  float calculateAttackOrRelease(float value);
72 
73  std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override {
74  return GetFrame(std::make_shared<openshot::Frame>(), frame_number);
75  }
76 
77  std::shared_ptr<openshot::Frame>
78  GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
79 
80  // Get and Set JSON methods
81  std::string Json() const override;
82  void SetJson(const std::string value) override;
83  Json::Value JsonValue() const override;
84  void SetJsonValue(const Json::Value root) override;
85 
86  std::string PropertiesJSON(int64_t requested_frame) const override;
87  };
88 
89 }
90 
91 #endif
Keyframe bypass
Definition: Expander.h:49
Expander()
Default constructor.
Definition: Expander.cpp:19
float inverse_sample_rate
Definition: Expander.h:61
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:52
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Expander.cpp:189
Keyframe attack
Definition: Expander.h:46
std::string Json() const override
Generate JSON string of this object.
Definition: Expander.cpp:122
Header file for the Keyframe class.
Keyframe release
Definition: Expander.h:47
Header file for JSON class.
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Expander.cpp:163
float calculateAttackOrRelease(float value)
Definition: Expander.cpp:113
Keyframe makeup_gain
Definition: Expander.h:48
Header file for TextReader class.
This class adds a expander (or noise gate) into the audio.
Definition: Expander.h:36
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
Header file for EffectBase class.
Keyframe ratio
Definition: Expander.h:45
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: Expander.h:73
juce::AudioBuffer< float > mixed_down_input
Definition: Expander.h:51
A Keyframe is a collection of Point instances, which is used to vary a number or property over time...
Definition: KeyFrame.h:53
Keyframe threshold
Definition: Expander.h:44
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Expander.cpp:129
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Expander.cpp:146