|
| Stream (std::shared_ptr< const Context > context, std::shared_ptr< Device > device, const StreamParameters ¶ms={}) |
| Construct stream.
|
|
|
virtual bool | GetIsActive () const |
| Tell whether the stream participates in I/O. By default returns the last value set by SetIsActive(). Initial value is true.
|
|
OSStatus | SetIsActive (bool isActive) |
| Activate or deactivate stream. Invokes SetIsActiveImpl() and NotifyPropertyChanged().
|
|
virtual Direction | GetDirection () const |
| Get stream direction. By default returns corresponding field of StreamParameters.
|
|
virtual UInt32 | GetTerminalType () const |
| Get terminal type. By default returns kAudioStreamTerminalTypeMicrophone if GetDirection() returns Direction::Input, and kAudioStreamTerminalTypeSpeaker if it return Direction::Output.
|
|
virtual UInt32 | GetStartingChannel () const |
| Absolute channel number for the first channel in the stream. For example, if a device has two output streams with two channels each, then the starting channel number for the first stream is 1 and thus starting channel number for the second stream is 3. By default returns StreamParameters::StartingChannel.
|
|
UInt32 | GetChannelCount () const |
| Get number of channels in stream. Return value is based on GetPhysicalFormat().
|
|
Float64 | GetSampleRate () const |
| Get stream sample rate. Return value is based on GetPhysicalFormat().
|
|
virtual UInt32 | GetLatency () const |
| Get any additional presentation latency the stream has. This latency is added to the device latency. By default returns value last set with SetLatencyAsync(). Initial value is StreamParameters::Latency.
|
|
OSStatus | SetLatencyAsync (UInt32 latency) |
| Asynchronously set stream presentation latency, Requests HAL to asynchronously invoke SetLatencyImpl().
|
|
virtual AudioStreamBasicDescription | GetPhysicalFormat () const |
| Get the current physical format of the stream. Physical format defines the underlying format supported natively by hardware. By default returns value set by last SetPhysicalFormatAsync() call. Initial value is StreamParameters::Format.
|
|
OSStatus | SetPhysicalFormatAsync (AudioStreamBasicDescription format) |
| Set current format of the stream. Requests HAL to asynchronously invoke SetPhysicalFormatImpl(). Fails if format is not present in GetAvailablePhysicalFormats(), which by default returns only one format, provided during initialization. If you want to make your stream supporting multiple formats, you typically need to override both of these methods.
|
|
virtual std::vector< AudioStreamRangedDescription > | GetAvailablePhysicalFormats () const |
| Get list of supported physical formats. Empty list means that any format is allowed. By default returns the last value set by SetAvailablePhysicalFormatsAsync(). If nothing was set, return a single-element list with the format returned by GetPhysicalFormat().
|
|
OSStatus | SetAvailablePhysicalFormatsAsync (std::vector< AudioStreamRangedDescription > formats) |
| Asynchronously set list of supported physical formats. See comments for GetAvailablePhysicalFormats(). Requests HAL to asynchronously invoke SetAvailablePhysicalFormatsImpl().
|
|
virtual AudioStreamBasicDescription | GetVirtualFormat () const |
| Get the current format of the stream. Virtual format defines the format used to present the device to the apps. For example, physical format may use integers, while virtual format may use floating point numbers. For devices that don't override the mix operation, the virtual format has to be the same as the physical format. By default returns value set by last SetVirtualFormatAsync() call. Initial value is StreamParameters::Format.
|
|
OSStatus | SetVirtualFormatAsync (AudioStreamBasicDescription format) |
| Set current virtual format of the stream. Requests HAL to asynchronously invoke SetVirtualFormatImpl(). Fails if format is not present in GetAvailableVirtualFormats(), which by default returns only one format, provided during initialization. If you want to make your stream supporting multiple formats, you typically need to override both of these methods.
|
|
virtual std::vector< AudioStreamRangedDescription > | GetAvailableVirtualFormats () const |
| Get list of supported virtual formats. Empty list means that any format is allowed. By default returns the last value set by SetAvailableVirtualFormatsAsync(). If nothing was set, return a single-element list with the format returned by GetVirtualFormat().
|
|
OSStatus | SetAvailableVirtualFormatsAsync (std::vector< AudioStreamRangedDescription > formats) |
| Asynchronously set list of supported virtual formats. See comments for GetAvailableVirtualFormats(). Requests HAL to asynchronously invoke SetAvailableVirtualFormatsImpl().
|
|
|
virtual UInt32 | ConvertFramesToBytes (UInt32 numFrames) const |
| Convert number of frame to the number of bytes. Result depends on the value returned by GetPhysicalFormat().
|
|
virtual UInt32 | ConvertBytesToFrames (UInt32 numBytes) const |
| Convert number of bytes to the number of frames. Result depends on the value returned by GetPhysicalFormat().
|
|
void | AttachVolumeControl (std::shared_ptr< VolumeControl > control) |
| Attach volume control to the stream. ApplyProcessing() will use control to apply volume settings to the stream.
|
|
void | AttachMuteControl (std::shared_ptr< MuteControl > control) |
| Attach mute control to the stream. ApplyProcessing() will use control to apply mute settings to the stream.
|
|
virtual void | ApplyProcessing (Float32 *frames, UInt32 frameCount, UInt32 channelCount) const |
| Apply processing to the stream's data. The provided buffer contains exactly frameCount * channelCount samples. Modifies frames in the provided buffer. Default implementation invokes ApplyProcessing() on attached volume and mute controls, if they are present.
|
|
|
void | RequestConfigurationChange (std::function< void()> func={}) |
| Request HAL to perform configuration update. Similar to Device::RequestConfigurationChange().
|
|
|
AudioClassID | GetClass () const override |
| Get class ID.
|
|
AudioClassID | GetBaseClass () const override |
| Get base class ID.
|
|
bool | IsInstance (AudioClassID classID) const override |
| Check if this object is instance of given base class.
|
|
Boolean | HasProperty (AudioObjectID objectID, pid_t clientPID, const AudioObjectPropertyAddress *address) const override |
| Check whether given property is present.
|
|
OSStatus | IsPropertySettable (AudioObjectID objectID, pid_t clientPID, const AudioObjectPropertyAddress *address, Boolean *outIsSettable) const override |
| Check whether given property can be changed.
|
|
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.
|
|
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.
|
|
OSStatus | SetPropertyData (AudioObjectID objectID, pid_t clientPID, const AudioObjectPropertyAddress *address, UInt32 qualifierDataSize, const void *qualifierData, UInt32 inDataSize, const void *inData) override |
| Change property value.
|
|
| Object (std::shared_ptr< const Context > context, const char *className="Object", AudioObjectID objectID=kAudioObjectUnknown) |
| Construct object. Class name is used for logging. It should be the name of the derived class. If objectID is kAudioObjectUnknown (zero), allocates new object ID. Otherwise uses given object ID.
|
|
| Object (const Object &)=delete |
|
Object & | operator= (const Object &)=delete |
|
std::shared_ptr< const Context > | GetContext () const |
| Get object context.
|
|
AudioObjectID | GetID () const |
| Get object ID. Returns objectID selected at construction time.
|
|
AudioObjectID | GetOwnerID () const |
| Get object owner. If the object has an owner, returns its ID. Otherwise, returns kAudioObjectUnknown (zero).
|
|
bool | HasOwner () const |
| Check if the object is part of the hierarchy. Returns true if GetOwnerID() is not equal to kAudioObjectUnknown.
|
|
std::vector< AudioObjectID > | GetOwnedObjectIDs (AudioObjectPropertyScope scope=kAudioObjectPropertyScopeGlobal, AudioClassID classID=0) const |
| Get owned objects. Returns the list of objects to which this object is the owner.
|
|
void | AddOwnedObject (std::shared_ptr< Object > object, AudioObjectPropertyScope scope=kAudioObjectPropertyScopeGlobal) |
| Add object to the list of owned objects. Also invokes SetOwner() on the added object.
|
|
void | RemoveOwnedObject (AudioObjectID objectID) |
| Remove object to the list of owned objects. Also invokes SetOwner() on the removed object.
|
|
void | NotifyPropertyChanged (AudioObjectPropertySelector selector, AudioObjectPropertyScope scope=kAudioObjectPropertyScopeGlobal, AudioObjectPropertyElement element=kAudioObjectPropertyElementMain) const |
| Notify HAL that a property was changed. This is automatically called by all setters.
|
|
void | NotifyPropertiesChanged (std::vector< AudioObjectPropertySelector > selectors, AudioObjectPropertyScope scope=kAudioObjectPropertyScopeGlobal, AudioObjectPropertyElement element=kAudioObjectPropertyElementMain) const |
| Notify HAL that some properties were changed. This is automatically called by all setters.
|
|
virtual std::vector< AudioServerPlugInCustomPropertyInfo > | GetCustomProperties () const |
| Get info about registered custom properties. Returns list of properties added using RegisterCustomProperty().
|
|
template<typename ObjectType, typename ValueType> |
void | RegisterCustomProperty (AudioObjectPropertySelector selector, ObjectType &object, GetterMethod< ObjectType, ValueType > getter, SetterMethod< ObjectType, ValueType > setter=nullptr) |
| Register custom property with getter and optional setter.
|
|
template<typename GetterFunc> |
void | RegisterCustomProperty (AudioObjectPropertySelector selector, GetterFunc getter) |
| Register custom property with getter and optional setter.
|
|
void | RegisterCustomProperty (AudioObjectPropertySelector selector, std::function< CFStringRef()> getter, std::function< void(CFStringRef)> setter) |
| Register custom property with getter and optional setter.
|
|
void | RegisterCustomProperty (AudioObjectPropertySelector selector, std::function< CFPropertyListRef()> getter, std::function< void(CFPropertyListRef)> setter) |
| Register custom property with getter and optional setter.
|
|
Audio stream object.
Stream is part of a Device representing a source (input stream) or a destination (output stream) for samples. Clients connected to the device can read from its input streams and write to its output streams.
Each stream can have its own format, latency, and other parameters.
Stream does not do I/O by its own. Instead, it provides ApplyProcessing() method, which is invoked by ReaderWriter (in its default implementation).
Default implementation of Stream::ApplyProcessing() just invokes corresponding methods on attached VolumeControl and MuteControl objects, which you can set using AttachVolumeControl() and AttachMuteControl().
Definition at line 76 of file Stream.hpp.