Ardour  9.0-pre0-582-g084a23a80d
AudioGrapher::SampleFormatConverter< TOut > Class Template Reference

#include <sample_format_converter.h>

Inheritance diagram for AudioGrapher::SampleFormatConverter< TOut >:
[legend]

Public Member Functions

 SampleFormatConverter (ChannelCount channels)
 
 ~SampleFormatConverter ()
 
void init (samplecnt_t max_samples, int type, int data_width)
 
void set_clip_floats (bool yn)
 Set whether or not clipping to [-1.0, 1.0] should occur when TOut = float. Clipping is off by default. More...
 
void process (ProcessContext< float > const &c_in)
 Processes data without modifying it. More...
 
void process (ProcessContext< float > &c_in)
 This version is only different in the case when TOut = float, and float clipping is on. More...
 
- Public Member Functions inherited from AudioGrapher::Sink< float >
virtual ~Sink ()
 
- Public Member Functions inherited from AudioGrapher::ListedSource< TOut >
void add_output (typename Source< TOut >::SinkPtr output)
 
void clear_outputs ()
 Removes all outputs added. More...
 
void remove_output (typename Source< TOut >::SinkPtr output)
 
- Public Member Functions inherited from AudioGrapher::Source< T >
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...
 

Private Member Functions

void reset ()
 
void init_common (samplecnt_t max_samples)
 
void check_sample_and_channel_count (samplecnt_t samples, ChannelCount channels_)
 

Private Attributes

ChannelCount channels
 
GDither dither
 
samplecnt_t data_out_size
 
TOut * data_out
 
bool clip_floats
 

Additional Inherited Members

- Public Types inherited from AudioGrapher::Source< T >
typedef std::shared_ptr< Sink< T > > SinkPtr
 
- Protected Types inherited from AudioGrapher::ListedSource< TOut >
typedef std::list< typename Source< TOut >::SinkPtrSinkList
 
- Protected Member Functions inherited from AudioGrapher::ListedSource< TOut >
void output (ProcessContext< TOut > const &c)
 Helper for derived classes. More...
 
void output (ProcessContext< TOut > &c)
 
bool output_size_is_one ()
 
- Protected Member Functions inherited from AudioGrapher::Throwing< L >
 Throwing ()
 
bool throw_level (ThrowLevel level)
 
- Protected Attributes inherited from AudioGrapher::ListedSource< TOut >
SinkList outputs
 

Detailed Description

template<typename TOut>
class AudioGrapher::SampleFormatConverter< TOut >

Sample format converter that does dithering. This class can only convert floats to either float, int32_t, int16_t, or uint8_t

Definition at line 25 of file sample_format_converter.h.

Constructor & Destructor Documentation

◆ SampleFormatConverter()

template<typename TOut >
AudioGrapher::SampleFormatConverter< TOut >::SampleFormatConverter ( ChannelCount  channels)

Constructor

Parameters
channelsnumber of channels in stream

◆ ~SampleFormatConverter()

template<typename TOut >
AudioGrapher::SampleFormatConverter< TOut >::~SampleFormatConverter ( )

Member Function Documentation

◆ check_sample_and_channel_count()

template<typename TOut >
void AudioGrapher::SampleFormatConverter< TOut >::check_sample_and_channel_count ( samplecnt_t  samples,
ChannelCount  channels_ 
)
private

◆ init()

template<typename TOut >
void AudioGrapher::SampleFormatConverter< TOut >::init ( samplecnt_t  max_samples,
int  type,
int  data_width 
)

Initialize and allocate buffers for processing.

Parameters
max_samplesmaximum number of samples that is allowed to be used in calls to process()
typedither type from DitherType
data_widthdata with in bits
Note
If the non-const version of process() is used with floats, there is no need to call this function.

◆ init_common()

template<typename TOut >
void AudioGrapher::SampleFormatConverter< TOut >::init_common ( samplecnt_t  max_samples)
private

◆ process() [1/2]

template<typename TOut >
void AudioGrapher::SampleFormatConverter< TOut >::process ( ProcessContext< float > &  c_in)
virtual

This version is only different in the case when TOut = float, and float clipping is on.

Reimplemented from AudioGrapher::Sink< float >.

◆ process() [2/2]

template<typename TOut >
void AudioGrapher::SampleFormatConverter< TOut >::process ( ProcessContext< float > const &  c_in)
virtual

Processes data without modifying it.

Implements AudioGrapher::Sink< float >.

◆ reset()

template<typename TOut >
void AudioGrapher::SampleFormatConverter< TOut >::reset ( )
private

◆ set_clip_floats()

template<typename TOut >
void AudioGrapher::SampleFormatConverter< TOut >::set_clip_floats ( bool  yn)
inline

Set whether or not clipping to [-1.0, 1.0] should occur when TOut = float. Clipping is off by default.

Definition at line 47 of file sample_format_converter.h.

Member Data Documentation

◆ channels

template<typename TOut >
ChannelCount AudioGrapher::SampleFormatConverter< TOut >::channels
private

Definition at line 60 of file sample_format_converter.h.

◆ clip_floats

template<typename TOut >
bool AudioGrapher::SampleFormatConverter< TOut >::clip_floats
private

Definition at line 65 of file sample_format_converter.h.

◆ data_out

template<typename TOut >
TOut* AudioGrapher::SampleFormatConverter< TOut >::data_out
private

Definition at line 63 of file sample_format_converter.h.

◆ data_out_size

template<typename TOut >
samplecnt_t AudioGrapher::SampleFormatConverter< TOut >::data_out_size
private

Definition at line 62 of file sample_format_converter.h.

◆ dither

template<typename TOut >
GDither AudioGrapher::SampleFormatConverter< TOut >::dither
private

Definition at line 61 of file sample_format_converter.h.


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