It is currently September 8th, 2024, 12:06 am

Thread for help with the Shape meter

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

Re: Thread for help with the Shape meter

Post by sl23 »

Oh of course! lol

Just noticed your post above using a formula, is that another way to do it? Is it better?

Ah i could use the BarW variable! duh!
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the Shape meter

Post by Yincognito »

sl23 wrote: July 13th, 2024, 1:28 pm Oh of course! lol

Just noticed your post above using a formula, is that another way to do it? Is it better?

Ah i could use the BarW variable! duh!
Probably, not sure - depends on what behavior you want. I'm sure that trying it out will clarify if it's what you wanted.
Generally, the main advantage of formulas is that they can be used everywhere and don't depend on any option. Obviously, sometimes the built-in options / methods are more suited.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

Yeah it is what I needed, though I need to also set the X of the next as 'r' but I've gotten sidetracked with cleaning up the Measures lol
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

Oh damn! You can't use 'r' in Shape Meters! Is there any way of achieving a similar result?
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the Shape meter

Post by Yincognito »

sl23 wrote: July 13th, 2024, 2:38 pm Oh damn! You can't use 'r' in Shape Meters! Is there any way of achieving a similar result?
Just use 'r' in the X or Y of the Shape meter, instead of in its options (where it doesn't make any sense, just like in other meters). Or, use formulas based on what you need to be relative to. Sorry for the delay, been working on the spectrum analyzer.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

If I do that, I may as well use bars. I was trying to get one shape meter with all the disks in one section but trying to do it the way it already worked with bars in my older skins. They use IfConditions on each disks TotalMeasure to disable the measures and meters associated with it, other than that specific disks TotalMeasure of course. But also, JSMorley gave me some code over 10 years ago that allowed me to move the other meters up or left, whichever way it was set up.
So if there were four disks: C,D,E,F, and disk E was removed and therefore empty which disables the measures/meters for it, then instead of this: C,D, ,F,, you would get this: C,D,F,, because the IfCondition would move the meters to fill the space where disk E was.

My current shape meter code:

Code: Select all

[DiskBars]
Meter=Shape
Shape=Rectangle                          #Bar1X#, 0, #BarW1#, #BarH# | StrokeWidth 0 | Fill Color #White60#
Shape2=Rectangle  #Bar1X#, 0, #BarW1#, ([m1Used:]/[m1Total:]*#BarH#) | StrokeWidth 0 | Fill Color #Disk1Bar#
Shape3=Rectangle                         #Bar2X#, 0, #BarW2#, #BarH# | StrokeWidth 0 | Fill Color #White60#
Shape4=Rectangle  #Bar2X#, 0, #BarW2#, ([m2Used:]/[m2Total:]*#BarH#) | StrokeWidth 0 | Fill Color #Disk2Bar#
Shape5=Rectangle                         #Bar3X#, 0, #BarW3#, #BarH# | StrokeWidth 0 | Fill Color #White60#
Shape6=Rectangle  #Bar3X#, 0, #BarW3#, ([m3Used:]/[m3Total:]*#BarH#) | StrokeWidth 0 | Fill Color #Disk3Bar#
Shape7=Rectangle                         #Bar4X#, 0, #BarW4#, #BarH# | StrokeWidth 0 | Fill Color #White60#
Shape8=Rectangle  #Bar4X#, 0, #BarW4#, ([m4Used:]/[m4Total:]*#BarH#) | StrokeWidth 0 | Fill Color #Disk4Bar#
Shape9=Rectangle                         #Bar5X#, 0, #BarW5#, #BarH# | StrokeWidth 0 | Fill Color #White60#
Shape10=Rectangle #Bar5X#, 0, #BarW5#, ([m5Used:]/[m5Total:]*#BarH#) | StrokeWidth 0 | Fill Color #Disk5Bar#
Shape11=Rectangle                            #Bar6X#, 0, #BarW6#, #BarH# | StrokeWidth 0 | Fill Color #White60#
Shape12=Rectangle     #Bar6X#, 0, #BarW6#, ([m6Used:]/[m6Total:]*#BarH#) | StrokeWidth 0 | Fill Color #Disk6Bar#
Shape13=Rectangle                            #Bar7X#, 0, #BarW7#, #BarH# | StrokeWidth 0 | Fill Color #White60#
Shape14=Rectangle     #Bar7X#, 0, #BarW7#, ([m7Used:]/[m7Total:]*#BarH#) | StrokeWidth 0 | Fill Color #Disk7Bar#
Shape15=Rectangle                            #Bar8X#, 0, #BarW8#, #BarH# | StrokeWidth 0 | Fill Color #White60#
Shape16=Rectangle     #Bar8X#, 0, #BarW8#, ([m8Used:]/[m8Total:]*#BarH#) | StrokeWidth 0 | Fill Color #Disk8Bar#
Shape17=Rectangle                            #Bar9X#, 0, #BarW9#, #BarH# | StrokeWidth 0 | Fill Color #White60#
Shape18=Rectangle     #Bar9X#, 0, #BarW9#, ([m9Used:]/[m9Total:]*#BarH#) | StrokeWidth 0 | Fill Color #Disk9Bar#
Shape19=Rectangle                          #Bar10X#, 0, #BarW10#, #BarH# | StrokeWidth 0 | Fill Color #White60#
Shape20=Rectangle #Bar10X#, 0, #BarW10#, ([m10Used:]/[m10Total:]*#BarH#) | StrokeWidth 0 | Fill Color #Disk10Bar#
DynamicVariables=1
X=0
Y=44
And the IfCondition on Disk4:

Code: Select all


[m4Total]
Measure=FreeDiskSpace
Drive=#Disk4#:
Total=1
IgnoreRemovable=0
RegExpSubstitute=1
Substitute="^(.+)$":"\1B","0\.00 B":""
DynamicVariables=1
OnChangeAction=[!UpdateMeasureGroup #Disk4#][!UpdateMeterGroup #Disk4#][!UpdateMeter DiskBars][!Redraw]

IfCondition=(#CurrentSection#=0)
IfTrueAction=[!SetVariable BarW4 "0"][!HideMeterGroup "#Disk4#"][!DisableMeasureGroup #Disk4#]
IfFalseAction=[!SetVariable BarW4 "#BarW#"][!ShowMeterGroup "#Disk4#"][!EnableMeasureGroup #Disk4#]
10 disks are referenced here and I am able to do as I stated above, disable and hide the meters, but not move their X position as I currently do with the older Bar meter version.

Tbh, I'll probably just change it back to bars as that's what worked before for me.

Hope the SpecAn's going well? :thumbup:
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the Shape meter

Post by Yincognito »

sl23 wrote: July 13th, 2024, 8:45 pm If I do that, I may as well use bars.
[...]
Hope the SpecAn's going well? :thumbup:
If you need to assign different mouse actions to your elements, then it's simpler to keep them as bars (you don't even need IfConditions, by the way). If the priority is being compact in terms of sections, then it can be done for the individual shapes in a Shape meter too (via formulas).

For both, but especially for the latter since the former can be done in multiple ways, you can use the fact that Sgn() of your measure value will be 1 if available (measure greater than 0) and 0 if not (measure is 0). As you know, any number multiplied with 1 is the same number and any number multiplied with 0 is zero. So, if you have:

X F = X C + (Width C + Distance C To D) * Sgn(Measure C) + (Width D + Distance D To E) * Sgn(Measure D) + (Width E + Distance E To F) * Sgn(Measure E)

then, if Measure E is 0 (disk unavailable) and the rest are greater than 0 (disk available):

X F = X C + (Width C + Distance C To D) + (Width D + Distance D To E)

which means that F would be placed at X E, i.e. after D, given that E is unavailable / missing. Obviously, if you don't like Sgn(X), you can use a corresponding conditional, e.g. (X>0?1:0).

The spectrum analyzer is going more than well on the visual / control side (added tooltips with the band number, frequency, rms and hold values via the Mouse plugin, as well as changing the number of bands on scroll via zeroing out the unneeded band and hold rectangles), but on the audio side it still doesn't quite match the one from the plugin you sent me. I'll leave the latter part for last as it's probably just about adjusting the parent measure.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

Thanks.
Im using mouse actions only on the string meters for the drives letter.

I deleted the whole shapes thing. It was more an experiment to see if I could get it working, but the way they work as a group of shapes is somewhat restricting, at least for me.

I may give your idea above a try though as the shape code is on the post I made above.
I like the idea of not using If Conditions, I'm just playing with new or different ideas as I like condensing the code making it minimal. Hopefully I'll learn something from the constant effort too! Lol

Although, I read up about nested variables and I sort of get how that works, it still hasn't been fully realised yet.

Can't wait to see your finished analyser. I bet it looks great! Isn't there another plugin for audio, sure it was mentioned in the old mic volume thread by deathcrafter? Is that one a better choice for fft? Meaning that it may be more accurate? I can't remember the name or I'd try it out if it is more accurate.

EDIT: Found the AudioAnalyser plugin. There is an updated version on GitHub page. Documentation. Links courtesy of death.crafter.
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

Yincognito wrote: July 13th, 2024, 11:48 pm ... (you don't even need IfConditions, by the way). If the priority is being compact in terms of sections, then it can be done for the individual shapes in a Shape meter too (via formulas).

For both, but especially for the latter since the former can be done in multiple ways, you can use the fact that Sgn() of your measure value will be 1 if available (measure greater than 0) and 0 if not (measure is 0). As you know, any number multiplied with 1 is the same number and any number multiplied with 0 is zero. So, if you have:

X F = X C + (Width C + Distance C To D) * Sgn(Measure C) + (Width D + Distance D To E) * Sgn(Measure D) + (Width E + Distance E To F) * Sgn(Measure E)

then, if Measure E is 0 (disk unavailable) and the rest are greater than 0 (disk available):

X F = X C + (Width C + Distance C To D) + (Width D + Distance D To E)

which means that F would be placed at X E, i.e. after D, given that E is unavailable / missing. Obviously, if you don't like Sgn(X), you can use a corresponding conditional, e.g. (X>0?1:0).
Going to try this, I kinda like the way you can do without the IfConditions! ;-)

I am a bit stuck right at the beginning though. So X F = X C + ... Does that go into the X or W of each shape meter? This gets longer the more disks you monitor? I have ten, never used more than 8 at a time, not at once, but each with different letters.

Also, where do I get the 1 from? I'm measuring Total disk space, either it returns 0 for disconnected or the size of the drive, not a 1.

EDIT: I have this so far, is it correct?

Code: Select all

X F = X C + (Width C + Distance C To D) * Sgn(Measure C) + (Width D + Distance D To E) * Sgn(Measure D) + (Width E + Distance E To F) * Sgn(Measure E)
#Bar4X = #Bar1X# + (#BarW# + 2) * Sgn(m1Total) + (#BarW# + 2) * Sgn(m2Total) + (#BarW# + 2) * Sgn(m3Total)
#Bar1X# = 0
#Bar4X# = 42
#BarW# = 12
m1Total = Measure disk 1 Total

What do I do with the X F = X C part? Do I replace each with the number value? Does it mean X*F or the X of F?
Should the whole thing be in brackets?
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the Shape meter

Post by Yincognito »

sl23 wrote: July 14th, 2024, 12:23 pm EDIT: Found the AudioAnalyser plugin. There is an updated version on GitHub page. Documentation. Links courtesy of death.crafter.
I mentioned this already...
Yincognito wrote: July 12th, 2024, 9:59 am By the way, not sure if you checked it, if it works properly and is flexible enough, or if it has a hold setting for peaks, but while trying to replicate the Winamp spectrum analyzer, I found this plugin by rxtd:
https://forum.rainmeter.net/viewtopic.php?t=31091

sl23 wrote: July 14th, 2024, 1:56 pm EDIT: I have this so far, is it correct?

Code: Select all

(#Bar1X# + (#BarW# + 2) * Sgn([m1Total:]) + (#BarW# + 2) * Sgn([m2Total:]) + (#BarW# + 2) * Sgn([m3Total:]))
Yes, precisely. You'd use this formula (note how to force get the number value of those measures above) in place of your otherwise fixed value of #Bar4X# in Shape8 from your earlier [DiskBars] meter (or, to be more compact, !SetVariable Bar4X to it once beforehand, in a regularly updated measure, so you can use #Bar4X# afterwards in the shapes). This will make the X of Bar4 dynamically adjust to whether such drives are unavailable / empty or not and position the individual shape accordingly. A similar approach for the rest of the X-es for your individual shapes, of course.

This is mainly for the shape variant, but it can be applied to the bar variant too. In the bar variant, there are multiple solutions that don't involve IfConditions, but for the shape variant, using such formulas is one of the few ways available, if not the only one.

P.S. Naturally, in both variants you'll also need to "hide" the "missing drive" figure, either via !HideMeter for bars or, for shapes, via making the width of the missing drive shape 0 or not using something like (#Bar3W#*Sgn([m3Total:])) for your 3rd aka "E" drive supposedly empty / unavailable.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth