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

BOOL PSoundChannelWin32::Abort (  ) [virtual]

Abort the background playing/recording of the sound channel.

Returns:
TRUE if the sound has successfully been aborted.

Reimplemented from PSoundChannel.

Definition at line 1467 of file sound_win32.cxx.

References PChannel::Miscellaneous, and PChannel::SetErrorValues().

Referenced by Close(), PlayFile(), PlaySound(), SetBuffers(), and SetFormat().

{
  DWORD osError = MMSYSERR_NOERROR;

  if (hWaveOut != NULL)
    osError = waveOutReset(hWaveOut);

  if (hWaveIn != NULL)
    osError = waveInReset(hWaveIn);

  {
    PWaitAndSignal mutex(bufferMutex);

    if (hWaveOut != NULL || hWaveIn != NULL) {
      for (PINDEX i = 0; i < buffers.GetSize(); i++) {
        while (buffers[i].Release() == WAVERR_STILLPLAYING) {
          if (hWaveOut != NULL)
            waveOutReset(hWaveOut);
          if (hWaveIn != NULL)
            waveInReset(hWaveIn);
        }
      }
    }

    bufferByteOffset = P_MAX_INDEX;
    bufferIndex = 0;

    // Signal any threads waiting on this event, they should then check
    // the bufferByteOffset variable for an abort.
    SetEvent(hEventDone);
  }

  if (osError != MMSYSERR_NOERROR)
    return SetErrorValues(Miscellaneous, osError|PWIN32ErrorFlag);

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index