Halyri - Häke  0.9
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
Hake_WPF.AudioVideoManagers.AudioVideoTransferManager Class Reference

Class for processing incoming and outgoing audio and images. Handles media data received from the server. Reproduces speex encoded audio and Wave file segments using the primary audio output device in the system. More...

Public Member Functions

 AudioVideoTransferManager (Connection c)
 Initializes a new AudioVideoTransferManager that uses the provided connection to receive and transmit audio and pictures. More...
 
void EnableOutgoingAudio ()
 Enables audio recording and publishing to the server from the primary audio capture in the system. More...
 
void DisableOutgoingAudio ()
 Stops recording audio and publishing it to the server. More...
 
void EnableIncomingAudio ()
 Starts receiving audio from the server and reproducing it using the primary audio output device in the system. More...
 
void DisableIncomingAudio ()
 Stops receiving and reproducing audio. More...
 

Public Attributes

JpgImageReceived JpgImageReceivedEvent
 

Properties

bool UseOutgoingUdp [get, set]
 Gets and sets UseOutGoingUdp. More...
 

Private Member Functions

void InitializeSpeex ()
 Initializes speex audio encoder and decoder. More...
 
void InitializeAudioIODevices ()
 Initializes NAudio WaveIn and WaveOut used to capture and reproduce audio. More...
 
void SpeexAudioReceived (byte[] speexData, int originatingLength)
 Handles incoming speex audio segments. Decompresses them into PCM that is added into the bufferedWaveStream from which the active WaveOut instance reads and reproduces them. More...
 
void MicrophoneDataAvailable (object sender, WaveInEventArgs e)
 Handles PCM data segments captured by the active WaveIn instance. More...
 
void UdpMediaReceivedHandler (object sender, MediaPacket mediaPacket)
 Handles incoming media received by the active Connection instance over the UDP channel. Supported formats are jpg images and speex encoded audio. More...
 
void TcpMediaReceivedHandler (object sender, MediaInformationDto info, byte[] data)
 Handles incoming media received by the active Connection instance over the WCF TCP channel. Supported formats are jpg images and wave audio fragments with pcm payload. More...
 
void PlayWaveFragment (byte[] audio)
 Plays a wave file using a new SoundPlayer instance. More...
 

Private Attributes

MediaInformation outgoingSpeexInformation = new MediaInformation(MediaFormat.Speex, TransferCompression.None)
 
WaveFormat AudioCaptureFormat
 
const int speexFramesInSecond = 50
 
const int defaultSpeexQuality = 2
 
SpeexDecoder decoder
 
SpeexEncoder encoder
 
IWaveIn recorder
 
WaveOut player
 
bool audioPlaybackActive = false
 
BufferWaveStream bufferedWaveStream
 
object playbackConfigurationLock = new object()
 
Connection connection
 
bool useOutgoingUdp = true
 

Detailed Description

Class for processing incoming and outgoing audio and images. Handles media data received from the server. Reproduces speex encoded audio and Wave file segments using the primary audio output device in the system.

<author>Veli-Mikko Puupponen</author> Captures audio from the dafault audio input device in the system using a NAudio WaveIn instance. If outgoing audio is enabled, uploads the captured audio in a speex encoded format to the server.

Publishes a JpgImageReceivedEvent upon receiving an image from the server.

Constructor & Destructor Documentation

Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.AudioVideoTransferManager ( Connection  c)

Initializes a new AudioVideoTransferManager that uses the provided connection to receive and transmit audio and pictures.

Parameters
cValid Connection instance.

Member Function Documentation

void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.DisableIncomingAudio ( )

Stops receiving and reproducing audio.

void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.DisableOutgoingAudio ( )

Stops recording audio and publishing it to the server.

void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.EnableIncomingAudio ( )

Starts receiving audio from the server and reproducing it using the primary audio output device in the system.

void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.EnableOutgoingAudio ( )

Enables audio recording and publishing to the server from the primary audio capture in the system.

void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.InitializeAudioIODevices ( )
private

Initializes NAudio WaveIn and WaveOut used to capture and reproduce audio.

void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.InitializeSpeex ( )
private

Initializes speex audio encoder and decoder.

void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.MicrophoneDataAvailable ( object  sender,
WaveInEventArgs  e 
)
private

Handles PCM data segments captured by the active WaveIn instance.

Parameters
senderThe publishing WaveIn instance
eWaveInEventArgs containing the captured audio
void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.PlayWaveFragment ( byte[]  audio)
private

Plays a wave file using a new SoundPlayer instance.

Parameters
audioAudio in wave format
void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.SpeexAudioReceived ( byte[]  speexData,
int  originatingLength 
)
private

Handles incoming speex audio segments. Decompresses them into PCM that is added into the bufferedWaveStream from which the active WaveOut instance reads and reproduces them.

Parameters
speexDataSpeex encoded audio
originatingLengthThe count of 16 bit PCM samples that were encoded to produce the provided encoded data
void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.TcpMediaReceivedHandler ( object  sender,
MediaInformationDto  info,
byte[]  data 
)
private

Handles incoming media received by the active Connection instance over the WCF TCP channel. Supported formats are jpg images and wave audio fragments with pcm payload.

Parameters
senderConnection instance publishing the event
infoMediaInformationDto describing the media data
dataMedia data payload
void Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.UdpMediaReceivedHandler ( object  sender,
MediaPacket  mediaPacket 
)
private

Handles incoming media received by the active Connection instance over the UDP channel. Supported formats are jpg images and speex encoded audio.

Parameters
senderConnection instance publishing the event
mediaPacketMediaPacket containing the media data and description

Member Data Documentation

WaveFormat Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.AudioCaptureFormat
private
bool Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.audioPlaybackActive = false
private
BufferWaveStream Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.bufferedWaveStream
private
Connection Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.connection
private
SpeexDecoder Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.decoder
private
const int Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.defaultSpeexQuality = 2
private
SpeexEncoder Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.encoder
private
JpgImageReceived Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.JpgImageReceivedEvent
MediaInformation Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.outgoingSpeexInformation = new MediaInformation(MediaFormat.Speex, TransferCompression.None)
private
object Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.playbackConfigurationLock = new object()
private
WaveOut Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.player
private
IWaveIn Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.recorder
private
const int Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.speexFramesInSecond = 50
private
bool Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.useOutgoingUdp = true
private

Property Documentation

bool Hake_WPF.AudioVideoManagers.AudioVideoTransferManager.UseOutgoingUdp
getset

Gets and sets UseOutGoingUdp.


The documentation for this class was generated from the following file: