Skip to content

Class Sound

Kristian Virtanen edited this page Oct 16, 2024 · 1 revision

Description:

The Sound class provides methods for playing system sounds and audio files, as well as controlling playback, including stopping, pausing, and waiting for playback to complete. It also handles errors through the LastError property, which stores the most recent error message if an operation fails.

Properties

Sound.LastError

  • Description: Stores the last error message, if any operation fails, including a timestamp in yyyy-MM-dd HH:mm:ss format.
  • Example: "2024-10-16 14:30:00: Error pausing file: File not found."

Methods

Sound.PlayClick()

  • Description: Plays the system click sound (Asterisk).

Sound.PlayClickAndWait()

  • Description: Plays the system click sound (Asterisk) and waits sound to stop.

Sound.PlayChime()

  • Description: Plays the system chime sound (Beep).

Sound.PlayChimeAndWait()

  • Description: Plays the system chime sound (Beep) and waits sound to stop.

Sound.PlayChimes()

  • Description: Plays the system chimes sound (Exclamation).

Sound.PlayChimesAndWait()

  • Description: Plays the system chimes sound (Exclamation) and waits sound to stop.

Sound.PlayBellRing()

  • Description: Plays the system bell ring sound (Hand).

Sound.PlayBellRingAndWait()

  • Description: Plays the system bell ring sound (Hand) and waits for approximately 1 second.

Sound.Play(filePath)

  • Description: Plays an audio file from the specified file path.
  • Parameters:
    • filePath: The file path of the audio to play (supports local and network paths).
  • Returns: true if playback starts successfully, false if an error occurs.

Sound.PlayAndWait(filePath)

  • Description: Plays an audio file from the specified file path and waits for the audio to finish playing.
  • Parameters:
    • filePath: The file path of the audio to play (supports local and network paths).
  • Returns: true if playback completes successfully, false if an error occurs.

Sound.Stop()

  • Description: Stops the playback of an audio file.

Sound.Pause()

  • Description: Pauses the playback of an audio file.
  • Returns: true if the pause is successful, false if an error occurs.

Top

Clone this wiki locally