Share via


Sound Player Foundation Class

This class loads and plays a sound file, and provides access to the Media Control Interface (MCI).

Category

Multimedia

Default Catalog

Visual FoxPro Catalog\Foundation Classes\Multimedia

Class

_soundplayer

Base Class

Container

Class Library

_multimedia.vcx

Parent Class

_container

Sample

...\Samples\Solution\Forms\mci_play.scx

Remarks

To use, drop the class on a project or form or, from the Component Gallery Item shortcut menu, select Add to Project or Add to Form. When you drop the class on a project, you can choose between adding the class or creating a subclass. When you choose an option from the shortcut menu or drop the class on a form, Visual FoxPro opens a builder so you can specify appropriate cFileName, lAutoOpen, lAutoPlay, lAutoRepeat, and cControlSource values.

See Guidelines for Using Visual FoxPro Foundation Classesfor more information on using foundation classes.

Properties, Events, Methods

Description

cControlSource property

Specifies the source of data to which an object is bound.

Default: ""

cFileName property

Specifies the name of the sound file to play.

Default: ""

cMCIAlias property

Specifies the alias for the video file when calling MCI commands. If empty, the name of the file is used.

Default: ""

cMCIErrorString property

Stores the error string from the last MCI command.

Default: ""

lAutoOpen property

Specifies whether the video file specified should be automatically opened when the class is created.

Default: .T.

lAutoPlay property

Specifies whether the video file should automatically play after opening.

Default: .T.

lAutoRepeat property

Specifies whether video plays continuously.

Default: .T.

nMCIError property

Specifies the result of the last MCI command executed.

Default: 0

CloseSound method

Closes the loaded sound file and releases its resources.

Syntax: CloseSound( )

Return: none

Arguments: none

OpenSound method

Opens the sound file.

Syntax: OpenSound( )

Return: none

Arguments: none

PauseSound method

Pauses the currently playing sound.

Syntax: PauseSound( )

Return: none

Arguments: none

PlaySound method

Plays the loaded sound file.

Syntax: PlaySound( )

Return: none

Arguments: none

SetPosition method

Makes it possible for the user to set the position of the media file.

Syntax: SetPosition (cPosition)

Return: none

Arguments: cPosition specifies Start, End, or a number representing milliseconds into the media file.

DoMCI method

Internal to the class.

GetMCIError method

Internal to the class.

ShowMCIError method

Internal to the class.

See Also

Concepts

Guidelines for Using Visual FoxPro Foundation Classes

Reference

Visual FoxPro Foundation Classes A-Z

Other Resources

Foundation Class Samples