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

BOOL PSoundChannelDirectSound::GetVolume ( unsigned &  volume ) [virtual]

Get the volume of the play/read process. The volume range is 0 == quiet. 100 == LOUD.

Returns:
TRUE if there were no errors.

Reimplemented from PSoundChannel.

Definition at line 1102 of file sound_directsound.cxx.

{

  BOOL no_error=TRUE;
  HRESULT hr;
  long volume = 100;
  switch (mDirection) 
    {

    case Player:

      if (mAudioPlaybackBuffer) 
      {

        if (FAILED (hr = mAudioPlaybackBuffer->GetVolume( &volume ))) 
          {
            PTRACE (4, "PSoundChannelDirectSound::GetVolume Failed " << DXGetErrorString9 (hr));
            no_error = FALSE;
          }
        devVol = (unsigned int) pow(10.0, (float)(volume+10000) / 5000.0);
      }
      break;

    case Recorder:
      // DirectX does not let you change the capture buffer volume
      devVol = mVolume;
      break;

    }
  return no_error;
}

Generated by  Doxygen 1.6.0   Back to index