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

BOOL PSoundChannel::Open ( const PString device,
Directions  dir,
unsigned  numChannels = 1,
unsigned  sampleRate = 8000,
unsigned  bitsPerSample = 16 
) [virtual, inherited]

Open the specified device for playing or recording. The device name is platform specific and is as returned in the GetDevices() function.

Returns:
TRUE if the sound device is valid for playing/recording.
Parameters:
deviceName of sound driver/device
dirSound I/O direction
numChannelsNumber of channels eg mono/stereo
sampleRateSamples per second
bitsPerSampleNumber of bits per sample

Reimplemented in PSoundChannelDirectSound, PSoundChannelBeOS, PSoundChannelCoreAudio, PSoundChannelALSA, and PSoundChannelOSS.

Definition at line 201 of file sound.cxx.

Referenced by PSoundChannel::CreateOpenedChannel(), Vxmltest::Main(), and Audio::Main().

{
  if (baseChannel == NULL) {
    PStringArray names = GetDriverNames();
    if (names.GetSize() == 0)
      return FALSE;

    baseChannel = CreateChannel(names[0]);
  }

  if (baseChannel == NULL)
    return FALSE;

  return baseChannel->Open(device, dir, numChannels, sampleRate, bitsPerSample);
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index