It is currently April 19th, 2024, 1:43 pm

Volume level display

Get help with creating, editing & fixing problems with skins
Fatichti
Posts: 10
Joined: December 6th, 2020, 2:56 pm

Volume level display

Post by Fatichti »

Hello,

I am under Windows10.
I would like to display in text format, the sound level in percentage for example, indicating: 40% for example or mute.

I searched a little but I did not find, in the doc, it indicates how to increase or decrease the sound but not display it.

Can you help me :D
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Volume level display

Post by CyberTheWorm »

Try this thread https://forum.rainmeter.net/viewforum.php?f=136 it should have some examples and skins you can modify.

But this might help

Code: Select all

[MeasureVolume]
Measure=Plugin
Plugin=Win7AudioPlugin

[MeterVolume]
Meter=String
MeasureName=MeasureVolume
X=103
Y=53
Text=%1#CRLF#[MeasureVolume:]%
DynamicVariables=1
FontColor=255,255,255,255
StringAlign=CenterCenter
AntiAlias=1
MouseScrollUpAction=!CommandMeasure "MeasureVolume" "ChangeVolume +5"
MouseScrollDownAction=!CommandMeasure "MeasureVolume" "ChangeVolume -5"
ToolTipText=Mouse scroll to adjust player volume
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Volume level display

Post by balala »

Fatichti wrote: April 9th, 2021, 6:47 pm I would like to display in text format, the sound level in percentage for example, indicating: 40% for example or mute.

I searched a little but I did not find, in the doc, it indicates how to increase or decrease the sound but not display it.

Can you help me :D
Beside CyberTheWorm's reply, here is what exactly should you do:
  • First you need a Win7audio plugin measure, which will be used to get the volume level. Add the following measure to your code (create a new skin if you don't have one):

    Code: Select all

    [MeasureWin7Audio]
    Measure=Plugin
    Plugin=Win7AudioPlugin
  • Now you'll need a String meter, to show the percentage returned by the above [MeasureWin7Audio] measure. Add this as well:

    Code: Select all

    [MeterVolLevel]
    Meter=STRING
    X=0
    Y=0
    Padding=15,5,15,5
    FontColor=220,220,220,220
    FontEffectColor=0,0,0
    StringEffect=Shadow
    SolidColor=0,0,0,150
    FontSize=8
    FontFace=Segoe UI
    StringStyle=BOLD
    StringAlign=LEFT
    AntiAlias=1
    Text=Volume level: [MeasureWin7Audio:]%
    DynamicVariables=1
    Hidden=0
  • An improvement: you can add the following two options to the above [MeterVolLevel] meter, in order to can change the volume through mouse scrolling:

    Code: Select all

    [MeterVolLevel]
    ...
    MouseScrollUpAction=[!CommandMeasure "MeasureWin7Audio" "ChangeVolume +#Step#"][!UpdateMeasure "MeasureWin7Audio"][!UpdateMeter "MeterVolLevel"][!Redraw]
    MouseScrollDownAction=[!CommandMeasure "MeasureWin7Audio" "ChangeVolume -#Step#"][!UpdateMeasure "MeasureWin7Audio"][!UpdateMeter "MeterVolLevel"][!Redraw]
  • In order to get this working, you have to add to the [Variables] section a Step variable, which is the volume changement level when you are scrolling. Add it:

    Code: Select all

    [Variables]
    Step=3
If you add all the above to a code, this is what you get (this code is extremely simple, it definitely can be improved):

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Step=3

[MeasureWin7Audio]
Measure=Plugin
Plugin=Win7AudioPlugin

[MeterVolLevel]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Volume level: [MeasureWin7Audio:]%
DynamicVariables=1
Hidden=0
MouseScrollUpAction=[!CommandMeasure "MeasureWin7Audio" "ChangeVolume +#Step#"][!UpdateMeasure "MeasureWin7Audio"][!UpdateMeter "MeterVolLevel"][!Redraw]
MouseScrollDownAction=[!CommandMeasure "MeasureWin7Audio" "ChangeVolume -#Step#"][!UpdateMeasure "MeasureWin7Audio"][!UpdateMeter "MeterVolLevel"][!Redraw]
When you mute the system, the above skin displays "Volume level: -1%". This is not a mistake, it's something which has to be fixed in the next version of your code. I wanted first you to try out the code, to see if it matches your needs. If interested we'll continue improving it, just please let me know if you want this.
Fatichti
Posts: 10
Joined: December 6th, 2020, 2:56 pm

Re: Volume level display

Post by Fatichti »

Hi forum,

That's fine, thank you, it works!

:thumbup:
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Volume level display

Post by balala »

Fatichti wrote: April 10th, 2021, 1:22 pm That's fine, thank you, it works!
I'm glad, especially if you're talking about my code. However if you do, some improvements are still needed, as said in the last paragraph of my reply. Interested?