Thread: controlling the volume

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    23

    controlling the volume

    is there an easy way to controll the volume? say for all applications
    let us eat and drink

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    A quick search produced this on MSDN waveOutSetVolume(). Not sure though if that means the device volume for the system or just that app.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    It says that the first parameter is a handle to a waveform device
    waveOutSetVolume
    The waveOutSetVolume function sets the volume level of the specified waveform-audio output device.

    MMRESULT waveOutSetVolume(
    HWAVEOUT hwo,
    DWORD dwVolume
    );
    Parameters
    hwo
    Handle to an open waveform-audio output device. This parameter can also be a device identifier.
    dwVolume
    New volume setting. The low-order word contains the left-channel volume setting, and the high-order word contains the right-channel setting. A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.
    If a device does not support both left and right volume control, the low-order word of dwVolume specifies the volume level, and the high-order word is ignored.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following.

    Value Description
    MMSYSERR_INVALHANDLE Specified device handle is invalid.
    MMSYSERR_NODRIVER No device driver is present.
    MMSYSERR_NOMEM Unable to allocate or lock memory.
    MMSYSERR_NOTSUPPORTED Function is not supported.


    Remarks
    If a device identifier is used, then the result of the waveOutSetVolume call applies to all instances of the device. If a device handle is used, then the result applies only to the instance of the device referenced by the device handle.

    Not all devices support volume changes. To determine whether the device supports volume control, use the WAVECAPS_VOLUME flag to test the dwSupport member of the WAVEOUTCAPS structure (filled by the waveOutGetDevCaps function). To determine whether the device supports volume control on both the left and right channels, use the WAVECAPS_LRVOLUME flag.

    Most devices do not support the full 16 bits of volume-level control and will not use the high-order bits of the requested volume setting. For example, for a device that supports 4 bits of volume control, requested volume level values of 0x4000, 0x4FFF, and 0x43BE all produce the same physical volume setting: 0x4000. The waveOutGetVolume function returns the full 16-bit setting set with waveOutSetVolume.

    Volume settings are interpreted logarithmically. This means the perceived increase in volume is the same when increasing the volume level from 0x5000 to 0x6000 as it is from 0x4000 to 0x5000.

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Just out of interest, how would you assign HWAVEOUT to the default wave-oout device?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Volume of a Cone Equation always equals 0
    By Devolution in forum C Programming
    Replies: 11
    Last Post: 01-28-2009, 03:13 AM
  2. What is wrong with my code?
    By dakarn in forum C Programming
    Replies: 6
    Last Post: 10-14-2008, 05:16 AM
  3. API for controlling OS volume
    By datainjector in forum Windows Programming
    Replies: 2
    Last Post: 05-16-2008, 03:55 PM
  4. Help! Right Math, Wrong Output
    By verd in forum C Programming
    Replies: 12
    Last Post: 03-15-2005, 07:49 PM
  5. What am I doing wrong? Help please...
    By SprinterSteve in forum C Programming
    Replies: 9
    Last Post: 04-17-2003, 09:35 PM