Thread: Internal Application specific volume control

  1. #1
    Registered User
    Join Date
    Jan 2005

    Internal Application specific volume control

    I have a game that plays a set of wav files after certain events. I am wondering what I need to be able to add a volume slider to internally modulate the volume without affecting system volumes.

    I am using Dx. If you need additional information please ask and I'll let you know.

    The purpose behind it is to be able to play other music, voice chat, etc, without being overshadowed by the activity in the game.



  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    *Request to have this thread moved to the game programming forum...

    You may have better luck there.


  3. #3
    Join Date
    Aug 2002
    Tucson, Arizona
    Well I know nothing about how to do this but if you do know how to change the system volume couldn't you just hold that volume level and then at the end of you program restore that value

  4. #4
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    I believe the problem is making the game quiter so that other sounds aren't drowned out, during execution of the program.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Doesn't the game have an options page where you can control it's own volume?

    Failing that, just re-encode all it's audio files to be quieter than normal
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Perhaps I haven't explained it fully. And I didn't notice that there was a gaming forum, I will more than likely repost.

    The game is being built by me, not a third party. Therefore I cannot just 'go to an options page' because I would have to make said options page.

    Forget that it's a game. The idea is to allow a user to modulate volumes played through the program from wav files, without affecting other volumes. There must be a codec/library set to do this... somewhere. Almost every game out there has this feature. It's just rather reclusive.

    Basically I want to buffer the incoming sound, make it quieter or louder based on the slider, and then send it on its way.


  7. #7
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas
    do a google on DirectSound or the MS MMIO API.
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    IDirectSoundBuffer8 has a method called SetVolume. That regulates the volume of a single sound - I don't think you have any choice but to store the volume level in your app and call SetVolume on every buffer you create.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Custom rightclick menu on a control?
    By Viper187 in forum Windows Programming
    Replies: 18
    Last Post: 10-10-2008, 08:55 AM
  2. how to see if a control is in a specific spot
    By AtomRiot in forum C# Programming
    Replies: 0
    Last Post: 05-15-2007, 10:37 AM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM