OpenShot Library | libopenshot  0.3.3
Whisperization.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_WHISPERIZATION_AUDIO_EFFECT_H
14 #define OPENSHOT_WHISPERIZATION_AUDIO_EFFECT_H
15 #define _USE_MATH_DEFINES
16 
17 #include <memory>
18 #include <mutex>
19 #include <string>
20 
21 #include "../EffectBase.h"
22 
23 #include "../Json.h"
24 #include "../KeyFrame.h"
25 #include "../Enums.h"
26 #include "STFT.h"
27 
28 namespace juce {
29  namespace dsp {
30  class FFT;
31  }
32 }
33 
34 namespace openshot
35 {
36  class Frame;
41  class Whisperization : public EffectBase
42  {
43  private:
45  void init_effect_details();
46 
47  public:
51 
54 
59 
60  std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override {
61  return GetFrame(std::make_shared<openshot::Frame>(), frame_number);
62  }
63 
64  std::shared_ptr<openshot::Frame>
65  GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
66 
67  // Get and Set JSON methods
68  std::string Json() const override;
69  void SetJson(const std::string value) override;
70  Json::Value JsonValue() const override;
71  void SetJsonValue(const Json::Value root) override;
72 
73  std::string PropertiesJSON(int64_t requested_frame) const override;
74 
75 
76  class WhisperizationEffect : public STFT
77  {
78  public:
79  WhisperizationEffect(Whisperization& p) : parent (p) { }
80 
81  private:
82  void modification(const int channel) override;
83 
84  Whisperization &parent;
85  };
86 
87  std::recursive_mutex mutex;
89  std::unique_ptr<juce::dsp::FFT> fft;
90  };
91 
92 }
93 
94 #endif
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:54
This class adds a whisperization effect into the audio.
std::unique_ptr< juce::dsp::FFT > fft
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Whisperization()
Default constructor.
std::string Json() const override
Generate JSON string of this object.
openshot::WindowType window_type
WhisperizationEffect stft
std::recursive_mutex mutex
Json::Value JsonValue() const override
Generate Json::Value for this object.
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...
std::string PropertiesJSON(int64_t requested_frame) const override
void SetJson(const std::string value) override
Load JSON string into this object.
openshot::FFTSize fft_size
openshot::HopSize hop_size
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:29
FFTSize
This enumeration determines the FFT size.
Definition: Enums.h:92
HopSize
This enumeration determines the hop size.
Definition: Enums.h:105
WindowType
This enumeration determines the window type.
Definition: Enums.h:112