SCARA, 6-Axis and Modules
Technical Support Notes

Article ID: T1002
Date: 3/22/2000
Product: EPSON RC+
Problem: How to play sounds in SPEL+

Purpose
The purpose of this Technical Support Note is to describe how to play wave files from a SPEL+ program.

Procedure
You can call several functions in the Windows API from SPEL+.  To play sounds, you can use the PlaySound API call.  Of course, your system must have a sound card installed.

Create a program called sound.prg.
Include the following code:

Declare PlaySound, "winmm.dll", "PlaySound", (name$ As String, module As Long, dwFlags As Long) As Long

#define SND_FILENAME &h20000

Function PlayWaveFile(fileName$ As String)

  
PlaySound fileName$, 0, SND_FILENAME
Fend

Now you can call PlayWaveFile from anywhere in your project.  For example:

Function main

  
PlayWaveFile "c:\winnt\media\tada.wav"
Fend

Click here to return to the EPSON Robots home page
The Power of Choice!