It is currently January 22nd, 2022, 5:58 am

How to hide visualizer when there's no audio playing

Help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 13719
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to hide visualizer when there's no audio playing

Post by balala »

rina wrote: March 19th, 2020, 6:10 pm I don't mind that much if the skin loads everytime the system is playing any audio, since most of the time it is playing audio is when I'm listening to music anyways. I realise having it activated only when the music player is playing audio would be a better option, but I don't mind it this way either.
Yes, such in a case probably the code checking if the appropriate process is running is a better way. As said which approach is better depends on more things, you have to decide which one to use.
rina wrote: March 19th, 2020, 6:10 pm I just tried it and when I open rainmeter, the visualizer is indeed unloaded and loads when I first play some audio. However after I pause it the visualizer seems to stay active, as it's still visible on the loaded skins list when I right click on the rainmeter icon on the system tray?
Well, it doesn't for me. Tried it out and if I pause the playing, the skin is unloaded, while whenever I start playing a music, the skin loads immediately.
rina wrote: March 19th, 2020, 6:10 pm Edit: I've noticed it sometimes unloads as it is supposed to, sometimes it stays active. Weird :???: not a big issue though, I tested it a lil bit more and it seems like it unloads more often than not ^^"
This might be something related to your system (I suppose), because I have no such problems.
rina
Posts: 6
Joined: March 18th, 2020, 3:03 pm

Re: How to hide visualizer when there's no audio playing

Post by rina »

balala wrote: March 19th, 2020, 6:27 pm Yes, such in a case probably the code checking if the appropriate process is running is a better way. As said which approach is better depends on more things, you have to decide which one to use.

Well, it doesn't for me. Tried it out and if I pause the playing, the skin is unloaded, while whenever I start playing a music, the skin loads immediately.

This might be something related to your system (I suppose), because I have no such problems.
Might be my system, but that's okay, as I said before it doesn't happen that often. Nonetheless I'm really satisfied with how the visualizer works now, thanks everyone for the help! :thumbup:
User avatar
balala
Rainmeter Sage
Posts: 13719
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to hide visualizer when there's no audio playing

Post by balala »

rina wrote: March 19th, 2020, 6:47 pm Nonetheless I'm really satisfied with how the visualizer works now, thanks everyone for the help! :thumbup:
Although I didn't help too much, I'm glad if you got it working as you wanted. :thumbup:
SCR
Posts: 60
Joined: April 15th, 2015, 11:13 pm

Re: How to hide visualizer when there's no audio playing

Post by SCR »

jsmorley wrote: March 19th, 2020, 12:39 pm

Alternatively, I think it can help if you entirely clear your browser cache, including and particularly any cookies that are related to Rainmeter.

I'm hoping we tumble on the root cause of this soon.
I've had a similar problem. Couldn't log off and never showed me as on the forum.

It took me a while but I finally figured out what happened. I changed my default browser from Opera back to Chrome. Once I noticed the issue and tried a few things I remembered that Opera has a strange way of saving cookies. I deleted all the history, cache and cookies. All was once again good, or so I thought.

Two days ago it started again. Turns out that Opera, not running, not default browser updated itself and brought all that stuff back in. Opera is now gone along with everything associated with it and it seems so is the problem. Perhaps it can help.

Edit: One other thing, be sure to delete the Rainmeter cookie in your default browser and log in to forums.
User avatar
YRS1999
Posts: 4
Joined: October 15th, 2021, 2:41 pm

Re: How to hide visualizer when there's no audio playing

Post by YRS1999 »

eclectic-tech wrote: March 19th, 2020, 2:38 am I would consider actually deactivating/activating the visualizer config when your media player is not active along with hiding/showing the visualizer when the sound is muted. I recommend this approach because visualizers are notorious CPU hogs and hiding them does not reduce the lag they can cause to your system, only deactivating them does.

You need to create a measure that checks the Process for your media player and deactivates/activates the visualizer config. I will use WinAmp as an example, your media player process may be different, but it will be the executable file that starts your player.

Code: Select all

[MeasureProcess]
Measure=Plugin
Plugin=Process
ProcessName=WinAmp.exe
; Value will be '1' when the process is running, '-1' when it is not running
IfCondition=([MeasureProcess]=-1)
IfTrueAction=[!DeactivateConfig "Lasix\Visualizer"]
UpdateDivider=66
As for your intermittent response to hide/show when paused, I would try to change balala's code to:

Code: Select all

IfCondition=([#CURRENTSECTION#]<=0.00001)
IfTrueAction=[!HideFade]
IfFalseAction=[!ShowFade]
IfConditionMode=1
DynamicVariables=1
The audiolevel plugin responds to all system sounds, so the visualizer will try to hide/show when any program generates sound... that is another reason to add a Process measure so the visualizer only loads when your player is active.

Edit: I was in a hurry again! :oops: Thanks balala!
There are several ways to use the Process measure, if the measure is added to the visualizer skin code, it only needs one action, the "IfTrueAction". Added an update divider so it checks about once per second (Visualizer skins update every ~16 ms).

Alternately, you could created a new skin, have it loaded first, and use the Process measure to activate/deactivate the visualizer when your media player is running.

Code: Select all

[MeasureProcess]
Measure=Plugin
Plugin=Process
ProcessName=WinAmp.exe
; Value will be '1' when the process is running, '-1' when it is not running
IfCondition=([MeasureProcess]=-1)
IfTrueAction=[!DeactivateConfig "Lasix\Visualizer"]
IfFalseAction=[!ActivateConfig "Lasix\Visualizer" "Visualizer.ini"]

[MeterDummy]
Meter=String
please help!
Hello, where should I add this code to?
Visualizer I'm using has this code 👇 and when I tried to add the very first code in this forum skin crashed

Code: Select all

[Rainmeter]
Group=Spectrum
Update=10
BackgroundMode=2
SolidColor=0,0,0,1

; = IMPORTANT =
; = For configuring the rainmeter skin, right-click the visualizer and click on "Open settings".
; = You can also open the variables.ini file located in:
; = "My Documents\Rainmeter\Skins\Lano-Visualizer\@Resources"

; Small context menu when you right-click the skin
ContextTitle=" Open settings"
ContextAction=[!ActivateConfig "#ROOTCONFIG#\Settings" "general.ini"]

[Metadata]
Name=Lano Visualizer
Author=marcopixel
Version=1.1.0
License=MIT License
Information=A simple but highly configurable visualizer with rounded bars.

[Variables]
; Includes the variables/styles used for the skin.
@include1=#@#variables.ini

; Include media player and styling measures.
@include2=#@#include\Measure#MPMode#.inc
@include3=#@#include\MeasureStyling.inc

; Measure AudioLevel - spectrum input
[MeasureAudio]
Measure=Plugin
Plugin=AudioLevel
Port=Output
FFTSize=#FFTSize#
FFTOverlap=(#FFTSize#/2)
FFTAttack=#FFTAttack#
FFTDecay=#FFTDecay#
Bands=#BarCountCalc#
FreqMin=#FreqMin#
FreqMax=#FreqMax#
Sensitivity=#Sensitivity#
ID=#AudioDeviceID#

; Script Factory - generates the bars for the visualizer
[ScriptFactoryBars]
Measure=Script
ScriptFile=#@#scripts\Factory.lua
IncFile=#@#include\MeterBars.inc
Number=#BarCount#
SectionName=MeterBar%%
Option0=Meter
Value0=Shape
Option1=Group
Value1=GroupBars | GroupDynamicColors
Option2=X
Value2=#BarGap#R
Option3=Y
Value3=#BarHeight#
Option4=Shape
Value4=Rectangle 0,0,(#BarWidth#*#ScaleVisualizer#),(-(#BarHeight#-(#BarWidth#*#ScaleVisualizer#))*[MeasureAudioSmoothed{%%}]-(#BarWidth#*#ScaleVisualizer#)),((#BarWidth#*#ScaleVisualizer#)/2) | Fill Color #*Color*# | StrokeWidth 0
Option5=DynamicVariables
Value5=1
UpdateDivider=-1

; Script Refresher - refreshes the code to apply the changes from the factory scripts
[ScriptRefresher]
Measure=Script
ScriptFile=#@#scripts\Refresher.lua
UpdateDivider=-1
Refreshed=0


; Include the BandMeasures with raw data
@include4=#@#include\MeasureBands.inc

; Include the BandMeasures with smoothed data
@include5=#@#include\MeasureBandsSmoothed.inc

; Include the band meters
@include6=#@#include\MeterBars.inc

User avatar
Yincognito
Rainmeter Sage
Posts: 4132
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How to hide visualizer when there's no audio playing

Post by Yincognito »

YRS1999 wrote: January 11th, 2022, 1:59 pmplease help!
Hello, where should I add this code to?
Visualizer I'm using has this code 👇 and when I tried to add the very first code in this forum skin crashed
Lano Visualiser - or at least the version I downloaded from here - already has in its settings (right click on skin / Open Settings / Hide Skin When Media Player Is Not Running) precisely the thing you want to achieve, if I correctly understood what you want. All you need to do is check the appropriate checkbox.
User avatar
YRS1999
Posts: 4
Joined: October 15th, 2021, 2:41 pm

Re: How to hide visualizer when there's no audio playing

Post by YRS1999 »

Yincognito wrote: January 11th, 2022, 8:22 pm Lano Visualiser - or at least the version I downloaded from here - already has in its settings (right click on skin / Open Settings / Hide Skin When Media Player Is Not Running) precisely the thing you want to achieve, if I correctly understood what you want. All you need to do is check the appropriate checkbox.
Oh! yes there's the option there I some how missed that 😅

Tried it didn't work the visualizer just vanishes and doesn't come back even though I'm playing music btw I'm playing music via YouTube Music Web app(Chrome) and New Windows Media Player (previously Groove Music) on Windows 11, is there any way I can fix this in code?

Thanks!
User avatar
Yincognito
Rainmeter Sage
Posts: 4132
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How to hide visualizer when there's no audio playing

Post by Yincognito »

YRS1999 wrote: January 15th, 2022, 3:47 pm Oh! yes there's the option there I some how missed that 😅

Tried it didn't work the visualizer just vanishes and doesn't come back even though I'm playing music btw I'm playing music via YouTube Music Web app(Chrome) and New Windows Media Player (previously Groove Music) on Windows 11, is there any way I can fix this in code?

Thanks!
For me it works when using both Winamp and (the old?) Windows Media Player on Windows 10. Since the Google Play Music that exists in the skin settings apparently was discontinued, I tried Music.Youtube which according to Google appears to be its successor, and it partially worked, in that it did animate the visualiser when playing, but didn't hide it when pausing (didn't see a stop button on that Google page) or closing the page, with only the lower visualiser "disks" on screen.

Maybe trying some of the hints from the address mentioned in the skin could be of some help? I'm not what you'd call an expert in using web music player plugins in Rainmeter as I prefer local ones and only use Winamp to play music on my system, but generally following the directions on the latter instruction page regarding possibly installing some browser extensions to make it work might be useful.

Other than that, I'm not sure that the Groove Music successor is equivalent to the "old" Windows Media Player in terms of Rainmeter plugin compatibility or that the new Music.Youtube or Youtube Music Web app (not familiar with it, unfortunately) are equivalent with the skin's Google Play Music option. But then , it never hurts to try, or maybe wait for someone who's more familiar than me on web music players and how they fit with correspondent Rainmeter plugins. I can surely be of assistance if necessary for local players that exist on my system, just not the web ones... :???: