12#include <CoreAudio/AudioServerPlugIn.h>
27 AudioObjectPropertyScope
Scope = kAudioObjectPropertyScopeOutput;
79 virtual AudioObjectPropertyScope
GetScope()
const;
157 UInt32 channelCount)
const;
176 const AudioObjectPropertyAddress* address)
const override;
181 const AudioObjectPropertyAddress* address,
182 Boolean* outIsSettable)
const override;
187 const AudioObjectPropertyAddress* address,
188 UInt32 qualifierDataSize,
189 const void* qualifierData,
190 UInt32* outDataSize)
const override;
195 const AudioObjectPropertyAddress* address,
196 UInt32 qualifierDataSize,
197 const void* qualifierData,
200 void* outData)
const override;
205 const AudioObjectPropertyAddress* address,
206 UInt32 qualifierDataSize,
207 const void* qualifierData,
209 const void* inData)
override;
226 const std::unique_ptr<VolumeCurve> volumeCurve_;
228 std::mutex writeMutex_;
229 std::atomic<SInt32> rawVolume_ = 0;
Base class for audio objects.
Boolean HasProperty(AudioObjectID objectID, pid_t clientPID, const AudioObjectPropertyAddress *address) const override
Check whether given property is present.
virtual AudioValueRange GetDecibelRange() const
Get minimum and maximum volume values, in decibel units. Default implementation returns range based o...
OSStatus IsPropertySettable(AudioObjectID objectID, pid_t clientPID, const AudioObjectPropertyAddress *address, Boolean *outIsSettable) const override
Check whether given property can be changed.
VolumeControl(std::shared_ptr< const Context > context, const VolumeControlParameters ¶ms={})
Construct stream.
virtual Float32 ConvertScalarToDecibels(Float32 value) const
Convert volume from scalar scale to decibel scale. Default implementation performs conversion based o...
virtual AudioObjectPropertyScope GetScope() const
Get the scope that the control is attached to. Can return kAudioObjectPropertyScopeInput or kAudioObj...
virtual Float32 GetDecibelValue() const
Get current volume, in decibel units. Values are in range GetDecibelRange().
OSStatus GetPropertyDataSize(AudioObjectID objectID, pid_t clientPID, const AudioObjectPropertyAddress *address, UInt32 qualifierDataSize, const void *qualifierData, UInt32 *outDataSize) const override
Get size of property value in bytes.
AudioClassID GetClass() const override
Get class ID.
virtual Float32 GetScalarValue() const
Get current volume, in scalar units. Values are in range [0; 1].
virtual OSStatus SetScalarValue(Float32 value)
Set current volume, in scalar units. Values are in range [0; 1]. Invokes by SetRawValue().
OSStatus SetRawValue(SInt32 value)
Set current volume, in raw units. Values are in range GetRawRange(). Invokes by SetRawValueImpl() and...
virtual OSStatus SetDecibelValue(Float32 value)
Get current volume, in decibel units. Values are in range GetDecibelRange(). Invokes by SetRawValue()...
virtual AudioObjectPropertyElement GetElement() const
Get the element that the control is attached to. Typically should return kAudioObjectPropertyElementM...
AudioClassID GetBaseClass() const override
Get base class ID.
OSStatus SetPropertyData(AudioObjectID objectID, pid_t clientPID, const AudioObjectPropertyAddress *address, UInt32 qualifierDataSize, const void *qualifierData, UInt32 inDataSize, const void *inData) override
Change property value.
virtual OSStatus SetRawValueImpl(SInt32 value)
Set current volume, in raw units. Values are in range GetRawRange(). Invoked by SetRawValue().
virtual SInt32 GetRawValue() const
Get current volume, in raw units. Values are in range GetRawRange().
virtual Float32 ConvertDecibelsToScalar(Float32 value) const
Convert volume from decibel scale to scalar scale. Default implementation performs conversion based o...
virtual AudioValueRange GetRawRange() const
Get minimum and maximum volume values, in raw units. Default implementation returns range based on Vo...
OSStatus GetPropertyData(AudioObjectID objectID, pid_t clientPID, const AudioObjectPropertyAddress *address, UInt32 qualifierDataSize, const void *qualifierData, UInt32 inDataSize, UInt32 *outDataSize, void *outData) const override
Get property value.
virtual void ApplyProcessing(Float32 *frames, UInt32 frameCount, UInt32 channelCount) const
Apply processing to given buffer. The provided buffer contains exactly frameCount * channelCount samp...
bool IsInstance(AudioClassID classID) const override
Check if this object is instance of given base class.
Volume control parameters.
AudioObjectPropertyScope Scope
Define whether this is input or output control. Used by default implementation of VolumeControl::GetS...
Float32 MinDecibelVolume
Minimum volume value in decibel units.
SInt32 MinRawVolume
Minimum volume value in raw units.
Float32 MaxDecibelVolume
Maximum volume value in decibel units.
SInt32 MaxRawVolume
Maximum volume value in raw units.