SF2cute
0.1
Modern C++ Library for SoundFont 2
|
The SFPreset class represents a preset. More...
#include <preset.hpp>
Public Member Functions | |
SFPreset () | |
Constructs a new empty preset. | |
SFPreset (std::string name) | |
Constructs a new empty SFPreset using the specified name. More... | |
SFPreset (std::string name, uint16_t preset_number, uint16_t bank) | |
Constructs a new SFPreset using the specified name and preset numbers. More... | |
SFPreset (std::string name, uint16_t preset_number, uint16_t bank, std::vector< SFPresetZone > zones) | |
Constructs a new SFPreset using the specified name, preset numbers and zones. More... | |
SFPreset (std::string name, uint16_t preset_number, uint16_t bank, std::vector< SFPresetZone > zones, SFPresetZone global_zone) | |
Constructs a new SFPreset using the specified name, preset numbers, zones and global zone. More... | |
SFPreset (const SFPreset &origin) | |
Constructs a new copy of specified SFPreset. More... | |
SFPreset & | operator= (const SFPreset &origin) |
Copy-assigns a new value to the SFPreset, replacing its current contents. More... | |
SFPreset (SFPreset &&origin) noexcept | |
Acquires the contents of specified SFPreset. More... | |
SFPreset & | operator= (SFPreset &&origin) noexcept |
Move-assigns a new value to the SFPreset, replacing its current contents. More... | |
~SFPreset ()=default | |
Destructs the SFPreset. | |
const std::string & | name () const noexcept |
Returns the name of this preset. More... | |
void | set_name (std::string name) |
Sets the name of this preset. More... | |
uint16_t | preset_number () const noexcept |
Returns the preset number. More... | |
void | set_preset_number (uint16_t preset_number) |
Sets the preset number. More... | |
uint16_t | bank () const noexcept |
Returns the bank number. More... | |
void | set_bank (uint16_t bank) |
Sets the bank number. More... | |
uint32_t | library () const noexcept |
Returns the library. More... | |
void | set_library (uint32_t library) |
Sets the library. More... | |
uint32_t | genre () const noexcept |
Returns the genre. More... | |
void | set_genre (uint32_t genre) |
Sets the genre. More... | |
uint32_t | morphology () const noexcept |
Returns the morphology. More... | |
void | set_morphology (uint32_t morphology) |
Sets the morphology. More... | |
const std::vector< std::unique_ptr< SFPresetZone > > & | zones () const noexcept |
Returns the list of preset zones. More... | |
void | AddZone (SFPresetZone zone) |
Adds a preset zone to the preset. More... | |
void | RemoveZone (std::vector< std::unique_ptr< SFPresetZone >>::const_iterator position) |
Removes a preset zone from the preset. More... | |
void | RemoveZone (std::vector< std::unique_ptr< SFPresetZone >>::const_iterator first, std::vector< std::unique_ptr< SFPresetZone >>::const_iterator last) |
Removes preset zones from the preset. More... | |
void | RemoveZoneIf (std::function< bool(const std::unique_ptr< SFPresetZone > &)> predicate) |
Removes preset zones from the preset. More... | |
void | ClearZones () noexcept |
Removes all of the preset zones. | |
bool | has_global_zone () const noexcept |
Returns true if the preset has a global zone. More... | |
SFPresetZone & | global_zone () const noexcept |
Returns the global zone. More... | |
void | set_global_zone (SFPresetZone global_zone) |
Sets the global zone. More... | |
void | reset_global_zone () noexcept |
Resets the global zone. | |
bool | has_parent_file () const noexcept |
Returns true if the preset has a parent file. More... | |
SoundFont & | parent_file () const noexcept |
Returns the parent file. More... | |
Static Public Member Functions | |
template<typename... Args> | |
static std::shared_ptr< SFPreset > | New (Args &&...args) |
Constructs a new SFPreset. More... | |
Static Public Attributes | |
static constexpr uint16_t | kPercussionBank = 128 |
The bank number for General MIDI drums. | |
static constexpr std::string::size_type | kMaxNameLength = 20 - 1 |
Maximum length of preset name (excluding the terminator byte), in terms of bytes. | |
Friends | |
class | SFPresetZone |
class | SoundFont |
The SFPreset class represents a preset.
|
explicit |
Constructs a new empty SFPreset using the specified name.
name | the name of the preset. |
sf2cute::SFPreset::SFPreset | ( | std::string | name, |
uint16_t | preset_number, | ||
uint16_t | bank | ||
) |
Constructs a new SFPreset using the specified name and preset numbers.
name | the name of the preset. |
preset_number | the preset number. |
bank | the bank number. |
sf2cute::SFPreset::SFPreset | ( | std::string | name, |
uint16_t | preset_number, | ||
uint16_t | bank, | ||
std::vector< SFPresetZone > | zones | ||
) |
Constructs a new SFPreset using the specified name, preset numbers and zones.
name | the name of the preset. |
preset_number | the preset number. |
bank | the bank number. |
zones | a collection of preset zones to be assigned to the preset. |
sf2cute::SFPreset::SFPreset | ( | std::string | name, |
uint16_t | preset_number, | ||
uint16_t | bank, | ||
std::vector< SFPresetZone > | zones, | ||
SFPresetZone | global_zone | ||
) |
Constructs a new SFPreset using the specified name, preset numbers, zones and global zone.
name | the name of the preset. |
preset_number | the preset number. |
bank | the bank number. |
zones | a collection of preset zones to be assigned to the preset. |
global_zone | a global zone to be assigned to the preset. |
sf2cute::SFPreset::SFPreset | ( | const SFPreset & | origin | ) |
|
noexcept |
void sf2cute::SFPreset::AddZone | ( | SFPresetZone | zone | ) |
Adds a preset zone to the preset.
zone | a preset zone to be assigned to the preset. |
std::invalid_argument | Preset zone has already been owned by another preset. |
|
noexcept |
Returns the bank number.
|
noexcept |
Returns the genre.
|
noexcept |
Returns the global zone.
|
noexcept |
Returns true if the preset has a global zone.
|
noexcept |
Returns true if the preset has a parent file.
|
noexcept |
Returns the library.
|
noexcept |
Returns the morphology.
|
noexcept |
Returns the name of this preset.
|
inlinestatic |
|
noexcept |
Returns the parent file.
|
noexcept |
Returns the preset number.
void sf2cute::SFPreset::RemoveZone | ( | std::vector< std::unique_ptr< SFPresetZone >>::const_iterator | position | ) |
Removes a preset zone from the preset.
position | the preset zone to remove. |
void sf2cute::SFPreset::RemoveZone | ( | std::vector< std::unique_ptr< SFPresetZone >>::const_iterator | first, |
std::vector< std::unique_ptr< SFPresetZone >>::const_iterator | last | ||
) |
Removes preset zones from the preset.
first | the first preset zone to remove. |
last | the last preset zone to remove. |
void sf2cute::SFPreset::RemoveZoneIf | ( | std::function< bool(const std::unique_ptr< SFPresetZone > &)> | predicate | ) |
Removes preset zones from the preset.
predicate | unary predicate which returns true if the preset zone should be removed. |
void sf2cute::SFPreset::set_bank | ( | uint16_t | bank | ) |
Sets the bank number.
bank | the bank number. |
void sf2cute::SFPreset::set_genre | ( | uint32_t | genre | ) |
Sets the genre.
genre | the genre. |
void sf2cute::SFPreset::set_global_zone | ( | SFPresetZone | global_zone | ) |
Sets the global zone.
global_zone | the global zone. |
std::invalid_argument | Preset zone has already been owned by another preset. |
void sf2cute::SFPreset::set_library | ( | uint32_t | library | ) |
Sets the library.
library | the library. |
void sf2cute::SFPreset::set_morphology | ( | uint32_t | morphology | ) |
Sets the morphology.
morphology | the morphology. |
void sf2cute::SFPreset::set_name | ( | std::string | name | ) |
Sets the name of this preset.
name | the name of this preset. |
void sf2cute::SFPreset::set_preset_number | ( | uint16_t | preset_number | ) |
Sets the preset number.
preset_number | the preset number. |
|
noexcept |
Returns the list of preset zones.