It is currently March 28th, 2024, 1:26 pm

[BUG?] Unloading skin doesn't stop its loop playing sound

Report bugs with the Rainmeter application and suggest features.
User avatar
Yincognito
Rainmeter Sage
Posts: 7020
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

[BUG?] Unloading skin doesn't stop its loop playing sound

Post by Yincognito »

I'm going to skip posting a sample skin this time since it's trivial to write it, but isn't unloading a skin supposed to also automatically stop from playing any of the .wav files triggered by a [PlayLoop] bang? I mean, I can easily achieve this by adding a [PlayStop] bang to the OnCloseAction from the said skin's [Rainmeter] section, but I'm thinking: what if the skin isn't unloaded "normally" so the on close event has the chance to happen, how would one stop the loop playing sound, other than closing and starting Rainmeter again (or maybe the said skin)?

I'm not sure if this is a bug or not, that's why I'm asking if this is supposed to be the expected behavior, because I can think of plenty reasons to have it the way it is now ... or not. What do you think?
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: [BUG?] Unloading skin doesn't stop its loop playing sound

Post by death.crafter »

Yincognito wrote: February 7th, 2022, 1:49 pm I'm going to skip posting a sample skin this time since it's trivial to write it, but isn't unloading a skin supposed to also automatically stop from playing any of the .wav files triggered by a [PlayLoop] bang? I mean, I can easily achieve this by adding a [PlayStop] bang to the OnCloseAction from the said skin's [Rainmeter] section, but I'm thinking: what if the skin isn't unloaded "normally" so the on close event has the chance to happen, how would one stop the loop playing sound, other than closing and starting Rainmeter again (or maybe the said skin)?

I'm not sure if this is a bug or not, that's why I'm asking if this is supposed to be the expected behavior, because I can think of plenty reasons to have it the way it is now ... or not. What do you think?
I guess this bug slipped right through from the start up until now cause no one ever tried to make a music player in rainmeter lol.

And hello Yincognito, it's been a long time :welcome:
User avatar
Yincognito
Rainmeter Sage
Posts: 7020
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] Unloading skin doesn't stop its loop playing sound

Post by Yincognito »

death.crafter wrote: February 7th, 2022, 6:59 pm I guess this bug slipped right through from the start up until now cause no one ever tried to make a music player in rainmeter lol.

And hello Yincognito, it's been a long time :welcome:
Hello hello, a new year arrived since we had our last conversation (I think) - yet we survived and thrived, even changed some of our profile pics, didn't we? 8-)

Well, I wouldn't call playing a Lua timer .wav alarm using [PlayLoop ...] as "music", haha, but yeah, the bang is indeed not that used on a regular basis. I know of other situations where things stay "as they were" and require specific OnCloseAction bangs to "reset" or "shut them down" (just can't remember exactly what they were about), and from a certain point of view I can understand the logic in such a case (e.g. maybe one wants the .wav to play even after unloading the skin?). Since "fixing" this can't bring that sound back while letting it like that offers at least one alternative to "stop" it (though not applicable in all cases as I mentioned), I wasn't 100% confident that this can be considered a bug or a slip up. I just try to find out if this is - or is worth being considered - "normal" behavior or not. :confused:
I checked your quote bug report in plugins too - quite an interesting dilemma there as well, in some way similar to this one (i.e. to be or not to be, the eternal question)...
Last edited by Yincognito on February 7th, 2022, 7:29 pm, edited 1 time in total.
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [BUG?] Unloading skin doesn't stop its loop playing sound

Post by Brian »

Not really a bug since Rainmeter doesn't really play any sound files. Instead, Rainmeter just passes it to Windows.

However, since playing the sound is initiated from Rainmeter, it probably should stop playback. We will discuss this.

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

Re: [BUG?] Unloading skin doesn't stop its loop playing sound

Post by Yincognito »

Brian wrote: February 7th, 2022, 7:28 pmNot really a bug since Rainmeter doesn't really play any sound files. Instead, Rainmeter just passes it to Windows.
Yep, my thought as well, regarding Windows doing the actual action.
Brian wrote: February 7th, 2022, 7:28 pmHowever, since playing the sound is initiated from Rainmeter, it probably should stop playback. We will discuss this.
I guess it boils down to how the usage cases would be. As I said, if automatically stopped at unload, the sound cannot be brought back (this could lead to unwanted behavior if one wants to keep hearing it after closing down the skin), and if not automatically stopped at unload it can lead to a sound that one could have trouble stopping it (albeit having a way to do that via OnCloseAction that works for the majority but not all cases, and certainly not for the cases where the said code isn't yet implemented).
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany
Contact:

Re: [BUG?] Unloading skin doesn't stop its loop playing sound

Post by Active Colors »

Probably you can simply add a new option StopOnUnload=1 with 0 being a default value which corresponds the current bahavior.
User avatar
Yincognito
Rainmeter Sage
Posts: 7020
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] Unloading skin doesn't stop its loop playing sound

Post by Yincognito »

Active Colors wrote: February 7th, 2022, 8:55 pm Probably you can simply add a new option StopOnUnload=1 with 0 being a default value which corresponds the current bahavior.
Or rather an optional bang parameter, since [PlayLoop] is a (sort of a) bang. An option in the [Rainmeter] section like you describe would probably be a good idea, if the possibility to choose between both behaviors is envisioned, it's just that it makes more sense as a bang parameter in this case, IMHO.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany
Contact:

Re: [BUG?] Unloading skin doesn't stop its loop playing sound

Post by Active Colors »

Yincognito wrote: February 7th, 2022, 9:27 pm Or rather an optional bang parameter, since [PlayLoop] is a (sort of a) bang. An option in the [Rainmeter] section like you describe would probably be a good idea, if the possibility to choose between both behaviors is envisioned, it's just that it makes more sense as a bang parameter in this case, IMHO.
Oh yeah I forgot that it was related to the bang. Don't lie, my idea is actually bad ahaha. I don't think it is a good idea to include additional and insignificant parameter in the [Rainmeter] section. Additional bang is obviously the most logical option.

I am sorry I didn't give a proper thought to my idea before.
User avatar
Yincognito
Rainmeter Sage
Posts: 7020
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] Unloading skin doesn't stop its loop playing sound

Post by Yincognito »

Active Colors wrote: February 7th, 2022, 9:58 pm Oh yeah I forgot that it was related to the bang. Don't lie, my idea is actually bad ahaha. I don't think it is a good idea to include additional and insignificant parameter in the [Rainmeter] section. Additional bang is obviously the most logical option.

I am sorry I didn't give a proper thought to my idea before.
I know it was meant as a joke, but actually I never lie - yep, it's possible, and so much easier. 8-) No need to feel sorry for a quick thought, most of the times the 2nd thought is better than the 1st for everyone (except maybe when betting or playing poker, where for some people the 1st thought is the lucky one). :D
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany
Contact:

Re: [BUG?] Unloading skin doesn't stop its loop playing sound

Post by Active Colors »

Yincognito wrote: February 7th, 2022, 10:31 pm I know it was meant as a joke, but actually I never lie - yep, it's possible, and so much easier. 8-) No need to feel sorry for a quick thought, most of the times the 2nd thought is better than the 1st for everyone (except maybe when betting or playing poker, where for some people the 1st thought is the lucky one). :D
There is a proverb in my culture: "Семь раз отмерь, один раз отрежь" which translates as "Measure seven times, cut once" which you can interpret as "Before you do something (i.e. cutting or making statements) measure it seven times (or give seven thoughts about it)".

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
Cut=No

[MeasureSeven]
Measure=Calc
Formula=([&MeasureSeven]+1)
IfEqualValue=7
IfEqualAction=[!DisableMeasure MeasureSeven]
OnChangeAction=[!UpdateMeter MeterText][!Redraw]
DynamicVariables=1
UpdateDivider=1
Disabled=0

[CutOnce]
Measure=Calc
Formula=[&MeasureSeven]
IfEqualValue=7
IfEqualAction=[!DisableMeasure CutOnce][!SetVariable Cut "Yes"][!UpdateMeter MeterText][!Redraw]
DynamicVariables=1
UpdateDivider=1
Disabled=0

[MeterBackground]
Meter=Image
X=0
Y=0
W=175
H=100
SolidColor=30,30,30,255
UpdateDivider=-1

[StyleText]
StringAlign=Left
FontFace=Segoe UI
FontSize=10
FontColor=255,255,255
AntiAlias=1
UpdateDivider=-1
DynamicVariables=1

[MeterText]
Meter=String
MeterStyle=StyleText
MeasureName=MeasureSeven
X=10
Y=10
Text=Times measured: %1. #CRLF#Cut? #Cut#
Post Reply