Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PSoundChannelSunAudio::PlayFile ( const PFilePath file,
BOOL  wait 
) [virtual]

Play a sound file to the open device. If the wait# parameter is TRUE then the function does not return until the file has been played. If FALSE then the sound play is begun asynchronously and the function returns immediately.

Note if the driver is closed of the object destroyed then the sound play is aborted.

Also note that not all possible sounds and sound files are playable by this library. No format conversions between sound object and driver are performed.

TRUE if the sound is playing or has played.

Reimplemented from PSoundChannel.

Definition at line 338 of file sound_sunaudio.cxx.

References PFile::Close(), PChannel::GetLastReadCount(), PChannel::IsOpen(), PChannel::NotOpen, PFile::Read(), PFile::ReadOnly, PChannel::SetErrorValues(), WaitForPlayCompletion(), and Write().

  if (os_handle < 0 )
    return SetErrorValues(NotOpen,EBADF);

  PFile file(filename, PFile::ReadOnly);
  if (!file.IsOpen())
    return FALSE;

  for (;;) {
    BYTE buffer[256];
    if (!file.Read(buffer, 256))
    PINDEX len = file.GetLastReadCount();
    if (len == 0)
    if (!Write(buffer, len))


  if (wait)
    return WaitForPlayCompletion();

  return TRUE;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index