Continuous sound in a loop? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mast4rwang
Posts: 141
Joined: 19 Jul 2017, 09:59

Continuous sound in a loop?

12 Sep 2017, 12:48

How to make the sound run continuously in a loop?

Let's say this is the code, when you press w it starts music, releasing the key silences it

Code: Select all

loop,
{
if GetKeyState("w","P")
soundplay,looooooongsound.wav
else
soundplay,empty.wav ;its purpose is to break the looooooongsound.wav

sleep,25
}
return
The result when you hold W is continuous first 25 milliseconds of the looooooongsound.wav.

How to make it so it doesn't replay the looooooongsound.wav?? :shifty:

maybe with A_index in a loop? :wtf: :wtf: :wtf:
Last edited by mast4rwang on 12 Sep 2017, 13:20, edited 3 times in total.
mast4rwang
Posts: 141
Joined: 19 Jul 2017, 09:59

Re: Continuous sound in a loop?

12 Sep 2017, 13:18

Nvm, I already thought this out:

Code: Select all

A:=1
loop,
{
	if GetKeyState("w","P")
	{
	if (A=1)
	{
	soundplay,looooongsound.wav
	A:=A+1
	}
	if (A>360)
	A:=1
	}
	else
	{
	soundplay,none.wav
	A:=1
	}
sleep,25
}
return
mast4rwang
Posts: 141
Joined: 19 Jul 2017, 09:59

Re: Continuous sound in a loop?  Topic is solved

12 Sep 2017, 13:42

I wish there was less CPU taxing method though, it eats up lots of CPU while sending empty wav file :/

edit: found out that pointing to non existent wav file reduces CPU usage exponentially :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Rohwedder and 254 guests