General Terminal

GtPlaySound

Start playing a sound file

Syntax

Signature
xBool GtPlaySound( const char *file );

Arguments

file is the path to a sound file supported by the active driver.

Return value

T if the driver reports that playback started, otherwise F.

Description

Playback runs in the background. Pass the sound file as the first program argument and keep the program running while it plays.

Example

gtplaysound.c
#include "xdev-wtui.h"

#include <stdio.h>

int main( int argc, char **argv )
{
   if( argc != 2 )
   {
      fprintf( stderr, "Usage: %s sound-file\n", argv[ 0 ] );
      return 1;
   }

   if( !GtPlaySound( argv[ 1 ] ) )
   {
      fputs( "Unable to play the sound.\n", stderr );
      return 1;
   }
   Inkey( 0, NIL );

   return 0;
}

See also