It is currently April 19th, 2024, 5:15 am

Changing the AudioLevel Port

Get help with creating, editing & fixing problems with skins
User avatar
cardencommachris
Posts: 5
Joined: March 3rd, 2020, 6:35 am

Changing the AudioLevel Port

Post by cardencommachris »

Let's say I want to temporarily enable the audio vu meter to listen to the headset mic, by moving the mouse over the background. In MeterBackground, I add:

Code: Select all

MouseOverAction=[!SetVariable PORT "Input"][!UpdateMeter "MeasureAudio"]
MouseLeaveAction=[!SetVariable PORT "Output"][!UpdateMeter "MeasureAudio"]
Nothing.

If I set it in the measure, of course, it works ...

Code: Select all

[MeasureAudio]
Measure=Plugin
Plugin=AudioLevel
Port=Input
etc.

I figure either
A) !UpdateMeter doesn't do what I thought it did
or
B) You can't change variables in a plugin measure.

Ideas?
Last edited by cardencommachris on May 22nd, 2020, 1:29 pm, edited 1 time in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Changing the AudioLevel Port

Post by mak_kawa »

I think [!UpdateMeasure MeasureAudio], instead of [!UpdateMeter MeasureAudio]...

And, [!SetOption MeasureAudio Port "Input"], instead of [!SetVariable PORT "Input"], possibly.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Changing the AudioLevel Port

Post by mak_kawa »

If you want to use !SetVariable bang, following code possibly works...

Code: Select all

[Variables]
PortSpec=Input

[MeasureAudio]
Measure=Plugin
Plugin=AudioLevel
Port=#PortSpec#
DynamicVariables=1

and...
MouseOverAction=[!SetVariable PortSpec "Input"][!UpdateMeasure MeasureAudio]
MouseLeaveAction=[!SetVariable PortSpec "Output"][!UpdateMeasure MeasureAudio]
And maybe !UpdateMeter and !Redraw bangs are necessary at the mouse action for the meter which displays the AudioLevel values.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing the AudioLevel Port

Post by balala »

cardencommachris wrote: May 21st, 2020, 1:43 am Let's say I want to temporarily enable the audio vu meter to listen to the headset mic, by moving the mouse over the background. In MeterBackground, I add:

MouseOverAction=[!SetVariable PORT "Input"][!UpdateMeter "MeasureAudio"]
MouseLeaveAction=[!SetVariable PORT "Output"][!UpdateMeter "MeasureAudio"]

Nothing.
As mak_kawa said (although he didn't specified expressly, but this is what he also said), neither Input, nor Output are not variables. So you set the Port variable in vain, especially that such a variable doesn't even exist.
Another solution beside mak_kawa's code, is to set the appropriate option on the [MeasureAudio] measure, without setting variables, with something like this:

Code: Select all

MouseOverAction=[!SetOption Measureaudio Port "Input"][!UpdateMeasure "MeasureAudio"]
MouseLeaveAction=[!SetOption Measureaudio Port "Output"][!UpdateMeasure "MeasureAudio"]
Note that I also replaced the !UpdateMeter bangs with !UpdateMeasure, because as mak_kawa said, [MeasureAudio] is a measure, not a meter. But practically this isn't a big problem, while the Update value of the skin is set to the default Update=1000 (or any positive value), because if you set the Port value with the !SetOption bangs and you don't update the measure, on next update cycle it anyway is updated.
User avatar
cardencommachris
Posts: 5
Joined: March 3rd, 2020, 6:35 am

Re: Changing the AudioLevel Port

Post by cardencommachris »

You are all very helpful, and I appreciate your responses. Yes, if I had stared at the code for another ten hours, I may just have noticed that I had typed UpdateMeter instead of Measure. I know better, I do. :)

So, this does not work:

Code: Select all

[MeasureAudio]
Measure=Plugin
Plugin=AudioLevel
Port=Output
FFTSize=1024
FFTAttack=15
FFTDecay=250
Bands=10
DynamicVariables=1

[MeterBackground]
Meter=Image
W=127
H=110
SolidColor=47,47,47,255
MouseOverAction=[!SetOption MeasureAudio Port "Input"][!SetOption MeterBackground SolidColor "255,255,255,255"][!UpdateMeasure "MeasureAudio"]
MouseLeaveAction=[!SetOption MeasureAudio Port "Output"][!SetOption MeterBackground SolidColor "47,47,47,255"][!UpdateMeasure "MeasureAudio"]
(changing background color to verify that MouseOverAction is actually working)

Nor does this:

Code: Select all

[Variables]
PORT=Output

[MeasureAudio]
Measure=Plugin
Plugin=AudioLevel
Port=#PORT#
FFTSize=1024
FFTAttack=15
FFTDecay=250
Bands=10
DynamicVariables=1

[MeterBackground]
Meter=Image
W=127
H=110
SolidColor=47,47,47,255
MouseOverAction=[!SetVariable PORT "Input"][!SetOption MeterBackground SolidColor "255,255,255,255"][!UpdateMeasure "MeasureAudio"]
MouseLeaveAction=[!SetVariable PORT "Output"][!SetOption MeterBackground SolidColor "47,47,47,255"][!UpdateMeasure "MeasureAudio"]
Finally, I did take all of the suggestions, and so I also tried UpdateMeter for each band Meter (10 all told), e.g.:

Code: Select all

MouseOverAction=[!SetVariable PORT "Input"][!UpdateMeasure "MeasureAudio"][!UpdateMeter "MeterBand0"][!UpdateMeter "MeterBand1"][!UpdateMeter "MeterBand2"][!UpdateMeter "MeterBand3"][!UpdateMeter "MeterBand4"][!UpdateMeter "MeterBand5"][!UpdateMeter "MeterBand6"][!UpdateMeter "MeterBand7"][!UpdateMeter "MeterBand8"][!UpdateMeter "MeterBand9"]
So, it may be that this cannot work. :-(
Last edited by Brian on May 22nd, 2020, 6:14 am, edited 1 time in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Changing the AudioLevel Port

Post by mak_kawa »

Hi cardencommachris

In fact, I am not sure that the AudioLevel plugin supports dynamic variables in its Port and Parent options... At least as far as I did, changing dynamically these options of AudioLevel plugin failed. Maybe your guess B) is right.

If so, you should prepare two-fold measures, output and input, for each AudioLevel measure including child measure, and change dynamically MeasureName option for all meters. It is really terrible. :-) Hope someone suggests better alternative way.

Ps. It's better to use code tag when you post code to this forum, I think.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing the AudioLevel Port

Post by balala »

mak_kawa wrote: May 22nd, 2020, 7:21 am In fact, I am not sure that the AudioLevel plugin supports dynamic variables in its Port and Parent options... At least as far as I did, changing dynamically these options of AudioLevel plugin failed. Maybe your guess B) is right.

If so, you should prepare two-fold measures, output and input, for each AudioLevel measure including child measure, and change dynamically MeasureName option for all meters. It is really terrible. :-) Hope someone suggests better alternative way.
Yep, it seems you're right, I also couldn't get dynamic changes on the AudioLevel plugin measure. Not sure why, but it's just not working. Maybe a dev will tell us something about this.
In meantime, yes, I suppose you're right, finally this was my approach as well: have created two AudioLevel plugin measures and a Calc measure, then disabled / enabled the appropriate AudioLevel measure. So I replaced the original [MeasureAudio] measure and the [MeterBackground] meter with the following ones:

Code: Select all

[MeasureAudioIn]
Measure=Plugin
Plugin=AudioLevel
Port=Input
FFTSize=1024
FFTAttack=15
FFTDecay=250
Bands=10
DynamicVariables=1
Disabled=1

[MeasureAudioOut]
Measure=Plugin
Plugin=AudioLevel
Port=Output
FFTSize=1024
FFTAttack=15
FFTDecay=250
Bands=10
DynamicVariables=1

[MeasureAudio]
Measure=Calc
Formula=( MeasureAudioIn + MeasureAudioOut )

[MeterBackground]
Meter=Image
W=127
H=110
SolidColor=47,0,0,255
MouseOverAction=[!DisableMeasure "MeasureAudioOut"][!EnableMeasure "MeasureAudioIn"][!SetOption MeterBackground SolidColor "255,0,0,255"][!UpdateMeasure "MeasureAudio"]
MouseLeaveAction=[!EnableMeasure "MeasureAudioOut"][!DisableMeasure "MeasureAudioIn"][!SetOption MeterBackground SolidColor "47,0,0,255"][!UpdateMeasure "MeasureAudio"]
Note that with the above measures [MeasureAudio] get its value from [MeasureAudioIn] when you're hovering the mouse over [MeterBackground] (because in this case [MeasureAudioOut] is disabled and [MeasureAudioIn] is enabled), respectively from [MeasureAudioOut] when you're leaving the [MeterBackground] (because in such a case [MeasureAudioIn] is disabled and [MeasureAudioOut] is enabled).
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Changing the AudioLevel Port

Post by Yincognito »

balala wrote: May 22nd, 2020, 7:42 am Yep, it seems you're right, I also couldn't get dynamic changes on the AudioLevel plugin measure. Not sure why, but it's just not working. Maybe a dev will tell us something about this.
There are one or two AudioLevel forks on GitHub that support dynamic variables, but then, of course, they are not officially supported by the Rainmeter team. Just saying...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing the AudioLevel Port

Post by balala »

Yincognito wrote: May 22nd, 2020, 11:32 am There are one or two AudioLevel forks on GitHub that support dynamic variables, but then, of course, they are not officially supported by the Rainmeter team. Just saying...
Really? Don't know. But the AudioLevel plugin included into Rainmeter, doesn't support them?
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Changing the AudioLevel Port

Post by Yincognito »

balala wrote: May 22nd, 2020, 1:03 pm Really? Don't know. But the AudioLevel plugin included into Rainmeter, doesn't support them?
No. They are "forks", in other words modifications of the original AudioLevel plugin by various other developers, which means they are seen as different plugins entirely. Fountain of Colors skin by alatsombath is using one of the forks, if you're curious.

Just yesterday I browsed over these two forks (the 2nd one by SnGmng is supporting dynamic variables for most options (except Port and ID), as seen in the comments at the bottom of the pages):
- AudioLevel plugin fork by alatsombath
- AudioLevel plugin fork by SnGmng
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth