Hello Guest it is November 14, 2019, 12:48:37 AM

Author Topic: Attaching wave file to button  (Read 4786 times)

0 Members and 1 Guest are viewing this topic.

Offline zealous

*
  •  492 492
  • HI!
    • View Profile
    • Artsoft Solutions
Attaching wave file to button
« 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

« Last Edit: June 06, 2006, 07:03:14 AM by zealouse »

Offline zealous

*
  •  492 492
  • HI!
    • View Profile
    • Artsoft Solutions
Re: Attaching wave file to button
« Reply #1 on: June 06, 2006, 07:52:15 AM »
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.