#include <RakVoice.h>
Public Member Functions | |
void | Init (unsigned short speexSampleRate, unsigned bufferSizeBytes) |
Starts RakVoice. | |
void | SetEncoderComplexity (int complexity) |
Changes encoder complexity Specifying higher values might help when encoding non-speech sounds. | |
void | SetVAD (bool enable) |
Enables or disables VAD (Voice Activity Detection) Enabling VAD can help reduce the amount of data transmitted, by automatically disabling outgoing data, when no voice is detected. Don't turn this off or the receive buffer fills up and you eventually get very long delays!! | |
void | SetNoiseFilter (bool enable) |
Enables or disables the noise filter. | |
void | SetVBR (bool enable) |
Enables or disables VBR VBR is variable bitrate. Uses less bandwidth but more CPU if on. | |
int | GetEncoderComplexity (void) |
Returns the complexity of the encoder. | |
bool | IsVADActive (void) |
Returns current state of VAD. | |
bool | IsNoiseFilterActive () |
Returns the current state of the noise filter. | |
bool | IsVBRActive () |
Returns the current state of VBR. | |
void | Deinit (void) |
Shuts down RakVoice. | |
void | RequestVoiceChannel (RakNetGUID recipient) |
Opens a channel to another connected system You will get ID_RAKVOICE_OPEN_CHANNEL_REPLY on success. | |
void | CloseVoiceChannel (RakNetGUID recipient) |
Closes an existing voice channel. Other system will get ID_RAKVOICE_CLOSE_CHANNEL. | |
void | CloseAllChannels (void) |
Closes all existing voice channels Other systems will get ID_RAKVOICE_CLOSE_CHANNEL. | |
bool | SendFrame (RakNetGUID recipient, void *inputBuffer) |
Sends voice data to a system on an open channel. | |
bool | IsSendingVoiceDataTo (RakNetGUID recipient) |
Returns if we are currently sending voice data, accounting for voice activity detection. | |
void | ReceiveFrame (void *outputBuffer) |
Gets decoded voice data, from one or more remote senders. | |
int | GetSampleRate (void) const |
int | GetBufferSizeBytes (void) const |
bool | IsInitialized (void) const |
RakPeerInterface * | GetRakPeerInterface (void) const |
unsigned | GetBufferedBytesToSend (RakNetGUID guid) const |
unsigned | GetBufferedBytesToReturn (RakNetGUID guid) const |
void | SetLoopbackMode (bool enabled) |
bool | IsLoopbackMode (void) const |
virtual void | Update (void) |
Update is called every time a packet is checked for . | |
virtual PluginReceiveResult | OnReceive (Packet *packet) |
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) |
void RakNet::RakVoice::CloseVoiceChannel | ( | RakNetGUID | recipient | ) |
Closes an existing voice channel. Other system will get ID_RAKVOICE_CLOSE_CHANNEL.
[in] | recipient | Which system to close a channel with |
unsigned RakNet::RakVoice::GetBufferedBytesToReturn | ( | RakNetGUID | guid | ) | const |
How many bytes are on the read buffer, waiting to be passed to a call to ReceiveFrame This should remain at a fairly small near-constant size as incoming data is read out at the same rate as outgoing data from the remote system
[in] | guid | The system to query, or RakNet::UNASSIGNED_SYSTEM_ADDRESS for the sum of all channels. |
unsigned RakNet::RakVoice::GetBufferedBytesToSend | ( | RakNetGUID | guid | ) | const |
How many bytes are on the write buffer, waiting to be passed to a call to RakPeer::Send (internally) This should remain at a fairly small near-constant size as outgoing data is sent to the Send function
[in] | guid | The system to query, or RakNet::UNASSIGNED_SYSTEM_ADDRESS for the sum of all channels. |
int RakNet::RakVoice::GetBufferSizeBytes | ( | void | ) | const |
Returns the buffer size in bytes, as passed to Init
int RakNet::RakVoice::GetEncoderComplexity | ( | void | ) |
Returns the complexity of the encoder.
RakPeerInterface* RakNet::RakVoice::GetRakPeerInterface | ( | void | ) | const |
Returns the RakPeerInterface that the object is attached to.
Reimplemented from RakNet::PluginInterface2.
int RakNet::RakVoice::GetSampleRate | ( | void | ) | const |
Returns the value sample rate, as passed to Init
void RakNet::RakVoice::Init | ( | unsigned short | speexSampleRate, | |
unsigned | bufferSizeBytes | |||
) |
Starts RakVoice.
[in] | speexSampleRate | 8000, 16000, or 32000 |
[in] | bufferSizeBytes | How many bytes long inputBuffer and outputBuffer are in SendFrame and ReceiveFrame are. Should be your sample size * the number of samples to encode at once. |
bool RakNet::RakVoice::IsInitialized | ( | void | ) | const |
Returns true or false, indicating if the object has been initialized
bool RakNet::RakVoice::IsLoopbackMode | ( | void | ) | const |
Returns true or false, indicating if the loopback mode is enabled
bool RakNet::RakVoice::IsNoiseFilterActive | ( | ) |
Returns the current state of the noise filter.
bool RakNet::RakVoice::IsSendingVoiceDataTo | ( | RakNetGUID | recipient | ) |
Returns if we are currently sending voice data, accounting for voice activity detection.
[in] | Which | system to check |
bool RakNet::RakVoice::IsVADActive | ( | void | ) |
Returns current state of VAD.
bool RakNet::RakVoice::IsVBRActive | ( | ) |
Returns the current state of VBR.
virtual void RakNet::RakVoice::OnClosedConnection | ( | const SystemAddress & | systemAddress, | |
RakNetGUID | rakNetGUID, | |||
PI2_LostConnectionReason | lostConnectionReason | |||
) | [virtual] |
Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system
[in] | systemAddress | The system whose connection was closed |
[in] | rakNetGuid | The guid of the specified system |
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection |
Reimplemented from RakNet::PluginInterface2.
virtual PluginReceiveResult RakNet::RakVoice::OnReceive | ( | Packet * | packet | ) | [virtual] |
OnReceive is called for every packet.
[in] | packet | the packet that is being returned to the user |
Reimplemented from RakNet::PluginInterface2.
void RakNet::RakVoice::ReceiveFrame | ( | void * | outputBuffer | ) |
Gets decoded voice data, from one or more remote senders.
[out] | outputBuffer | The voice data. The size of outputBuffer should be what was specified as bufferSizeBytes in Init |
void RakNet::RakVoice::RequestVoiceChannel | ( | RakNetGUID | recipient | ) |
Opens a channel to another connected system You will get ID_RAKVOICE_OPEN_CHANNEL_REPLY on success.
[in] | recipient | Which system to open a channel to |
bool RakNet::RakVoice::SendFrame | ( | RakNetGUID | recipient, | |
void * | inputBuffer | |||
) |
Sends voice data to a system on an open channel.
[in] | recipient | The system to send voice data to |
[in] | inputBuffer | The voice data. The size of inputBuffer should be what was specified as bufferSizeBytes in Init |
void RakNet::RakVoice::SetEncoderComplexity | ( | int | complexity | ) |
Changes encoder complexity Specifying higher values might help when encoding non-speech sounds.
[in] | complexity | 0 to 10. The higher the value, the more CPU it needs. Recommended values are from 2 to 4. |
void RakNet::RakVoice::SetLoopbackMode | ( | bool | enabled | ) |
Enables/disables loopback mode
[in] | true | to enable, false to disable |
void RakNet::RakVoice::SetNoiseFilter | ( | bool | enable | ) |
Enables or disables the noise filter.
[in] | enable | true to enable, false to disable. |
void RakNet::RakVoice::SetVAD | ( | bool | enable | ) |
Enables or disables VAD (Voice Activity Detection) Enabling VAD can help reduce the amount of data transmitted, by automatically disabling outgoing data, when no voice is detected. Don't turn this off or the receive buffer fills up and you eventually get very long delays!!
[in] | enable | true to enable, false to disable. True by default |
void RakNet::RakVoice::SetVBR | ( | bool | enable | ) |
Enables or disables VBR VBR is variable bitrate. Uses less bandwidth but more CPU if on.
[in] | enable | true to enable VBR, false to disable |