SF2cute
0.1
Modern C++ Library for SoundFont 2
|
The SFInstrument class represents an instrument. More...
#include <instrument.hpp>
Public Member Functions | |
SFInstrument () | |
Constructs a new empty instrument. | |
SFInstrument (std::string name) | |
Constructs a new empty SFInstrument using the specified name. More... | |
SFInstrument (std::string name, std::vector< SFInstrumentZone > zones) | |
Constructs a new SFInstrument using the specified name and zones. More... | |
SFInstrument (std::string name, std::vector< SFInstrumentZone > zones, SFInstrumentZone global_zone) | |
Constructs a new SFInstrument using the specified name, zones and global zone. More... | |
SFInstrument (const SFInstrument &origin) | |
Constructs a new copy of specified SFInstrument. More... | |
SFInstrument & | operator= (const SFInstrument &origin) |
Copy-assigns a new value to the SFInstrument, replacing its current contents. More... | |
SFInstrument (SFInstrument &&origin) noexcept | |
Acquires the contents of specified SFInstrument. More... | |
SFInstrument & | operator= (SFInstrument &&origin) noexcept |
Move-assigns a new value to the SFInstrument, replacing its current contents. More... | |
~SFInstrument ()=default | |
Destructs the SFInstrument. | |
const std::string & | name () const noexcept |
Returns the name of this instrument. More... | |
void | set_name (std::string name) |
Sets the name of this instrument. More... | |
const std::vector< std::unique_ptr< SFInstrumentZone > > & | zones () const noexcept |
Returns the list of instrument zones. More... | |
void | AddZone (SFInstrumentZone zone) |
Adds an instrument zone to the instrument. More... | |
void | RemoveZone (std::vector< std::unique_ptr< SFInstrumentZone >>::const_iterator position) |
Removes an instrument zone from the instrument. More... | |
void | RemoveZone (std::vector< std::unique_ptr< SFInstrumentZone >>::const_iterator first, std::vector< std::unique_ptr< SFInstrumentZone >>::const_iterator last) |
Removes instrument zones from the instrument. More... | |
void | RemoveZoneIf (std::function< bool(const std::unique_ptr< SFInstrumentZone > &)> predicate) |
Removes instrument zones from the instrument. More... | |
void | ClearZones () noexcept |
Removes all of the instrument zones. | |
bool | has_global_zone () const noexcept |
Returns true if the instrument has a global zone. More... | |
SFInstrumentZone & | global_zone () const noexcept |
Returns the global zone. More... | |
void | set_global_zone (SFInstrumentZone 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 instrument 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< SFInstrument > | New (Args &&...args) |
Constructs a new SFInstrument. More... | |
Static Public Attributes | |
static constexpr std::string::size_type | kMaxNameLength = 20 - 1 |
Maximum length of instrument name (excluding the terminator byte), in terms of bytes. | |
Friends | |
class | SFInstrumentZone |
class | SoundFont |
The SFInstrument class represents an instrument.
|
explicit |
Constructs a new empty SFInstrument using the specified name.
name | the name of the instrument. |
sf2cute::SFInstrument::SFInstrument | ( | std::string | name, |
std::vector< SFInstrumentZone > | zones | ||
) |
Constructs a new SFInstrument using the specified name and zones.
name | the name of the instrument. |
zones | a collection of instrument zones to be assigned to the instrument. |
sf2cute::SFInstrument::SFInstrument | ( | std::string | name, |
std::vector< SFInstrumentZone > | zones, | ||
SFInstrumentZone | global_zone | ||
) |
Constructs a new SFInstrument using the specified name, zones and global zone.
name | the name of the instrument. |
zones | a collection of instrument zones to be assigned to the instrument. |
global_zone | a global zone to be assigned to the instrument. |
sf2cute::SFInstrument::SFInstrument | ( | const SFInstrument & | origin | ) |
Constructs a new copy of specified SFInstrument.
origin | a SFInstrument object. |
|
noexcept |
Acquires the contents of specified SFInstrument.
origin | a SFInstrument object. |
void sf2cute::SFInstrument::AddZone | ( | SFInstrumentZone | zone | ) |
Adds an instrument zone to the instrument.
zone | an instrument zone to be assigned to the instrument. |
std::invalid_argument | Instrument zone has already been owned by another instrument. |
|
noexcept |
Returns the global zone.
|
noexcept |
Returns true if the instrument has a global zone.
|
noexcept |
Returns true if the instrument has a parent file.
|
noexcept |
Returns the name of this instrument.
|
inlinestatic |
Constructs a new SFInstrument.
args | the arguments for the SFInstrument constructor. |
SFInstrument& sf2cute::SFInstrument::operator= | ( | const SFInstrument & | origin | ) |
Copy-assigns a new value to the SFInstrument, replacing its current contents.
origin | a SFInstrument object. |
|
noexcept |
Move-assigns a new value to the SFInstrument, replacing its current contents.
origin | a SFInstrument object. |
|
noexcept |
Returns the parent file.
void sf2cute::SFInstrument::RemoveZone | ( | std::vector< std::unique_ptr< SFInstrumentZone >>::const_iterator | position | ) |
Removes an instrument zone from the instrument.
position | the instrument zone to remove. |
void sf2cute::SFInstrument::RemoveZone | ( | std::vector< std::unique_ptr< SFInstrumentZone >>::const_iterator | first, |
std::vector< std::unique_ptr< SFInstrumentZone >>::const_iterator | last | ||
) |
Removes instrument zones from the instrument.
first | the first instrument zone to remove. |
last | the last instrument zone to remove. |
void sf2cute::SFInstrument::RemoveZoneIf | ( | std::function< bool(const std::unique_ptr< SFInstrumentZone > &)> | predicate | ) |
Removes instrument zones from the instrument.
predicate | unary predicate which returns true if the instrument zone should be removed. |
void sf2cute::SFInstrument::set_global_zone | ( | SFInstrumentZone | global_zone | ) |
Sets the global zone.
global_zone | the global zone. |
std::invalid_argument | Instrument zone has already been owned by another instrument. |
void sf2cute::SFInstrument::set_name | ( | std::string | name | ) |
Sets the name of this instrument.
name | the name of this instrument. |
|
noexcept |
Returns the list of instrument zones.