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

FluidSynth decoder. More...

#include <DecoderFluidsynth.h>

Inheritance diagram for Aulib::DecoderFluidsynth:
Aulib::Decoder

Public Member Functions

 DecoderFluidsynth ()
 
 ~DecoderFluidsynth () override
 
auto loadSoundfont (SDL_RWops *rwops) -> bool
 Load a soundfont. More...
 
auto loadSoundfont (const std::string &filename) -> bool
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
auto gain () const -> float
 Get the current master gain. More...
 
void setGain (float gain)
 Set the synthesizer gain. More...
 
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
 

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
 

Additional Inherited Members

- 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...
 

Detailed Description

FluidSynth decoder.

Constructor & Destructor Documentation

◆ DecoderFluidsynth()

Aulib::DecoderFluidsynth::DecoderFluidsynth ( )

◆ ~DecoderFluidsynth()

Aulib::DecoderFluidsynth::~DecoderFluidsynth ( )
override

Member Function Documentation

◆ doDecoding()

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

Implements Aulib::Decoder.

◆ duration()

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

Implements Aulib::Decoder.

◆ gain()

auto Aulib::DecoderFluidsynth::gain ( ) const -> float

Get the current master gain.

◆ getChannels()

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

Implements Aulib::Decoder.

◆ getRate()

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

Implements Aulib::Decoder.

◆ loadSoundfont() [1/2]

auto Aulib::DecoderFluidsynth::loadSoundfont ( const std::string &  filename) -> bool

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

◆ loadSoundfont() [2/2]

auto Aulib::DecoderFluidsynth::loadSoundfont ( SDL_RWops *  rwops) -> bool

Load a soundfont.

Ownership of the rwops is transfered to the decoder.

Returns
true on success, false if an error occurred.

◆ open()

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

Implements Aulib::Decoder.

◆ rewind()

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

Implements Aulib::Decoder.

◆ seekToTime()

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

Implements Aulib::Decoder.

◆ setGain()

void Aulib::DecoderFluidsynth::setGain ( float  gain)

Set the synthesizer gain.

Lowering the gain helps reduce clipping in overly loud soundfonts. Some soundfonts however might be too quiet and thus need a higher gain.

FluidSynth's default is 0.2. Can be between 0 and 10.

Parameters
gainGain level.