Hello
Guest
it is
March 29, 2024, 10:29:36 PM
Guest
Login
Register
Menu
Home
Help
Search
Calendar
Members
Members
View the memberlist
Search For Members
Login
Register
YouTube
Machsupport Forum
/
Mach Discussion
/
Mach4 General Discussion
/
Playing a sound in a script?
« previous
next »
Print
Pages:
1
Go Down
Author
Topic: Playing a sound in a script? (Read 882 times)
0 Members and 1 Guest are viewing this topic.
TonyMemphis
30
Playing a sound in a script?
«
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
Logged
SwiftyJ
215
Re: Playing a sound in a script?
«
Reply #1 on:
February 07, 2020, 02:44:06 AM »
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.
Logged
TonyMemphis
30
Re: Playing a sound in a script?
«
Reply #2 on:
February 08, 2020, 11:01:40 PM »
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
Logged
Print
Pages:
1
Go Up
« previous
next »