OpenShot Library | libopenshot  0.5.0
Public Member Functions | List of all members
openshot::AudioWaveformer Class Reference

This class is used to extra audio data used for generating waveforms. More...

#include <AudioWaveformer.h>

Public Member Functions

AudioWaveformData ApplyKeyframes (const AudioWaveformData &base, const openshot::Keyframe *time_keyframe, const openshot::Keyframe *volume_keyframe, const openshot::Fraction &project_fps, const openshot::Fraction &source_fps, int source_channels, int num_per_second, int channel, bool normalize)
 Apply time and volume keyframes to an existing waveform data set. More...
 
 AudioWaveformer (ReaderBase *reader)
 Default constructor. More...
 
AudioWaveformData ExtractSamples (const std::string &path, const openshot::Keyframe *time_keyframe, const openshot::Keyframe *volume_keyframe, const openshot::Fraction &project_fps, int channel, int num_per_second, bool normalize)
 Convenience: extract then apply keyframes in one step from a file path. More...
 
AudioWaveformData ExtractSamples (const std::string &path, int channel, int num_per_second, bool normalize)
 Extract audio samples from a media file path (audio-only fast path) More...
 
AudioWaveformData ExtractSamples (int channel, int num_per_second, bool normalize)
 Extract audio samples from any ReaderBase class (legacy overload, now delegates to audio-only path) More...
 
 ~AudioWaveformer ()
 Destructor. More...
 

Detailed Description

This class is used to extra audio data used for generating waveforms.

Pass in a ReaderBase* with audio data, and this class will iterate the reader, and sample down the dataset to a much smaller set - more useful for generating waveforms. For example, take 44100 samples per second, and reduce it to 20 "max" or "average" samples per second - much easier to graph.

Definition at line 83 of file AudioWaveformer.h.

Constructor & Destructor Documentation

◆ AudioWaveformer()

AudioWaveformer::AudioWaveformer ( ReaderBase reader)

Default constructor.

Definition at line 35 of file AudioWaveformer.cpp.

◆ ~AudioWaveformer()

AudioWaveformer::~AudioWaveformer ( )

Destructor.

Definition at line 45 of file AudioWaveformer.cpp.

Member Function Documentation

◆ ApplyKeyframes()

AudioWaveformData AudioWaveformer::ApplyKeyframes ( const AudioWaveformData base,
const openshot::Keyframe time_keyframe,
const openshot::Keyframe volume_keyframe,
const openshot::Fraction project_fps,
const openshot::Fraction source_fps,
int  source_channels,
int  num_per_second,
int  channel,
bool  normalize 
)

Apply time and volume keyframes to an existing waveform data set.

Definition at line 114 of file AudioWaveformer.cpp.

Referenced by ExtractSamples().

◆ ExtractSamples() [1/3]

AudioWaveformData AudioWaveformer::ExtractSamples ( const std::string &  path,
const openshot::Keyframe time_keyframe,
const openshot::Keyframe volume_keyframe,
const openshot::Fraction project_fps,
int  channel,
int  num_per_second,
bool  normalize 
)

Convenience: extract then apply keyframes in one step from a file path.

Definition at line 96 of file AudioWaveformer.cpp.

◆ ExtractSamples() [2/3]

AudioWaveformData AudioWaveformer::ExtractSamples ( const std::string &  path,
int  channel,
int  num_per_second,
bool  normalize 
)

Extract audio samples from a media file path (audio-only fast path)

Definition at line 84 of file AudioWaveformer.cpp.

◆ ExtractSamples() [3/3]

AudioWaveformData AudioWaveformer::ExtractSamples ( int  channel,
int  num_per_second,
bool  normalize 
)

Extract audio samples from any ReaderBase class (legacy overload, now delegates to audio-only path)

Parameters
channelWhich audio channel should we extract data from (-1 == all channels)
num_per_secondHow many samples per second to return
normalizeShould we scale the data range so the largest value is 1.0

Definition at line 51 of file AudioWaveformer.cpp.


The documentation for this class was generated from the following files: