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
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:53
openshot::Whisperization::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Whisperization.cpp:147
openshot::Whisperization::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Whisperization.cpp:100
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Whisperization::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Whisperization.cpp:131
openshot::Whisperization::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Whisperization.cpp:114
openshot::Whisperization::fft
std::unique_ptr< juce::dsp::FFT > fft
Definition: Whisperization.h:89
openshot::Whisperization::mutex
std::recursive_mutex mutex
Definition: Whisperization.h:87
openshot::Whisperization
This class adds a whisperization effect into the audio.
Definition: Whisperization.h:41
openshot::Whisperization::Json
std::string Json() const override
Generate JSON string of this object.
Definition: Whisperization.cpp:93
openshot::Whisperization::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: Whisperization.h:60
juce
Definition: Robotization.h:29
openshot::FFTSize
FFTSize
This enumeration determines the FFT size.
Definition: Enums.h:91
openshot::Whisperization::window_type
openshot::WindowType window_type
Definition: Whisperization.h:50
openshot::Whisperization::Whisperization
Whisperization()
Default constructor.
Definition: Whisperization.cpp:20
openshot::Whisperization::WhisperizationEffect
Definition: Whisperization.h:76
openshot::STFT
Definition: STFT.h:21
openshot::Whisperization::hop_size
openshot::HopSize hop_size
Definition: Whisperization.h:49
openshot::Whisperization::fft_size
openshot::FFTSize fft_size
Definition: Whisperization.h:48
openshot::HopSize
HopSize
This enumeration determines the hop size.
Definition: Enums.h:105
openshot::Whisperization::stft
WhisperizationEffect stft
Definition: Whisperization.h:88
openshot::Whisperization::WhisperizationEffect::WhisperizationEffect
WhisperizationEffect(Whisperization &p)
Definition: Whisperization.h:79
STFT.h
openshot::WindowType
WindowType
This enumeration determines the window type.
Definition: Enums.h:112