This section describes the work required to add support for PiaChat to an application that previously used VCT for voice chat.
The PiaChat API replaces the various types, functions, and constants of the VCT API. The new object names simply drop the VCT_ prefix used for objects in the VCT API. See the following examples.
VCT API | PiaChat |
---|---|
VCTCodec | enum nn::pia::chat::Codec |
VCT_SetCodec(VCTCodec) | nn::pia::chat::VoiceProtocol::SetCodec(enum Codec) |
VCT_CODEC_4BIT_ADPCM | nn::pia::chat::CODEC_4BIT_ADPCM |
VCT_AUDIO_FRAME_LENGTH_DEFAULT | nn::pia::chat::VoiceProtocol::AUDIO_FRAME_LENGTH_DEFAULT |
Some of the functions in the PiaChat API do not follow this naming convention. The following table lists the exceptions.
VCT API | PiaChat API |
---|---|
VCT_Init() | nn::pia::chat::VoiceProtocol::Initialize() |
VCT_Cleanup() | nn::pia::chat::VoiceProtocol::Finalize() |
VCT_SendAudioEx() | nn::pia::chat::VoiceProtocol::Send() |
VCT_ReceiveAudio() | nn::pia::chat::VoiceProtocol::Receive() |
VCT_GetAudioInfoFromCid() | nn::pia::chat::VoiceProtocol::GetAudioInfo() |
First initialize and set up the PiaSession module and then initialize and set up the PiaChat module. Create an instance of VoiceProtocol using the CreateProtocol() function, and then call the VoiceProtocol::Initialize() function. For more information, see the VoiceProtocol sample demo.
The PiaChat module internally uses nn::pia::transport::UnreliableProtocol. For the UnreliableProtocol port number, the PiaChat module uses the value of the port member variable of the Setting structure passed to the nn::pia::chat::VoiceProtocol::Initialize() function. If your application is already using an instance of UnreliableProtocol for something else, make sure to specify a different port number for the port member variable.