Help - Search - Members - Calendar
Full Version: Panels UI : Need Help With A Mute Button
Hydrogenaudio Forums > Hosted Forums > foobar2000 > 3rd Party Plugins - (fb2k)
Keikonium
I am wanting to create a button in Panels UI that when the volume is altered, the image is altered, and I have gotten that with this code here:
CODE
// PerSecond
$imageabs(0,1,$ifgreater(%cwb_volume%,-20,$get(dir1)sound_high.png,$get(dir1)sound_low.png))


I also have some code that will display a mute button right in the same position as the volume button:
CODE
// PerTrack
$imagebutton(0,1,
$ifgreater(%cwb_volume%,-20,$get(dir1)sound_high.png,$get(dir1)sound_low.png),
$ifgreater(%cwb_volume%,-20,$get(dir1)sound_high.png,$get(dir1)sound_low.png),
Volume mute,tooltip,Mute)


What I have done is taken an invisible .png and used that as a button over top of the other volume images. That way, I can press the button, and mute the volume. But what I want to do, is when the volume is MUTED, I want to hide the altered images, and display a mute image. Is this possible?

Hopefullt this made sense... :S.

EDIT:
Fixed my mute code, I accidentally put my old code that was glitchy.

Moderation: added line breaks in code to preserve forum layout.
Yotsuya
I do not see anything in the foobar titleformat help or in the cwb_hooks list that will return the current state of muting. However, you might try something like this:
$ifgreater(%cwb_volume%,-100,unmuted,muted)

Another approach to your situation you may wish to consider instead of layering buttons, is using $select() to choose the button like this:

CODE
// PerSecond
$puts(volume.level,
$ifequal(%cwb_volume%,0,max,$ifgreater(%cwb_volume%,-100,
$select($div(%cwb_volume%,-1),
high,high,high,high,high,high,high,high,high,
high,high,high,high,high,high,high,high,high,high,
high,high,high,high,high,high,high,high,high,high,
med,med,med,med,med,med,med,med,med,med,
med,med,med,med,med,med,med,med,med,med,
med,med,med,med,med,med,med,med,med,med,
low,low,low,low,low,low,low,low,low,low,
low,low,low,low,low,low,low,low,low,low,
low,low,low,low,low,low,low,low,low,low
)
,mute))
)

$imagebutton(0,1,$get(dir1)sound_$get(volume.level).png)


* You'll probably have to adjust the matrix to your liking because volume is not a linear scale
* I am not familiar with $imagebutton() is that new?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.