SoundFontInfoLib  2.21.6
Library for parsing and rendering SF2 files
SF2::Render::Preset Class Reference

Represents a preset that knows how to emit sounds for MIDI events when it is active. More...

#include <Preset.hpp>

Inherits SF2::Render::WithZones< PresetZone, Entity::Preset >.

Public Types

using PresetZoneCollection = WithZoneCollection
 
using Matches = std::vector< Voice::Setup >
 
- Public Types inherited from SF2::Render::WithZones< PresetZone, Entity::Preset >
using ZoneType = PresetZone
 
using EntityType = Entity::Preset
 
using WithZoneCollection = ZoneCollection< ZoneType >
 

Public Member Functions

 Preset (const IO::File &file, const InstrumentCollection &instruments, const Entity::Preset &config)
 Construct new Preset from SF2 entities. More...
 
Matches find (int key, int velocity) const
 Locate preset/instrument pairs for the given key/velocity values. More...
 
- Public Member Functions inherited from SF2::Render::WithZones< PresetZone, Entity::Preset >
bool hasGlobalZone () const
 
const ZoneTypeglobalZone () const
 
const WithZoneCollectionzones () const
 
const EntityTypeconfiguration () const
 

Additional Inherited Members

- Protected Member Functions inherited from SF2::Render::WithZones< PresetZone, Entity::Preset >
 WithZones (size_t zoneCount, const EntityType &configuration)
 
- Protected Attributes inherited from SF2::Render::WithZones< PresetZone, Entity::Preset >
WithZoneCollection zones_
 
const EntityTypeconfiguration_
 

Detailed Description

Represents a preset that knows how to emit sounds for MIDI events when it is active.

A preset is made up of a collection of zones, where each zone defines a MIDI key and velocity range that it applies to and an instrument that determines the sound to produce. Note that zones can overlap, so one MIDI event can cause multiple instruments to play, each which will require a Voice instance to render.

Member Typedef Documentation

◆ Matches

◆ PresetZoneCollection

Constructor & Destructor Documentation

◆ Preset()

SF2::Render::Preset::Preset ( const IO::File file,
const InstrumentCollection instruments,
const Entity::Preset config 
)
inline

Construct new Preset from SF2 entities.

Parameters
filethe SF2 file that is loaded
instrumentsthe collection of instruments that apply to the preset
configthe SF2 preset definition

References SF2::Render::ZoneCollection< Kind >::add(), SF2::Entity::Preset::firstZoneIndex(), SF2::IO::File::presetZones(), SF2::Entity::Preset::zoneCount(), and SF2::Render::WithZones< PresetZone, Entity::Preset >::zones_.

Member Function Documentation

◆ find()

Matches SF2::Render::Preset::find ( int  key,
int  velocity 
) const
inline

Locate preset/instrument pairs for the given key/velocity values.

Parameters
keythe MIDI key to filter with
velocitythe MIDI velocity to filter with
Returns
vector of matching preset/instrument pairs

References SF2::Render::ZoneCollection< Kind >::filter(), SF2::Render::WithZones< PresetZone, Entity::Preset >::globalZone(), and SF2::Render::WithZones< PresetZone, Entity::Preset >::zones_.


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