It is currently April 26th, 2024, 10:51 pm

Changing image depending on the volume

Get help with creating, editing & fixing problems with skins
svejedobro
Posts: 3
Joined: June 2nd, 2017, 12:01 pm

Changing image depending on the volume

Post by svejedobro »

I need help, I just got into Rainmeter and I'm still learning the basics. I guess this has a simple solution but I can't seem to figure it out.

Code: Select all

[Rainmeter]
Update=1000
MouseScrollUpAction=[!CommandMeasure MeasureVolume "ChangeVolume +3"][!Update]
MouseScrollDownAction=[!CommandMeasure MeasureVolume "ChangeVolume -3"][!Update]
MiddleMouseUpAction=[!CommandMeasure MeasureVolume "ToggleMute"][!Update]

[BackGroundDisplay]
Meter=Image
X=0
Y=0
W=70
H=70
SolidColor=0,0,0,1

[MeasureVolume]
Measure=Plugin
Plugin=Win7AudioPlugin

[VolumeBar]
Meter=Image
ImageName=#@#Volume.png
DynamicVariables=1
X=0
Y=0
W=70
H=70
I want to change the image "Volume.png" to either "Volume1", "Volume2" or "Volume3" depending on the volume, where "Volume1" is lowest and "Volume3" is the highest.

Thanks in advance.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing image depending on the volume

Post by balala »

svejedobro wrote:I want to change the image "Volume.png" to either "Volume1", "Volume2" or "Volume3" depending on the volume, where "Volume1" is lowest and "Volume3" is the highest.
You have to add some IfConditions to the [MeasureVolume] measure:

Code: Select all

[MeasureVolume]
...
IfCondition=(#CURRENTSECTION#<=33)
IfTrueAction=[!SetOption VolumeBar ImageName "#@#Volume1.png"]
IfCondition2=((#CURRENTSECTION#>33)&&(#CURRENTSECTION#<=66))
IfTrueAction2=[!SetOption VolumeBar ImageName "#@#Volume2.png"]
IfCondition3=(#CURRENTSECTION#>66)
IfTrueAction3=[!SetOption VolumeBar ImageName "#@#Volume3.png"]
Here the limits where the images are changing are 33% and respectively 66%. Obviously you can can easily change these limits, changing the appropriate values in the IfCondition options. Just be careful to have covered the whole range, from 0% to 100% (and if you want, you can add one more IfCondition and the appropriate IfTrueAction, to change the image to a fourth one, when the system is on mute, with the following condition: IfCondition4=(#CURRENTSECTION#<0), because in this case, the [MeasureVolume] measure returns -1).
svejedobro
Posts: 3
Joined: June 2nd, 2017, 12:01 pm

Re: Changing image depending on the volume

Post by svejedobro »

Thank you man, it worked ideally.

In case you wondered how it looks, I'll put it here so you can check it out. It's as simple as it gets and quite useful.
I've colored it how I like it but you can easely color it in photoshop.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing image depending on the volume

Post by balala »

Good work, congratulations.
Just a short note: you can completely remove the ImageName option of the [VolumeBar] meter. It's not needed, because the IfTrueAction options of the [MeasureVolume] measure are setting the appropriate image. However even if you let it there, that's not a problem.
svejedobro
Posts: 3
Joined: June 2nd, 2017, 12:01 pm

Re: Changing image depending on the volume

Post by svejedobro »

You're right, it's unnecessary,I've removed it. Thanks again. :thumbup:

Here, I've applied few more things I think now it's lot more better. When you turn the volume louder it's turning red.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing image depending on the volume

Post by balala »

Ok, one more, I hope you don't mind.
The [BackGroundDisplay] meter is again useless. I'd remove it and instead, I'd add the following options to the [Rainmeter] section:

Code: Select all

[Rainmeter]
...
BackgroundMode=2
SolidColor=0,0,0,1
SkinWidth=70
SkinHeight=70
This way you can avoid using another meter.
But even if you prefer to leave the [BackGroundDisplay] meter, add an UpdateDivider=-1 option to it, because there is no need to update it on each update cycle of the skin.