It is currently January 26th, 2021, 10:09 pm

Problem with "Mute Detection" in Volume-Meter

Help with creating, editing & fixing problems with skins
User avatar
Youkai1977
Posts: 40
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Problem with "Mute Detection" in Volume-Meter

Post by Youkai1977 »

Hi Peoples :welcome:

... first of all Happy New Year in retrospect. ;-)

After more than a year in which no one saw or heard from me, because my Rainmeter projects were idle due to family problems, I have to turn to the experts here today.

It is about the following. An old skin of mine (M.A.R.S. Skin from 2018/2019, can be found here in the forum), receives a complete overhaul like new gimmik functions.
And that's exactly what I'm biting my teeth into. Because after more than a year of doing "nothing" in terms of programming with the Rainmeter, I was completely rusty.
The point is that when the sound on the PC is set to "mute", a corresponding loudspeaker icon should flash. I've managed everything so far.
But....

... if the sound was only briefly on "0" and immediately reset to normal, the loudspeaker symbol for "mute" still appears.
I've already found out that it's because of the "[! Delay]" command.
But I need it, because if the sound is "intentionally" set to "mute", the loudspeaker mute symbol should only appear 6 seconds later, "after" the "%" volume display that was "previously" displayed is gone.
As I said, everything works as I wanted. The only difference is that the "[! Delay]" command does not update the corresponding "Measure", and therefore the "Mute" icon appears when it shouldn't.
If I say "within" this "6-second delay" I mute the sound and make it loud again.
What do I have to change in the code that it no longer happens, but all other functions remain as programmed.

For a better understanding, here is the complete skin code. And also all files as a ZIP download

It's about the (active) measure -> "[MeasureAudio]"
As you can see, I have 2 versions of it (one with ";" deactivated) because I've been tinkering with it for days and really don't know what to do and how

CAUTION: a minimum resolution of 1440x900 pixels is required to display the skin

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=Background - Clock - Systemcontrol (BETA)
Author=Youkai1977
Version=V1.0 <> 05.01.2021
Information=This Meter is a Part of M.A.R.S.-2021 Skin Package
License=Creative Commons BY-NC-SA 3.0

;--------------------------------------------------
;--- VARIABLES & STYLES ---------------------------
;--------------------------------------------------

[Variables]
Sound=#@#sounds\ready.wav
Images=#@#images\
ImgAlpha1=200
ImgAlpha2=230
BGBackground=background.png
BGClock=bg_clock.png
FontColor=120,210,255,230
DigitBack=164,164,164,230
FS1=10
FS2=60
OnScreen=6000
;---------------------------------------------------
AudioOut1=5 ; <- Audio Source 1 -> Example: HDMI(TV)
AudioOut2=4 ; <- Audio Source 2 -> Example: Speaker
AudioOut3=2 ; <- Audio Source 3 -> Example: Headset
;---------------------------------------------------

[Style]
FontColor=#FontColor#
FontFace=UBUNTU LIGHT
StringAlign=LEFT
FontWeight=600
AntiAlias=1

;--------------------------------------------------
;--- MEASURE (DE)ACTIVATE (YT-Player & VISUALIZER)-
;--------------------------------------------------

[MeasureVisualizerEnabler]
Measure=Plugin
Plugin=WebNowPlaying
PlayerType=Status
IfCondition=MeasureVisualizerEnabler=0
IfFalseAction=[!DeactivateConfig "M.A.R.S\Visualizer" "visualizerdemo.ini"][!ActivateConfig "M.A.R.S\Visualizer" "visualizer.ini"][!Delay 500][!ActivateConfig "M.A.R.S\YouTubePlayer" "ytplayer.ini"][!FadeDuration 2500]
IfTrueAction=[!DeactivateConfig "M.A.R.S\Visualizer" "visualizer.ini"][!ActivateConfig "M.A.R.S\Visualizer" "visualizerdemo.ini"][!Delay 500][!DeactivateConfig "M.A.R.S\YouTubePlayer" "ytplayer.ini"][!FadeDuration 2500]

;--------------------------------------------------
;--- MEASURE SYSTEM-UPTIME CLOCK ------------------
;--------------------------------------------------

[MeasureUptime]
Measure=Uptime
Format="%4!02i!:%3!02i!:%2!02i!:%1!02i!"

;---------------------------------------------------
;--- MEASURE AUDIO-PART ----------------------------
;---------------------------------------------------

;--- AUDIO MAIN MEASURE (VOLUME / MUTE & PORT) -----

[MeasureAudio]
Measure=Plugin
Plugin=Win7AudioPlugin
IfCondition=MeasureAudio <= 0
IfTrueAction=[!Delay #OnScreen#][!EnableMeasure MeasureMute][!ShowMeter MuteWarning]
IfCondition2=MeasureAudio >= 1
IfTrueAction2=[!DisableMeasure MeasureMute][!HideMeter MuteWarning]
OnChangeAction=[!ShowMeterGroup Volume][!Delay #OnScreen#][!HideMeterGroup Volume][!UpdateMeter *]

;[MeasureAudio]
;Measure=Plugin
;Plugin=Win7AudioPlugin
;IfCondition=(MeasureAudio >= -1) && (MeasureAudio <= 0)
;IfTrueAction=[!Delay #OnScreen#][!EnableMeasure MeasureMute][!ShowMeter MuteWarning]
;IfCondition2=(MeasureAudio >= 1) && (MeasureAudio <= 100)
;IfTrueAction2=[!DisableMeasure MeasureMute][!HideMeter MuteWarning]
;OnChangeAction=[!ShowMeterGroup Volume][!Delay #OnScreen#][!HideMeterGroup Volume][!Update]

[MeasureVolPercent]
Measure=Calc
Formula=MeasureAudio
Substitute="-1":"0"

;--- AUDIO MUTE WARNING ----------------------------

[MeasureMute]
Measure=CALC
Formula=Counter % 2
Disabled=1

;--------------------------------------------------
;--- METER BACKGROUND & GRAPHIC ELEMENTS ----------
;--------------------------------------------------

[BG_MAIN]
Meter=Image
ImageName=#Images##BGBackground#
AntiAlias=1
X=0
Y=0
W=1440
H=900
UpdateDivider=-1

[BG_CLOCK]
Meter=Image
ImageName=#Images##BGClock#
AntiAlias=1
X=500
Y=280
W=440
H=340
UpdateDivider=-1

[BG_Lines_1]
Meter=Image
ImageName=#Images#lines_1.png
AntiAlias=1
X=971
Y=378
W=80
H=140
UpdateDivider=-1

;--------------------------------------------------
;--- METER SYSTEM RUNTIME -------------------------
;--------------------------------------------------

[SYS_RUNTIME]
Meter=STRING
MeterStyle=Style
FontSize=#FS1#
Text="SYSTEM RUNTIME: [MeasureUptime]"
X=624
Y=308
DynamicVariables=1

;---------------------------------------------------
;--- METER AUDIO CONTROL SECTION -------------------
;---------------------------------------------------

;--- DIRECT SELECTION AUDIO-OUT-PORT ---------------

[AudioSource_1]
Meter=Button
ButtonImage=#Images#source_hdmi_btn.png
AntiAlias=1
X=955
Y=361
LeftMouseDoubleClickAction=[!CommandMeasure "MeasureAudio" "SetOutPutIndex #AudioOut1#"][PLAY "#Sound#"][!Update]

[AudioSource_2]
Meter=Button
ButtonImage=#Images#source_spdif_btn.png
AntiAlias=1
X=r
Y=66r
LeftMouseDoubleClickAction=[!CommandMeasure "MeasureAudio" "SetOutPutIndex #AudioOut2#"][PLAY "#Sound#"][!Update]

[AudioSource_3]
Meter=Button
ButtonImage=#Images#source_headset_btn.png
AntiAlias=1
X=r
Y=66r
LeftMouseDoubleClickAction=[!CommandMeasure "MeasureAudio" "SetOutPutIndex #AudioOut3#"][PLAY "#Sound#"][!Update]

;--- VOLUME / SCROLLING AUDIO-SOURCE & MUTE-SYMBOL -

[VolumeIcon]
Meter=BUTTON
ButtonImage=#Images#speaker.png
AntiAlias=1
X=66r
Y=-99r
MouseScrollUpAction=[!CommandMeasure "MeasureAudio" "ChangeVolume 5"][!Update] 
MouseScrollDownAction=[!CommandMeasure "MeasureAudio" "ChangeVolume -5"][!Update]
LeftMouseUpAction=[!CommandMeasure "MeasureAudio" "ToggleMute"][!Update]
 
[AudioSource_Settings]
Meter=BUTTON
ButtonImage=#Images#audio_source.png
AntiAlias=1
X=r
Y=66r
MouseScrollUpAction=[!CommandMeasure "MeasureAudio" "ToggleNext"][PLAY "#Sound#"][!Update]
MouseScrollDownAction=[!CommandMeasure "MeasureAudio" "TogglePrevious"][PLAY "#Sound#"][!Update]
LeftMouseUpAction=[%windir%\system32\control.exe mmsys.cpl]
RightMouseUpAction=[%windir%\system32\sndvol.exe]

[MuteWarning]
Meter=BITMAP
MeasureName=MeasureMute
BitmapImage=#Images#mute.png
BitmapFrames=2
BitmapExtend=1
ImageAlpha=#ImgAlpha1#
AntiAlias=1
X=668
Y=398
UpdateDivider=1
Hidden=1

;--- AUDIO-OUT SOURCE DISPLAY ----------------------

[ICON_AudioOut]
Meter=Image
ImageName=#Images#audio_out.png
ImageAlpha=#ImgAlpha2#
AntiAlias=1
X=590
Y=575
W=38
H=19
UpdateDivider=-1
Group=AudioOut

[AudioPort]
Meter=STRING
FontSize=#FS1#
MeterStyle=Style
Text=[MeasureAudio]
ClipString=1
X=43r
Y=2r
W=220
DynamicVariables=1
Group=AudioOut

;--- VOLUME-BAR & NUMBER IN PERCENT ----------------

[VolumeBar]
Meter=Bar
MeasureName=MeasureAudio
SolidColor=#DigitBack#
BarImage=#@#Images\volume.png
BarOrientation=Horizontal
X=1021
Y=390
W=46
H=2

[FRAMEVolume]
Meter=Image
ImageName=#Images#frame_volume.png
AntiAlias=1
X=500
Y=280
W=440
H=340
UpdateDivider=-1
Hidden=1
Group=Volume

[VolumePercent]
Meter=STRING
FontSize=#FS2#
MeterStyle=Style
StringAlign=CENTER
Text=[MeasureVolPercent]%
X=718
Y=402
DynamicVariables=1
Hidden=1
Group=Volume

;--------------------------------------------------
;--- METER SYSTEM SHUTDOWN-CONTROL ----------------
;--------------------------------------------------

;--- Button 1 LOG OFF -----------------------------

[Button1]
Meter=BUTTON
ButtonImage=#Images#logoff.png
SolidColor=0,0,0,1
AntiAlias=1
X=677
Y=635
W=16
H=16
LeftMouseDoubleClickAction=[shutdown.exe -l]
MouseOverAction=[!ShowMeter Button1Active][!HideMeterGroup AudioOut][!Redraw]
MouseLeaveAction=[!HideMeter Button1Active][!ShowMeterGroup AudioOut][!Redraw]

;--- Button 2 SYSTEM LOG --------------------------

[Button2]
Meter=Button
ButtonImage=#Images#log.png
SolidColor=0,0,0,1
AntiAlias=1
X=26r
Y=r
W=16
H=16
LeftMouseDoubleClickAction=[rundll32.exe user32.dll LockWorkStation]
MouseOverAction=[!ShowMeter Button2Active][!HideMeterGroup AudioOut][!Redraw]
MouseLeaveAction=[!HideMeter Button2Active][!ShowMeterGroup AudioOut][!Redraw]

;--- Button 3 SYSTEM RESTART ----------------------

[Button3]
Meter=Button
ButtonImage=#Images#restart.png
SolidColor=0,0,0,1
AntiAlias=1
X=26r
Y=r
W=16
H=16
LeftMouseDoubleClickAction=[shutdown.exe -r -t 00]
MouseOverAction=[!ShowMeter Button3Active][!HideMeterGroup AudioOut][!Redraw]
MouseLeaveAction=[!HideMeter Button3Active][!ShowMeterGroup AudioOut][!Redraw]

;--- Button 4 SYSTEM SHUTDOWN ---------------------

[Button4]
Meter=Button
ButtonImage=#Images#shutdown.png
SolidColor=0,0,0,1
AntiAlias=1
X=26r
Y=r
W=16
H=16
LeftMouseDoubleClickAction=[shutdown.exe -s -t 00]
MouseOverAction=[!ShowMeter Button4Active][!HideMeterGroup AudioOut][!Redraw]
MouseLeaveAction=[!HideMeter Button4Active][!ShowMeterGroup AudioOut][!Redraw]

;--- Text for Buttons 1-4 -------------------------

[Button1Active]
Meter=STRING
MeterStyle=Style
StringAlign=CENTER
FontSize=#FS1#
Text=LOG OUT
X=-32r
Y=-60r
Hidden=1

[Button2Active]
Meter=STRING
MeterStyle=Style
StringAlign=CENTER
FontSize=#FS1#
Text=LOCK
X=r
Y=r
Hidden=1

[Button3Active]
Meter=STRING
MeterStyle=Style
StringAlign=CENTER
FontSize=#FS1#
Text=RESTART
X=r
Y=r
Hidden=1

[Button4Active]
Meter=STRING
MeterStyle=Style
StringAlign=CENTER
FontSize=#FS1#
Text=SHUTDOWN
X=r
Y=r
Hidden=1

;--------------------------------------------------
;--- FRAME CLOCK ----------------------------------
;--------------------------------------------------

[FRAME_CLOCK]
Meter=Image
ImageName=#Images#frame_clock.png
AntiAlias=1
X=500
Y=280
W=440
H=340
UpdateDivider=-1
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 12112
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Problem with "Mute Detection" in Volume-Meter

Post by balala »

Try to add an IfConditionMode=1 option to the [MeasureAudio] measure.
User avatar
Youkai1977
Posts: 40
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: Problem with "Mute Detection" in Volume-Meter

Post by Youkai1977 »

Thank you, you are my hero. :thumbup:
That was what I was looking for or what I was missing.

Sometimes you can't see the forest for the trees :???:
User avatar
balala
Rainmeter Sage
Posts: 12112
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Problem with "Mute Detection" in Volume-Meter

Post by balala »

Youkai1977 wrote: January 10th, 2021, 10:45 pm That was what I was looking for or what I was missing.
Glad you got it working as expected.