Audacity 3.2.0
Public Types | Public Member Functions | Public Attributes | List of all members
AudioUnitEffectSettings Struct Reference

#include <AudioUnitWrapper.h>

Collaboration diagram for AudioUnitEffectSettings:
[legend]

Public Types

using StringSet = std::set< wxString >
 
using Pair = std::pair< const wxString &, AudioUnitParameterValue >
 
using Map = std::map< AudioUnitParameterID, std::optional< Pair > >
 

Public Member Functions

 AudioUnitEffectSettings ()=default
 
 AudioUnitEffectSettings (Map map)
 
const wxString & Intern (const wxString &name)
 
void ResetValues ()
 Associate nullopt with all keys already present in the map. More...
 

Public Attributes

const std::shared_ptr< StringSetmSharedNames
 
std::optional< SInt32 > mPresetNumber
 Optionally store a preset. More...
 
Map values
 

Detailed Description

This works as a cached copy of state stored in an AudioUnit, but can also outlive it

Definition at line 36 of file AudioUnitWrapper.h.

Member Typedef Documentation

◆ Map

using AudioUnitEffectSettings::Map = std::map<AudioUnitParameterID, std::optional<Pair> >

Definition at line 55 of file AudioUnitWrapper.h.

◆ Pair

using AudioUnitEffectSettings::Pair = std::pair<const wxString &, AudioUnitParameterValue>

Map from numerical parameter IDs (not always a small initial segment of the integers) to optional pairs of names and floating point values

Definition at line 54 of file AudioUnitWrapper.h.

◆ StringSet

The effect object and all Settings objects coming from it share this set of strings, which allows Pair below to copy without allocations.

Note that names associated with parameter IDs are not invariant metadata of an AudioUnit effect! The names can themselves depend on the current values. Example: AUGraphicEQ changes names of slider parameters when you change the switch between 10 and 31 bands.

Definition at line 45 of file AudioUnitWrapper.h.

Constructor & Destructor Documentation

◆ AudioUnitEffectSettings() [1/2]

AudioUnitEffectSettings::AudioUnitEffectSettings ( )
default

◆ AudioUnitEffectSettings() [2/2]

AudioUnitEffectSettings::AudioUnitEffectSettings ( Map  map)
inline

Definition at line 59 of file AudioUnitWrapper.h.

59: values{ move(map) } {}

Member Function Documentation

◆ Intern()

const wxString & AudioUnitEffectSettings::Intern ( const wxString &  name)
inline

Get a pointer to a durable copy of name May allocate memory

Definition at line 63 of file AudioUnitWrapper.h.

63 {
64 // std::set::insert guarantees this iterator is not at the end
65 auto [iter, _] = mSharedNames->insert(name);
66 // so dereference it merrily
67 return *iter;
68 }
const TranslatableString name
Definition: Distortion.cpp:76
#define _(s)
Definition: Internat.h:73
const std::shared_ptr< StringSet > mSharedNames

References _, mSharedNames, and name.

◆ ResetValues()

void AudioUnitEffectSettings::ResetValues ( )
inline

Associate nullopt with all keys already present in the map.

Definition at line 71 of file AudioUnitWrapper.h.

72 {
73 for (auto &[_, value] : values)
74 value.reset();
75 }

References _, and values.

Member Data Documentation

◆ mPresetNumber

std::optional<SInt32> AudioUnitEffectSettings::mPresetNumber

Optionally store a preset.

Definition at line 50 of file AudioUnitWrapper.h.

◆ mSharedNames

const std::shared_ptr<StringSet> AudioUnitEffectSettings::mSharedNames
Initial value:
{
std::make_shared<StringSet>() }

Definition at line 46 of file AudioUnitWrapper.h.

Referenced by Intern().

◆ values

Map AudioUnitEffectSettings::values

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