Share via


IUccAudioMediaChannel.set_Volume Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Sets the streaming volume for a specified media direction.

Namespace: Microsoft.Office.Interop.UccApi
Assembly: Microsoft.Office.Interop.UccApi (in microsoft.office.interop.uccapi.dll)

Syntax

'Declaration
Sub set_Volume ( _
    enDirection As UCC_MEDIA_DIRECTIONS, _
    lVolume As Integer _
)
void set_Volume (
    UCC_MEDIA_DIRECTIONS enDirection,
    int lVolume
)
void set_Volume (
    UCC_MEDIA_DIRECTIONS enDirection, 
    int lVolume
)
void set_Volume (
    UCC_MEDIA_DIRECTIONS enDirection, 
    int lVolume
)
function set_Volume (
    enDirection : UCC_MEDIA_DIRECTIONS, 
    lVolume : int
)

Parameters

  • lVolume
    A value of the LONG (int, for a .NET application) type. lVolume can be in the range of 0 to 65535.

Remarks

Win32 COM/C++ Syntax

HRESULT put_Volume
(
   UCC_MEDIA_DIRECTIONS enDirection,
   LONG lVolume
);

The following example sets the volume of an audio media channel.

        /// <summary>
        /// sets the volume of an audio media channel in at the specified
        /// level and direction
        /// </summary>
        /// <param name="pMediaChannel">IUccMediaChannel Media channel to update</param>
        /// <param name="pVolume">int new volume</param>
        /// <param name="pDirection">UCC_MEDIA_DIRECTIONS direction to set</param>
        private void SetVolume(IUccMediaChannel pMediaChannel, int pVolume, UCC_MEDIA_DIRECTIONS pDirection)
        {

            // Maximum value of int volume is 65535
            if (pVolume >= 65536)
            {
                pVolume = 65535;
            }
            try
            {
                IUccAudioMediaChannel amc = pMediaChannel as IUccAudioMediaChannel;
                amc.set_Volume(pDirection, pVolume);

            }
            catch (COMException e)
            {
                MessageBox.Show("Volume " + pVolume.ToString() + " COM exception on set volume: " + this.m_ReturnError.returnComError(e.ErrorCode));
            }
            catch (ArgumentException ae)
            {
                MessageBox.Show("Volume " + pVolume.ToString() + " Argument exception on set volume: " + ae.Message);
            }
        
        }

Note

In a Win32 application, the return value of a method or property is always an HRESULT value indicating the status of the call to the interface member. Any result of the operation is returned as a parameter marked with the [out, retval] attribute. In contrast, in a .NET application the HRESULT value indicating an error condition is returned as a COM exception and the [out, retval] parameter becomes the return value. For the UCC API-defined HRESULT values, see Trace and Handle Errors in Unified Communications Client API.

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2000 with Service Pack 4, Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

See Also

Reference

IUccAudioMediaChannel Interface
IUccAudioMediaChannel Members
Microsoft.Office.Interop.UccApi Namespace