It is currently March 29th, 2024, 10:52 am

Adjust Mic Volume Level?

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Adjust Mic Volume Level?

Post by Yincognito »

sl23 wrote: May 2nd, 2022, 7:22 pm Told you so! :p
I guess this must be a Powershell thing then? Typical MS!

I'll just have to leave it with the AudioDeviceCmdlet I think. It seemed to be going so well with the Nir software too, shame! But I like to exhaust all avenues first, least the ones I can anyway. Don't trouble yourself any more with this, you've done enough. Thanks for all your input and attempts at solving it, but as I said... doomed to failure! :thumbdown:
No, I don't think it's a MS thing, at least not when talking about Powershell - it might be slower than CMD, but that's one thing where MS got it almost right. Plus, you said it happens with Nir as well, so it might just be that the system / Rainmeter is overwhelmed with that many times and at that frequency to execute either Nir programs or PS and eventually crashes. I didn't notice before because I didn't keep the skin loaded for a longer (i.e. above 20 minutes) period.

Ideally, the approach shouldn't have been to consistently run programs very often, because that's a slippery slope anyway, but we had to explore it since the only other solution at that time was a memory leaking approach. Sadly, neither this or some other variants I tested now (e.g. installing the module instead of importing it) don't properly work. The culprit is definitely AudioDeviceCmdlets, since other commands like Get-PnpDevice -FriendlyName "*Microphone*" | Select-Object -Property FriendlyName | Select-Object -First 1, although almost choking Rainmeter and the CPU by being ran every 50 ms do not cause a memory leak.

Well, personally, I don't like taking no for an answer, but if you say so ... this is indeed an objective with very few avenues to explore, and all of them pretty bad, from a technical perspective. :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
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 »

20 minutes? Only takes about 5 on my system! O.O
And CPU doesn't get very high either, about 20% max according to Rainmeter. Maybe I've got too many skins working hard? :oops:

If you feel so inclined to find a solution, far be it from me to stop you! :D

At present it just means that it's best to keep the volume skin unloaded and load it only when mic is required, or maybe use SVV just to enable/disable the mic thus avoiding the leak.

Just had one last thought actually. Using the AudioDeviceCmdlet. When the InputVolme measure has a high UpdateRate, it's not very practical as it takes ages to update the meters. Is it possible to dynamically change the update rate only on mouse actions?

For example, L-click would change the Update Divider to 1, perform setting the volume to 25,then maybe short delay bang and finally, reset the Update Divider back to say 20?

Is that any good? Can't test just yet.
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Adjust Mic Volume Level?

Post by Yincognito »

sl23 wrote: May 3rd, 2022, 9:47 am 20 minutes? Only takes about 5 on my system! O.O
And CPU doesn't get very high either, about 20% max according to Rainmeter. Maybe I've got too many skins working hard? :oops:

If you feel so inclined to find a solution, far be it from me to stop you! :D

At present it just means that it's best to keep the volume skin unloaded and load it only when mic is required, or maybe use SVV just to enable/disable the mic thus avoiding the leak.

Just had one last thought actually. Using the AudioDeviceCmdlet. When the InputVolme measure has a high UpdateRate, it's not very practical as it takes ages to update the meters. Is it possible to dynamically change the update rate only on mouse actions?

For example, L-click would change the Update Divider to 1, perform setting the volume to 25,then maybe short delay bang and finally, reset the Update Divider back to say 20?

Is that any good? Can't test just yet.
I think I have a much better idea, one that you'll probably like. Stay tuned.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
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 »

Hmm... Interesting, very interesting! :sly:
- MuLab -
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Adjust Mic Volume Level?

Post by CodeCode »

Yincognito wrote: May 3rd, 2022, 10:18 am I think I have a much better idea, one that you'll probably like. Stay tuned.
Hmm. Far be it from me to not take interest in a new way to manage environmental mic volume with RM.
This has been a really confusing topic to read through.
I am still doing it though. :twisted:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
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 »

You're confused?! :rofl:
I struggle with the basics let alone all this! :o
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Adjust Mic Volume Level?

Post by Yincognito »

sl23 wrote: May 3rd, 2022, 12:10 pmHmm... Interesting, very interesting! :sly:
CodeCode wrote: May 3rd, 2022, 1:38 pmHmm. Far be it from me to not take interest in a new way to manage environmental mic volume with RM.
This has been a really confusing topic to read through.
I am still doing it though. :twisted:
Ok, not taking no for an answer paid off eventually. This is the best that can be done to keep the AudioDeviceCmdlets memory leak under control (as in, slowing down the leak as much as possible) AND still feel like you're doing real-time adjustments on the audio input / output volumes and mute states. Apart from the code, the idea is basically a trick: why even trying to get or set the audio data every couple of milliseconds to simulate real time in the first place ... when you can only make it look like it does? :D

In a nutshell, what the code does is get all the potentially needed audio data in one attempt, once every #SlowUpdate# milliseconds (the higher, the slower the memory leak), taking care to also set all the potentially needed data if #Changed# is 1 before that but in the same attempt, then pass the newline delimited list to individual String measures in order to distribute it separately, as independent corresponding variables. Those independent variables can be modified in realtime via scroll (by the corresponding Step variables) on volumes or click (to toggle) on mute states, at which point #Changed# will be temporarily set to 1 to trigger inserting the set data code in the PowershellRM measure when the time comes, but the change or query to or from the actual audio devices will happen only once every #SlowUpdate# milliseconds, irrespective of how many clicks and scrolls one does to change the variables - after all, nobody stays with the Control Panel windows opened to see if the changes happen right away or after one, two, three or whatever seconds.

Initially, when no mouse actions happen, and right after getting or setting the actual data, the #Changed# variable will be set (or reset) to 0, to make sure we don't pointlessly override volumes and mute states and everything goes with the flow. The [SetAudio] measure and variable will insert the code for setting the audio data based on the #Changed# variable's value - I had to do it this way because apparently PowershellRM doesn't like or supports Rainmeter's nested syntax or measure syntax, so this extra measure will, if necessary, convert #Changed# value to the code needed to set the data, then pass it to an identically named plain variable that can be used with PowershellRM. If the #Changed# value says that no change or set data is needed, the code to set it will be the empty string, essentially allowing to only get the said data.

The code (you can tweak FastUpdate, SlowUpdate, OutputStep and InputStep to your liking, of course)...

[SkinFolder]\@Resources\DeviceVolume.ps1:

Code: Select all

Import-Module -Name "$($RmAPI.VariableStr('@'))Addons\AudioDeviceCmdlets"

function Get-OutputVolume
{
  return Get-AudioDevice -PlaybackVolume
}

function Get-InputVolume
{
  return Get-AudioDevice -RecordingVolume
}

function Get-OutputMute
{
  if (Get-AudioDevice -PlaybackMute) {return 1} else {return 0}
}

function Get-InputMute
{
  if (Get-AudioDevice -RecordingMute) {return 1} else {return 0}
}

function Set-OutputVolume
{
  [CmdletBinding()]param([Parameter(Mandatory)][float]$Volume)
  Set-AudioDevice -PlaybackVolume $Volume
}

function Set-InputVolume
{
  [CmdletBinding()]param([Parameter(Mandatory)][float]$Volume)
  Set-AudioDevice -RecordingVolume $Volume
}

function Set-OutputMute
{
  [CmdletBinding()]param([Parameter(Mandatory)][byte]$State)
  switch($State)
  {
    0 {Set-AudioDevice -PlaybackMute $false}
    1 {Set-AudioDevice -PlaybackMute $true}
  }
}	

function Set-InputMute
{
  [CmdletBinding()]param([Parameter(Mandatory)][byte]$State)
  switch($State)
  {
    0 {Set-AudioDevice -RecordingMute $false}
    1 {Set-AudioDevice -RecordingMute $true}
  }
}
[SkinFolder]\AudioManager.ini:

Code: Select all

[Variables]
FastUpdate=25
SlowUpdate=2000
OutputVolume=0
InputVolume=0
OutputMute=0
InputMute=0
OutputStep=1
InputStep=1
Changed=0

[Rainmeter]
Update=25
DynamicWindowSize=1
AccurateText=1

[Metadata]
Name=AudioManager
Author=Yincognito & Other Credited Authors
; Credit for the AudioDeviceCmdlets .dll module to frgnca - https://github.com/frgnca/AudioDeviceCmdlets
; Credit for the initial Powershell code to death.crafter - https://forum.rainmeter.net/viewtopic.php?f=5&t=38135#p195694
; Credit for the supplemental Powershell code to jsmorley - https://forum.rainmeter.net/viewtopic.php?t=38135&start=30#p195744
; Other adjustments and improvements to keep the AudioDeviceCmdlets memory leak under control by Yincognito

---Measures---

[DeviceVolume]
Measure=Plugin
Plugin=PowershellRM
ScriptFile=#@#DeviceVolume.ps1
UpdateDivider=-1
DynamicVariables=1

[SetAudio]
Measure=String
String=#Changed#
RegExpSubstitute=1
Substitute="^0$":"","^1$":"Set-OutputVolume -Volume #OutputVolume#; Set-InputVolume -Volume #InputVolume#; Set-OutputMute -State #OutputMute#; Set-InputMute -State #InputMute#;"
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
OnUpdateAction=[!SetVariable #CURRENTSECTION# [#CURRENTSECTION#]]
DynamicVariables=1

[GetAudio]
Measure=Plugin
Plugin=PowershellRM
Parent=DeviceVolume
Line=#SetAudio#$(Get-OutputVolume), $(Get-InputVolume), $(Get-OutputMute), $(Get-InputMute), "" -join "`n"
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
DynamicVariables=1

[OutputVolume]
Measure=String
String=[GetAudio]
RegExpSubstitute=1
Substitute="(?siU)^.*(\N*\R)(\N*\R)(\N*\R)(\N*\R).*$":"\1","^\\\d+$":"","^(\d+).*$":"\1","^\\\d+$":""
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
OnUpdateAction=[!SetVariable #CURRENTSECTION# [#CURRENTSECTION#]][!SetVariable Changed 0]
DynamicVariables=1

[InputVolume]
Measure=String
String=[GetAudio]
RegExpSubstitute=1
Substitute="(?siU)^.*(\N*\R)(\N*\R)(\N*\R)(\N*\R).*$":"\2","^\\\d+$":"","^(\d+).*$":"\1","^\\\d+$":""
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
OnUpdateAction=[!SetVariable #CURRENTSECTION# [#CURRENTSECTION#]][!SetVariable Changed 0]
DynamicVariables=1

[OutputMute]
Measure=String
String=[GetAudio]
RegExpSubstitute=1
Substitute="(?siU)^.*(\N*\R)(\N*\R)(\N*\R)(\N*\R).*$":"\3","^\\\d+$":"","^(\d+).*$":"\1","^\\\d+$":""
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
OnUpdateAction=[!SetVariable #CURRENTSECTION# [#CURRENTSECTION#]][!SetVariable Changed 0]
DynamicVariables=1

[InputMute]
Measure=String
String=[GetAudio]
RegExpSubstitute=1
Substitute="(?siU)^.*(\N*\R)(\N*\R)(\N*\R)(\N*\R).*$":"\4","^\\\d+$":"","^(\d+).*$":"\1","^\\\d+$":""
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
OnUpdateAction=[!SetVariable #CURRENTSECTION# [#CURRENTSECTION#]][!SetVariable Changed 0]
DynamicVariables=1

---Meters---

[OutputVolumeText]
Meter=String
Y=5R
SolidColor=47,47,47,255
FontColor=255,255,255,255
FontFace=Consolas
FontSize=16
AntiAlias=1
Text=Output Volume: #OutputVolume#
MouseScrollUpAction=[!SetVariable OutputVolume (Clamp(#OutputVolume#+#OutputStep#,0,100))][!SetVariable Changed 1][!Update]
MouseScrollDownAction=[!SetVariable OutputVolume (Clamp(#OutputVolume#-#OutputStep#,0,100))][!SetVariable Changed 1][!Update]
DynamicVariables=1

[OutputMuteText]
Meter=String
Y=5R
SolidColor=47,47,47,255
FontColor=255,255,255,255
FontFace=Consolas
FontSize=16
AntiAlias=1
Text=Output   Mute: #OutputMute#
LeftMouseUpAction=[!SetVariable OutputMute (1-#OutputMute#)][!SetVariable Changed 1][!Update]
DynamicVariables=1

[InputVolumeText]
Meter=String
Y=5R
SolidColor=47,47,47,255
FontColor=255,255,255,255
FontFace=Consolas
FontSize=16
AntiAlias=1
Text=Input  Volume: #InputVolume#
MouseScrollUpAction=[!SetVariable InputVolume (Clamp(#InputVolume#+#InputStep#,0,100))][!SetVariable Changed 1][!Update]
MouseScrollDownAction=[!SetVariable InputVolume (Clamp(#InputVolume#-#InputStep#,0,100))][!SetVariable Changed 1][!Update]
DynamicVariables=1

[InputMuteText]
Meter=String
Y=5R
SolidColor=47,47,47,255
FontColor=255,255,255,255
FontFace=Consolas
FontSize=16
AntiAlias=1
Text=Input    Mute: #InputMute#
LeftMouseUpAction=[!SetVariable InputMute (1-#InputMute#)][!SetVariable Changed 1][!Update]
DynamicVariables=1

The packed skin for the lazy ones:
AudioManager_1.0.0.rmskin
A screenshot for the curious ones (yeah, not too pretty, but functional):
AudioManager.jpg
And that's about it. Questions, complaints, awards, talks about the weather welcomed. Just not to many requests to change it, cause just like the above skin, I like to do things one time and for good, if possible... :lol:

P.S. Didn't bother to create additional String measures to add the percentage sign to the volume percentages or convert the 0 and 1 mute states to "unmute" or "mute" strings, since anyone can do that. If you do, however, take care to not affect the values passed to the OutputVolume, InputVolume, OutputMute and InputMute variables from the identically named measures, cause they need to be plain values (0 to 100 and float type for volumes, 0 or 1 and byte type for the mute states).
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
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 »

What can I say? Apart from... WOW! You've stumped me again lol.

I'll give it a go and try figure out what's what. Is it ok to remove the OutputDevice code though, as it's already used via Rainmeter native code and works fine, I see no need to replace it. I imagine you added it for completeness?

I tried this:

Code: Select all

LeftMouseUpAction=[!SetVariable InputVolume 25][!SetVariable Changed 1][!Update]
RightMouseUpAction=[!SetVariable InputVolume 80][!SetVariable Changed 1][!Update]
But it shows a volume change, but actually changes nothing then the meter changes back to the correct volume amount.
EDIT: Actually, it seems to work. The problem seems to be a conflict with the other Mic Volume skin, the original one using the AudioDeviceCmdlet. And yeah, ok, it wasn't as complex as it first appeared! :oops:
EDIT:The problem wasn't the other skin, but the fact that I commented out the all OutputDevice Variables, Measures and Meters. So there seems to be some connection/relation with each other? I assume it's to do with this line (or do the Substitutes have any impact on this?):

Code: Select all

Line=#SetAudio#$(Get-OutputVolume), $(Get-InputVolume), $(Get-OutputMute), $(Get-InputMute), "" -join "`n"
How do I remove all output commands without affecting the Input? Sorry, I know you've gone to a great deal of trouble to resolve this, but I only really need the Input commands. ;-) I commented everything to do with Output in both the .ps1 script and the skin config, but it just breaks! :-(

If it's too much to change it, seeing as you said not to ask, I imagine it's not using much resources as is, so I could just keep it and only show the meters I need, sort of like the Weather.com skin by JSMorley. :thumbup:
Thanks for all your help, hope this works finally lol it's been a long journey!!! :rofl:
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Adjust Mic Volume Level?

Post by Yincognito »

sl23 wrote: May 3rd, 2022, 7:57 pm What can I say? Apart from... WOW! You've stumped me again lol.

I'll give it a go and try figure out what's what. Is it ok to remove the OutputDevice code though, as it's already used via Rainmeter native code and works fine, I see no need to replace it. I imagine you added it for completeness?

I tried this:

Code: Select all

LeftMouseUpAction=[!SetVariable InputVolume 25][!SetVariable Changed 1][!Update]
RightMouseUpAction=[!SetVariable InputVolume 80][!SetVariable Changed 1][!Update]
But it shows a volume change, but actually changes nothing then the meter changes back to the correct volume amount.



Thanks for all your help, hope this works finally lol it's been a long journey!!! :rofl:
Yes, the idea was to be complete, and yes, everything is connected (isn't it all when it comes to code?).

To leave only the input part, well, you remove everything dealing with the output, it's as simple as that. Not just deleting, but deleting according to the "patterns" / "scenarios" in each case - I let the "removed" stuff commented out so you can see what, how and most importantly why it's done this way before actually deleting them (# means comment in Powershell)...

PS1:

Code: Select all

Import-Module -Name "$($RmAPI.VariableStr('@'))Addons\AudioDeviceCmdlets"

# function Get-OutputVolume
# {
  # return Get-AudioDevice -PlaybackVolume
# }

function Get-InputVolume
{
  return Get-AudioDevice -RecordingVolume
}

# function Get-OutputMute
# {
  # if (Get-AudioDevice -PlaybackMute) {return 1} else {return 0}
# }

function Get-InputMute
{
  if (Get-AudioDevice -RecordingMute) {return 1} else {return 0}
}

# function Set-OutputVolume
# {
  # [CmdletBinding()]param([Parameter(Mandatory)][float]$Volume)
  # Set-AudioDevice -PlaybackVolume $Volume
# }

function Set-InputVolume
{
  [CmdletBinding()]param([Parameter(Mandatory)][float]$Volume)
  Set-AudioDevice -RecordingVolume $Volume
}

# function Set-OutputMute
# {
  # [CmdletBinding()]param([Parameter(Mandatory)][byte]$State)
  # switch($State)
  # {
    # 0 {Set-AudioDevice -PlaybackMute $false}
    # 1 {Set-AudioDevice -PlaybackMute $true}
  # }
# }	

function Set-InputMute
{
  [CmdletBinding()]param([Parameter(Mandatory)][byte]$State)
  switch($State)
  {
    0 {Set-AudioDevice -RecordingMute $false}
    1 {Set-AudioDevice -RecordingMute $true}
  }
}
INI:

Code: Select all

[Variables]
FastUpdate=25
SlowUpdate=2000
; OutputVolume=0
InputVolume=0
; OutputMute=0
InputMute=0
; OutputStep=1
InputStep=1
Changed=0

[Rainmeter]
Update=25
DynamicWindowSize=1
AccurateText=1

[Metadata]
Name=AudioManager
Author=Yincognito & Other Credited Authors
; Credit for the AudioDeviceCmdlets .dll module to frgnca - https://github.com/frgnca/AudioDeviceCmdlets
; Credit for the initial Powershell code to death.crafter - https://forum.rainmeter.net/viewtopic.php?f=5&t=38135#p195694
; Credit for the supplemental Powershell code to jsmorley - https://forum.rainmeter.net/viewtopic.php?t=38135&start=30#p195744
; Other adjustments and improvements to keep the AudioDeviceCmdlets memory leak under control by Yincognito

---Measures---

[DeviceVolume]
Measure=Plugin
Plugin=PowershellRM
ScriptFile=#@#DeviceVolume.ps1
UpdateDivider=-1
DynamicVariables=1

[SetAudio]
Measure=String
String=#Changed#
RegExpSubstitute=1
; Substitute="^0$":"","^1$":"Set-OutputVolume -Volume #OutputVolume#; Set-InputVolume -Volume #InputVolume#; Set-OutputMute -State #OutputMute#; Set-InputMute -State #InputMute#;"
Substitute="^0$":"","^1$":"Set-InputVolume -Volume #InputVolume#; Set-InputMute -State #InputMute#;"
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
OnUpdateAction=[!SetVariable #CURRENTSECTION# [#CURRENTSECTION#]]
DynamicVariables=1

[GetAudio]
Measure=Plugin
Plugin=PowershellRM
Parent=DeviceVolume
; Line=#SetAudio#$(Get-OutputVolume), $(Get-InputVolume), $(Get-OutputMute), $(Get-InputMute), "" -join "`n"
Line=#SetAudio#$(Get-InputVolume), $(Get-InputMute), "" -join "`n"
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
DynamicVariables=1

; [OutputVolume]
; Measure=String
; String=[GetAudio]
; RegExpSubstitute=1
; Substitute="(?siU)^.*(\N*\R)(\N*\R)(\N*\R)(\N*\R).*$":"\1","^\\\d+$":"","^(\d+).*$":"\1","^\\\d+$":""
; UpdateDivider=(#SlowUpdate#/#FastUpdate#)
; OnUpdateAction=[!SetVariable #CURRENTSECTION# [#CURRENTSECTION#]][!SetVariable Changed 0]
; DynamicVariables=1

[InputVolume]
Measure=String
String=[GetAudio]
RegExpSubstitute=1
; Substitute="(?siU)^.*(\N*\R)(\N*\R)(\N*\R)(\N*\R).*$":"\2","^\\\d+$":"","^(\d+).*$":"\1","^\\\d+$":""
Substitute="(?siU)^.*(\N*\R)(\N*\R).*$":"\1","^\\\d+$":"","^(\d+).*$":"\1","^\\\d+$":""
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
OnUpdateAction=[!SetVariable #CURRENTSECTION# [#CURRENTSECTION#]][!SetVariable Changed 0]
DynamicVariables=1

; [OutputMute]
; Measure=String
; String=[GetAudio]
; RegExpSubstitute=1
; Substitute="(?siU)^.*(\N*\R)(\N*\R)(\N*\R)(\N*\R).*$":"\3","^\\\d+$":"","^(\d+).*$":"\1","^\\\d+$":""
; UpdateDivider=(#SlowUpdate#/#FastUpdate#)
; OnUpdateAction=[!SetVariable #CURRENTSECTION# [#CURRENTSECTION#]][!SetVariable Changed 0]
; DynamicVariables=1

[InputMute]
Measure=String
String=[GetAudio]
RegExpSubstitute=1
; Substitute="(?siU)^.*(\N*\R)(\N*\R)(\N*\R)(\N*\R).*$":"\4","^\\\d+$":"","^(\d+).*$":"\1","^\\\d+$":""
Substitute="(?siU)^.*(\N*\R)(\N*\R).*$":"\2","^\\\d+$":"","^(\d+).*$":"\1","^\\\d+$":""
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
OnUpdateAction=[!SetVariable #CURRENTSECTION# [#CURRENTSECTION#]][!SetVariable Changed 0]
DynamicVariables=1

---Meters---

; [OutputVolumeText]
; Meter=String
; Y=5R
; SolidColor=47,47,47,255
; FontColor=255,255,255,255
; FontFace=Consolas
; FontSize=16
; AntiAlias=1
; Text=Output Volume: #OutputVolume#
; MouseScrollUpAction=[!SetVariable OutputVolume (Clamp(#OutputVolume#+#OutputStep#,0,100))][!SetVariable Changed 1][!Update]
; MouseScrollDownAction=[!SetVariable OutputVolume (Clamp(#OutputVolume#-#OutputStep#,0,100))][!SetVariable Changed 1][!Update]
; DynamicVariables=1

; [OutputMuteText]
; Meter=String
; Y=5R
; SolidColor=47,47,47,255
; FontColor=255,255,255,255
; FontFace=Consolas
; FontSize=16
; AntiAlias=1
; Text=Output   Mute: #OutputMute#
; LeftMouseUpAction=[!SetVariable OutputMute (1-#OutputMute#)][!SetVariable Changed 1][!Update]
; DynamicVariables=1

[InputVolumeText]
Meter=String
Y=5R
SolidColor=47,47,47,255
FontColor=255,255,255,255
FontFace=Consolas
FontSize=16
AntiAlias=1
Text=Input  Volume: #InputVolume#
MouseScrollUpAction=[!SetVariable InputVolume (Clamp(#InputVolume#+#InputStep#,0,100))][!SetVariable Changed 1][!Update]
MouseScrollDownAction=[!SetVariable InputVolume (Clamp(#InputVolume#-#InputStep#,0,100))][!SetVariable Changed 1][!Update]
DynamicVariables=1

[InputMuteText]
Meter=String
Y=5R
SolidColor=47,47,47,255
FontColor=255,255,255,255
FontFace=Consolas
FontSize=16
AntiAlias=1
Text=Input    Mute: #InputMute#
LeftMouseUpAction=[!SetVariable InputMute (1-#InputMute#)][!SetVariable Changed 1][!Update]
DynamicVariables=1

And yeah, your mouse code is otherwise correct:

Code: Select all

LeftMouseUpAction=[!SetVariable InputVolume 25][!SetVariable Changed 1][!Update]
RightMouseUpAction=[!SetVariable InputVolume 80][!SetVariable Changed 1][!Update]
Or, you could just set the InputStep to 25 and jump with 25 percents at a time on scroll. You could even make a progress bar like jsmorley did in his version, and use the $MouseX:%$ and $MouseY:%$ variables to set the percentage according to the percentual mouse position relative to the progress bar meter when you click on it. Bottom line, you're not restricted to just 2 actions or 2 percentages, if you want a different way of setting the percentages. ;-)

Things aren't complicated, but a bit of understanding of what happens is needed before adjustments are done, and not the other way around - just like in other cases. For example, if you remove the 2 output code parts from SetAudio and GetAudio (well, actually, only GetAudio in this case, but anyway) it goes without saying that you should adjust the Substitutes that extract the individual parts from GetAudio, in the Input... measures, since now the whole data is a list of just 2 elements (instead of 4 like before), separated by newlines - for the record, \N means not a newline and \R means newline in regex (I suppose the R letter comes from carriage-return). Of course, if you didn't remove anything from GetAudio, you could have just removed the Output... measures without operating any changes in any Substitute. And so on.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
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 »

As always, great explanation. That helps considerably. :thumbup:

I did try removing both just the output measures then the GetAudio. But think I may have removed the #SetAudio# variable, not sure now.

So should be OK to use Roundline meter as before?

Thank you again for all your help :thumbup: :thumbup:
- MuLab -