Audaspace 1.5.0
A high level audio library.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ChannelMapperReader Class Reference

This class maps a sound source's channels to a specific output channel count. More...

#include <ChannelMapperReader.h>

Inheritance diagram for ChannelMapperReader:
Inheritance graph
[legend]

Public Member Functions

 ChannelMapperReader (std::shared_ptr< IReader > reader, Channels channels)
 Creates a channel mapper reader.
 
 ~ChannelMapperReader ()
 Destroys the reader.
 
Channels getSourceChannels () const
 Returns the channel configuration of the source reader.
 
Channels getChannels () const
 Returns the target channel configuration.
 
void setChannels (Channels channels)
 Sets the requested channel output count.
 
float getMapping (int source, int target)
 Returns the mapping of the source channel to the target channel.
 
void setMonoAngle (float angle)
 Sets the angle for mono sources.
 
virtual Specs getSpecs () const
 Returns the specification of the reader.
 
virtual void read (int &length, bool &eos, sample_t *buffer)
 Request to read the next length samples out of the source.
 
- Public Member Functions inherited from EffectReader
 EffectReader (std::shared_ptr< IReader > reader)
 Creates a new effect reader.
 
virtual ~EffectReader ()
 Destroys the reader.
 
virtual bool isSeekable () const
 Tells whether the source provides seeking functionality or not.
 
virtual void seek (int position)
 Seeks to a specific position in the source.
 
virtual int getLength () const
 Returns an approximated length of the source in samples.
 
virtual int getPosition () const
 Returns the position of the source as a sample count value.
 
- Public Member Functions inherited from IReader
virtual ~IReader ()
 Destroys the reader.
 

Additional Inherited Members

- Protected Attributes inherited from EffectReader
std::shared_ptr< IReaderm_reader
 The reader to read from.
 

Detailed Description

This class maps a sound source's channels to a specific output channel count.

Note
The input sample format must be float.

Constructor & Destructor Documentation

◆ ChannelMapperReader()

ChannelMapperReader::ChannelMapperReader ( std::shared_ptr< IReader > reader,
Channels channels )

Creates a channel mapper reader.

Parameters
readerThe reader to map.
channelsThe target channel count this reader should map to.

Member Function Documentation

◆ getChannels()

Channels ChannelMapperReader::getChannels ( ) const

Returns the target channel configuration.

Equals getSpecs().channels.

Returns
The target channel configuration.

◆ getMapping()

float ChannelMapperReader::getMapping ( int source,
int target )

Returns the mapping of the source channel to the target channel.

Parameters
sourceThe number of the source channel. Should be in the range [0, source channels).
targetThe number of the target channel. Should be in the range [0, target channels).
Returns
The mapping value which should be between 0.0 and 1.0. If source or target are out of range, NaN is returned.

◆ getSourceChannels()

Channels ChannelMapperReader::getSourceChannels ( ) const

Returns the channel configuration of the source reader.

Returns
The channel configuration of the reader.

◆ getSpecs()

virtual Specs ChannelMapperReader::getSpecs ( ) const
virtual

Returns the specification of the reader.

Returns
The Specs structure.

Reimplemented from EffectReader.

◆ read()

virtual void ChannelMapperReader::read ( int & length,
bool & eos,
sample_t * buffer )
virtual

Request to read the next length samples out of the source.

The buffer supplied has the needed size.

Parameters
[in,out]lengthThe count of samples that should be read. Shall contain the real count of samples after reading, in case there were only fewer samples available. A smaller value also indicates the end of the reader.
[out]eosEnd of stream, whether the end is reached or not.
[in]bufferThe pointer to the buffer to read into.

Reimplemented from EffectReader.

◆ setChannels()

void ChannelMapperReader::setChannels ( Channels channels)

Sets the requested channel output count.

Parameters
channelsThe channel output count.

◆ setMonoAngle()

void ChannelMapperReader::setMonoAngle ( float angle)

Sets the angle for mono sources.

Parameters
angleThe angle for mono sources.

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