OpenShot Library | libopenshot  0.4.0
Delay.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_DELAY_AUDIO_EFFECT_H
14 #define OPENSHOT_DELAY_AUDIO_EFFECT_H
15 
16 #include "EffectBase.h"
17 
18 #include "Json.h"
19 #include "KeyFrame.h"
20 
21 #include <memory>
22 #include <string>
23 
24 #include <AppConfig.h>
25 #include <juce_audio_basics/juce_audio_basics.h>
26 
27 namespace openshot
28 {
29  class Frame;
30 
35  class Delay : public EffectBase
36  {
37  private:
39  void init_effect_details();
40 
41  public:
43 
49 
51  Delay();
52 
54  Delay(Keyframe new_delay_time);
55 
56  std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override {
57  return GetFrame(std::make_shared<openshot::Frame>(), frame_number);
58  }
59 
60  void setup(std::shared_ptr<openshot::Frame> frame);
61 
62  std::shared_ptr<openshot::Frame>
63  GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
64 
65  // Get and Set JSON methods
66  std::string Json() const override;
67  void SetJson(const std::string value) override;
68  Json::Value JsonValue() const override;
69  void SetJsonValue(const Json::Value root) override;
70 
71  std::string PropertiesJSON(int64_t requested_frame) const override;
72  };
73 
74 }
75 
76 #endif
openshot::Delay::setup
void setup(std::shared_ptr< openshot::Frame > frame)
Definition: Delay.cpp:41
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:53
openshot::Delay::Delay
Delay()
Default constructor.
Definition: Delay.cpp:19
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Delay
This class adds a delay into the audio.
Definition: Delay.h:35
openshot::Delay::delay_write_position
int delay_write_position
Definition: Delay.h:47
juce::AudioBuffer< float >
openshot::Delay::delay_time
Keyframe delay_time
Definition: Delay.h:42
EffectBase.h
Header file for EffectBase class.
KeyFrame.h
Header file for the Keyframe class.
openshot::Delay::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: Delay.h:56
openshot::Delay::Json
std::string Json() const override
Generate JSON string of this object.
Definition: Delay.cpp:105
openshot::Delay::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Delay.cpp:124
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::Delay::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Delay.cpp:112
openshot::Delay::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Delay.cpp:152
openshot::Delay::initialized
bool initialized
Definition: Delay.h:48
openshot::Delay::delay_buffer_samples
int delay_buffer_samples
Definition: Delay.h:45
openshot::Delay::delay_buffer
juce::AudioBuffer< float > delay_buffer
Definition: Delay.h:44
openshot::Delay::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Delay.cpp:141
Json.h
Header file for JSON class.
openshot::Delay::delay_buffer_channels
int delay_buffer_channels
Definition: Delay.h:46