I finished most of the steps to voice chat by steamworks.The last step is that I have an array of uint8 to play.I don’t how to cast it to wave to play.
Could you share what tutorial you followed or any description of your implementations ?
Here is my code(I am not going to send the other player my voice,I just want to record my voice and listen it myself):void AVoiceChatCharacter::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
SteamAPI_Init();
if (!SteamUser())
{
return;
}
uint32 pcbCompressed = 0;
EVoiceResult m_Result = SteamUser()->GetAvailableVoice(&pcbCompressed);
if (m_Result == k_EVoiceResultOK)
{
uint8 pDestBuff[1024];
uint32 nBytesWritten = 0;
SteamUser()->GetVoice(true, &pDestBuff, 1024, &nBytesWritten);
TArray<uint8> TApDestBuff[1024];
for (int a = 0; a != 1023; a++)
{
TApDestBuff->Add(pDestBuff[0]);
}
void* NewDest = TApDestBuff;
void* d = pDestBuff;
}
}
void AVoiceChatCharacter::OnVoicing()
{
SteamAPI_Init();
if (SteamUser())
{
SteamUser()->StartVoiceRecording();
}
}
void AVoiceChatCharacter::StopVoicing()
{
SteamAPI_Init();
if (SteamUser())
{
SteamUser()->StopVoiceRecording();
}
}
I have a sample code to record the voice somewhere, I’m looking for it, I will share with you in few days.
Thanks my friend!