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

The SFInstrumentZone class represents an instrument zone. More...

#include <instrument_zone.hpp>

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

Public Member Functions

 SFInstrumentZone ()
 Constructs a new empty SFInstrumentZone.
 
 SFInstrumentZone (std::weak_ptr< SFSample > sample)
 Constructs a new SFInstrumentZone with a sample. More...
 
 SFInstrumentZone (std::weak_ptr< SFSample > sample, std::vector< SFGeneratorItem > generators, std::vector< SFModulatorItem > modulators)
 Constructs a new SFInstrumentZone with a sample, using the specified generators and modulators. More...
 
 SFInstrumentZone (const SFInstrumentZone &origin)
 Constructs a new copy of specified SFInstrumentZone. More...
 
SFInstrumentZoneoperator= (const SFInstrumentZone &origin)
 Copy-assigns a new value to the SFInstrumentZone, replacing its current contents. More...
 
 SFInstrumentZone (SFInstrumentZone &&origin)=default
 Acquires the contents of specified SFInstrumentZone. More...
 
SFInstrumentZoneoperator= (SFInstrumentZone &&origin)=default
 Move-assigns a new value to the SFInstrumentZone, replacing its current contents. More...
 
virtual ~SFInstrumentZone () override=default
 Destructs the SFInstrumentZone.
 
bool has_sample () const noexcept
 Returns true if the zone has an associated sample. More...
 
std::shared_ptr< SFSamplesample () const noexcept
 Returns the associated sample. More...
 
void set_sample (std::weak_ptr< SFSample > sample)
 Sets the associated sample. More...
 
void reset_sample () noexcept
 Resets the associated sample.
 
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_instrument () const noexcept
 Returns true if the zone has a parent instrument. More...
 
SFInstrumentparent_instrument () const noexcept
 Returns the parent instrument. 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 SFInstrument
 

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 SFInstrumentZone class represents an instrument zone.

Remarks
This class represents the official sfInstBag type and the sampleID generator.
See also
"7.6 The IBAG Sub-chunk". In SoundFont Technical Specification 2.04.

Constructor & Destructor Documentation

sf2cute::SFInstrumentZone::SFInstrumentZone ( std::weak_ptr< SFSample sample)
explicit

Constructs a new SFInstrumentZone with a sample.

Parameters
samplethe sample to be associated with the zone.
sf2cute::SFInstrumentZone::SFInstrumentZone ( std::weak_ptr< SFSample sample,
std::vector< SFGeneratorItem generators,
std::vector< SFModulatorItem modulators 
)

Constructs a new SFInstrumentZone with a sample, using the specified generators and modulators.

Parameters
samplethe sample 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::SFInstrumentZone::SFInstrumentZone ( const SFInstrumentZone origin)

Constructs a new copy of specified SFInstrumentZone.

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

Acquires the contents of specified SFInstrumentZone.

Parameters
origina SFInstrumentZone object.

Member Function Documentation

bool sf2cute::SFInstrumentZone::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::SFInstrumentZone::has_parent_instrument ( ) const
noexcept

Returns true if the zone has a parent instrument.

Returns
true if the zone has a parent instrument.
bool sf2cute::SFInstrumentZone::has_sample ( ) const
noexcept

Returns true if the zone has an associated sample.

Returns
true if the zone has an associated sample.
Remarks
This function returns false if the associated sample has been deleted.
SFInstrumentZone& sf2cute::SFInstrumentZone::operator= ( const SFInstrumentZone origin)

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

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

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

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

Returns the parent file.

Returns
the parent file.
SFInstrument& sf2cute::SFInstrumentZone::parent_instrument ( ) const
noexcept

Returns the parent instrument.

Returns
the parent instrument.
std::shared_ptr<SFSample> sf2cute::SFInstrumentZone::sample ( ) const
noexcept

Returns the associated sample.

Returns
a pointer to the associated sample.
Remarks
This function returns nullptr if the associated sample has been deleted.
void sf2cute::SFInstrumentZone::set_sample ( std::weak_ptr< SFSample sample)

Sets the associated sample.

Parameters
samplea pointer to the associated sample.

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