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

BOOL PSoundChannelSunAudio::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 539 of file sound_sunaudio.cxx.

References PChannel::os_handle.

{
   audio_info_t audio_info;
   int err;

   AUDIO_INITINFO(&audio_info);

   err=::ioctl(os_handle,AUDIO_GETINFO,&audio_info);
   if (err==EINVAL || err==EBUSY)
   {
     PTRACE(1,  "PSoundChannelSunAudio::GetVolume failed : " << ::strerror(errno)) ;
     return FALSE;
   }

   volume =  ( direction == Player ) ?  audio_info.play.gain : audio_info.record.gain;

   volume = (volume * 100) / (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN);

   return TRUE;
}

Generated by  Doxygen 1.6.0   Back to index