SDL_audiolib 0.0.0
An audio decoding, resampling and mixing library
Aulib::Decoder Class Referenceabstract

Abstract base class for audio decoders. More...

#include <Decoder.h>

Inheritance diagram for Aulib::Decoder:
Aulib::DecoderAdlmidi Aulib::DecoderBassmidi Aulib::DecoderDrflac Aulib::DecoderDrmp3 Aulib::DecoderDrwav Aulib::DecoderFlac Aulib::DecoderFluidsynth Aulib::DecoderModplug Aulib::DecoderMpg123 Aulib::DecoderMusepack Aulib::DecoderOpenmpt Aulib::DecoderOpus Aulib::DecoderSndfile Aulib::DecoderVorbis Aulib::DecoderWildmidi Aulib::DecoderXmp

Public Member Functions

 Decoder ()
 
virtual ~Decoder ()
 
 Decoder (const Decoder &)=delete
 
auto operator= (const Decoder &) -> Decoder &=delete
 
auto isOpen () const -> bool
 
auto decode (float buf[], int len, bool &callAgain) -> int
 
virtual auto open (SDL_RWops *rwops) -> bool=0
 
virtual auto getChannels () const -> int=0
 
virtual auto getRate () const -> int=0
 
virtual auto rewind () -> bool=0
 
virtual auto duration () const -> std::chrono::microseconds=0
 
virtual auto seekToTime (std::chrono::microseconds pos) -> bool=0
 

Static Public Member Functions

template<class... Decoders>
static auto decoderFor (const std::string &filename) -> std::unique_ptr< Decoder >
 Find and return an instance of the first decoder that can open the specified file. More...
 
template<class... Decoders>
static auto decoderFor (SDL_RWops *rwops) -> std::unique_ptr< Decoder >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
static auto decoderFor (const std::string &filename) -> std::unique_ptr< Decoder >
 Find and return an instance of the first decoder that can open the specified file. More...
 
static auto decoderFor (SDL_RWops *rwops) -> std::unique_ptr< Decoder >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 

Protected Member Functions

void setIsOpen (bool f)
 
virtual auto doDecoding (float buf[], int len, bool &callAgain) -> int=0
 

Detailed Description

Abstract base class for audio decoders.

Constructor & Destructor Documentation

◆ Decoder() [1/2]

Aulib::Decoder::Decoder ( )

◆ ~Decoder()

virtual Aulib::Decoder::~Decoder ( )
virtual

◆ Decoder() [2/2]

Aulib::Decoder::Decoder ( const Decoder )
delete

Member Function Documentation

◆ decode()

auto Aulib::Decoder::decode ( float  buf[],
int  len,
bool &  callAgain 
) -> int

◆ decoderFor() [1/4]

template<class... Decoders>
auto Aulib::Decoder::decoderFor ( const std::string &  filename) -> std::unique_ptr<Decoder>
inlinestatic

Find and return an instance of the first decoder that can open the specified file.

Only the specified decoder types will be tried.

Returns
A suitable decoder or nullptr if none of the decoders can open the file.

◆ decoderFor() [2/4]

static auto Aulib::Decoder::decoderFor ( const std::string &  filename) -> std::unique_ptr< Decoder >
static

Find and return an instance of the first decoder that can open the specified file.

All decoders known by SDL_Audiolib will be tried. If you want to try your own decoders or limit the list of tried decoders, then use the templated version of this function instead.

Returns
A suitable decoder or nullptr if none of the decoders can open the file.

◆ decoderFor() [3/4]

template<class... Decoders>
auto Aulib::Decoder::decoderFor ( SDL_RWops *  rwops) -> std::unique_ptr<Decoder>
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ decoderFor() [4/4]

static auto Aulib::Decoder::decoderFor ( SDL_RWops *  rwops) -> std::unique_ptr< Decoder >
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ doDecoding()

◆ duration()

◆ getChannels()

◆ getRate()

◆ isOpen()

auto Aulib::Decoder::isOpen ( ) const -> bool

◆ open()

◆ operator=()

auto Aulib::Decoder::operator= ( const Decoder ) -> Decoder &=delete
delete

◆ rewind()

◆ seekToTime()

◆ setIsOpen()

void Aulib::Decoder::setIsOpen ( bool  f)
protected