最終更新:2012-04-29 (日) 23:44:17 (4378d)  

IAudioEndpointVolume
Top / IAudioEndpointVolume

http://msdn.microsoft.com/en-us/library/dd370892(VS.85).aspx

Vistaのマスターボリュームの変更とかに使う

メンバーメソッド

  • GetChannelCount? - Gets a count of the channels in the audio stream.
  • GetChannelVolumeLevel? - Gets the volume level, in decibels, of the specified channel in the audio stream.
  • GetChannelVolumeLevelScalar? - Gets the normalized, audio-tapered volume level of the specified channel of the audio stream.
  • GetMasterVolumeLevel? - Gets the master volume level of the audio stream, in decibels.
  • GetMasterVolumeLevelScalar? - Gets the master volume level, expressed as a normalized, audio-tapered value.
  • GetMute? - Gets the muting state of the audio stream.
  • GetVolumeRange? - Gets the volume range of the audio stream, in decibels.
  • GetVolumeStepInfo? - Gets information about the current step in the volume range.
  • QueryHardwareSupport? - Queries the audio endpoint device for its hardware-supported functions.
  • RegisterControlChangeNotify? - Registers a client's notification callback interface.
  • SetChannelVolumeLevel? - Sets the volume level, in decibels, of the specified channel of the audio stream.
  • SetChannelVolumeLevelScalar? - Sets the normalized, audio-tapered volume level of the specified channel in the audio stream.
  • SetMasterVolumeLevel? - Sets the master volume level of the audio stream, in decibels.
  • SetMasterVolumeLevelScalar? - Sets the master volume level, expressed as a normalized, audio-tapered value.
  • SetMute? - Sets the muting state of the audio stream.
  • UnregisterControlChangeNotify? - Deletes the registration of a client's notification callback interface.
  • VolumeStepDown? - Decreases the volume level by one step.
  • VolumeStepUp? - Increases the volume level by one step.

サンプル

public AudioEndpointVolume()
{
    IMMDeviceEnumerator deviceEnumerator;
    IMMDevice endPoint;
    deviceEnumerator = new _MMDeviceEnumerator() as IMMDeviceEnumerator;
    deviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eConsole, out endPoint);
    Marshal.ReleaseComObject(deviceEnumerator);

    Guid IID_IAudioEndpointVolume = new Guid(IID.IAudioEndpointVolume);
    IntPtr ppInterface;
    endPoint.Activate(ref IID_IAudioEndpointVolume, (uint)CLSCTX.CLSCTX_ALL, IntPtr.Zero, out ppInterface);

    iAudioEndpointVolume = Marshal.GetObjectForIUnknown(ppInterface) as IAudioEndpointVolume;

    //コールバックの設定
    audioEndpointVolumeCallback = new AudioEndpointVolumeCallback(this);
    iAudioEndpointVolume.RegisterControlChangeNotify(audioEndpointVolumeCallback);

}

参考

関連