SF2cute  0.1
Modern C++ Library for SoundFont 2
sf2cute::SFPresetZone Class Reference

The SFPresetZone class represents a preset zone. More...

#include <preset_zone.hpp>

Inheritance diagram for sf2cute::SFPresetZone:
sf2cute::SFZone

Public Member Functions

 SFPresetZone ()
 Constructs a new empty SFPresetZone.
 
 SFPresetZone (std::weak_ptr< SFInstrument > instrument)
 Constructs a new SFPresetZone with an instrument. More...
 
 SFPresetZone (std::weak_ptr< SFInstrument > instrument, std::vector< SFGeneratorItem > generators, std::vector< SFModulatorItem > modulators)
 Constructs a new SFPresetZone with an instrument, using the specified generators and modulators. More...
 
 SFPresetZone (const SFPresetZone &origin)
 Constructs a new copy of specified SFPresetZone. More...
 
SFPresetZoneoperator= (const SFPresetZone &origin)
 Copy-assigns a new value to the SFPresetZone, replacing its current contents. More...
 
 SFPresetZone (SFPresetZone &&origin)=default
 Acquires the contents of specified SFPresetZone. More...
 
SFPresetZoneoperator= (SFPresetZone &&origin)=default
 Move-assigns a new value to the SFPresetZone, replacing its current contents. More...
 
virtual ~SFPresetZone () override=default
 Destructs the SFPresetZone.
 
bool has_instrument () const noexcept
 Returns true if the zone has an associated instrument. More...
 
std::shared_ptr< SFInstrumentinstrument () const noexcept
 Returns the associated instrument. More...
 
void set_instrument (std::weak_ptr< SFInstrument > instrument)
 Sets the associated instrument. More...
 
void reset_instrument () noexcept
 Resets the associated instrument.
 
bool has_parent_file () const noexcept
 Returns true if the zone has a parent file. More...
 
SoundFontparent_file () const noexcept
 Returns the parent file. More...
 
bool has_parent_preset () const noexcept
 Returns true if the zone has a parent preset. More...
 
SFPresetparent_preset () const noexcept
 Returns the parent preset. More...
 
- Public Member Functions inherited from sf2cute::SFZone
 SFZone ()
 Constructs a new empty SFZone.
 
 SFZone (std::vector< SFGeneratorItem > generators, std::vector< SFModulatorItem > modulators)
 Constructs a new SFZone using the specified generators and modulators. More...
 
 SFZone (const SFZone &origin)
 Constructs a new copy of specified SFZone. More...
 
SFZoneoperator= (const SFZone &origin)
 Copy-assigns a new value to the SFZone, replacing its current contents. More...
 
 SFZone (SFZone &&origin)=default
 Acquires the contents of specified SFZone. More...
 
SFZoneoperator= (SFZone &&origin)=default
 Move-assigns a new value to the SFZone, replacing its current contents. More...
 
virtual ~SFZone ()=default
 Destructs the SFZone.
 
const std::vector< std::unique_ptr< SFGeneratorItem > > & generators () const noexcept
 Returns the list of generators. More...
 
void SetGenerator (SFGeneratorItem generator)
 Sets a generator to the zone. More...
 
const std::vector< std::unique_ptr< SFGeneratorItem > >::const_iterator FindGenerator (SFGenerator op) const
 Finds the generator which is the specified type. More...
 
void RemoveGenerator (std::vector< std::unique_ptr< SFGeneratorItem >>::const_iterator position)
 Removes a generator from the zone. More...
 
void RemoveGenerator (std::vector< std::unique_ptr< SFGeneratorItem >>::const_iterator first, std::vector< std::unique_ptr< SFGeneratorItem >>::const_iterator last)
 Removes generators from the zone. More...
 
void RemoveGeneratorIf (std::function< bool(const std::unique_ptr< SFGeneratorItem > &)> predicate)
 Removes generators from the zone. More...
 
void ClearGenerators () noexcept
 Removes all of the generators.
 
const std::vector< std::unique_ptr< SFModulatorItem > > & modulators () const noexcept
 Returns the list of modulators. More...
 
void SetModulator (SFModulatorItem modulator)
 Sets a modulator to the zone. More...
 
const std::vector< std::unique_ptr< SFModulatorItem > >::const_iterator FindModulator (SFModulatorKey key) const
 Finds the modulator which is the specified type. More...
 
void RemoveModulator (std::vector< std::unique_ptr< SFModulatorItem >>::const_iterator position)
 Removes a modulator from the zone. More...
 
void RemoveModulator (std::vector< std::unique_ptr< SFModulatorItem >>::const_iterator first, std::vector< std::unique_ptr< SFModulatorItem >>::const_iterator last)
 Removes modulators from the zone. More...
 
void RemoveModulatorIf (std::function< bool(const std::unique_ptr< SFModulatorItem > &)> predicate)
 Removes modulators from the zone. More...
 
void ClearModulators () noexcept
 Removes all of the modulators.
 

Friends

class SFPreset
 

Additional Inherited Members

- Protected Attributes inherited from sf2cute::SFZone
std::vector< std::unique_ptr< SFGeneratorItem > > generators_
 The list of generators.
 
std::vector< std::unique_ptr< SFModulatorItem > > modulators_
 The list of modulators.
 

Detailed Description

The SFPresetZone class represents a preset zone.

Remarks
This class represents the official sfPresetBag type and the instrument generator.
See also
"7.3 The PBAG Sub-chunk". In SoundFont Technical Specification 2.04.

Constructor & Destructor Documentation

sf2cute::SFPresetZone::SFPresetZone ( std::weak_ptr< SFInstrument instrument)
explicit

Constructs a new SFPresetZone with an instrument.

Parameters
instrumentthe instrument to be associated with the zone.
sf2cute::SFPresetZone::SFPresetZone ( std::weak_ptr< SFInstrument instrument,
std::vector< SFGeneratorItem generators,
std::vector< SFModulatorItem modulators 
)

Constructs a new SFPresetZone with an instrument, using the specified generators and modulators.

Parameters
instrumentthe instrument to be associated with the zone.
generatorsa collection of generators to be assigned to the zone.
modulatorsa collection of modulators to be assigned to the zone.
sf2cute::SFPresetZone::SFPresetZone ( const SFPresetZone origin)

Constructs a new copy of specified SFPresetZone.

Parameters
origina SFPresetZone object.
sf2cute::SFPresetZone::SFPresetZone ( SFPresetZone &&  origin)
default

Acquires the contents of specified SFPresetZone.

Parameters
origina SFPresetZone object.

Member Function Documentation

bool sf2cute::SFPresetZone::has_instrument ( ) const
noexcept

Returns true if the zone has an associated instrument.

Returns
true if the zone has an associated instrument.
Remarks
This function returns false if the associated instrument has been deleted.
bool sf2cute::SFPresetZone::has_parent_file ( ) const
noexcept

Returns true if the zone has a parent file.

Returns
true if the zone has a parent file.
bool sf2cute::SFPresetZone::has_parent_preset ( ) const
noexcept

Returns true if the zone has a parent preset.

Returns
true if the zone has a parent preset.
std::shared_ptr<SFInstrument> sf2cute::SFPresetZone::instrument ( ) const
noexcept

Returns the associated instrument.

Returns
a pointer to the associated instrument.
Remarks
This function returns nullptr if the associated instrument has been deleted.
SFPresetZone& sf2cute::SFPresetZone::operator= ( const SFPresetZone origin)

Copy-assigns a new value to the SFPresetZone, replacing its current contents.

Parameters
origina SFPresetZone object.
SFPresetZone& sf2cute::SFPresetZone::operator= ( SFPresetZone &&  origin)
default

Move-assigns a new value to the SFPresetZone, replacing its current contents.

Parameters
origina SFPresetZone object.
SoundFont& sf2cute::SFPresetZone::parent_file ( ) const
noexcept

Returns the parent file.

Returns
the parent file.
SFPreset& sf2cute::SFPresetZone::parent_preset ( ) const
noexcept

Returns the parent preset.

Returns
the parent preset.
void sf2cute::SFPresetZone::set_instrument ( std::weak_ptr< SFInstrument instrument)

Sets the associated instrument.

Parameters
instrumenta pointer to the associated instrument.

The documentation for this class was generated from the following file: