OpenShot Library | libopenshot
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
BeatSync.h
Go to the documentation of this file.
1
8
9
// Copyright (c) 2008-2026 OpenShot Studios, LLC
10
//
11
// SPDX-License-Identifier: LGPL-3.0-or-later
12
13
#ifndef OPENSHOT_BEAT_SYNC_EFFECT_H
14
#define OPENSHOT_BEAT_SYNC_EFFECT_H
15
16
#include "
../AnimatedCurve.h
"
17
#include "
../Color.h
"
18
#include "
../EffectBase.h
"
19
#include "
../Frame.h
"
20
#include "
../Json.h
"
21
#include "
../KeyFrame.h
"
22
23
#include <memory>
24
#include <string>
25
26
namespace
openshot
27
{
28
class
BeatSync
:
public
EffectBase
29
{
30
private
:
31
void
init_effect_details();
32
float
envelope_;
// persistent IIR envelope state
33
int64_t last_frame_;
// detects seeks so we can reset envelope
34
35
public
:
36
Color
low_color
;
// generated color at minimum response
37
Color
high_color
;
// generated color at maximum response
38
Keyframe
intensity
;
// audio gain multiplier (0.0–10.0)
39
Keyframe
threshold
;
// energy floor below which nothing happens (0.0–1.0)
40
Keyframe
attack_ms
;
// envelope rise time in milliseconds
41
Keyframe
decay_ms
;
// envelope fall time in milliseconds
42
Keyframe
frequency_low
;
// normalized frequency floor (0=20Hz, 1=20kHz)
43
Keyframe
frequency_high
;
// normalized frequency ceiling (0=20Hz, 1=20kHz)
44
bool
invert
;
// flip: silence = max effect, loud = no effect
45
AnimatedCurve
response_curve
;
// maps normalized audio response to color blend
46
47
BeatSync
();
48
BeatSync
(
Color
color,
Keyframe
intensity
);
49
50
std::shared_ptr<openshot::Frame>
GetFrame
(int64_t frame_number)
override
{
return
GetFrame
(std::make_shared<openshot::Frame>(), frame_number); }
51
std::shared_ptr<openshot::Frame>
GetFrame
(std::shared_ptr<openshot::Frame> frame, int64_t frame_number)
override
;
52
53
std::string
Json
()
const override
;
54
void
SetJson
(
const
std::string value)
override
;
55
Json::Value
JsonValue
()
const override
;
56
void
SetJsonValue
(
const
Json::Value root)
override
;
57
std::string
PropertiesJSON
(int64_t requested_frame)
const override
;
58
};
59
}
60
61
#endif
AnimatedCurve.h
Header file for AnimatedCurve classes.
Color.h
Header file for Color class.
EffectBase.h
Header file for EffectBase class.
Frame.h
Header file for Frame class.
Json.h
Header file for JSON class.
KeyFrame.h
Header file for the Keyframe class.
openshot::AnimatedCurve
Definition
AnimatedCurve.h:49
openshot::BeatSync::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition
BeatSync.cpp:255
openshot::BeatSync::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition
BeatSync.cpp:240
openshot::BeatSync::BeatSync
BeatSync()
Definition
BeatSync.cpp:111
openshot::BeatSync::frequency_low
Keyframe frequency_low
Definition
BeatSync.h:42
openshot::BeatSync::invert
bool invert
Definition
BeatSync.h:44
openshot::BeatSync::low_color
Color low_color
Definition
BeatSync.h:36
openshot::BeatSync::frequency_high
Keyframe frequency_high
Definition
BeatSync.h:43
openshot::BeatSync::intensity
Keyframe intensity
Definition
BeatSync.h:38
openshot::BeatSync::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition
BeatSync.cpp:231
openshot::BeatSync::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
BeatSync.h:50
openshot::BeatSync::attack_ms
Keyframe attack_ms
Definition
BeatSync.h:40
openshot::BeatSync::threshold
Keyframe threshold
Definition
BeatSync.h:39
openshot::BeatSync::response_curve
AnimatedCurve response_curve
Definition
BeatSync.h:45
openshot::BeatSync::high_color
Color high_color
Definition
BeatSync.h:37
openshot::BeatSync::Json
std::string Json() const override
Generate JSON string of this object.
Definition
BeatSync.cpp:211
openshot::BeatSync::decay_ms
Keyframe decay_ms
Definition
BeatSync.h:41
openshot::BeatSync::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition
BeatSync.cpp:215
openshot::Color
This class represents a color (used on the timeline and clips).
Definition
Color.h:27
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition
EffectBase.h:57
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
This namespace is the default namespace for all code in the openshot library.
Definition
AnimatedCurve.h:24
effects
BeatSync.h
Generated by
1.17.0