Loading ...
Sorry, an error occurred while loading the content.

Re: [gui4cli] Volume Control

Expand Messages
  • Dimitris Keletsekis
    ... To use MCI you must first open a device. The normal code that should do this (but doesn t) would be: XBUTTON 10 10 165 30 volume half mci open
    Message 1 of 5 , Nov 15, 2006
    View Source
    • 0 Attachment
      > mci setaudio $vol

      To use MCI you must first "open" a device.
      The normal code that "should" do this (but doesn't) would be:

      XBUTTON 10 10 165 30 "volume half"
      mci 'open "c:/myfile.wav" alias temp'
      if $$retcode = 0
      mci 'setaudio temp volume to 50'
      mci 'close temp'
      endif

      The reason it doesn't work is that the SetAudio command works only for
      "digitalvideo" and "vcr" devices. - see:
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_setaudio.asp

      so you would have to open one of those types of files - I don't know how..
      In general volume control through MCI sucks.

      > Does anyone know of an easy way to control volume?

      I have a half finished dll that deals with that but I have to find
      sometime to finish it.

      There may be another way I don't know about though..

      Dimitris
    • Fer Stoopman
      Hi, You can smoothly change the volume of the song that has been opened with MCI but that does not change the setting of your system volume control
      Message 2 of 5 , Nov 16, 2006
      View Source
      • 0 Attachment
        Hi,

        You can smoothly change the volume of the song that has been opened
        with MCI but that does not change the setting of your system volume
        control (sndvol32.exe).

        To control the volume of a song you first have to open it as
        mpegvideo like this:

        mci 'open $sound type mpegvideo alias song'
        if $$retcode = 0
        mci 'play song'
        mci 'setaudio song volume to $vol'
        endif

        The trackbar should have the style 'busy' and the command:
        mci 'setaudio song volume to $vol'

        $sound is the full path to the song which may be a type wav, mp3,
        wma and mid.

        Fer
      • Fer Stoopman
        Hi, I forgot something (must be the age) 1. If you don t use MIDI-files and WAV-files than you don t have to specify the device. (Useful for MP3/WMA only) You
        Message 3 of 5 , Nov 16, 2006
        View Source
        • 0 Attachment
          Hi,

          I forgot something (must be the age)

          1. If you don't use MIDI-files and WAV-files than you don't have to
          specify the device. (Useful for MP3/WMA only)
          You can simply open MCI by: mci 'open $sound alias song'
          and then change the volume. In this case volume control of MIDI- and
          WAV-files is not possible but they still can be heard at max level.

          2. The trackbar should have min/max values of 0 and 1000
          Max value of 100 means the sound is hardly audible.

          3. If you want to change the system sound volume from a Gui4Cli gui
          add the command <run 'sndvol32.exe'> to a button or any other event
          whenever/whereever you want.


          Fer

          NB. Applies to XP
        Your message has been successfully submitted and would be delivered to recipients shortly.