Announcement

Collapse
No announcement yet.

Jon00 Audio Control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Jon00 Audio Control

    Finally got around to post this...

    This package allows you to individually control the main volume/mute and mixed outputs on the default sound device assigned to your Homeseer server.

    Virtual devices are created for each detected output showing a graphical representation (not direct control) of the volume levels by means of a slider image.

    Each detected output can be individually controlled to any value between 0 and 100% via scripts /events using a variety of keywords/values (Mute, UnMute, Togglemute, Last, Max, Min, 44% etc). They can also be set via 5 preset values on the status page.

    This package cannot be used to control audio inputs or adjust controls such as balance or bass/treble.

    The script will auto-detect any outputs it finds and will assign a generic name. This can be altered to reflect the actual usage of this control if required.

    Please note that this has only been tested on my Hometroller using XPe. Due to the flaky audio interface that Microsoft provides, there is no guarantee that it will work or detect outputs on all Windows operating systems.
    It will also only detect common outputs and may not detect specialist outputs found on upmarket sound cards.
    I am unable to assist if it does not detect or work with your set-up.

    As always, it is available for download from my site. Please let me know if it works for you!
    Attached Files
    Last edited by jon00; February 14, 2009, 04:04 AM.
    Jon


    #2
    Works here and as usual... nice bit of coding.. well done Jon

    TrOjAn

    Comment


      #3
      Problem with master volume value/percentage tracking

      This might not just be a "problem" with Master Volume but with all the Audio Control devices.

      I created a slider in HStouch (0...65355) to track/control the Master Volume variable created in HS with the plug in..

      I can see that the value moves fine with the slider BUT the PERCENTAGE
      value and graphics under "Satus" stays where it is was last set in HS Status.

      Moreveove if I try to run the script again (as suggested in doc file) to sync/update the variables then the Master Volume goes back to where
      the value would be for the original PERCENTAGE was.

      e.g I had set the value of Master Volume to 32k or so but the percentage was last set at 75% and then I try to "sync" thenI all a suddden I see the Master Volume go back to 75% *65355

      Comment


        #4
        OK, so what you are trying to say is that it adjusts the volume OK but does not remember this when using it through the range 0-65535 method?
        Jon

        Comment


          #5
          I guess that is right....the percentage (0..100%) value seems to overwrite the value (0...65535) as I re-run the script as suggested.

          if I just refresh the status screen I just see a precentage and slider of let's say 50% even with a volume that was just set to 50k or so.

          Note that the "Last Change" indicator shows the correct time that the Value was changed last.
          Last edited by fbitz777; January 8, 2009, 03:38 PM.

          Comment


            #6
            I think I found the issue.

            Try the attached (to replace the existing in the scripts directory). If OK, I'll update the download.
            Last edited by jon00; January 10, 2009, 03:07 AM.
            Jon

            Comment


              #7
              same is still happening ...files were exactly the same size and name, right?

              I did set up an event to catch when the percentage overwrites the Volume Value and it is always after running the script (I do it manually for now)

              HStouch has 3 fields: text, image, value which display on my screen:


              text: 25%
              image: I see just the knob of the slider..not the rest of the slider
              value: 45554 or any value from 0 to 65555

              the HStouch slider can only track the value obviously not the percentage text

              Comment


                #8
                I think we need to take a step back.

                Set the master volume on your HS PC to max normally.
                Please call the script on it's own via an event with the following optional parameters:

                ("Main","1,32000")

                Watch the actual Windows Volume control and it should move to approx 50%.
                If you refresh the status page, the slider on the master volume should reflect this.

                Now call the script again without any parameters. If you do this nothing should happen. If it moves to another position then something is wrong.

                How are you calling the script with HSTouch?
                Jon

                Comment


                  #9
                  I did what you suggested and I immediately see the right value
                  in HStouch and HS status both for percentage (49%) and value

                  I am not sure how HStouch works, all I know is that it sets the value and not the percentage...and in no way would HStouch know about your script to start with.


                  I think there are ways to call scrips from HStouch however.
                  Last edited by fbitz777; January 9, 2009, 03:38 PM.

                  Comment


                    #10
                    Maybe I misunderstood you here. Are you just running my script to update its virtual devices to show the current volume as a graphic?
                    Jon

                    Comment


                      #11
                      The plan was to run the plugin once to create the variables and then just
                      use status and control via HStouch which has its own set of sliders which sets/tracks the value (0...65535) of the volume.

                      Not much different then if I were to use the Windows Volume Slider and then try to reflect the correct status in HS...

                      I think I know now what the problem is:
                      HStouch does not do anything but set a "number" for Volume into the value field of the Volume Variable....It does NOT acually set the real volume on the speakers (or other devices)!

                      Hence there are only a few solutions:

                      -find a way for HStouch to call your main() function in your script with the value of the slider...pretty sure this is feasible but I am not an HStouch expert yet...I posted in HStouch forum about it...

                      -Hstouch can trigger an event for sure and I need then to find the correct syntax on how to call jon00audiocontrol("main","1,xxx")

                      I am not sure how to "spell" the xxx above to reflect for example M50.devicevalue...M50 beeing the device of volume control

                      Comment


                        #12
                        To make your life easier, I have now added a new option to read a value from any device. Just replace your current version with the new attachment.

                        When you call the script, you can now use $DV:<housecode> as a parameter.

                        For an example, to adjust the master volume using the device value stored in J22, you would call the script:

                        ("Main","1,$DV:J22")

                        To call this in hs.touch just use:

                        [$SCRIPT=&hs.RunEX ("Jon00AudioControl.vben","Main","1,$DV:J22")]

                        (This is provided you can get the slider value of HS Touch in to device value J22 - I have not tried HS Touch myself)

                        Please give it a try and if successful, I'll update the download.

                        EDIT:

                        I re-uploaded this with another call:

                        $DV%:<housecode>

                        You can use this if your device value contains percentages i.e. 0 - 100
                        Last edited by jon00; January 10, 2009, 02:39 PM.
                        Jon

                        Comment


                          #13
                          I was able to run the main() procedure as well as call the script from HStouch

                          Only ONE problem now:

                          The device I use is M50 which is the one setup originally for Volume Control...which has let's say 32000

                          When I call ("Main","1,$DV:M50"), I see now:
                          Volume 49%...fine
                          Actual volume is SET correctly on the speaker...fine
                          however the M50 Device value is overwritten with ZERO!

                          obviously the value field has been overwritten by the script call...note that this does not happen if I call ("Main","1,32000")

                          interestingly enough if I call ("Main","1,$DV:M50") again (now that the value is zero, nothing changes...i.e. set volume stays at 49%

                          Comment


                            #14
                            Not being familiar with HSTouch, can you use another device for the HS Slider. What you are doing is interfering with my slider control by using the same device.
                            Jon

                            Comment


                              #15
                              not possible since the slider function is to "track" a homeseer device in the first place! ..I have the same working fine with the Itunes volume controller for example but again there I think they only deal with values and not value/percentage pairs.

                              I probably would need to create some other shadow virtual variables but
                              when I would need to call the script more than once (e.g v50):

                              Slider moves (v50)....call script to update volume precentage(m50%),and value (m50)

                              Percentage changes (m50%)....make a script to update the slider value (v50)

                              Comment

                              Working...
                              X