Ardour
9.0-pre0-582-g084a23a80d
|
Removes and adds silent samples to beginning and/or end of stream. More...
#include <silence_trimmer.h>
Public Member Functions | |
SilenceTrimmer (samplecnt_t silence_buffer_size_=1024, float thresh_dB=-INFINITY) | |
Constructor,. More... | |
~SilenceTrimmer () | |
void | reset (samplecnt_t silence_buffer_size_=1024) |
void | add_silence_to_beginning (samplecnt_t samples_per_channel) |
void | add_silence_to_end (samplecnt_t samples_per_channel) |
void | set_trim_beginning (bool yn) |
void | set_trim_end (bool yn) |
void | process (ProcessContext< T > const &c) |
Public Member Functions inherited from AudioGrapher::ListedSource< DefaultSampleType > | |
void | add_output (typename Source< DefaultSampleType >::SinkPtr output) |
void | clear_outputs () |
Removes all outputs added. More... | |
void | remove_output (typename Source< DefaultSampleType >::SinkPtr output) |
Public Member Functions inherited from AudioGrapher::Source< DefaultSampleType > | |
virtual | ~Source () |
virtual void | add_output (SinkPtr output)=0 |
Adds an output to this source. All data generated is forwarded to output. More... | |
virtual void | remove_output (SinkPtr output)=0 |
Removes a specific output from this source. More... | |
Public Member Functions inherited from AudioGrapher::Sink< DefaultSampleType > | |
virtual | ~Sink () |
virtual void | process (ProcessContext< DefaultSampleType > const &context)=0 |
virtual void | process (ProcessContext< DefaultSampleType > &context) |
Private Member Functions | |
bool | find_first_non_silent_sample (ProcessContext< T > const &c, samplecnt_t &result_sample) |
bool | find_last_silent_sample_reverse (ProcessContext< T > const &c, samplecnt_t &result_sample) |
void | output_silence_samples (ProcessContext< T > const &c, samplecnt_t &total_samples) |
Private Attributes | |
bool | processed_data |
bool | processing_finished |
bool | trim_beginning |
bool | trim_end |
samplecnt_t | silence_samples |
samplecnt_t | max_output_frames |
samplecnt_t | add_to_beginning |
samplecnt_t | add_to_end |
samplecnt_t | silence_buffer_size |
T * | silence_buffer |
SilenceTester< T > | tester |
Additional Inherited Members | |
Public Types inherited from AudioGrapher::Source< DefaultSampleType > | |
typedef std::shared_ptr< Sink< DefaultSampleType > > | SinkPtr |
Public Types inherited from AudioGrapher::FlagDebuggable< L > | |
typedef FlagField::Flag | Flag |
Protected Types inherited from AudioGrapher::ListedSource< DefaultSampleType > | |
typedef std::list< typename Source< DefaultSampleType >::SinkPtr > | SinkList |
Protected Member Functions inherited from AudioGrapher::ListedSource< DefaultSampleType > | |
void | output (ProcessContext< DefaultSampleType > const &c) |
Helper for derived classes. More... | |
void | output (ProcessContext< DefaultSampleType > &c) |
bool | output_size_is_one () |
Protected Member Functions inherited from AudioGrapher::FlagDebuggable< L > | |
void | add_supported_flag (Flag flag) |
Adds a flag to the set of flags supported. More... | |
template<typename SelfType , typename ContextType > | |
void | check_flags (SelfType &self, ProcessContext< ContextType > context) |
Prints debug output if context contains flags that are not supported by this class. More... | |
Protected Member Functions inherited from AudioGrapher::Debuggable< DebugNone > | |
Debuggable (std::ostream &debug_stream=std::cerr) | |
bool | debug_level (DebugLevel level) |
std::ostream & | debug_stream () |
Protected Member Functions inherited from AudioGrapher::Throwing< L > | |
Throwing () | |
bool | throw_level (ThrowLevel level) |
Protected Attributes inherited from AudioGrapher::ListedSource< DefaultSampleType > | |
SinkList | outputs |
Removes and adds silent samples to beginning and/or end of stream.
Definition at line 38 of file silence_trimmer.h.
|
inline |
|
inline |
Definition at line 56 of file silence_trimmer.h.
|
inline |
Tells that samples_per_channel samples of silence per channel should be added to beginning Needs to be called before starting processing.
RT safe
Definition at line 94 of file silence_trimmer.h.
|
inline |
Tells that samples_per_channel samples of silence per channel should be added to end Needs to be called before end is reached.
RT safe
Definition at line 106 of file silence_trimmer.h.
|
inlineprivate |
Definition at line 256 of file silence_trimmer.h.
|
inlineprivate |
Reverse find the last silent sample index. If the last sample in the buffer is non-silent the index will be one past the end of the buffer and equal to c.samples(). e.g silent_end_samples = c.samples() - result_sample
Definition at line 277 of file silence_trimmer.h.
|
inlineprivate |
Definition at line 294 of file silence_trimmer.h.
|
inline |
Process stream according to current settings. Note that some calls will not produce any output, while others may produce many.
Definition at line 143 of file silence_trimmer.h.
|
inline |
Reset state
Not RT safe Allocates a buffer the size of silence_buffer_size_ This also defines the maximum length of output process context which can be output during long intermediate silence.
Definition at line 66 of file silence_trimmer.h.
|
inline |
Tells whether ot nor silence should be trimmed from the beginning Has to be called before starting processing.
RT safe
Definition at line 118 of file silence_trimmer.h.
|
inline |
Tells whether ot nor silence should be trimmed from the end Has to be called before the is reached.
RT safe
Definition at line 130 of file silence_trimmer.h.
|
private |
Definition at line 320 of file silence_trimmer.h.
|
private |
Definition at line 321 of file silence_trimmer.h.
|
private |
Definition at line 318 of file silence_trimmer.h.
|
private |
Definition at line 311 of file silence_trimmer.h.
|
private |
Definition at line 312 of file silence_trimmer.h.
|
private |
Definition at line 324 of file silence_trimmer.h.
|
private |
Definition at line 323 of file silence_trimmer.h.
|
private |
Definition at line 317 of file silence_trimmer.h.
|
private |
Definition at line 326 of file silence_trimmer.h.
|
private |
Definition at line 314 of file silence_trimmer.h.
|
private |
Definition at line 315 of file silence_trimmer.h.