SDL_audiolib 0.0.0
An audio decoding, resampling and mixing library
|
libADLMIDI decoder. More...
#include <DecoderAdlmidi.h>
Public Types | |
enum class | Emulator { Nuked , Nuked_174 , Dosbox , Opal , Java } |
Public Member Functions | |
DecoderAdlmidi () | |
~DecoderAdlmidi () override | |
auto | setEmulator (Emulator emulator) -> bool |
Set OPL emulator. More... | |
auto | setChipAmount (int chip_amount) -> bool |
Set amount of emulated OPL chips. More... | |
auto | loadBank (SDL_RWops *rwops) -> bool |
Load and set an FM patch bank. More... | |
auto | loadBank (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 | loadEmbeddedBank (int bank_number) -> bool |
Load and set one of the FM patch banks embedded in libADLMIDI. 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 |
Static Public Member Functions | |
static auto | getEmbeddedBanks () -> const std::vector< std::string > & |
Get a list of all libADLMIDI embedded FM patch banks. 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 |
libADLMIDI decoder.
This decoder always generates samples at 49716Hz, the native rate of the OPL synths provided by libADLMIDI.
|
strong |
Aulib::DecoderAdlmidi::DecoderAdlmidi | ( | ) |
|
override |
|
overrideprotectedvirtual |
Implements Aulib::Decoder.
|
overridevirtual |
Implements Aulib::Decoder.
|
overridevirtual |
Implements Aulib::Decoder.
|
static |
Get a list of all libADLMIDI embedded FM patch banks.
If libADLMIDI was built without embedded banks, the list will be empty. To use one of these banks, pass its index to loadEmbeddedBank().
|
overridevirtual |
Implements Aulib::Decoder.
auto Aulib::DecoderAdlmidi::loadBank | ( | 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.
auto Aulib::DecoderAdlmidi::loadBank | ( | SDL_RWops * | rwops | ) | -> bool |
Load and set an FM patch bank.
The data must be in a format that libADLMIDI understands. At the time of this writing, this means WOPL3. If there's an already loaded bank, it will be replaced by the new one. Ownership of the rwops
is transfered to the decoder.
The bank will be set immediately if the decoder is open. Otherwise, it will be set when open() is called.
true
on success, false
otherwise. auto Aulib::DecoderAdlmidi::loadEmbeddedBank | ( | int | bank_number | ) | -> bool |
Load and set one of the FM patch banks embedded in libADLMIDI.
By default, libADLMIDI comes with a set of embedded FM patch banks. These can be disabled when building libADLMIDI, in which case this function will always fail. Use getEmbeddedBanks() to get a list of all embedded banks. If there's an already loaded bank, it will be replaced by the new one.
The bank will be set immediately if the decoder is open. Otherwise, it will be set when open() is called.
true
on success, false
otherwise.
|
overridevirtual |
Implements Aulib::Decoder.
|
overridevirtual |
Implements Aulib::Decoder.
|
overridevirtual |
Implements Aulib::Decoder.
auto Aulib::DecoderAdlmidi::setChipAmount | ( | int | chip_amount | ) | -> bool |
Set amount of emulated OPL chips.
By default, 6 chips will be emulated, which should provide a high enough polyphony without note dropouts with most FM banks. However, the needed chip amount might be higher with some FM banks, in which case you can use a higher amount of chips.
The chip amount will be changed immediately if the decoder is open. Otherwise, it will be changed when open() is called.
true
on success, false
otherwise. auto Aulib::DecoderAdlmidi::setEmulator | ( | Emulator | emulator | ) | -> bool |
Set OPL emulator.
If you don't call this function, libADLMIDI will use whatever emulator it uses by default. Which one that is, is not specified. Note that libADLMIDI might have been built without all of the emulators. Trying to set an emulator that is missing will fail.
The emulator will be set immediately if the decoder is open. Otherwise, it will be set when open() is called.
true
on success, false
otherwise.