It is currently March 29th, 2024, 1:00 pm

Sound Stop when MouseLeaveAction for no reason

Get help with creating, editing & fixing problems with skins
User avatar
Moubarack
Posts: 12
Joined: January 3rd, 2022, 5:56 pm

Sound Stop when MouseLeaveAction for no reason

Post by Moubarack »

Hello guys , i dont understand why SoundFile (1) stop when my mouse leave the icon , i have another skin with same settings and the sound don't stop when i leave action , pls help <3

Code: Select all

[Rainmeter]
Update=40
DynamicWindowSize=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh] 
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.2 ? 0.2 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.2 ? 0.2 : #Scale#-#ScrollMouseIncrement#)"][!Refresh]
OnRefreshAction=[!HideMeter "ImageMeter"][!ShowMeter "ImageMeter2"]


[Metadata]
Name=GIFFrames
Author=Moubarack

[Variables]
@include=#@#Variables.inc
SoundFile=#@#Sounds\clickrocket.wav
SoundFile2=#@#Sounds\mouseoverrocket.wav
Scale=0.26
Reset=1

[MeterBackground]
Meter=Image
ImageName=#@#ImagesFrames3\bk.png
X=0
Y=0
H=(386*#Scale#)
W=(400*#Scale#)
MouseOverAction=[!SetVariable reset "0"][!UpdateMeasure ImageNumberCalc][!SetVariable reset "1"][!ShowMeter "ImageMeter"][!HideMeter "ImageMeter2"][Play #SoundFile2#]
LeftMouseUpAction=[Play #SoundFile#]["C:\FOLDER.ACCESS"]

[ImageNumberCalc]
Measure=Calc
Formula=((ImageNumberCalc % 24) + 1) * #reset#
DynamicVariables=1

[ImageMeter]
Meter=Image
ImageName=#@#ImagesFrames3\rocket-[ImageNumberCalc].png
AntiAlias=1
DynamicVariables=1
X=0
Y=0
H=(386*#Scale#)
W=(400*#Scale#)
MouseLeaveAction=[!HideMeter "ImageMeter"][!ShowMeter "ImageMeter2"][PlayStop #SoundFile2#]



[ImageMeter2]
Meter=Image
ImageName=#@#ImagesFrames3\fixrocket.png
AntiAlias=1
DynamicVariables=1
X=0
Y=0
H=(386*#Scale#)
W=(400*#Scale#)
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Sound Stop when MouseLeaveAction for no reason

Post by balala »

Moubarack wrote: January 5th, 2022, 4:08 pm i dont understand why SoundFile (1) stop when my mouse leave the icon , i have another skin with same settings and the sound don't stop when i leave action , pls help <3
Due to the [PlayStop #SoundFile2#] bang of the MouseLeaveAction option of the [ImageMeter] meter. The two meters ([MeterBackground] and [ImageMeter]) are overlaping each other, so when you're hovering the mouse over [MeterBackground] or clicking it, the sound is played, however when you're leaving this meter, you're leaving the [ImageMeter] meter as well, which has the mentioned PlayStop bang, stopping the playing.

Additional note: PlayStop doesn't admit parameters. So when it is executed, it stops any sound file, not just the one posted as parameter (in this case #SoundFile2#). In fact the #SoundFile2# parameter in such cases is ignored by Rainmeter. There is no way to stop playing just certain file.
User avatar
Moubarack
Posts: 12
Joined: January 3rd, 2022, 5:56 pm

Re: Sound Stop when MouseLeaveAction for no reason

Post by Moubarack »

Okay thank for your advice
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Sound Stop when MouseLeaveAction for no reason

Post by balala »

:thumbup:
User avatar
Moubarack
Posts: 12
Joined: January 3rd, 2022, 5:56 pm

Re: Sound Stop when MouseLeaveAction for no reason

Post by Moubarack »

u think its possible ti find another way with condition something like that

Code: Select all

IfCondition=#Var#=0
IfTrueAction=[Play #SoundFile#]
IfFalseAction=[Playstop]
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Sound Stop when MouseLeaveAction for no reason

Post by balala »

Moubarack wrote: January 5th, 2022, 7:22 pm u think its possible ti find another way with condition something like that
Not clear what is your intention. So, what do you want to achieve?
User avatar
Moubarack
Posts: 12
Joined: January 3rd, 2022, 5:56 pm

Re: Sound Stop when MouseLeaveAction for no reason

Post by Moubarack »

I want , stop the music if leave mouse , and keep another sound if i left click

Code: Select all

[Rainmeter]
Update=40
DynamicWindowSize=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh] 
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.2 ? 0.2 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.2 ? 0.2 : #Scale#-#ScrollMouseIncrement#)"][!Refresh]
OnRefreshAction=[!HideMeter "ImageMeter"][!ShowMeter "ImageMeter2"]


[Metadata]
Name=GIFFrames
Author=Moubarack

[Variables]
@include=#@#Variables.inc
SoundFile=#@#Sounds\clickrocket.wav
SoundFile2=#@#Sounds\mouseoverrocket.wav
SoundFile3=#@#Sounds\nosound.wav
Scale=0.26
Reset=1
Var=0

[MeterBackground]
Meter=Image
ImageName=#@#ImagesFrames3\bk.png
DynamicVariables=1
X=0
Y=0
H=(386*#Scale#)
W=(400*#Scale#)
MouseOverAction=[!SetVariable reset "0"][!UpdateMeasure ImageNumberCalc][!SetVariable reset "1"][!ShowMeter "ImageMeter"][!HideMeter "ImageMeter2"][Play #SoundFile2#]
LeftMouseDownAction=[!HideMeter "ImageMeter"][!ShowMeter "ImageMeter2"]["C:\FOLDER.ACCESS"][!SetVariable var "1"]
IfCondition=#Var#=0
IfTrueAction=[Play #SoundFile#]
IfFalseAction=[PlayStop #SoundFile#]

[ImageNumberCalc]
Measure=Calc
Formula=((ImageNumberCalc % 24) + 1) * #reset#
DynamicVariables=1

[ImageMeter]
Meter=Image
ImageName=#@#ImagesFrames3\rocket-[ImageNumberCalc].png
AntiAlias=1
DynamicVariables=1
X=0
Y=0
H=(386*#Scale#)
W=(400*#Scale#)
MouseLeaveAction=[!HideMeter "ImageMeter"][!ShowMeter "ImageMeter2"][!SetVariable var "1"]
I dont understand clearly why my condition not work
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Sound Stop when MouseLeaveAction for no reason

Post by balala »

Moubarack wrote: January 5th, 2022, 7:34 pm I want , stop the music if leave mouse , and keep another sound if i left click
Not sure I follow. What should go on when you click to one or the other meter? What should go on when you're hovering the mouse over one or the other meter? And finally what when you're leaving any of those meters?
Just note that unfortunately as said, there is not possible to execute a PlayStop bang to stop certain sound. Again: in the IfFalseAction=[PlayStop #SoundFile#] option, the PlayStop bang doesn't accept parameters, you don't have and can't add a a sound file to be stopped the playing of only that one. However even if you're adding the parameter (as you did) the bang stops all playing, because Rainmeter simply ignores the not-permitted parameters.
When a PlayStop bang is executed, all sound playing are stopped immediately. And even more: if you're executing a PlayStop bang, it stops ALL currently playing sounds which have been started by a Rainmeter skin. I mean by ANY skin. So, if your skin starts playing a sound and into ANY OTHER skin a StopPlay bang is executed, it stops playing even the sound started into the current skin, not just those played into the skin which executed the PlayStop bang.
Moubarack wrote: January 5th, 2022, 7:34 pm I dont understand clearly why my condition not work
IfConditions have to be used into measures. They are not working on meters. But you've added them to a meter ([MeterBackground]) that's why you never get them executed. Move them to a measure.
User avatar
Moubarack
Posts: 12
Joined: January 3rd, 2022, 5:56 pm

Re: Sound Stop when MouseLeaveAction for no reason

Post by Moubarack »

My english is not very good it's hard to explain my objectiv , but i fin a way and now its work

Code: Select all

[Rainmeter]
Update=40
DynamicWindowSize=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh] 
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.2 ? 0.2 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.2 ? 0.2 : #Scale#-#ScrollMouseIncrement#)"][!Refresh]
OnRefreshAction=[!HideMeter "ImageMeter"][!ShowMeter "ImageMeter2"]


[Metadata]
Name=GIFFrames
Author=Moubarack

[Variables]
@include=#@#Variables.inc
SoundFile=#@#Sounds\clickrocket.wav
SoundFile2=#@#Sounds\mouseoverrocket.wav
SoundFile3=#@#Sounds\nosound.wav
Scale=0.26
Reset=1
Var=0

[MeterBackground]
Meter=Image
ImageName=#@#ImagesFrames3\bk.png
DynamicVariables=1
X=0
Y=0
H=(386*#Scale#)
W=(400*#Scale#)
MouseOverAction=[!SetVariable reset "0"][!UpdateMeasure ImageNumberCalc][!SetVariable reset "1"][!SetVariable var "1"][!UpdateMeasure ImageNumberCalc][!SetVariable var "0"][!ShowMeter "ImageMeter"][!HideMeter "ImageMeter2"]
LeftMouseDownAction=[!HideMeter "ImageMeter"][!ShowMeter "ImageMeter2"]["C:\FOLDER.ACCESS"][!SetVariable var "2"][!UpdateMeasure ImageNumberCalc]


[ImageNumberCalc]
Measure=Calc
Formula=((ImageNumberCalc % 24) + 1) * #reset#
DynamicVariables=1
IfCondition=#Var#=1
IfTrueAction=[Play #SoundFile2#]
IfCondition2=#Var#=2
IfTrueAction2=[Play #SoundFile#][!DisableMouseAction ImageMeter "MouseLeaveAction"]
IfCondition3=#Var#=3
IfTrueAction3=[PlayStop #SoundFile#]


[ImageMeter]
Meter=Image
ImageName=#@#ImagesFrames3\rocket-[ImageNumberCalc].png
AntiAlias=1
DynamicVariables=1
X=0
Y=0
H=(386*#Scale#)
W=(400*#Scale#)
MouseLeaveAction=[!HideMeter "ImageMeter"][!ShowMeter "ImageMeter2"][!SetVariable var "3"][!UpdateMeasure ImageNumberCalc][!SetVariable var "0"]



[ImageMeter2]
Meter=Image
ImageName=#@#ImagesFrames3\fixrocket.png
AntiAlias=1
DynamicVariables=1
X=0
Y=0
H=(386*#Scale#)
W=(400*#Scale#)
Var 1 = Sound(1) is played when the mouse is on icon and not when leave the icon (Var =3)
Var 2 = When i click on icon, play the second sound(2) but dont stop the sound(2) by disable MouseOverAction

I dont know why but its work well now xD

If you want to see on what im working
https://cdn.discordapp.com/attachments/392480321192591364/928403254285586462/Test_Icon_Rocket_.rmskin

Thank for your time ;)

PS: tell me if you see something wrong ;)
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Sound Stop when MouseLeaveAction for no reason

Post by balala »

Glad you got it working as expected. Is there anything else I can help you with?
Moubarack wrote: January 5th, 2022, 9:36 pm PS: tell me if you see something wrong ;)
Ok, recommend you two more things to do:
  • Remove the parameter of the PlayStop bang, used in the IfTrueAction3 option of the [ImageNumberCalc] measure. The option now looks this way: IfTrueAction3=[PlayStop #SoundFile#]. But as explained above, the PlayStop bang doesn't accept parameters, even if it does work when the parameter is there. But it shouldn't be. So, recommend to remove it, replacing the above IfTrueAction3 option with the following one: IfTrueAction3=[PlayStop].
  • ALWAYS quote parameters, especially those representing file paths/names. This is not important as long as there is / are no space(s) in the path. But when the path includes a space (or more - doesn't really matter how many), the quotes are becoming mandatory. Without them, the bang doesn't work. So, for instance recommend you to replace the IfTrueAction2 option of the same [ImageNumberCalc] measure (IfTrueAction=[Play #SoundFile2#]) with something like this: IfTrueAction=[Play "#SoundFile2#"]. Here you have a little bit more detailed description of why is this necessary.