Methods (38) Properties (5)
Namespace: CSCore.CoreAudioAPI

Syntax

public class AudioEndpointVolume : ComObject

Base Type

Summary

The AudioEndpointVolume interface represents the volume controls on the audio stream to or from an audio endpoint device. For more information, see .

Uses

Methods

AudioEndpointVolume(IntPtr ptr)

Initializes a new instance of the AudioEndpointVolume class.

public void AudioEndpointVolume(IntPtr ptr)

Parameters

ptr

IntPtr

Native pointer of the AudioEndpointVolume object.

FromDevice(MMDevice device)

Returns a new AudioEndpointVolume instance based on a MMDevice instance.

public static AudioEndpointVolume FromDevice(MMDevice device)

Parameters

device

MMDevice

MMDevice instance to create the AudioEndpointVolume for.

Returns

A new AudioEndpointVolume instance based on the specified device.

GetChannelCount()

Gets the number of channels in the audio stream that enters or leaves the audio endpoint device.

public Int32 GetChannelCount()

Returns

The number of channels in the audio stream.

GetChannelCountNative(Int32& channelCount)

Gets the number of channels in the audio stream that enters or leaves the audio endpoint device.

public Int32 GetChannelCountNative(Int32& channelCount)

Parameters

channelCount

Int32&

Retrieves the number of channels in the audio stream.

Returns

HRESULT

GetChannelVolumeLevel(Int32 channel)

Gets the volume level, in decibels, of the specified channel in the audio stream that enters or leaves the audio endpoint device.

public Single GetChannelVolumeLevel(Int32 channel)

Parameters

channel

Int32

The channel number. If the audio stream contains n channels, the channels are numbered from 0 to n–1.

Returns

Volume level in decibels. To get the range of volume levels obtained from this method, call the GetVolumeRange method.

GetChannelVolumeLevelNative(Int32 channel, Single& levelDB)

Gets the volume level, in decibels, of the specified channel in the audio stream that enters or leaves the audio endpoint device.

public Int32 GetChannelVolumeLevelNative(Int32 channel, Single& levelDB)

Parameters

levelDB

Single&

A float variable into which the method writes the volume level in decibels. To get the range of volume levels obtained from this method, call the GetVolumeRange method.

channel

Int32

The channel number. If the audio stream contains n channels, the channels are numbered from 0 to n–1.

Returns

HRESULT

GetChannelVolumeLevelScalar(Int32 channel)

Gets the normalized, audio-tapered volume level of the specified channel of the audio stream that enters or leaves the audio endpoint device.

public Single GetChannelVolumeLevelScalar(Int32 channel)

Parameters

channel

Int32

The channel number. If the audio stream contains n channels, the channels are numbered from 0 to n–1.

Returns

Volume level of a specific channel. The level is expressed as a normalized value in the range from 0.0 to 1.0.

GetChannelVolumeLevelScalarNative(Int32 channel, Single& level)

Gets the normalized, audio-tapered volume level of the specified channel of the audio stream that enters or leaves the audio endpoint device.

public Int32 GetChannelVolumeLevelScalarNative(Int32 channel, Single& level)

Parameters

level

Single&

A float variable into which the method writes the volume level. The level is expressed as a normalized value in the range from 0.0 to 1.0.

channel

Int32

The channel number. If the audio stream contains n channels, the channels are numbered from 0 to n–1.

Returns

HRESULT

GetMasterVolumeLevel()

Gets the master volume level, in decibels, of the audio stream that enters or leaves the audio endpoint device.

public Single GetMasterVolumeLevel()

Returns

Volume level in decibels. To get the range of volume levels obtained from this method, call the GetVolumeRange method.

GetMasterVolumeLevelNative(Single& levelDB)

Gets the master volume level, in decibels, of the audio stream that enters or leaves the audio endpoint device.

public Int32 GetMasterVolumeLevelNative(Single& levelDB)

Parameters

levelDB

Single&

A float variable into which the method writes the volume level in decibels. To get the range of volume levels obtained from this method, call the GetVolumeRange method.

Returns

HRESULT

GetMasterVolumeLevelScalar()

Gets the master volume level of the audio stream that enters or leaves the audio endpoint device. The volume level is expressed as a normalized, audio-tapered value in the range from 0.0 to 1.0.

public Single GetMasterVolumeLevelScalar()

Returns

Volume level. The level is expressed as a normalized value in the range from 0.0 to 1.0.

GetMasterVolumeLevelScalarNative(Single& level)

Gets the master volume level of the audio stream that enters or leaves the audio endpoint device. The volume level is expressed as a normalized, audio-tapered value in the range from 0.0 to 1.0.

public Int32 GetMasterVolumeLevelScalarNative(Single& level)

Parameters

level

Single&

A float variable into which the method writes the volume level. The level is expressed as a normalized value in the range from 0.0 to 1.0.

Returns

HRESULT

GetMute()

Gets the muting state of the audio stream that enters or leaves the audio endpoint device.

public Boolean GetMute()

Returns

If the method returns true, the stream is muted. If false, the stream is not muted.

GetMuteNative(NativeBool& mute)

Gets the muting state of the audio stream that enters or leaves the audio endpoint device.

public Int32 GetMuteNative(NativeBool& mute)

Parameters

mute

NativeBool&

A Variable into which the method writes the muting state. If mute is true, the stream is muted. If false, the stream is not muted.

Returns

HRESULT

GetVolumeRange(Single& volumeMinDB, Single& volumeMaxDB, Single& volumeIncrementDB)

Gets the volume range, in decibels, of the audio stream that enters or leaves the audio endpoint device.

public void GetVolumeRange(Single& volumeMinDB, Single& volumeMaxDB, Single& volumeIncrementDB)

Parameters

volumeMinDB

Single&

Minimum volume level in decibels. This value remains constant for the lifetime of the AudioEndpointVolume object instance.

volumeMaxDB

Single&

Maximum volume level in decibels. This value remains constant for the lifetime of the AudioEndpointVolume object instance.

volumeIncrementDB

Single&

Volume increment in decibels. This increment remains constant for the lifetime of the AudioEndpointVolume object instance.

GetVolumeRangeNative(Single& volumeMinDB, Single& volumeMaxDB, Single& volumeIncrementDB)

Gets the volume range, in decibels, of the audio stream that enters or leaves the audio endpoint device.

public Int32 GetVolumeRangeNative(Single& volumeMinDB, Single& volumeMaxDB, Single& volumeIncrementDB)

Parameters

volumeMinDB

Single&

Minimum volume level in decibels. This value remains constant for the lifetime of the AudioEndpointVolume object instance.

volumeMaxDB

Single&

Maximum volume level in decibels. This value remains constant for the lifetime of the AudioEndpointVolume object instance.

volumeIncrementDB

Single&

Volume increment in decibels. This increment remains constant for the lifetime of the AudioEndpointVolume object instance.

Returns

HREUSLT

GetVolumeStepInfo(Int32& currentStep, Int32& stepCount)

Gets information about the current step in the volume range.

public void GetVolumeStepInfo(Int32& currentStep, Int32& stepCount)

Parameters

currentStep

Int32&

A variable into which the method writes the current step index. This index is a value in the range from 0 to stepCount– 1, where 0 represents the minimum volume level and stepCount– 1 represents the maximum level.

stepCount

Int32&

A variable into which the method writes the number of steps in the volume range. This number remains constant for the lifetime of the AudioEndpointVolume object instance.

GetVolumeStepInfoNative(Int32& currentStep, Int32& stepCount)

Gets information about the current step in the volume range.

public Int32 GetVolumeStepInfoNative(Int32& currentStep, Int32& stepCount)

Parameters

currentStep

Int32&

A variable into which the method writes the current step index. This index is a value in the range from 0 to stepCount– 1, where 0 represents the minimum volume level and stepCount– 1 represents the maximum level.

stepCount

Int32&

A variable into which the method writes the number of steps in the volume range. This number remains constant for the lifetime of the AudioEndpointVolume object instance.

Returns

HRESULT

QueryHardwareSupport()

Queries the audio endpoint device for its hardware-supported functions.

public EndpointHardwareSupportFlags QueryHardwareSupport()

Returns

A hardware support mask that indicates the hardware capabilities of the audio endpoint device.

QueryHardwareSupportNative(EndpointHardwareSupportFlags& hardwareSupportMask)

Queries the audio endpoint device for its hardware-supported functions.

public Int32 QueryHardwareSupportNative(EndpointHardwareSupportFlags& hardwareSupportMask)

Parameters

hardwareSupportMask

EndpointHardwareSupportFlags&

A variable into which the method writes a hardware support mask that indicates the hardware capabilities of the audio endpoint device.

Returns

HRESULT

RegisterControlChangeNotify(IAudioEndpointVolumeCallback notify)

Registers a client's notification callback interface.

public void RegisterControlChangeNotify(IAudioEndpointVolumeCallback notify)

Parameters

notify

IAudioEndpointVolumeCallback

The callback instance that the client is registering for notification callbacks.

Remarks

When notifications are no longer needed, the client can call the UnregisterControlChangeNotify method to terminate the notifications.

RegisterControlChangeNotifyNative(IAudioEndpointVolumeCallback notify)

Registers a client's notification callback interface.

public Int32 RegisterControlChangeNotifyNative(IAudioEndpointVolumeCallback notify)

Parameters

notify

IAudioEndpointVolumeCallback

The callback instance that the client is registering for notification callbacks.

Returns

HRESULT

Remarks

When notifications are no longer needed, the client can call the UnregisterControlChangeNotify method to terminate the notifications.

SetChannelVolumeLevel(Int32 channel, Single levelDB, Guid eventContext)

Sets the volume level, in decibels, of the specified channel of the audio stream that enters or leaves the audio endpoint device.

public void SetChannelVolumeLevel(Int32 channel, Single levelDB, Guid eventContext)

Parameters

levelDB

Single

The new volume level in decibels. To obtain the range and granularity of the volume levels that can be set by this method, call the GetVolumeRange method.

eventContext

Guid

EventContext which can be accessed in the event handler.

channel

Int32

The channel number. If the audio stream contains n channels, the channels are numbered from 0 to n–1.

SetChannelVolumeLevelNative(Int32 channel, Single levelDB, Guid eventContext)

Sets the volume level, in decibels, of the specified channel of the audio stream that enters or leaves the audio endpoint device.

public Int32 SetChannelVolumeLevelNative(Int32 channel, Single levelDB, Guid eventContext)

Parameters

levelDB

Single

The new volume level in decibels. To obtain the range and granularity of the volume levels that can be set by this method, call the GetVolumeRange method.

eventContext

Guid

EventContext which can be accessed in the event handler.

channel

Int32

The channel number. If the audio stream contains n channels, the channels are numbered from 0 to n–1.

Returns

HRESULT

SetChannelVolumeLevelScalar(Int32 channel, Single level, Guid eventContext)

Sets the normalized, audio-tapered volume level of the specified channel in the audio stream that enters or leaves the audio endpoint device.

public void SetChannelVolumeLevelScalar(Int32 channel, Single level, Guid eventContext)

Parameters

level

Single

The volume level. The volume level is expressed as a normalized value in the range from 0.0 to 1.0.

eventContext

Guid

EventContext which can be accessed in the event handler.

channel

Int32

The channel number. If the audio stream contains n channels, the channels are numbered from 0 to n–1.

SetChannelVolumeLevelScalarNative(Int32 channel, Single level, Guid eventContext)

Sets the normalized, audio-tapered volume level of the specified channel in the audio stream that enters or leaves the audio endpoint device.

public Int32 SetChannelVolumeLevelScalarNative(Int32 channel, Single level, Guid eventContext)

Parameters

level

Single

The volume level. The volume level is expressed as a normalized value in the range from 0.0 to 1.0.

eventContext

Guid

EventContext which can be accessed in the event handler.

channel

Int32

The channel number. If the audio stream contains n channels, the channels are numbered from 0 to n–1.

Returns

HRESULT

SetMasterVolumeLevel(Single levelDB, Guid eventContext)

Sets the master volume level, in decibels, of the audio stream that enters or leaves the audio endpoint device.

public void SetMasterVolumeLevel(Single levelDB, Guid eventContext)

Parameters

levelDB

Single

The new master volume level in decibels. To obtain the range and granularity of the volume levels that can be set by this method, call the GetVolumeRange method.

eventContext

Guid

EventContext which can be accessed in the event handler.

SetMasterVolumeLevelNative(Single levelDB, Guid eventContext)

Sets the master volume level, in decibels, of the audio stream that enters or leaves the audio endpoint device.

public Int32 SetMasterVolumeLevelNative(Single levelDB, Guid eventContext)

Parameters

levelDB

Single

The new master volume level in decibels. To obtain the range and granularity of the volume levels that can be set by this method, call the GetVolumeRange method.

eventContext

Guid

EventContext which can be accessed in the event handler.

Returns

HRESULT

SetMasterVolumeLevelScalar(Single level, Guid eventContext)

Sets the master volume level of the audio stream that enters or leaves the audio endpoint device. The volume level is expressed as a normalized, audio-tapered value in the range from 0.0 to 1.0.

public void SetMasterVolumeLevelScalar(Single level, Guid eventContext)

Parameters

level

Single

The new master volume level. The level is expressed as a normalized value in the range from 0.0 to 1.0.

eventContext

Guid

EventContext which can be accessed in the event handler.

SetMasterVolumeLevelScalarNative(Single level, Guid eventContext)

Sets the master volume level of the audio stream that enters or leaves the audio endpoint device. The volume level is expressed as a normalized, audio-tapered value in the range from 0.0 to 1.0.

public Int32 SetMasterVolumeLevelScalarNative(Single level, Guid eventContext)

Parameters

level

Single

The new master volume level. The level is expressed as a normalized value in the range from 0.0 to 1.0.

eventContext

Guid

EventContext which can be accessed in the event handler.

Returns

HRESULT

SetMute(Boolean mute, Guid eventContext)

Sets the muting state of the audio stream that enters or leaves the audio endpoint device.

public void SetMute(Boolean mute, Guid eventContext)

Parameters

eventContext

Guid

EventContext which can be accessed in the event handler.

mute

Boolean

True mutes the stream. False turns off muting.

SetMuteNative(NativeBool mute, Guid eventContext)

Sets the muting state of the audio stream that enters or leaves the audio endpoint device.

public Int32 SetMuteNative(NativeBool mute, Guid eventContext)

Parameters

mute

NativeBool

True mutes the stream. False turns off muting.

eventContext

Guid

EventContext which can be accessed in the event handler.

Returns

HRESULT

UnregisterControlChangeNotify(IAudioEndpointVolumeCallback notify)

Deletes the registration of a client's notification callback interface that the client registered in a previous call to the RegisterControlChangeNotify method.

public void UnregisterControlChangeNotify(IAudioEndpointVolumeCallback notify)

Parameters

notify

IAudioEndpointVolumeCallback

The callback instance to unregister. The client passed this same object to the endpoint volume object in the previous call to the RegisterControlChangeNotify method.

UnregisterControlChangeNotifyNative(IAudioEndpointVolumeCallback notify)

Deletes the registration of a client's notification callback interface that the client registered in a previous call to the RegisterControlChangeNotify method.

public Int32 UnregisterControlChangeNotifyNative(IAudioEndpointVolumeCallback notify)

Parameters

notify

IAudioEndpointVolumeCallback

The callback instance to unregister. The client passed this same object to the endpoint volume object in the previous call to the RegisterControlChangeNotify method.

Returns

HRESULT

VolumeStepDown(Guid eventContext)

Decrements, by one step, the volume level of the audio stream that enters or leaves the audio endpoint device.

public void VolumeStepDown(Guid eventContext)

Parameters

eventContext

Guid

EventContext which can be accessed in the event handler.

VolumeStepDownNative(Guid eventContext)

Decrements, by one step, the volume level of the audio stream that enters or leaves the audio endpoint device.

public Int32 VolumeStepDownNative(Guid eventContext)

Parameters

eventContext

Guid

EventContext which can be accessed in the event handler.

Returns

HRESULT

VolumeStepUp(Guid eventContext)

Increments, by one step, the volume level of the audio stream that enters or leaves the audio endpoint device.

public void VolumeStepUp(Guid eventContext)

Parameters

eventContext

Guid

EventContext which can be accessed in the event handler.

VolumeStepUpNative(Guid eventContext)

Increments, by one step, the volume level of the audio stream that enters or leaves the audio endpoint device.

public Int32 VolumeStepUpNative(Guid eventContext)

Parameters

eventContext

Guid

EventContext which can be accessed in the event handler.

Returns

HRESULT

Properties

ChannelCount

Gets the number of available channels.

public Int32 ChannelCount { get; }

Channels

Gets all available channels.

public ReadOnlyCollection<AudioEndpointVolumeChannel> Channels { get; }

MasterVolumeLevel

Gets or sets the MasterVolumeLevel in decibel.

public Single MasterVolumeLevel { get; set; }

MasterVolumeLevelScalar

Gets or sets the MasterVolumeLevel as a normalized value in the range from 0.0 to 1.0.

public Single MasterVolumeLevelScalar { get; set; }

RegisteredCallbacks

Gets all registered IAudioEndpointVolumeCallback.

public ReadOnlyCollection<IAudioEndpointVolumeCallback> RegisteredCallbacks { get; }

Class Diagram

save

reset

Drag to pan - Use Mousewheel + Ctrl to zoom