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

The SFZone class represents a zone. More...

#include <zone.hpp>

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

Public Member Functions

 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.
 

Protected Attributes

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 SFZone class represents a zone.

Remarks
This class represents the official sfPresetBag/sfInstBag type.
See also
"7.3 The PBAG Sub-chunk". In SoundFont Technical Specification 2.04.
"7.7 The IBAG Sub-chunk". In SoundFont Technical Specification 2.04.

Constructor & Destructor Documentation

sf2cute::SFZone::SFZone ( std::vector< SFGeneratorItem generators,
std::vector< SFModulatorItem modulators 
)

Constructs a new SFZone using the specified generators and modulators.

Parameters
generatorsa collection of generators to be assigned to the zone.
modulatorsa collection of modulators to be assigned to the zone.
sf2cute::SFZone::SFZone ( const SFZone origin)

Constructs a new copy of specified SFZone.

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

Acquires the contents of specified SFZone.

Parameters
origina SFZone object.

Member Function Documentation

const std::vector<std::unique_ptr<SFGeneratorItem> >::const_iterator sf2cute::SFZone::FindGenerator ( SFGenerator  op) const

Finds the generator which is the specified type.

Returns
the position of the found generator or std::end(generators()) if no such generator is found.
const std::vector<std::unique_ptr<SFModulatorItem> >::const_iterator sf2cute::SFZone::FindModulator ( SFModulatorKey  key) const

Finds the modulator which is the specified type.

Returns
the position of the found modulator or std::end(modulators()) if no such modulator is found.
const std::vector<std::unique_ptr<SFGeneratorItem> >& sf2cute::SFZone::generators ( ) const
noexcept

Returns the list of generators.

Returns
the list of generators assigned to the zone.
const std::vector<std::unique_ptr<SFModulatorItem> >& sf2cute::SFZone::modulators ( ) const
noexcept

Returns the list of modulators.

Returns
the list of modulators assigned to the zone.
SFZone& sf2cute::SFZone::operator= ( const SFZone origin)

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

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

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

Parameters
origina SFZone object.
void sf2cute::SFZone::RemoveGenerator ( std::vector< std::unique_ptr< SFGeneratorItem >>::const_iterator  position)

Removes a generator from the zone.

Parameters
positionthe generator to remove.
void sf2cute::SFZone::RemoveGenerator ( std::vector< std::unique_ptr< SFGeneratorItem >>::const_iterator  first,
std::vector< std::unique_ptr< SFGeneratorItem >>::const_iterator  last 
)

Removes generators from the zone.

Parameters
firstthe first generator to remove.
lastthe last generator to remove.
void sf2cute::SFZone::RemoveGeneratorIf ( std::function< bool(const std::unique_ptr< SFGeneratorItem > &)>  predicate)

Removes generators from the zone.

Parameters
predicateunary predicate which returns true if the generator should be removed.
void sf2cute::SFZone::RemoveModulator ( std::vector< std::unique_ptr< SFModulatorItem >>::const_iterator  position)

Removes a modulator from the zone.

Parameters
positionthe modulator to remove.
void sf2cute::SFZone::RemoveModulator ( std::vector< std::unique_ptr< SFModulatorItem >>::const_iterator  first,
std::vector< std::unique_ptr< SFModulatorItem >>::const_iterator  last 
)

Removes modulators from the zone.

Parameters
firstthe first modulator to remove.
lastthe last modulator to remove.
void sf2cute::SFZone::RemoveModulatorIf ( std::function< bool(const std::unique_ptr< SFModulatorItem > &)>  predicate)

Removes modulators from the zone.

Parameters
predicateunary predicate which returns true if the modulator should be removed.
void sf2cute::SFZone::SetGenerator ( SFGeneratorItem  generator)

Sets a generator to the zone.

Parameters
generatora generator to be assigned to the zone.
Remarks
An existing generator which has the same key will be overwritten.
void sf2cute::SFZone::SetModulator ( SFModulatorItem  modulator)

Sets a modulator to the zone.

Parameters
modulatora modulator to be assigned to the zone.
Remarks
An existing modulator which has the same key will be overwritten.

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