SoundFontInfoLib  2.21.6
Library for parsing and rendering SF2 files
SF2::Render::ZoneCollection< Kind > Class Template Reference

Templated collection of zones. More...

#include <ZoneCollection.hpp>

Public Types

using Matches = typename std::vector< std::reference_wrapper< Kind const > >
 

Public Member Functions

 ZoneCollection (size_t zoneCount)
 Construct a new collection that expects to hold the given number of elements. More...
 
size_t size () const
 
Matches filter (int key, int velocity) const
 Locate the zone(s) that match the given key/velocity pair. More...
 
bool hasGlobal () const
 
const Kind * global () const
 
template<class... Args>
void add (const IO::File &file, const Entity::Bag &bag, Args &&... values)
 Add a zone with the given args. More...
 

Detailed Description

template<typename Kind>
class SF2::Render::ZoneCollection< Kind >

Templated collection of zones.

A non-global zone defines a range of MIDI keys and/or velocities over which it operates. The first zone can be a global zone. The global zone defines the configuration settings that apply to all other zones.

Member Typedef Documentation

◆ Matches

template<typename Kind >
using SF2::Render::ZoneCollection< Kind >::Matches = typename std::vector<std::reference_wrapper<Kind const> >

Constructor & Destructor Documentation

◆ ZoneCollection()

template<typename Kind >
SF2::Render::ZoneCollection< Kind >::ZoneCollection ( size_t  zoneCount)
inlineexplicit

Construct a new collection that expects to hold the given number of elements.

Parameters
zoneCountthe number of zones that the collection will hold

Member Function Documentation

◆ add()

template<typename Kind >
template<class... Args>
void SF2::Render::ZoneCollection< Kind >::add ( const IO::File file,
const Entity::Bag bag,
Args &&...  values 
)
inline

Add a zone with the given args.

Note that empty zones (no generators and no modulators) are dropped, as are any global zones that are not the first zone.

Parameters
filethe SF2 file with the entities to use
bagthe definition for the Zone
valuesadditional arguments for the Zone construction

References SF2::Entity::Bag::generatorCount(), SF2::Entity::Bag::modulatorCount(), and values.

Referenced by SF2::Render::Instrument::Instrument(), and SF2::Render::Preset::Preset().

◆ filter()

template<typename Kind >
Matches SF2::Render::ZoneCollection< Kind >::filter ( int  key,
int  velocity 
) const
inline

Locate the zone(s) that match the given key/velocity pair.

Parameters
keythe MIDI key to filter on
velocitythe MIDI velocity to filter on
Returns
a vector of matching zones

References SF2::Render::ZoneCollection< Kind >::hasGlobal().

Referenced by SF2::Render::Instrument::filter(), and SF2::Render::Preset::find().

◆ global()

template<typename Kind >
const Kind* SF2::Render::ZoneCollection< Kind >::global ( ) const
inline
Returns
get pointer to global zone or nullptr if there is not one

References SF2::Render::ZoneCollection< Kind >::hasGlobal().

Referenced by SF2::Render::WithZones< T, E >::globalZone().

◆ hasGlobal()

template<typename Kind >
bool SF2::Render::ZoneCollection< Kind >::hasGlobal ( ) const
inline

◆ size()

template<typename Kind >
size_t SF2::Render::ZoneCollection< Kind >::size ( ) const
inline
Returns
number of zones in the collection (include the optional global one)

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