SDL_audiolib 0.0.0
An audio decoding, resampling and mixing library
Aulib::DecoderWildmidi Class Reference

WildMIDI decoder. More...

#include <DecoderWildmidi.h>

Inheritance diagram for Aulib::DecoderWildmidi:
Aulib::Decoder

Public Member Functions

 DecoderWildmidi ()
 
 ~DecoderWildmidi () override
 
auto open (SDL_RWops *rwops) -> bool override
 
auto getChannels () const -> int override
 
auto getRate () const -> int override
 
auto rewind () -> bool override
 
auto duration () const -> std::chrono::microseconds override
 
auto seekToTime (std::chrono::microseconds pos) -> bool override
 
- Public Member Functions inherited from Aulib::Decoder
 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

static auto init (const std::string &configFile, int rate, bool hqResampling, bool reverb) -> bool
 Initialize the WildMIDI library. More...
 
static void quit ()
 Shut down the WildMIDI library. More...
 
- Static Public Member Functions inherited from Aulib::Decoder
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

auto doDecoding (float buf[], int len, bool &callAgain) -> int override
 
- Protected Member Functions inherited from Aulib::Decoder
void setIsOpen (bool f)
 
virtual auto doDecoding (float buf[], int len, bool &callAgain) -> int=0
 

Detailed Description

WildMIDI decoder.

Note
Before creating any instances of this class, you need to initialize the WildMIDI library by calling the DecoderWildmidi::init() function once.

Constructor & Destructor Documentation

◆ DecoderWildmidi()

Aulib::DecoderWildmidi::DecoderWildmidi ( )

◆ ~DecoderWildmidi()

Aulib::DecoderWildmidi::~DecoderWildmidi ( )
override

Member Function Documentation

◆ doDecoding()

auto Aulib::DecoderWildmidi::doDecoding ( float  buf[],
int  len,
bool &  callAgain 
) -> int
overrideprotectedvirtual

Implements Aulib::Decoder.

◆ duration()

auto Aulib::DecoderWildmidi::duration ( ) const -> std::chrono::microseconds
overridevirtual

Implements Aulib::Decoder.

◆ getChannels()

auto Aulib::DecoderWildmidi::getChannels ( ) const -> int
overridevirtual

Implements Aulib::Decoder.

◆ getRate()

auto Aulib::DecoderWildmidi::getRate ( ) const -> int
overridevirtual

Implements Aulib::Decoder.

◆ init()

static auto Aulib::DecoderWildmidi::init ( const std::string &  configFile,
int  rate,
bool  hqResampling,
bool  reverb 
) -> bool
static

Initialize the WildMIDI library.

This needs to be called before creating any instances of this decoder.

Parameters
configFilePath to the wildmidi.cfg or timidity.cfg configuration file with which to initialize WildMIDI with.
rateInternal WildMIDI sampling rate in Hz. Must be between 11025 and 65000.
hqResamplingPass the WM_MO_ENHANCED_RESAMPLING flag to WildMIDI. By default libWildMidi uses linear interpolation for the resampling of the sound samples. Setting this option enables the library to use a resampling method that attempts to fill in the gaps giving richer sound.
reverbPass the WM_MO_REVERB flag to WildMIDI. libWildMidi has an 8 reflection reverb engine. Use this option to give more depth to the output.
Returns
Return values
trueWildMIDI was initialized sucessfully.
falseWildMIDI could not be initialized.

◆ open()

auto Aulib::DecoderWildmidi::open ( SDL_RWops *  rwops) -> bool
overridevirtual

Implements Aulib::Decoder.

◆ quit()

static void Aulib::DecoderWildmidi::quit ( )
static

Shut down the WildMIDI library.

Shuts down the wildmidi library, resetting data and freeing up memory used by the library.

Once this is called, the library is no longer initialized and DecoderWildmidi::init() will need to be called again.

◆ rewind()

auto Aulib::DecoderWildmidi::rewind ( ) -> bool
overridevirtual

Implements Aulib::Decoder.

◆ seekToTime()

auto Aulib::DecoderWildmidi::seekToTime ( std::chrono::microseconds  pos) -> bool
overridevirtual

Implements Aulib::Decoder.