Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: CCWood on September 25, 2022, 03:42:55 PM

Title: Sound in Mach4
Post by: CCWood on September 25, 2022, 03:42:55 PM
Can anyone point me in the right direction for adding sound (wav files) to Mach4, such as when a probe touches, or a limit is hit? I've seen DaztheGas's Quicky #1 video and have followed his example... the button works after adding the code and restarting mach, but then stops working after the next restart. If anyone has sound working in M4 could you share some code on how you have it set up? Had no problems adding sound to M3, but lua is kicking this old man's butt (beginning to believe the "You can't teach an old dog new tricks" thing).

Andy
Title: Re: Sound in Mach4
Post by: SwiftyJ on September 26, 2022, 03:15:26 PM
Try this...just replace the path with the path to your sound

Code: [Select]
local sound = wx.wxSound("C:\\Windows\\Media\\chimes.wav", false)
sound:Play(wx.wxSOUND_ASYNC)