Master volume bar

After hours of browsing and testing to find a solution to this, i finally throw my pride away and asks for help instead :P

What i need is a trackbar to control the master volume, i found a couple of examples for this but most in the wrong language or too complicated for me.

If anyone could help me out abit i would greatly appreciate it.

Andy



Answer this question

Master volume bar

  • foobarX

    Hi!

    I used this "dll",
    but I'm running under Vista and all it does is to change the volume for the application not the Master Volume...

    Please help!

    /ph1l

  • phil_m

    Thanks for your answer, it kinda looks like one piece of code i already tried, last time it didn't work tho. Tried this, and it worked so far that i didn't get any compile errors.

    Just one question tho: Where do i set the value of the volume (how do i link my Trackbar to it ). Been eyeing through it for a while now, and i found a couple of lines to "set" volume, but in the end i just ended up confused.

     

    Thanks

    Andy


  • NMF

    Hi, Andy

    I've tried it, and find it works well.

    Put the code in a new class library application and compile it. It will generate a dll file.

    Reference the dll file to your new winform project.

    In your winform, you can just use AudioMixerHelper.SetVolume(int) and AudioMixerHelper.GetVolume() methods in PhidgetTest namespace to set and get the master volume.

    So, the left is to apply these two methods into the trackbar!

    If you do have further problems, pls feel free to let me know. Thank you



  • Nick Gravelyn

    Hi, Ph1l

    You can deliver such a question with more details in Vista Pro-Audio Application Development rather than here.

    Thank you.



  • Andy Goodwin

    In winform project:

    Create a trackBar named trackBar1

    Set trackBar1.Maximum = 65535; (say that 65535 is the max value of volume) trackBar1.Minimum = 0;

    Initialize the trackBar's value: trackBar1.Value = AudioMixerHelper.GetVolume();

    Set trackBar's value in trackBar.Scroll event:

    private void trackBar1_Scroll(object sender, EventArgs e)
            {
                AudioMixerHelper.SetVolume(trackBar1.Value);
            }

    Follow the steps above, you will make it!

    Thank you



  • Jagadeesan

  • Master volume bar