MODM_SETVOLUME function

WINMM sends the MODM_SETVOLUME message to the modMessage function of a MIDI output driver to set the volume for a MIDI device.

Syntax


DWORD modMessage(
   UINT      uDeviceID,
   UINT      uMsg,
   DWORD_PTR dwUser,
   DWORD_PTR dwParam1,
   DWORD_PTR dwParam2
);

Parameters

uDeviceID

Specifies the ID of the target device. Device IDs are sequential and have an initial value of zero and a final value that is equal to one less than the number of devices that the driver supports.

uMsg

WINMM sets this parameter to MODM_SETVOLUME when it calls modMessage to process this message.

dwUser

Use this parameter to return instance data to the driver. Drivers that support multiple clients can use this instance data to track the client that is associated with the message.

dwParam1

This parameter specifies the new volume level. The high-order word contains the right channel setting and the low-order word contains the left channel setting. A value of zero is silence, and a value of 0xFFFF is full volume. If the driver does not support both left and right channel volume changes, it uses the volume specified in the low-order word. The driver will typically not support the full 16 bits of volume control and must truncate the lower bits if necessary. However, the original volume level set with MODM_SETVOLUME must be returned with MODM_GETVOLUME.

dwParam2

Not used.

Return value

The modMessage function returns MMSYSERR_NOERROR if the operation was successful. Otherwise, it returns one of the error messages in the following table.

Return codeDescription
MMSYSERR_NOTENABLED

The driver failed to load or initialize.

MMSYSERR_NOTSUPPORTED

The driver does not support changes to volume level.

 

Remarks

This volume level is the final output volume; therefore, only drivers for internal synthesizer devices can support volume level changes. Drivers for MIDI output ports must return a MMSYSERR_NOTSUPPORTED error for this message. Support for volume level changes is optional for internal synthesizer devices. When a driver receives a MODM_GETDEVCAPS message, it must indicate support for volume level changes by setting or clearing the MIDICAPS_VOLUME and MIDICAPS_LRVOLUME bits in the dwSupport field of the MIDIOUTCAPS data structure. If a driver supports the MODM_SETVOLUME message, it must also support MODM_GETVOLUME.

Requirements

Target platform

Version

Available in Windows XP and later Windows operating systems.

Header

Mmddk.h (include Mmddk.h, Mmsystem.h, or Windows.h)

See also

modMessage
MODM_GETDEVCAPS
MIDIOUTCAPS

 

 

Send comments about this topic to Microsoft

Show: