Main Page | Class Hierarchy | Class List | File List | Class Members

UdpSoundChannel Class Reference

#include <udpsound.h>

Collaboration diagram for UdpSoundChannel:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 UdpSoundChannel (MyOpalCall &myOpalCall, BOOL isSource)
virtual ~UdpSoundChannel ()
virtual BOOL Write (const void *buffer, PINDEX amount)
virtual BOOL Read (void *buffer, PINDEX amount)
void CreateSilence (void *buffer, PINDEX amount)
virtual BOOL Close ()
PINDEX GetPortNumber ()
virtual BOOL IsOpen () const
virtual BOOL Open (const PString &device, Directions dir, unsigned numChannels=1, unsigned sampleRate=8000, unsigned bitsPerSample=16)
virtual BOOL SetFormat (unsigned, unsigned, unsigned)
virtual unsigned GetChannels () const
 Get the number of channels (mono/stereo) in the sound.
virtual unsigned GetSampleRate () const
 Get the sample rate in samples per second.
virtual unsigned GetSampleSize () const
 Get the sample size in bits per sample.
virtual BOOL SetBuffers (PINDEX size, PINDEX count=2)
virtual BOOL GetBuffers (PINDEX &size, PINDEX &count)
virtual BOOL SetVolume (unsigned)
virtual BOOL GetVolume (unsigned &volume)
void PrintOn (ostream &strm) const

Protected Member Functions

virtual int overflow (int=EOF)
virtual int sync ()
virtual int underflow ()

Protected Attributes

MyOpalCallmyOpalCall
PUDPSocket & audioSocket
BOOL isSource
AudioDelay delay
PINDEX bufSize
PINDEX bufCount
PQueueChannel readQueue
PBYTEArray readBuffer

Detailed Description

Class to connect a udp socket with an opalConnection


Constructor & Destructor Documentation

UdpSoundChannel::UdpSoundChannel MyOpalCall myOpalCall,
BOOL  isSource
 

Constructor

UdpSoundChannel::~UdpSoundChannel  )  [virtual]
 

Destructor


Member Function Documentation

BOOL UdpSoundChannel::Close  )  [virtual]
 

Close the socket down

void UdpSoundChannel::CreateSilence void *  buffer,
PINDEX  amount
 

Set the buffer to null, as we have no sound

virtual BOOL UdpSoundChannel::GetBuffers PINDEX &  size,
PINDEX &  count
[inline, virtual]
 

Get the internal buffers for the sound channel I/O.

Returns:
TRUE if the buffer size were obtained.

PINDEX UdpSoundChannel::GetPortNumber  ) 
 

Get the port number used by the socket on this channel

virtual BOOL UdpSoundChannel::GetVolume unsigned &  volume  )  [inline, virtual]
 

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

Returns:
TRUE if there were no errors.
Parameters:
volume  Variable to receive volume level.

BOOL UdpSoundChannel::IsOpen  )  const [virtual]
 

Report if the UDPSocket used for comms is open

BOOL UdpSoundChannel::Open const PString &  device,
Directions  dir,
unsigned  numChannels = 1,
unsigned  sampleRate = 8000,
unsigned  bitsPerSample = 16
[virtual]
 

Open the sound device for use

int UdpSoundChannel::overflow int  = EOF  )  [protected, virtual]
 

From the PChannelStreamBuffer ancestor

void UdpSoundChannel::PrintOn ostream &  strm  )  const
 

Standard stream print function. The PObject class has a << operator defined that calls this function polymorphically.

Parameters:
strm  Stream to output text representation

BOOL UdpSoundChannel::Read void *  buffer,
PINDEX  amount
[virtual]
 

pull audio of the socket

virtual BOOL UdpSoundChannel::SetBuffers PINDEX  size,
PINDEX  count = 2
[inline, virtual]
 

Set the internal buffers for the sound channel I/O.

Note that with Linux OSS, the size is always rounded up to the nearest power of two, so 20000 => 32768.

Returns:
TRUE if the sound device is valid for playing/recording.
Parameters:
count  Size of each buffer Number of buffers

virtual BOOL UdpSoundChannel::SetFormat unsigned  ,
unsigned  ,
unsigned 
[inline, 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.

virtual BOOL UdpSoundChannel::SetVolume unsigned   )  [inline, virtual]
 

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

Returns:
TRUE if there were no errors.

int UdpSoundChannel::sync  )  [protected, virtual]
 

From the PChannelStreamBuffer ancestor

int UdpSoundChannel::underflow  )  [protected, virtual]
 

From the PChannelStreamBuffer ancestor

BOOL UdpSoundChannel::Write const void *  buffer,
PINDEX  amount
[virtual]
 

Send audio from the connection to the socket


Member Data Documentation

PUDPSocket& UdpSoundChannel::audioSocket [protected]
 

Socket for handling UDP comms. of the audio data.

PINDEX UdpSoundChannel::bufCount [protected]
 

Depth of the buffers

PINDEX UdpSoundChannel::bufSize [protected]
 

Size of the buffers

AudioDelay UdpSoundChannel::delay [protected]
 

Interactive the delay

BOOL UdpSoundChannel::isSource [protected]
 

Flag to say if we generate data, or receive data

MyOpalCall& UdpSoundChannel::myOpalCall [protected]
 

OpalCall structure responsible for managing this call

PBYTEArray UdpSoundChannel::readBuffer [protected]
 

A read buffer for incoming data

PQueueChannel UdpSoundChannel::readQueue [protected]
 

an intermediate buffer to cope with the size of the network packet being larger than the size of the read array


The documentation for this class was generated from the following files:
Generated on Sun Jan 29 19:49:24 2006 for SSVoip, which is Sofa Switch Voip by  doxygen 1.4.4