Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 01:55:11 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Mach Screens
| | |-+  Attaching wave file to button
Pages: 1   Go Down
Print
Author Topic: Attaching wave file to button  (Read 1736 times)
0 Members and 1 Guest are viewing this topic.
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« on: June 06, 2006, 05: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


 Angry Currently I haven't found the code to trigger a wave sound for the E-Stop, need some help Grin

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

Regards, Jason Blake

www.Fusioncnc.com
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #1 on: June 06, 2006, 06: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.
Logged

Regards, Jason Blake

www.Fusioncnc.com
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!