Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Attributes | List of all members
AudioUnitWrapper::ParameterInfo Class Referencefinal

Encapsulates parameter information for an AudioUnit. More...

#include <AudioUnitWrapper.h>

Collaboration diagram for AudioUnitWrapper::ParameterInfo:
[legend]

Public Member Functions

 ParameterInfo (AudioUnit mUnit, AudioUnitParameterID parmID)
 Make a structure holding a key for the config file and a value. More...
 

Static Public Member Functions

static std::optional< AudioUnitParameterID > ParseKey (const wxString &key)
 Recover the parameter ID from the key, if well formed. More...
 

Public Attributes

std::optional< wxString > mName
 
AudioUnitUtils::ParameterInfo mInfo {}
 

Static Private Attributes

static constexpr char idBeg = wxT('<')
 
static constexpr char idSep = wxT(',')
 
static constexpr char idEnd = wxT('>')
 

Detailed Description

Encapsulates parameter information for an AudioUnit.

Definition at line 206 of file AudioUnitWrapper.h.

Constructor & Destructor Documentation

◆ ParameterInfo()

AudioUnitWrapper::ParameterInfo::ParameterInfo ( AudioUnit  mUnit,
AudioUnitParameterID  parmID 
)

Make a structure holding a key for the config file and a value.

Definition at line 68 of file AudioUnitWrapper.cpp.

70{
71 UInt32 dataSize;
72
73 mInfo = {};
74 // Note non-default element parameter, parmID
76 kAudioUnitProperty_ParameterInfo, mInfo,
77 kAudioUnitScope_Global, parmID))
78 return;
79
80 wxString &name = mName.emplace();
81 if (mInfo.flags & kAudioUnitParameterFlag_HasCFNameString)
82 name = wxCFStringRef::AsString(mInfo.cfNameString);
83 else
84 name = wxString(mInfo.name);
85
86#if defined(USE_EXTENDED_NAMES)
87 // Parameter name may or may not be present. The modified name will be:
88 //
89 // <[ParameterName,]parmID>
90 //
91 // (where the [ ] meta-characters denote optionality)
92 // (And any of the characters < , > in ParameterName are replaced with _)
93 if (!name.empty()) {
94 name.Replace(idBeg, wxT('_'));
95 name.Replace(idSep, wxT('_'));
96 name.Replace(idEnd, wxT('_'));
97 name.Append(idSep);
98 }
99 name = wxString::Format(wxT("%c%s%x%c"), idBeg, name, parmID, idEnd);
100
101 // If the parameter has a clumpID, then the final modified name will be:
102 //
103 // <[clumpName,]clumpId><[ParameterName,]parmID>
104 //
105 // (And any of the characters < , > in clumpName are replaced with _)
106 if (mInfo.flags & kAudioUnitParameterFlag_HasClump) {
107 wxString clumpName;
109 mInfo.clumpID, kAudioUnitParameterName_Full
110 };
111
113 kAudioUnitProperty_ParameterClumpName, clumpInfo)) {
114 clumpName = wxCFStringRef::AsString(clumpInfo.outName);
115 clumpName.Replace(idBeg, wxT('_'));
116 clumpName.Replace(idSep, wxT('_'));
117 clumpName.Replace(idEnd, wxT('_'));
118 clumpName.Append(idSep);
119 }
120 name = wxString::Format(wxT("%c%s%x%c%s"),
121 idBeg, clumpName, mInfo.clumpID, idEnd, name);
122 }
123#endif
124}
wxT("CloseDown"))
wxString name
Definition: TagsEditor.cpp:166
std::optional< wxString > mName
AudioUnitUtils::ParameterInfo mInfo
OSStatus GetFixedSizeProperty(AudioUnit unit, AudioUnitPropertyID inID, T &property, AudioUnitScope inScope=kAudioUnitScope_Global, AudioUnitElement inElement=0)
AudioUnitCleanup< AudioUnit, AudioComponentInstanceDispose > mUnit

References AudioUnitUtils::GetFixedSizeProperty(), idBeg, idEnd, idSep, mInfo, mName, AudioUnitWrapper::mUnit, name, and wxT().

Here is the call graph for this function:

Member Function Documentation

◆ ParseKey()

std::optional< AudioUnitParameterID > AudioUnitWrapper::ParameterInfo::ParseKey ( const wxString &  key)
static

Recover the parameter ID from the key, if well formed.

Definition at line 127 of file AudioUnitWrapper.cpp.

128{
129 // This is not a complete validation of the format of the key
130 // Scan left for , or <
131 if (const auto rend = key.rend(), riter = std::find_if(key.rbegin(), rend,
132 [](wxChar c) { return c == idBeg || c == idSep; })
133 ; riter != rend
134 ) {
135 // Scan right for >
136 if (const auto end = key.end(), left = riter.base(), // one right of riter
137 right = std::find(left, end, idEnd)
138 ; left != right && right != end
139 ){
140 // Interpret character range as hex
141 if (long value{}
142 ; wxString{left, right}.ToLong(&value, 16))
143 return value;
144 }
145 }
146 return {};
147}
static const AudacityProject::AttachedObjects::RegisteredFactory key
const char * end(const char *str) noexcept
Definition: StringUtils.h:106

References details::end(), and key.

Referenced by AudioUnitEffectBase::LoadSettings().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ idBeg

constexpr char AudioUnitWrapper::ParameterInfo::idBeg = wxT('<')
staticconstexprprivate

Definition at line 219 of file AudioUnitWrapper.h.

Referenced by ParameterInfo().

◆ idEnd

constexpr char AudioUnitWrapper::ParameterInfo::idEnd = wxT('>')
staticconstexprprivate

Definition at line 221 of file AudioUnitWrapper.h.

Referenced by ParameterInfo().

◆ idSep

constexpr char AudioUnitWrapper::ParameterInfo::idSep = wxT(',')
staticconstexprprivate

Definition at line 220 of file AudioUnitWrapper.h.

Referenced by ParameterInfo().

◆ mInfo

AudioUnitUtils::ParameterInfo AudioUnitWrapper::ParameterInfo::mInfo {}

Definition at line 215 of file AudioUnitWrapper.h.

Referenced by ParameterInfo().

◆ mName

std::optional<wxString> AudioUnitWrapper::ParameterInfo::mName

Definition at line 214 of file AudioUnitWrapper.h.

Referenced by ParameterInfo().


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