PLAY

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 3


PLAY (objectName{; channel})

ParameterTypeDescription
objectNameStringSound name
Windows: .WAV, .MID or .AVI file
Any platform: Mac OS-based 'snd' resource
or empty string for stopping asynchronous play
channelNumberif specified, synthesizer channel and asynchronous
if omitted, synchronous

Description on Windows

On Windows, the PLAY command plays sound (.WAV files), MIDI (.MID files), or Video (.AVI files) Windows files. You pass the full pathname of the file you want to play in objectName.

Note: You cannot play multimedia files or objects in asynchronous mode. To do so, use OLE Services.

On Macintosh or on Windows (with some restrictions, see Important Note below), the command PLAY plays the sound resource named by objectName on Macintosh.

The channel parameter specifies the Macintosh synthesizer channel. If channel is not specified, the channel is for simple digitized sounds and is synchronous. Synchronous means that all processing stops until the sound has finished. If channel is 0, the channel is for simple digitized sounds and is asynchronous. Asynchronous means that processing does not stop and the sound plays in the background.

To stop playing a synchronous sound, use the following statement:

   PLAY ("";0)

If you work with a database on Macintosh and Windows concurrently, you can also play Macintosh sounds on the Windows platform. To do so:

On the Macintosh, using a resource editor such as ResEdit or Resorcerer, copy the required 'snd ' resources into the resource fork of the structure file.

Transport the database from Macintosh to Windows, using 4D Transporter.

Important Note: The Windows version of 4th Dimension does not play Macintosh sounds that have been compressed by MACE. If your Macintosh 'snd' resource does not play on Windows, determine whether it complies with the following requirements:

snd resource fieldValue (in hexadecimal)
Version0x0001
NbSynth0x0001
SynthResID0x0005
SynthInitOptions0x000000A0
NbSoundCommand0x0001
FirstCommand0x8051

You can check the internal data of a 'snd' resource using Resorcerer.

Examples

1. The following example shows how to play a video file on Windows:

   $DocRef := Open document ( ""; "AVI") 
   If (OK=1) 
      CLOSE DOCUMENT($DocRef) 
      PLAY (Document) 
   End if

2. The following example code appears in a startup method. It welcomes the user with a sound called Welcome Sound on Macintosh:

   PLAY ("Welcome Sound")  ` Play the Welcome Sound

See Also

BEEP.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next