This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
PLAY
|
PLAY ( objectName {; async} ) | ||||||||
Parameter | Type | Description | ||||||
objectName | String |
![]() |
Name or path of sound file or system sound Empty string for stopping asynchronous play |
|||||
async | Longint |
![]() |
(Windows) If specified, asynchronous execution; If omitted, synchronous execution | |||||
The PLAY command plays sound or multimedia files. You pass the full pathname of the file you want to play in objectName. On OS X, the command can also be used to play a system sound.
Note: 'snd' resources, as used on Mac OS 9 and older, are no longer supported.
The async parameter specifies that the sound will play asynchronously on Windows. Synchronous play means that all processing stops until the sound has finished playing; asynchronous means that processing does not stop and the sound plays in the background. If async is passed and contains 0 (or any longint value), the sound is played asynchronously. If omitted, the sound is played synchronously.
Note: On OS X, the sound is always played asynchronously, with or without the async parameter.
To stop playing an asynchronous sound, use the following statement:
PLAY("";0)
The following example shows how to play a WAV file on Windows:
$DocRef :=Open document("";"WAV";Read Mode)
If(OK=1)
CLOSE DOCUMENT($DocRef)
PLAY(Document;0) //play asynchronously
End if
The following example code plays a system sound on OS X:
PLAY("Submarine.aiff")
Product: 4D
Theme: User Interface
Number:
290
Created: < 4D v6
Modified: 4D v11 SQL
4D Language Reference ( 4D v20 R7)