It is currently April 25th, 2024, 9:50 am

Adjust Mic Volume Level?

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

Re: Adjust Mic Volume Level?

Post by sl23 »

Using jsmorley's skin, how do I remove the scroll actions from the SliderBar? I have the Scroll actions working but I have to include code that I don't need. Also, when the Input% value is shown, it shows between 20 and 200 and I can't figure out how to change it. :???:

Code: Select all

[Rainmeter]
Update=50
AccurateText=1
DynamicWindowSize=1
MouseOverAction= [!UpdateMeterGroup *] [!Redraw]
MouseLeaveAction= [!UpdateMeterGroup *] [!Redraw]

[Metadata]
Name=RoundTemplate
Author=sl23
Information=RoundTemplate.||Credits:||Adapted from "SimplyRound" Suite by Krzysztof "gronostaj" Smialek||Help via forum: 
Version=2021.8.14
License=CC BY 3.0

[Variables]
Color1=255,255,255,200
Color2=128,255,0
Color3=64,191,167,200
Color4=0,255,255
Color5=255,255,255,60
Color6=235,170,0,190

VolLow=25
VolMax=80

APP1=
APP2=
APP3=
APP4=
APP5=
APP6=

NAME1=
NAME2=
NAME3=
NAME4=
NAME5=
NAME6=

; For Mic Click action
MicVolume=
Increment=5
InputVolume=0
VolumeIncrement=1

========================================
; Background
========================================
[Bg]
Meter=Shape
Shape=Rectangle 0,0,230,70,35 | Fill Color 0,0,0,150 | StrokeWidth 2 | Extend StrokeAlpha
StrokeAlpha=Stroke Color #Color5#
DynamicVariables=1
X=2
Y=2

[Bg1]
Meter=Shape
Shape=Rectangle 0,0,60,60,50 | Fill Color 0,0,0,50 | StrokeWidth 2 | Extend StrokeAlpha
Shape2=Rectangle 9,9,42,42,50 | Fill Color 0,0,0,1 | StrokeWidth 2 | Extend StrokeAlpha2
Shape3=Rectangle 5,5,50,50,50 | Fill Color 0,0,0,1 | StrokeWidth 10 | Stroke Color 255,255,255,20
StrokeAlpha=Stroke Color #Color5#
StrokeAlpha2=Stroke Color #Color5#

LeftMouseUpAction=[!CommandMeasure "mOutput" "SetVolume #VolLow#"][PLAY "#@#Windows Notify System Generic.wav"] [!UpdateMeasure mOutput] [!UpdateMeter *] [!Redraw]
MiddleMouseUpAction=[!CommandMeasure "mOutput" "ToggleMute"]
RightMouseUpAction=[!CommandMeasure "mOutput" "SetVolume #VolMax#"][PLAY "#@#Windows Notify System Generic.wav"] [!UpdateMeasure mOutput] [!UpdateMeter *] [!Redraw]

MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #Color4#"][!SetOption Speaker FontColor "#Color2#"][!HideMeterGroup SpeakerIcon][!ShowMeterGroup Output] [!UpdateMeter *][!UpdateMeterGroup *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #Color5#"][!SetOption Speaker FontColor "#Color1#"][!ShowMeterGroup SpeakerIcon][!HideMeterGroup Output] [!UpdateMeter *][!UpdateMeterGroup *][!Redraw]

MouseScrollUpAction=[!CommandMeasure "mOutput" "ChangeVolume 5"] [!UpdateMeasure mOutput] [!UpdateMeter VolBar] [!UpdateMeasure mOutput] [!UpdateMeter *] [!Redraw]
MouseScrollDownAction=[!CommandMeasure "mOutput" "ChangeVolume -5"] [!UpdateMeasure mOutput] [!UpdateMeter VolBar] [!UpdateMeasure mOutput] [!UpdateMeter *] [!Redraw]

DynamicVariables=1
ToolTipText="L - #NAME1##CRLF#M - #NAME2##CRLF#R - #NAME3#"
X=7
Y=7

[BgLine]
Meter=Shape
Shape=Rectangle 67,42,100,1,0 | Fill Color #Color5# | StrokeWidth 0
DynamicVariables=1

[Bg2]
Meter=Shape
Shape=Rectangle 0,0,60,60,50 | Fill Color 0,0,0,50 | StrokeWidth 2 | Extend StrokeAlpha
Shape2=Rectangle 9,9,42,42,50 | Fill Color 0,0,0,1 | StrokeWidth 2 | Extend StrokeAlpha2
Shape3=Rectangle 5,5,50,50,50 | Fill Color 0,0,0,1 | StrokeWidth 10 | Stroke Color 255,255,255,20
StrokeAlpha=Stroke Color #Color5#
StrokeAlpha2=Stroke Color #Color5#

LeftMouseUpAction=[!CommandMeasure DeviceVolume "Set-InputVolume"]
MiddleMouseUpAction=[!CommandMeasure DeviceVolume "InputToggle-Mute"]
RightMouseUpAction=[!CommandMeasure DeviceVolume "Set-InputVolume"]

MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #Color4#"][!SetOption MicLevel FontColor "#Color2#"][!HideMeter MicIcon][!ShowMeterGroup Input] [!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #Color5#"][!SetOption MicLevel FontColor "#Color1#"][!ShowMeter MicIcon][!HideMeterGroup Input] [!UpdateMeter *][!Redraw]

MouseScrollUpAction=[!SetVariable InputVolume "(Clamp(#InputVolume#+5,0,100))"][!CommandMeasure DeviceVolume "Set-InputVolume"][!Update]
MouseScrollDownAction=[!SetVariable InputVolume "(Clamp(#InputVolume#-5,0,100))"][!CommandMeasure DeviceVolume "Set-InputVolume"][!Update]

DynamicVariables=1
ToolTipText="L - #NAME4##CRLF#M - #NAME5##CRLF#R - #NAME6#"
X=167
Y=7

========================================
; STYLES
========================================
[sAllText]
FontFace=Trebuchet MS
StringStyle=Bold
StringAlign=Center
FontSize=12
FontColor=#Color1#
StringEffect=Shadow
FontEffectColor=0,0,0,150
AntiAlias=1
DynamicVariables=1

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

[sRoundBar]
LineStart=22
LineLength=28
LineWidth=2
StartAngle=(Rad(270))
Antialias=1
Solid=1


;[Title]
;Meter=String
;MeterStyle=sAllText | sHighlight
;FontSize=11
;Text=SPKR   +   MIC
;InlineSetting=Size | 8
;InlinePattern=.+  ( .+ )  .+
;LeftMouseUpAction=[!ToggleMeterGroup Info][!Redraw]
;X=116
;Y=25

========================================
; Output
========================================
[mSpeakerLevel]
Measure=Plugin
Plugin=AudioLevel
Port=Output
RMSAttack=50
RMSDecay=300
RMSGain=2

[mSpeaker]
Measure=Plugin
Plugin=AudioLevel
Parent=mSpeakerLevel
Type=RMS

[Speaker]
Meter=String
MeterStyle=sAllText
MeasureName=mSpeaker
NumOfDecimals=2
Percentual=1
Text=%1
X=90
Y=5

[SpeakerBar]
Meter=Roundline
MeasureName=mSpeaker
MeterStyle=sRoundBar
LineColor=#Color3#
X=37
Y=37

[SpeakerIconBg]
Meter=String
MeterStyle=sAllText
FontFace=Segoe MDL2 Assets
FontSize=16
FontColor=#Color5#
Text=[\xE767]
Group=SpeakerIcon
X=38
Y=27

[SpeakerIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe MDL2 Assets
FontSize=16
Text=
Group=SpeakerIcon
X=38
Y=27

========================================
; VOLUME
========================================
[mOutput]
Measure=Plugin
Plugin=Win7AudioPlugin
DynamicVariables=1
IfCondition=mOutput = -1
IfTrueAction=[!SetOption SpeakerIcon Text "[\xE74F]"][!SetOption MeterOutputPercent Text "Output: Muted"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterOutputSlider X "(([OutputVolume:] * (200 - 20) / 100) + 20)"][!UpdateMeter *][!Redraw]
IfCondition2=mOutput = 0
IfTrueAction2=[!SetOption SpeakerIcon Text "[\xE992]"][!UpdateMeter *][!Redraw]
IfCondition3=(mOutput > 0) && (mOutput <= 35)
IfTrueAction3=[!SetOption SpeakerIcon Text "[\xE993]"]
IfCondition4=(mOutput > 35) && (mOutput <= 65)
IfTrueAction4=[!SetOption SpeakerIcon Text "[\xE994]"]
IfCondition5=mOutput > 65
IfTrueAction5=[!SetOption SpeakerIcon Text "[\xE995]"]
IfConditionMode=1
Substitute="-1":"Muted"

[OutputLevel]
Meter=String
MeterStyle=sAllText
FontColor=#Color2#
Text=[mOutput:]
Hidden=1
Group=Output
X=37
Y=27

[OutputRoundBar]
Meter=Roundline
MeasureName=mOutput
MeterStyle=sRoundBar
LineColor=#Color2#
LineWidth=4
Solid=0
Hidden=1
Group=Output
X=r
Y=37

========================================
; Microphone
========================================
[mMicLevel]
Measure=Plugin
Plugin=AudioLevel
Port=Input
RMSAttack=50
RMSDecay=300
;Set your desired Mic-response here--------------------
RMSGain=10

[mMic]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicLevel
Type=RMS

[MicLevel]
Meter=String
MeterStyle=sAllText
MeasureName=mMic
NumOfDecimals=2
Percentual=1
Text=%1
X=145
Y=5

[MicRoundBar]
Meter=Roundline
MeasureName=mMic
MeterStyle=sRoundBar
LineColor=#Color3#
X=197
Y=37

[MicIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe MDL2 Assets
FontSize=16
Text=[\xE720]
X=198
Y=27

========================================
; Mic Volume
========================================
[DeviceVolume]
Measure=Plugin
Plugin=PowershellRM
ScriptFile=DeviceVolume.ps1

[InputVolume]
Measure=Plugin
Plugin=PowershellRM
Parent=DeviceVolume
Line=Get-Volume -Type Input
IfCondition=InputVolume = -1
IfTrueAction=[!SetOption MicIcon Text "[\xE720]"][!SetOption MicVolumeText Text "Muted"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterInputSlider X "(([InputVolume:] * (200 - 20) / 100) + 20)"][!SetOption MicVolumeText Text "[*MeasureInputPercent:%,0*]"][!UpdateMeter *][!Redraw]
IfCondition2=InputVolume = 0
IfTrueAction2=[!SetOption MicIcon Text "[\xE720]"]
IfCondition3=(InputVolume > 0) && (InputVolume <= 35)
IfTrueAction3=[!SetOption MicIcon Text "[\xE720]"]
IfCondition4=(InputVolume > 35) && (InputVolume <= 65)
IfTrueAction4=[!SetOption MicIcon Text "[\xE720]"]
IfCondition5=InputVolume > 65
IfTrueAction5=[!SetOption MicIcon Text "[\xE720]"]
IfConditionMode=1
Substitute="-1":"Muted","1.000001":"1","2.999999":"3","9.000001":"9"

[MeasureInputMouse]
Measure=Plugin
Plugin=Mouse
RelativeToSkin=1
RequireDragging=1
DynamicVariables=1

[MeasureInputPercent]
Measure=Calc
Formula=[MeterInputSlider:X]
MinValue=20
MaxValue=200
DynamicVariables=1
OnChangeAction=[!SetVariable InputVolume "([MeasureInputPercent:%,0])"][!CommandMeasure DeviceVolume "Set-InputVolume"]

[MicVolumeText]
Meter=String
MeasureName=InputVolume
MeterStyle=sAllText
FontColor=#Color2#
Text=%1
Percentual=1
NumOfDecimals=0
Hidden=1
Group=Input
X=197
Y=27

[InputRoundBar]
Meter=Roundline
MeasureName=MeasureInputPercent
MeterStyle=sRoundBar
LineColor=#Color2#
LineWidth=4
Solid=0
Hidden=1
Group=Input
X=197
Y=37

==========================================






[MeterInputSlideBack]
Meter=Shape
X=20
Y=80
Shape=Rectangle 0,0,200,10,5 | Fill Color 150,150,150,255 | StrokeWidth 0
DynamicVariables=1
MouseActionCursor=0
MouseScrollUpAction=[!SetVariable InputVolume "(Clamp(#InputVolume#-1,0,100))"][!CommandMeasure DeviceVolume "Set-InputVolume"][!Update]
MouseScrollDownAction=[!SetVariable InputVolume "(Clamp(#InputVolume#+1,0,100))"][!CommandMeasure DeviceVolume "Set-InputVolume"][!Update]

[MeterInputSlideBar]
Meter=Shape
X=20
Y=80
Shape=Rectangle 0,0,[MeterInputSlider:X],10,5 | Fill Color 56,150,51,255 | StrokeWidth 0
DynamicVariables=1

[MeterInputSlider]
Meter=Shape
Y=75
Shape=Ellipse 10,10,10,10 | Fill Color 106,222,100,255 | StrokeWidth 0
LeftMouseDownAction=[!CommandMeasure MeasureInputMouse "Start"]

[MeterInputPercent]
Meter=String
X=22
Y=108
FontSize=11
FontWeight=700
FontColor=255,255,255,255
Percentual=1
NumOfDecimals=0
AntiAlias=1
DynamicVariables=1

EDIT: I managed to work out the Input% value issue. The code above is a revised version.
Another problem I'm trying to solve, is the Left and Right click to set the Mic Volume at 25 and 80 respectively.
- MuLab -
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Adjust Mic Volume Level?

Post by death.crafter »

jsmorley wrote: August 14th, 2021, 12:31 pm You know death.crafter, if you do talk to the author of PowershellRM, maybe he could set up an option on the plugin like LogErrors=0 (default 1) that would just supress those "pipeline" errors from being transmitted to the Rainmeter log. They are transient, non-fatal errors that basically means that some action was "skipped" since it was stepping on some other action. The plugin will recover and the action will presumably happen the next time it is called.

In effect it looks like the calls to the device volume stuff "locks" the device while being executed. With some very careful coding, it seems you can reduce them a lot with this AudioDeviceCmdlets.dll, but I can't seem to get rid of them entirely, and they just happen randomly from time to time. The trouble is that in order to "monitor" the current volume, you have to poke this thing once a second or so, and I suspect that is causing the conflicts when you actually change the value(s). Things are just running into each other.

This is the error I get:



Seems to me that the errors in the log might be valuable while "debugging" a skin you are writing, but then you might want to turn them off once you have it working as expected.

I do not like errors in the log. I do not like them, Sam-I-Am...
Actually I found out that if a command using pipelines is run at load or refresh, the error shows up. So I put a [!Delay 200] before executing a function and it doesn't show anymore.

While in this case it is not fatal, it is a show stopper in some cases. So suppressing it wouldn't be a good idea. Using some kind of Start-Sleep -Millisecond 100 might get rid of these errors(May be)
from the Realm of Death
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Adjust Mic Volume Level?

Post by death.crafter »

And sorry for the bad skin. I forgot to put separators in module path so it didn't work. And ofc a missing plugin.

Also I updated the package: https://forum.rainmeter.net/viewtopic.php?f=5&t=38135&start=50#p195773
from the Realm of Death
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Adjust Mic Volume Level?

Post by jsmorley »

death.crafter wrote: August 14th, 2021, 6:36 pm Actually I found out that if a command using pipelines is run at load or refresh, the error shows up. So I put a [!Delay 200] before executing a function and it doesn't show anymore.

While in this case it is not fatal, it is a show stopper in some cases. So suppressing it wouldn't be a good idea. Using some kind of Start-Sleep -Millisecond 100 might get rid of these errors(May be)
I'm not suggesting that you would want to supress errors all the time, but on these particular measures, which get that non-fatal "Pipeline" errors, it would be good to very selectively turn them off for just those measures.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Adjust Mic Volume Level?

Post by death.crafter »

jsmorley wrote: August 14th, 2021, 6:43 pm I'm not suggesting that you would want to supress errors all the time, but on these particular measures, which get that non-fatal "Pipeline" errors, it would be good to very selectively turn them off for just those measures.
Ahh I see. If he's free and available I will tell him.
from the Realm of Death
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Adjust Mic Volume Level?

Post by jsmorley »

death.crafter wrote: August 14th, 2021, 6:45 pm Ahh I see. If he's free and available I will tell him.
Thanks! That would be cool, as I simply refuse to run a skin that produces any errors in the log. I have to either track down and stamp out the problem, or the skin has to go...

My log must look like this:


1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Adjust Mic Volume Level?

Post by death.crafter »

jsmorley wrote: August 14th, 2021, 6:52 pm Thanks! That would be cool, as I simply refuse to run a skin that produces any errors in the log. I have to either track down and stamp out the problem, or the skin has to go...

My log must look like this:
I too have the same opinion.

While occasional errors, like server side connection error or temporary parsing errors, are okay, but if they are regular
ApagaIssoGIF.gif
You do not have the required permissions to view the files attached to this post.
from the Realm of Death
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Adjust Mic Volume Level?

Post by jsmorley »

Yes...


biggif.gif
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Adjust Mic Volume Level?

Post by Yincognito »

death.crafter wrote: August 14th, 2021, 6:40 pm And sorry for the bad skin. I forgot to put separators in module path so it didn't work. And ofc a missing plugin.

Also I updated the package: https://forum.rainmeter.net/viewtopic.php?f=5&t=38135&start=50#p195773
Still nothing is shown though. EDIT: Ran it the 2nd time and it does show stuff, but it doesn't show my AMD HDMI Output for the output and it doesn't select (although it's shown in the context menu) my Analog Audio In (AverMedia H830 USB Hybrid DVB-T) (plugged in, but not running, TV Tuner device) for the input.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Adjust Mic Volume Level?

Post by Yincognito »

I'm more forgivable to "errors", if I know they're to be expected (like the 2 RegExp matching errors for datetime and observation units in my weather skin) or the "warnings" when I deactivate my tooltip skin while it isn't loaded...but other than that, I don't even need errors to delete something, as it's part of the cleaning / uncluttering process. :D
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth