It is currently October 24th, 2020, 5:28 am

[Solved] AudioLevel plugin temporary "fix"

Share and get help with Plugins and Addons
User avatar
jsmorley
Developer
Posts: 21424
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

[Solved] AudioLevel plugin temporary "fix"

Post by jsmorley »

This is a little addon you can use with your AudioLevel plugin skins to "fix" a known issue it has that we are still working on. We hope to have a permanent "solution" to the issue soon, but in the meantime, this can allow your skins to work a bit better.

The problem

If there is a stream playing through the defined device, and it abruptly ends by "stopping" the song or sound, or "closing" the application or media player in question while the plugin is actively monitoring it, then the plugin values "freeze" at their last value, and worse yet, there can sometimes be a horrible "buzz" for some short period of time.

This isn't really about the audio process "closing" abruptly, but simply about the entire sound stream "ending" abruptly. You can cause it by simply pressing "stop" in many audio players, or playing any .wav file or other sound that ends without "fading out to zero" or having some period of "silence" at the end.

The root of this seems to be that Windows "activates" the sound driver when a sound is playing, and "deactivates" it when there are no processes using the driver. AudioLevel, due to a bug in a Windows routine, is not properly able to detect this "deactivation" of the driver, and gets cranky when it is actively monitoring it.

Edit - March 9, 2015

We have corrected this issue in the actual AudioLevel plugin, and no "temporary fix" is required going forward. Please be sure to update to the latest Rainmeter beta r2380 or later if you are experiencing this issue with AudioLevel.
Godmode_Off
Posts: 4
Joined: January 28th, 2015, 7:34 am

Re: AudioLevel plugin temporary "fix"

Post by Godmode_Off »

Thanks for the temporary fix!
User avatar
jsmorley
Developer
Posts: 21424
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: AudioLevel plugin temporary "fix"

Post by jsmorley »

Godmode_Off wrote:Thanks for the temporary fix!
Sure thing. It is very similar in practice to what you talked about here: http://rainmeter.net/forum/viewtopic.php?p=107782#p107782. The trouble with PlayLoop though, is that any other Play, PlayLoop or PlayStop command anywhere in Rainmeter in any skin, will shut your sound off, and you would need to refresh your skin to restart it. The approach I use won't be effected by anything Rainmeter does, so I found it to be just a hair more reliable.

Neither is the perfect solution of course, but this bug seems to be a tricky one to solve permanently.
User avatar
fonpaolo
Moderator
Posts: 1397
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: AudioLevel plugin temporary "fix"

Post by fonpaolo »

It' very strange that I've never encountered this problem with my system, maybe because I have some system sounds enabled (especially to let me know if an application is closed).
Maybe it's because I'm using WMP, but I've also tested with VLC, and if I close the skin, I don't have any strange sound.
I don't know if it's a solution, but, when I have released my skin, I have added a little silent sound (just a few seconds) to be executed when the player is closed.

I can say that I have tested it only on a few systems (even less, since isn't possible to use this plugin in XP).
Until now, no one who has downloaded my suite has reported this problem.
User avatar
jsmorley
Developer
Posts: 21424
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: AudioLevel plugin temporary "fix"

Post by jsmorley »

fonpaolo wrote:It' very strange that I've never encountered this problem with my system, maybe because I have some system sounds enabled (especially to let me know if an application is closed).
Maybe it's because I'm using WMP, but I've also tested with VLC, and if I close the skin, I don't have any strange sound.
I don't know if it's a solution, but, when I have released my skin, I have added a little silent sound (just a few seconds) to be executed when the player is closed.

I can say that I have tested it only on a few systems (even less, since isn't possible to use this plugin in XP).
Until now, no one who has downloaded my suite has reported this problem.
Well, that's good. I'm sure it does vary a bit depending on the hardware, drivers, and other factors. I can cause it every single time by simply running any AudioLevel skin, then playing a song in VLC or WinAmp and pressing "stop" in the player while the song is playing. The values for AudioLevel "freeze" and I get a "buzz" sound for a second or so. Any sound after that gets things going again, and if there is another sound of any kind playing at the same time, it doesn't happen at all.
User avatar
fonpaolo
Moderator
Posts: 1397
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: AudioLevel plugin temporary "fix"

Post by fonpaolo »

This "solution" is only based on my experience, since I haven't had any problem with AudioLevel, I started to investigate on the reason, and this was the only difference.

I don't know how many people are so "crazy" to use a system sound when an application is closed... :lol:
User avatar
jsmorley
Developer
Posts: 21424
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: AudioLevel plugin temporary "fix"

Post by jsmorley »

fonpaolo wrote:This "solution" is only based on my experience, since I haven't had any problem with AudioLevel, I started to investigate on the reason, and this was the only difference.

I don't know how many people are so "crazy" to use a system sound when an application is closed... :lol:
Not sure I follow. It would be very common I would think that someone would run a skin that has an AudioLevel visualization or volume meter in it, and just run that all the time as a part of their normal setup. Then they are going to to be opening and closing various players and applications that make "sound" in the normal course of things. I'm betting most people are not going to take the time to load and unload the visualizer Rainmeter skin every time they feel like playing a song in their media player.

To be clear, the behavior I see is that if you have such a skin running, and you abruptly "stop" all output to the default audio device, which might be by pressing "stop" in your player while a song is playing, or "closing" a player in the middle of a song, or even just playing a .wav or .mp3 file that "ends" without fading to zero volume or having some period of silence at the end, then AudioLevel is not able to react to that properly. The values for the AudioLevel measures "freeze" at the value they had when there last was some sound (which will also "freeze" the display in the meters of course) and at least in some cases, you get a pretty horrid "buzz" sound for a second or so.

It has nothing to do with closing the skin.

My assumption is that this is caused by Windows. What it feels like happens is that when a sound of any kind is played, Windows "activates" the sound device driver in some fashion. When no sounds at all are playing, when no process at all is "using" the device, then Windows "deactivates" it. I don't know that "activate / deactivate" are the right terms, I just don't know enough about it. But that is the effect I see. It might be Windows doing this, or it might be the audio driver itself.

When Windows "deactivates" the driver suddenly, while AudioLevel is monitoring an audio stream coming from it, AudioLevel is not able to react to this. Instead, it suddenly has access to the device it is monitoring "yanked out from under it", and sorta gets "stuck". It feels like a situation where it isn't that there isn't any output from the device any more, but that AudioLevel can't even access the device any more. It just gets "stuck" right there, trying and failing to access the device, until it becomes available again.

So as soon as any other sound is played, then AudioLevel just picks up where it left off, and all is well.

It's easy enough to test to see if your particular setup has this issue. Just load any AudioLevel visualizer or volume meter skin. Then start up VLC or WinAmp (or presumably any media player, I certainly have not tested them all) and start a song. While the song is still playing, press "stop" in the media player, or even more conclusively, just click the "close " button on the player's window. Assuming no other sounds of any kind are playing at the same time in Windows, my experience is that that will cause AudioLevel to misbehave. At least it does on my system, every single time, and based on posts here, many others.

If you have some system "sound" associated with "closing a window" in Windows, then I'm betting you don't get this behavior, since while the media player stops outputting anything, Windows itself immediately plays some sound, which fades to zero or has some silence at the end, and all is well. I personally don't use any sounds in Windows for any of those kinds of "minimize / maximize / close" actions.

I'm actually of the opinion that AudioLevel "misbehaves" in any case even if the only sound playing fades to zero volume or has some silence at the end. I am of the opinion that AudioLevel is "stuck" anytime there is no output at all through the device it is monitoring. However, since at the moment the sound actually "ends", AudioLevel is monitoring a stream with no amplitude, the fact that is gets "stuck" at zero is of no consequence. It's invisible to the user, and since it picks up where it left off when another sound is played, it appears to work fine.

While the "freezing" of the meter display is just annoying, the "buzz" sound is absolutely unacceptable, and would keep me from using AudioLevel at all. The whole issue is just a huge bucket of fail. That is the reason for this "temporary fix", while dgrace struggles to find a more permanent and proper solution.
User avatar
fonpaolo
Moderator
Posts: 1397
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: AudioLevel plugin temporary "fix"

Post by fonpaolo »

jsmorley wrote:If you have some system "sound" associated with "closing a window" in Windows, then I'm betting you don't get this behavior, since while the media player stops outputting anything, Windows itself immediately plays some sound, which fades to zero or has some silence at the end, and all is well. I personally don't use any sounds in Windows for any of those kinds of "minimize / maximize / close" actions.
I'm only using a couple of system sounds, but I have some friends who use almost all of them... O.O :sly:

I started using that particular system sound when I had some programs I had to use, still running after closing them for some kind of bug, so, knowing if they were closed or not, was important for the problems they could have caused.
User avatar
fonpaolo
Moderator
Posts: 1397
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: AudioLevel plugin temporary "fix"

Post by fonpaolo »

jsmorley wrote:Not sure I follow. It would be very common I would think that someone would run a skin that has an AudioLevel visualization or volume meter in it, and just run that all the time as a part of their normal setup. Then they are going to to be opening and closing various players and applications that make "sound" in the normal course of things. I'm betting most people are not going to take the time to load and unload the visualizer Rainmeter skin every time they feel like playing a song in their media player.
I haven't thought at this, you're right, as always, since this has never happened to me, I've added a sound only when the player is closed.
Now I have to find another solution to avoid that situation.
...or, maybe, use your solution. ;-)
User avatar
jsmorley
Developer
Posts: 21424
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: AudioLevel plugin temporary "fix"

Post by jsmorley »

My shrew-like nagging and pathetic mewling about this has caused the code nerds to dig into it a bit more, mostly just to shut me up. So I'm hopeful that we will have a better solution, even if it means baking a solution like mine into the plugin itself, before too long.