OpenShot Library | libopenshot  0.3.1
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
Header file for EffectBase class.
Header file for JSON class.
Header file for the Keyframe class.
This class adds a delay into the audio.
Definition: Delay.h:36
juce::AudioBuffer< float > delay_buffer
Definition: Delay.h:44
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Delay.cpp:141
Keyframe delay_time
Definition: Delay.h:42
Delay()
Default constructor.
Definition: Delay.cpp:19
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Delay.cpp:124
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Delay.cpp:112
std::string Json() const override
Generate JSON string of this object.
Definition: Delay.cpp:105
int delay_write_position
Definition: Delay.h:47
int delay_buffer_samples
Definition: Delay.h:45
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Delay.cpp:152
bool initialized
Definition: Delay.h:48
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
int delay_buffer_channels
Definition: Delay.h:46
void setup(std::shared_ptr< openshot::Frame > frame)
Definition: Delay.cpp:41
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:53
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