It is currently April 26th, 2024, 3:04 pm

Volume bar not working?

Get help with creating, editing & fixing problems with skins
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Volume bar not working?

Post by deXxterlab97 »

I am trying to create a simple vertical volume bar but it doesn't seem to work

What is the problem?

Also is it possible to rotate bars to a certain degree?

Code: Select all

[Rainmeter]
Update=1000

[Variables]
@Include=#@#Variables.inc

[Metadata]
Name=Life is Rainmeter
Author=deXxterlab97 
Information=Music progress bar, clickable to seek track (fast forward).
License=to kill
Version=1.1 (beta)

[MusicVolume]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PN#
PlayerType=Volume



[Bar Background]
Meter=Image
X=0
Y=0
H=500
W=5
SolidColor=200,200,200,100
LeftMouseUpAction=[!CommandMeasure MusicVolume "SetVolume $MouseX:%$"][!Redraw][!SetOption "MeterBar" "X"]
DynamicVariables=1

[MeterBar]
Meter=Bar
MeasureName=MusicVolume
X=0
Y=0
H=500
W=5
BarColor=255,255,255

[Volume]
Meter=String
MeasureName=MusicVolume
Text="Volume is %1"
FontColor=255,255,255
deXxterlab97
User avatar
balala
Rainmeter Sage
Posts: 16173
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Volume bar not working?

Post by balala »

deXxterlab97 wrote:What is the problem?
[MusicVolume] being a NowPlaying plugin measure returns just the volume level of the appropriate music player, not the volume level of the system. To get the current volume, use a Win7AudioPlugin plugin measure. Replace the [MusicVolume] measure, with the following one:

Code: Select all

[MusicVolume]
Measure=Plugin
Plugin=Win7AudioPlugin
This measure returns a numeric and a string value. To use the returned volume level into the [Volume] meter, replace the Text option of this meter with the following one: Text=Volume is [MusicVolume:] (and now you can remove the MeasureName=MusicVolume option of this measure). To work, the [Volume] meter now also requires a DynamicVariables=1 option. Add it.
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Volume bar not working?

Post by deXxterlab97 »

balala wrote:[MusicVolume] being a NowPlaying plugin measure returns just the volume level of the appropriate music player, not the volume level of the system. To get the current volume, use a Win7AudioPlugin plugin measure. Replace the [MusicVolume] measure, with the following one:

Code: Select all

[MusicVolume]
Measure=Plugin
Plugin=Win7AudioPlugin
This measure returns a numeric and a string value. To use the returned volume level into the [Volume] meter, replace the Text option of this meter with the following one: Text=Volume is [MusicVolume:] (and now you can remove the MeasureName=MusicVolume option of this measure). To work, the [Volume] meter now also requires a DynamicVariables=1 option. Add it.
The [BarBackground] should be left as is?

I wonder where could I find more info on the Win7AudioPlugin as the NowPlaying doc page wasn't displaying it
deXxterlab97
User avatar
balala
Rainmeter Sage
Posts: 16173
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Volume bar not working?

Post by balala »

deXxterlab97 wrote:I wonder where could I find more info on the Win7AudioPlugin as the NowPlaying doc page wasn't displaying it
https://docs.rainmeter.net/manual-beta/plugins/win7audio/
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Volume bar not working?

Post by deXxterlab97 »

Leftmouseup action doesn't seem to work however, what could be the issue?
Clicking just makes the volume go up to a random number, rest is fine i.e if i manually change volume the bar will display correctly
deXxterlab97
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Volume bar not working?

Post by CyberTheWorm »

The mouse values get weird 0% is at the top if you want I did one a while back you can look at.

https://forum.rainmeter.net/viewtopic.php?f=27&t=26144
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Volume bar not working?

Post by jsmorley »

It's not a problem to use NowPlaying for this, in fact that is presumably what you want, to change the volume of the "player", not the entire system volume.

The issues are:

You are using MouseX, which is based on the "width" of the meter it is in. That isn't what you want. You want to use the "height" of the meter as the basis. So MouseY not MouseX.

However, the percentage you will get is based on a "top down" evaluation of the meter's height. That is going to be the opposite of what you want, since you are displaying the value in the Bar meter vertically from the "bottom up".

Simple enough, just subtract the percentage from 100. However embedded formulas are not going to work in that !CommandMeasure bang, which is sending a "string" to the measure. So we need to use a Calc measure to get that formula as a string and convert it to a real number that we then send to the NowPlaying plugin.

This seems to work fine for me:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
@Include=#@#Variables.inc

[Metadata]
Name=Life is Rainmeter
Author=deXxterlab97 
Information=Music progress bar, clickable to seek track (fast forward).
License=to kill
Version=1.1 (beta)

[MusicVolume]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PN#
PlayerType=Volume

[MeasureChangeVolume]
Measure=Calc
OnChangeAction=[!CommandMeasure MusicVolume "SetVolume [MeasureChangeVolume]"][!UpdateMeasure MusicVolume][!UpdateMeter *][!Redraw]

[BarBackground]
Meter=Image
X=0
Y=0
H=500
W=5
SolidColor=200,200,200,100
LeftMouseUpAction=[!SetOption MeasureChangeVolume Formula "(100-$MouseY:%$)"][!UpdateMeasure MeasureChangeVolume]
DynamicVariables=1

[MeterBar]
Meter=Bar
MeasureName=MusicVolume
X=0
Y=0
H=500
W=5
BarColor=255,255,255

[Volume]
Meter=String
MeasureName=MusicVolume
Text="Volume is %1"
FontColor=255,255,255
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Volume bar not working?

Post by deXxterlab97 »

jsmorley wrote:It's not a problem to use NowPlaying for this, in fact that is presumably what you want, to change the volume of the "player", not the entire system volume.

The issues are:

You are using MouseX, which is based on the "width" of the meter it is in. That isn't what you want. You want to use the "height" of the meter as the basis. So MouseY not MouseX.

However, the percentage you will get is based on a "top down" evaluation of the meter's height. That is going to be the opposite of what you want, since you are displaying the value in the Bar meter vertically from the "bottom up".

Simple enough, just subtract the percentage from 100. However embedded formulas are not going to work in that !CommandMeasure bang, which is sending a "string" to the measure. So we need to use a Calc measure to get that formula as a string and convert it to a real number that we then send to the NowPlaying plugin.

This seems to work fine for me:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
@Include=#@#Variables.inc

[Metadata]
Name=Life is Rainmeter
Author=deXxterlab97 
Information=Music progress bar, clickable to seek track (fast forward).
License=to kill
Version=1.1 (beta)

[MusicVolume]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PN#
PlayerType=Volume

[MeasureChangeVolume]
Measure=Calc
OnChangeAction=[!CommandMeasure MusicVolume "SetVolume [MeasureChangeVolume]"][!UpdateMeasure MusicVolume][!UpdateMeter *][!Redraw]

[BarBackground]
Meter=Image
X=0
Y=0
H=500
W=5
SolidColor=200,200,200,100
LeftMouseUpAction=[!SetOption MeasureChangeVolume Formula "(100-$MouseY:%$)"][!UpdateMeasure MeasureChangeVolume]
DynamicVariables=1

[MeterBar]
Meter=Bar
MeasureName=MusicVolume
X=0
Y=0
H=500
W=5
BarColor=255,255,255

[Volume]
Meter=String
MeasureName=MusicVolume
Text="Volume is %1"
FontColor=255,255,255
lastly, is it possible to rotate bars and image with rainmeter or not?
deXxterlab97
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Volume bar not working?

Post by jsmorley »

deXxterlab97 wrote:lastly, is it possible to rotate bars and image with rainmeter or not?
It is really not. Not easily anyway. You can use TransformationMatrix to rotate the Image meter and the Bar meter, but that is going to screw up the "hit target" of the mouse, since the hit target will be based on the original un-rotated meter container.

I can't even imagine a way right off, that isn't going to be a hideous challenge, to get the $MouseY:%$ value to be anything close to correct on a rotated meter.
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Volume bar not working?

Post by deXxterlab97 »

jsmorley wrote:It is really not. Not easily anyway. You can use TransformationMatrix to rotate a Bar meter, but that is going to screw up the "hit target" of the mouse, since the hit target will be based on the original un-rotated meter container.

I can't even imagine a way right off, that isn't going to be a hideous challenge, to get the $MouseY:%$ value to be anything close to correct on a rotated meter.
ah alright, guess it's gonna be straight like this.

thanks
deXxterlab97