Volume control help in xml ...

Jorge

Members +
Good afternoon.

Just a short post during lunch break wondering if there is anyone out there that knows how to set up some code that would allow me to change volume using the Doug Dawson "dsd_fsx_xml_sound.gau" gauge?

I posted over at FSDeveloper, so hoping someone there can shed some light. No "bites" over there yet.

I'm able to change volume, but I have to shut the sound off first before the change takes place. I haven't been able to figure out how to change the volume "on the fly" by clicking on the volume knob.

Here's the mouse code so far:

XML:
<!--  Volume Control  -->
    <Area Left="139" Top="375" Width="63" Height="62">
        <Tooltip>Volume: %((L:SW_Volume_Set, enum))%!6.2f!; %((L:SW_Volume, enum))%!6.2f!</Tooltip>
        <Cursor Type="Hand"/>
        <Click Kind="LeftSingle+RightSingle+WheelUp+WheelDown" Repeat="Yes">
            (M:Event) 'WheelDown' scmp 0 ==
            (M:Event) 'LeftSingle' scmp 0 == ||
            if{
                (L:SW_Volume_Set, enum) 3.33 - 0 max (&gt; L:SW_Volume_Set, enum)
                (L:SW_Volume, enum) -3000 &gt;
                    if{
                        (L:SW_Volume, enum) 100 - (&gt; L:SW_Volume, enum)
                        <!-- Make the knob rotate through 360 degrees -->
                        (L:SW_Volume_Knob, number) 1 - dnor (&gt;L:SW_Volume_Knob, number)
                    }
            }

            (M:Event) 'WheelUp' scmp 0 ==
            (M:Event) 'RightSingle' scmp 0 == ||
            if{
                (L:SW_Volume_Set, enum) 3.33 + 100 min (&gt; L:SW_Volume_Set, enum)
                (L:SW_Volume, enum) -1 &lt;
                    if{
                        (L:SW_Volume,enum) 100 + (&gt; L:SW_Volume,enum)
                        <!-- Make the knob rotate through 360 degrees -->
                        (L:SW_Volume_Knob, number) 1 + dnor (&gt;L:SW_Volume_Knob, number)
                    }
            }
        </Click>
    </Area>

Here's the main code placed in an element section just before the mouse stuff:

XML:
<!-- ========== Volume Controls ========== -->
<!-- Volume Control -->
    <Element>
        <Position X="139" Y="375"/>
        <Value Minimum="-3000" Maximum="-1">(L:SW_Volume, enum)</Value>
    </Element>
<!-- Set Volume Level -->
    <Element>
        <Position X="139" Y="375"/>
        <Value Minimum="0" Maximum="100">(L:SW_Volume_Set, enum)</Value>
    </Element>
<!-- Volume Knob -->
    <Element>
        <Position X="170.5" Y="406"/>
        <Image Name="radio_popup_tuning_knob_vega.bmp">
            <Axis X="31.5" Y="31"/>
        </Image>
        <Clip/>
        <Rotate>
            <Value>(L:SW_Volume_Knob, number) dgrd </Value>
            <Delay DegreesPerSecond="360"/>
        </Rotate>
    </Element>

The "main majic" is via another xml which acts like a "system" or "update" gauge. I would put the sound section I have so far, but it's fairly long -- about 400 lines so far, and not even close to getting all the stations in there yet.

I can post it here if it's okay, but I'd rather send the parts to someone to check out if possible.

Here's link to what it's looking like so far:

JRN-3 Shortwave Radio

Any ideas how to get the thing to have a "dynamic" volume control based on clicking the knob?

Thanks in advance!

Saludos,

Jorge
Miami, FL
 
Back
Top