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

play and stop audio files

Get help with installing and using Rainmeter.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: play and stop audio files

Post by jsmorley »

Cellinarac wrote:well, I had it set as

Code: Select all

LeftMouseUpAction=[!PLAYSTOP][PLAY "#@#Sounds\ShortClick.wav"]
but that didn't end the song when I clicked it a second time... did I do the command wrong or something?
First, it's just [PLAYSTOP] not [!PLAYSTOP]. You don't use the ! character with the various PLAY commands.

Second, that won't work. Any PLAY command will in and of itself stop any currently playing sound before it plays, so the PLAYSTOP is redundant.

See my post just above this one for the solution.
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: play and stop audio files

Post by Cellinarac »

the whole code for this is

Code: Select all

[MeterLauncherText]
meter=string
meterstyle=textstyle
text="Merry Christmas!"
x = 0
y = 0
FontFace=Beyond Wonderland
FontColor=20,160,255,255
FontSize=80
StringStyle=Bold
SolidColor=1,1,1,1
LeftMouseUpAction=[PLAY "#@#Sounds\Christmas.wav"]
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: play and stop audio files

Post by jsmorley »

jsmorley wrote:You aren't going to be able to have your cake and eat it too. If you want a click to stop a sound, you just use the PLAYSTOP bang to do so. If you want the click to play another random sound from the folder, you just have it update the QuotePlugin measure, and execute a PLAY bang using the QuotePLugin measure's value as the sound to play. If you want both, you will need two buttons, one for "stop" and one for "play".
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: play and stop audio files

Post by Cellinarac »

ok, so basically the easiest way I see doing this is make 1 button that says "Merry" set it for play and a second that says "Christmas" and have it set to stop. eh, I guess that will have to do lol. I was kind of thinking about splitting it into two anyway but was trying to get around that
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: play and stop audio files

Post by jsmorley »

Cellinarac wrote:ok, so basically the easiest way I see doing this is make 1 button that says "Merry" set it for play and a second that says "Christmas" and have it set to stop. eh, I guess that will have to do lol. I was kind of thinking about splitting it into two anyway but was trying to get around that
Yes, or have a left click "play" and a right or middle click "stop".

Or have a left click "stop" and a left double-click "play".
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: play and stop audio files

Post by Cellinarac »

ok well I did have

Code: Select all

LeftMouseUpAction=[!PLAYSTOP][PLAY "#@#Sounds\Christmas.wav"]
MiddleMouseUpAction=[!PLAYSTOP][STOP "#@#Sounds\Christmas.wav"]
that wasn't working, but I did have the "!" still in there so maybe thats why...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: play and stop audio files

Post by jsmorley »

Cellinarac wrote:ok well I did have

Code: Select all

LeftMouseUpAction=[!PLAYSTOP][PLAY "#@#Sounds\Christmas.wav"]
MiddleMouseUpAction=[!PLAYSTOP][STOP "#@#Sounds\Christmas.wav"]
that wasn't working, but I did have the "!" still in there so maybe thats why...
That is entirely wrong.

Code: Select all

LeftMouseUpAction=[PLAY "#@#Sounds\Christmas.wav"]
MiddleMouseUpAction=[PLAYSTOP]
That is all you need.
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: play and stop audio files

Post by Cellinarac »

oooohhh...
ok thank you so much!
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: play and stop audio files

Post by Cellinarac »

don't suppose you would know how to make a "blinking" text would you? lol
if not I will play around with that when I get off work later.
I did some research on it last night but wasn't able to find much on doing it the way I was trying to do it.
pretty much I want this banner I made to flash in random colors at a given rate. (change colors every "X" milliseconds) or something to that effect
for this I have about 5 or 6 colors I want it to cycle through if that can be done
might be something else I can't get the way I want it on here but thought it would be cool if it could be done
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: play and stop audio files

Post by jsmorley »

That can be done, but most easily with the latest 4.1 beta of Rainmeter from http://www.rainmeter.net.

https://docs.rainmeter.net/manual-beta/variables/nesting-variables/

Code: Select all

[Rainmeter]
Update=200
DynamicWindowSize=1
AccurateText=1

[Variables]
Color0=255,0,0
Color1=255,128,0
Color2=255,255,0
Color3=0,255,0
Color4=0,255,128
Color5=80,80,255
Color6=255,0,255

[MeasureRandom]
Measure=Calc
Formula=Random
UpdateRandom=1
UniqueRandom=1
LowBound=0
HighBound=6

[MeterFlash]
Meter=String
FontSize=40
FontWeight=400
FontColor=[#Color[&MeasureRandom]]
SolidColor=0,0,0,1
AntiAlias=1
Text=Merry Christmas
DynamicVariables=1
Click to animate
GIF.gif
Post Reply