public sealed class VistaCoreAudioApiHelper : IDisposable
Public NotInheritable Class VistaCoreAudioApiHelper
Implements IDisposable
Dim instance As VistaCoreAudioApiHelper
public ref class VistaCoreAudioApiHelper sealed : IDisposable
[<SealedAttribute>]
type VistaCoreAudioApiHelper =
class
interface IDisposable
end
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
' Instance the Class:
' ###################
Friend WithEvents AudioDevice As New VistaCoreAudioApiHelper(EnableDeviceMonitors:=True)
' Disable or enable Monitors, and/or it's intervals:
' ##################################################
AudioDevice.DeviceMonitorsEnabled = True
AudioDevice.Timer_MasterVolumeChanged_DetectionInterval = 100I
AudioDevice.Timer_ChannelsVolumeChanged_DetectionInterval = 100I
AudioDevice.Timer_Mute_DetectionInterval = 100I
' Get the DeviceName
' ##################
MessageBox.Show(String.Format("Device Name: {0}", AudioDevice.Name),
"CoreAudip API", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Get a value indicating whether the Device is muted:
' ###################################################
MessageBox.Show(String.Format("Device Is Muted?: {0}", CStr(AudioDevice.IsMuted)),
"CoreAudip API", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Mute the device:
' ################
AudioDevice.Mute()
' Unmute the device:
' ##################
AudioDevice.Unmute()
' Set the master-volume:
' ######################
AudioDevice.Volume = 50I
' Get the channel count:
' ######################
MessageBox.Show(String.Format("Device Total Channels: {0}", AudioDevice.ChannelsCount),
"CoreAudip API", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Set the volume for an specific channel:
' #######################################
AudioDevice.ChannelVolumeSet(MasterVolume.DeviceChannel.Channel0, 50I)
' Set the volume for all channels:
' ################################
AudioDevice.ChannelVolumeSetAll(50I)
' Get the volume of an specific channel:
' ######################################
MessageBox.Show(String.Format("Channel: 0, Volume: {0}",
AudioDevice.ChannelVolumeGet(MasterVolume.DeviceChannel.Channel0)),
"CoreAudip API", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Get the volume of all channels:
' ###############################
Dim ChannelsInfo As Dictionary(Of MasterVolume.DeviceChannel, Integer) = AudioDevice.ChannelVolumeGetAll
Dim sb As New System.Text.StringBuilder
With sb
For Each Channel As KeyValuePair(Of MasterVolume.DeviceChannel, Integer) In ChannelsInfo
.AppendLine(String.Format("Channel: {0}, Volume: {1}", CStr(Channel.Key), CStr(Channel.Value)))
Next
End With
MessageBox.Show(sb.ToString(), "CoreAudip API", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Lock the audio device:
' ######################
AudioDevice.LockDevice()
' Unlock the audio device:
' ########################
AudioDevice.UnlockDevice()
Private Sub AudioDevice_OnMutedChanged(ByVal sender As Object, ByVal e As MasterVolume.MuteArgs) _
Handles AudioDevice.OnMutedChanged
' Do something here...
Debug.WriteLine(String.Format("Device Muted changed to: {0}", CStr(e.IsMuted)))
End Sub
Private Sub AudioDevice_OnVolumeChanged(ByVal sender As Object, ByVal e As MasterVolume.MasterVolumeArgs) _
Handles AudioDevice.OnMasterVolumeChanged
' Do something here...
Debug.WriteLine(String.Format("Device Master-Volume changed to: {0}", CStr(e.Volume)))
End Sub
Private Sub AudioDevice_OnVolumeChanged(ByVal sender As Object, ByVal e As MasterVolume.ChannelVolumeArgs) _
Handles AudioDevice.OnChannelVolumeChanged
' Do something here...
Debug.WriteLine(String.Format("Device volume in channel '{0}' changed to: {1}", e.Channel.ToString(), CStr(e.Volume)))
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
VistaCoreAudioApiHelper | Initializes a new instance of the VistaCoreAudioApiHelper class. |
ChannelsCount | Gets the total amount of device channels. |
DeviceMonitorsEnabled | Gets or sets a value indicating whether the audio device timers that monitors and reports changes are enabled. |
IsLocked | Gets a value indicating whether the device is locked. |
IsMuted | Gets a value indicating whether the device is muted. |
Name | Gets the audio device name. |
TimerChannelsVolumeChangedDetectionInterval | Gets or sets the Channels-Volume changed detection interval, in milliseconds. This interval is associated with a timer that monitors and reports Channels-Volume changes on the device. |
TimerMasterVolumeChangedDetectionInterval | Gets or sets the Master-Volume changed detection interval, in milliseconds. This interval is associated with a timer that monitors and reports Master-Volume changes on the device. |
TimerMuteDetectionInterval | Gets or sets the mute detection interval, in milliseconds. This interval is associated with a timer that monitors and reports Mute changes on the device. |
Volume | Gets or sets the current device volume. |
Dispose | Releases all the resources used by this instance. |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetAllChannelVolume | Gets the volume of all the device channels. |
GetChannelVolume | Gets the volume of an specific device channel. |
GetHashCode | Serves as the default hash function. (Inherited from Object) |
GetType | Gets the Type of the current instance. (Inherited from Object) |
LockDevice | Locks the device, disabling to mute or change the volume. |
MuteDevice | Mutes the device. |
SetAllChannelVolume | Sets the volume for all the device channels. |
SetChannelVolume | Sets the volume for an specific device channel. |
ToString | Returns a string that represents the current object. (Inherited from Object) |
UnlockDevice | Unlocks the device, enabling to mute or change the volume. |
UnmuteDevice | Unmutes the device. |
ChannelVolumeChanged | Event raised when a device channel(s) volume changes |
MasterVolumeChanged | Event raised when device master-volume changes. |
MutedChanged | Event raised when device muting changes. |
CanConvertTo |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
CanConvertToT |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions) |
IsDisposable |
Determines whether the specified object is a disposable type
(i.e., it implements IDisposable interface).
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
ThrowIfNullTException |
Throws the specified exception if the source object is null.
(Defined by ObjectExtensions) |