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

Represents a cached copy of the state stored in an AudioUnit, but can outlive the original AudioUnit. More...

#include <AudioUnitWrapper.h>

Collaboration diagram for AudioUnitEffectSettings:
[legend]

Public Types

using StringSet = std::set< wxString >
 Shared set of strings to optimize memory usage by avoiding repeated allocations. More...
 
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

Represents a cached copy of the state stored in an AudioUnit, but can outlive the original AudioUnit.

This structure handles the storage and management of settings and state information for AudioUnit effects. It provides mechanisms for sharing settings between different instances and managing preset configurations.

Definition at line 41 of file AudioUnitWrapper.h.

Member Typedef Documentation

◆ Map

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

Definition at line 60 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 59 of file AudioUnitWrapper.h.

◆ StringSet

Shared set of strings to optimize memory usage by avoiding repeated allocations.

All instances of AudioUnitEffectSettings share this set to reduce memory overhead and ensure consistency. The effect object and all Settings objects coming from it share this set of strings. Note: The names associated with parameter IDs are not invariant metadata of an AudioUnit effect. For example, AUGraphicEQ changes names of slider parameters when you switch between 10 and 31 bands.

Definition at line 50 of file AudioUnitWrapper.h.

Constructor & Destructor Documentation

◆ AudioUnitEffectSettings() [1/2]

AudioUnitEffectSettings::AudioUnitEffectSettings ( )
default

◆ AudioUnitEffectSettings() [2/2]

AudioUnitEffectSettings::AudioUnitEffectSettings ( Map  map)
inline

Definition at line 64 of file AudioUnitWrapper.h.

64: 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 68 of file AudioUnitWrapper.h.

68 {
69 // std::set::insert guarantees this iterator is not at the end
70 auto [iter, _] = mSharedNames->insert(name);
71 // so dereference it merrily
72 return *iter;
73 }
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 76 of file AudioUnitWrapper.h.

77 {
78 for (auto &[_, value] : values)
79 value.reset();
80 }

References _, and values.

Member Data Documentation

◆ mPresetNumber

std::optional<SInt32> AudioUnitEffectSettings::mPresetNumber

Optionally store a preset.

Definition at line 55 of file AudioUnitWrapper.h.

◆ mSharedNames

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

Definition at line 51 of file AudioUnitWrapper.h.

Referenced by Intern().

◆ values

Map AudioUnitEffectSettings::values

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