Machsupport Forum
Mach Discussion => Mach Screens => Topic started by: zealous on June 06, 2006, 06:20:17 AM
-
I thought I'd post this here for the screen designers.
If you'd like to attach a wave file to a single state or multiple state button use the code provided.
1. In screen designer you'll change your button to "VB",
2. then in Mach 3 you'll apply the button comand and the wave file code.
3. All you have to do is change the directory of your wave files or the directory in the code.
*Example:(sndPlaySound "C:\WINDOWS\MEDIA\tada.wav", &H1)
Here is the basic function code to call on a wave sound placed on a button:
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
sndPlaySound "C:\WINDOWS\MEDIA\ding.wav", &H1
Here is the code to place on the "Display" button(This is a two state button with two diffrent state sounds!)
value = GetParam("Boundry")
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
If value = 1 Then
'SetButtonText " Job "
SetParam "Boundry" , 0
sndPlaySound "C:\WINDOWS\MEDIA\ding.wav", &H1
Else
SetParam "Boundry" , 1
'SetButtonText "Machine"
sndPlaySound "C:\WINDOWS\MEDIA\tada.wav", &H1
End If
>:( Currently I haven't found the code to trigger a wave sound for the E-Stop, need some help ;D
-
If you need to find good sounds to add to Mach look here:
http://www.findsounds.com/ISAPI/search.dll
All sounds are free and the search engine is great, best I've seen.