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

BOOL PSoundChannelDirectSound::SetFormat ( unsigned  numChannels,
unsigned  sampleRate,
unsigned  bitsPerSample 
) [virtual]

Set the format for play/record. Note that linear PCM data is the only one supported at this time.

Note that if the PlayFile() function is used, this may be overridden by information in the file being played.

Returns:
TRUE if the format is valid.

Reimplemented from PSoundChannel.

Definition at line 657 of file sound_directsound.cxx.

References SetFormat().

Referenced by Open(), and SetFormat().

{
  PTRACE (4, "PSoundChannelDirectSound (" << ((mDirection == Player) ? "Playback" : "Recording") << ") :: SetFormat");
  HRESULT hr;
  
  memset (&mWFX, 0, sizeof (mWFX)); 
  mWFX.wFormatTag = WAVE_FORMAT_PCM;
  mWFX.nChannels = numChannels;
  mWFX.nSamplesPerSec = sampleRate;
  mWFX.wBitsPerSample = bitsPerSample;
  mWFX.nBlockAlign = mWFX.nChannels * (mWFX.wBitsPerSample / 8);
  mWFX.nAvgBytesPerSec = mWFX.nSamplesPerSec * mWFX.nBlockAlign;
  mWFX.cbSize = 0; //ignored

  mOutburst = mWFX.nBlockAlign*8;

  PTRACE (4, "PSoundChannelDirectSound   -->  nChannels  :" << mWFX.nChannels);
  PTRACE (4, "PSoundChannelDirectSound   -->  nSamplesPerSec  :" << mWFX.nSamplesPerSec);
  PTRACE (4, "PSoundChannelDirectSound   -->  wBitsPerSample  :" << mWFX.wBitsPerSample);
  PTRACE (4, "PSoundChannelDirectSound   -->  nBlockAlign  :" << mWFX.nBlockAlign);
  PTRACE (4, "PSoundChannelDirectSound   -->  nAvgBytesPerSec  :" << mWFX.nAvgBytesPerSec);
  PTRACE (4, "PSoundChannelDirectSound   -->  mOutburst  :" << mOutburst);
  
  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