Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: TonyMemphis on February 06, 2020, 10:21:35 PM
-
I am trying to play a sound in a script. I tried several examples that are all basically the same. Nothing worked. I get no errors when debugging or when I click the button I created. I am using the Avid configuration if that makes any difference.
Just wondering if I am missing something? Just getting started with Mach4.
This is one of the things I tried:
local logoff = wx.wxSound('C:\\Mach4Hobby\\Sounds\\logoff.wav',0)
logoff:Play()
Thanks,
Tony
-
I think you need to add a flag to Play(), these are the options available.
wxSOUND_SYNC: Play will block and wait until the sound is replayed.
wxSOUND_ASYNC: Sound is played asynchronously, Play returns immediately.
wxSOUND_ASYNC|wxSOUND_LOOP: Sound is played asynchronously and loops until another sound is played, Stop() is called or the program terminates.
I have had it working with just wxSOUND_LOOP. So in your case it would be logoff:Play(wx.wxSOUND_LOOP) and then you have to use logoff:Stop() to stop it.
-
Thanks for the help! I did get it working. Not sure I'll use it much but I learned something. Between the machine, the dust collector, air cleaner, radio, etc., I probably couldn't hear many sounds anyway, but...
Tony