It is currently June 28th, 2024, 3:57 am

[!Refreshapp] when skin loaded?

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Wow, that's strange! Could it be system specific in some way?
I don't blame you I bet you've had enough of this one! :oops:

Oh damn! Never noticed that extra line!

Just in case the code you tried isn't the same as my working code, here's my end result. Though I'm working on the idea of merging JSMorley skin sliders with it so there's just a simple small circle for an indicator of set volume instead of the whole bar. Not sure if I'll like it that way or just return it to using roundline. Don't worry, I'll not bother you again with this.

Can't thank you enough, you've been such a great help and very patient, thanks for that. :thumbup: :great: :rosegift:

Here's the final code:

Code: Select all

[Rainmeter]
Update=50
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!CommandMeasure mRunMicVol "Run"][!CommandMeasure mRunLineVol "Run"][!CommandMeasure mRunMicMute "Run"][!CommandMeasure mRunLineMute "Run"]
SkinHeight=44

[Metadata]
Name=RoundVolume
Author=sl23
Information=Adjust Mic volume.||Credits:||Help via forum: JSMorley, death.crafter, Yincognito.||Thanks to JSMorley for the AudioDeviceList skin. Massive thanks to Yincognito, without whom, this wouldn't have happened!
Version=2024.06.22
License=CC BY 3.0

[Variables]
Aqua=0,255,255
AquaDark=64,191,167,200
AquaDark2=0,255,255,150
Green=128,255,0,220
Orange=255,170,0
Red=255,100,100
Trans=0,0,0,1
White=255,255,255,200
White20=255,255,255,20
White60=255,255,255,60
Yellow=255,255,0,200

BgFill=0,0,0,150
VolBar=64,191,167,200

VolLow=25
VolMax=80
InputStep=5
MicVol=
LineVol=
MicMute=
LineMute=
InputVolume=0

NAME1=Low
NAME2=Mute
NAME3=Hi

; CmdFriendlyID=DeviceName\Type\Name\Direction
; CmdFriendlyID=USB Audio\Device\Microphone\Capture
Mic=USB Audio\Device\Microphone\Capture
Line=Realtek(R) Audio\Device\Line In\Capture

========================================
; Background
========================================
[Bg]
Meter=Shape
Shape=Rectangle 0,0,170,40,5 | FillColor #BgFill# | StrokeWidth 2 | Extend StrokeAlpha
StrokeAlpha=Stroke Color #White60#
UpdateDivider=-1
X=1
Y=1

========================================
; STYLES
========================================
[sAllText]
FontFace=Trebuchet MS
StringStyle=Bold
StringAlign=Center
FontSize=12
FontColor=#White#
AntiAlias=1
DynamicVariables=1

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "#Green#"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]

[sBar]
BarOrientation=Horizontal
BarColor=#Yellow#
SolidColor=#White60#
DynamicVariables=1
W=150
H=1

========================================
; Set Audio In Volume
========================================
[mMicdbLevel]
Measure=Plugin
Plugin=AudioLevel
Port=Input
RMSAttack=50
RMSDecay=300
RMSGain=10

[mDeviceStatus]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceStatus
Substitute="0":"Off","1":"On"

[mDeviceList]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceList
Substitute="}: ":"}		"
OnChangeAction=[!Refresh]

[mDeviceName]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceName
Substitute="(Realtek(R) Audio)":"(R)","(USB Audio)":"(USB)","Microphone":"Mic"
IfMatch="Mic"
IfMatchAction=[!EnableMeasure MicMute][!ShowMeter MicPercent][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!DisableMeasure MicMute][!HideMeter MicPercent][!UpdateMeter *][!Redraw]

[mDeviceID]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceID
RegExpSubstitute=1
Substitute="{.*}\.":""

[mDeviceFormat]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=Format

========================================
; Get Audio In Status
========================================
[mRunMicVol]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getpercent "#Mic#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption MicVol Formula [mRunMicVol]][!UpdateMeasure MicVol][!UpdateMeter *][!Redraw]
RegExpSubstitute=1
Substitute="(?:\s+|[.]\d+)":""
DynamicVariables=1
;[!SetOption (MicBarShape:X) Formula [mRunMicVol]]

[MicVol]
Measure=Calc
Formula=0
MinValue=0
MaxValue=100
DynamicVariables=1

[mRunMicMute]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getmute "#Mic#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption MicMute Formula [mRunMicMute]][!UpdateMeasure MicMute][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MicMute]
Measure=Calc
Formula=0
IfCondition=(MicMute=1)
IfTrueAction=[!SetOption MicIcon Text "[\xEC54]"][!SetOption MicIcon FontColor "#Red#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MicIcon Text "[\xE720]"][!SetOption MicIcon FontColor "#Green#"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[mRunLineVol]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getpercent "#Line#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption LineVol Formula [mRunLineVol]][!UpdateMeasure LineVol][!UpdateMeter *][!Redraw]
RegExpSubstitute=1
Substitute="(?:\s+|[.]\d+)":""
DynamicVariables=1

[LineVol]
Measure=Calc
Formula=0
MinValue=0
MaxValue=100
DynamicVariables=1

[mRunLineMute]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getmute "#Line#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption LineMute Formula [mRunLineMute]][!UpdateMeasure LineMute][!UpdateMeter *][!Redraw]
DynamicVariables=1

[LineMute]
Measure=Calc
Formula=0
Substitute="0":"UnMuted","1":"Muted"
IfCondition=(LineMute=1)
IfTrueAction=[!SetOption LineIcon Text "[\xEC54]"][!SetOption LineIcon FontColor "#Red#"] [!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption LineIcon Text "[\xE720]"][!SetOption LineIcon FontColor "#Yellow#"] [!UpdateMeter *][!Redraw]
DynamicVariables=1

========================================
; METERS
========================================
[MicIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe Fluent Icons
FontSize=12
FontColor=#White60#
Text=[\xE720]

LeftMouseUpAction=[Play "#@#Volume\Copy.wav"][!SetClip "; Windows Default Input Device:#CRLF##CRLF#; Device Name:      [mDeviceName]#CRLF#; Device ID:        [mDeviceID]#CRLF#; Device Format:    [mDeviceFormat]#CRLF#; Device Status:    [mDeviceStatus]#CRLF##CRLF#; Device List:#CRLF##CRLF#[mDeviceList]"]
MiddleMouseUpAction=[!Refresh]
RightMouseUpAction=[!CommandMeasure mRunMicVol "Run"]

X1MouseUpAction=ms-settings:sound
X2MouseUpAction=[control mmsys.cpl]

ToolTipIcon=Info
ToolTipTitle=[mDeviceName] - [mDeviceStatus]
ToolTipText=L - Copy Device List#CRLF#M - Refresh#CRLF#R - #CRLF#X1 - CP Sound Settings#CRLF#X2 - Main Sound Settings

X=30
Y=8

[MicPercent]
Meter=String
MeterStyle=sAllText | sHighlight
FontColor=#White#
Text=[MicVol]

LeftMouseUpAction=[!SetVariable MicVol 25]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Mic#" 25][!CommandMeasure mRunMicVol "Run"][!Update]
MiddleMouseUpAction=["#CURRENTPATH#SoundVolumeView.exe" /Switch "#Mic#"][!CommandMeasure mRunMicMute "Run"][!Update]
RightMouseUpAction=[!SetVariable MicVol 80]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Mic#" 80][!CommandMeasure mRunMicVol "Run"][!Update]

TooltipIcon=Info
ToolTipTitle=Mic - [mRunMicMute]
ToolTipText=.

MouseScrollUpAction=[!SetVariable MicVol (Clamp(#MicVol#+#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Mic#" 5][!CommandMeasure mRunMicVol "Run"][!Update]
MouseScrollDownAction=[!SetVariable MicVol (Clamp(#MicVol#-#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Mic#" -5][!CommandMeasure mRunMicVol "Run"][!Update]
X=25r
Y=-2r

[LineIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe Fluent Icons
FontSize=12
Text=[\xE720]

X=55r
Y=8

[LinePercent]
Meter=String
MeterStyle=sAllText | sHighlight
FontColor=#White#
Text=[LineVol]

LeftMouseUpAction=[!SetVariable LineVol 25]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Line#" 25][!CommandMeasure mRunLineVol "Run"][!Update]
MiddleMouseUpAction=["#CURRENTPATH#SoundVolumeView.exe" /Switch "#Line#"][!CommandMeasure mRunLineMute "Run"][!Update][!Refresh]
RightMouseUpAction=[!SetVariable LineVol 80]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Line#" 80][!CommandMeasure mRunLineVol "Run"][!Update]

TooltipIcon=Info
ToolTipTitle=Line In - [mRunLineMute]
ToolTipText=.

MouseScrollUpAction=[!SetVariable LineVol (Clamp(#LineVol#+#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Line#" 5][!CommandMeasure mRunLineVol "Run"][!Update]
MouseScrollDownAction=[!SetVariable LineVol (Clamp(#LineVol#-#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Line#" -5][!CommandMeasure mRunLineVol "Run"][!Update]
X=25r
Y=-2r
======================================

[MicBarShape]
Meter=Shape
Shape=Rectangle 0,0,4,6,0 | Fill Color #Green#
DynamicVariables=1
;X=[mRunMicVol]+9
X=([MicVol:]*150/100)+9
Y=25

[LevelBar]
Meter=Bar
MeasureName=mMicdbLevel
MeterStyle=sBar
BarColor=#AquaDark#
X=11
Y=7r

[LineBarShape]
Meter=Shape
Shape=Rectangle 0,0,4,6,0 | Fill Color #Yellow#
DynamicVariables=1
X=([LineVol:]*150/100)+9
Y=2r
=======================================
;[MicBar]
;Meter=Bar
;MeasureName=MicVol
;MeterStyle=sBar
;BarColor=#Green#
;X=11
;Y=30

;[LineBar]
;Meter=Bar
;MeasureName=LineVol
;MeterStyle=sBar
;BarColor=#Yellow#
;X=11
;Y=34

Last edited by sl23 on June 22nd, 2024, 12:02 pm, edited 2 times in total.
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7551
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [!Refreshapp] when skin loaded?

Post by Yincognito »

I don't know if it's system specific or not, but it's not helpful the moment when you try to advise someone else experiencing a different behavior.

Yeah, it's more about consistency in results, which is lacking here a bit. AudioLevel, the .dll used in PS, the NirSoft sound tools, they all seem to be incomplete or inconsistent in one way or another. Then you have to do a mish-mash between them and hope for the best, which isn't particularly pleasant from my POV.

I would have liked to be more helpful in this, but if you think you mostly got to what you wanted, I can't say that it's not a relief... :lol:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

I get you. ;-)
Yes it is working perfectly for me, although there are inconsistencies, like you say. But until there's a 'do all' plugin with no leaks or issues, it's the best available solution. I am glad I decided to change it from powershell though. This is far more responsive, has no memory leak issues to deal with and just feels nicer to use. I think the only thing I dislike about it is having to Refresh the skin every time I middle click Line In meter to Mute/Unmute. But it works, so.... :D

Btw, I've updated the bar meters to something slightly more elegant. I adapted a little code from JSMorley's input/output skin for the slidebar meter. looks quite nice I think. Maybe the colours won't suit everyone's taste, but that's easy changed! :)

I updated the code in the last post and will post the finished skin in the forum.

Thanks :thumbup:
- MuLab -
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Damn! Sorry, need one more thing :oops:

I was so focused on Mic that I forgot to test the Line In. It doesn't register on the meter. I missed the point that it needs also the corresponding meters and measures. But first, I tried to specify the ID tag in the parent Mic Measure, but it stops working when I do that.

I tried setting the DeviceID:

Code: Select all

[mMicdbLevel]
Measure=Plugin
Plugin=AudioLevel
Port=Input
ID=[mDeviceID]

[mDeviceID]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceID
RegExpSubstitute=1
Substitute="{.*}\.":""
Which I suppose is creating a loop? Which is why it won't work? I've never used this before, so haven't any idea what's wrong.

Also tried: ID=#Mic#.
Last edited by sl23 on June 22nd, 2024, 12:35 pm, edited 1 time in total.
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7551
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [!Refreshapp] when skin loaded?

Post by Yincognito »

sl23 wrote: June 22nd, 2024, 12:00 pmI think the only thing I dislike about it is having to Refresh the skin every time I middle click Line In meter to Mute/Unmute
I do the same my audio skin when I connect / disconnect headphones. Luckily, I almost never use the audio skin, so I don't have to bother with it.
sl23 wrote: June 22nd, 2024, 12:00 pm I updated the code in the last post and will post the finished skin in the forum.
Regarding that, I believe the !SetVariables (or the variables themselves, for that matter) are now obsolete in the meters, since the skin is using identically named measures instead. Also, unless you really want to see the devices, running SoundVolumeView.exe can be replaced by running svcl.exe in the meter bangs. Just saying, it "should" work this way as well. :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

I did actually try to replace SoundVolumeView with svcl, but it opens a command window and closes quickly, so I left it.

Yeah I wondered about those Variables too, wasn't sure if it was safe to remove. I'll leave for now until I can be bothered to get back on that! :lol:
- MuLab -
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

If I unplug the Mic, then Line In is shown on the db level bar meter. But it would be best to have both in separate bars. Dunno why I didn't think of that! :?
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7551
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [!Refreshapp] when skin loaded?

Post by Yincognito »

sl23 wrote: June 22nd, 2024, 12:30 pm Damn! Sorry, need one more thing :oops:
Told you, I was certain it wasn't over... :rofl:

I repeat myself (again): the order in the code matters. [mMicdbLevel] doesn't know the value of [mDeviceID] (until the next update, at which point it might be too late if it changed) since the former is before the latter in the code. Plus, you're already modifying that device ID in the Substitute (which, by the way, doesn't escape the curly brackets by preceding them with a \ symbol), so even if the order was right it wouldn't work anyway if you kept the Substitute.

Also, the ID / DeviceID from AudioLevel is NOT the same as the "friendly ID" from the NirSoft sound tools, what you're looking for is the "item ID" that you see in SoundVolumeView.exe (and which is available to use in svcl.exe too).

Even so, if by any chance you think of using an IfMatch to compare those device / item IDs (which would be the proper way to identify a device, as it's unique and all), such an IfMatch won't work for the variable side of the comparison (e.g. if you're trying to do IfMatch=^#MicID#$), you will again have to use an identical measure whose value you'll be regex escaping, e.g. IfMatch=^[MicID:EscapeRegExp]$:
https://docs.rainmeter.net/manual/variables/section-variables/#EscapeRegExp
sl23 wrote: June 22nd, 2024, 12:37 pm I did actually try to replace SoundVolumeView with svcl, but it opens a command window and closes quickly, so I left it.
Yeah, I got that too, before deleting my code. That's what happens when you run things in a bang and not in a State=Hide RunCommand measure.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

So I'm looking for this: {0.0.1.00000000}.{7fb35683-1fea-4fa1-be4a-a3e49b15aeeb} for Microphone (USB Audio)?
Is it better to use a variable to specify?
- MuLab -
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Yincognito wrote: June 22nd, 2024, 1:00 pm Even so, if by any chance you think of using an IfMatch to compare those device / item IDs (which would be the proper way to identify a device, as it's unique and all), such an IfMatch won't work for the variable side of the comparison (e.g. if you're trying to do IfMatch=^#MicID#$), you will again have to use an identical measure whose value you'll be regex escaping, e.g. IfMatch=^[MicID:EscapeRegExp]$:
https://docs.rainmeter.net/manual/variables/section-variables/#EscapeRegExp
Oh s**t! Here we go again! :confused: :oops:
- MuLab -