mohammad be
Member
Hello
I have a voice call app
And now I can establish voice communication between Android devices through a server
I want to save the input information from each device to an audio file.
I used the following code, the file is created, but unfortunately the files are not saved in audio format
Please help
I have a voice call app
And now I can establish voice communication between Android devices through a server
I want to save the input information from each device to an audio file.
I used the following code, the file is created, but unfortunately the files are not saved in audio format
Please help
Server B4j:
Sub astream_NewData (Buffer() As Byte)
Dim Rec_data1 As MyMessage
Rec_data1.Initialize
Rec_data1 = ser.ConvertBytesToObject(Buffer)
Dim bb() As Byte
bb=Rec_data1.Voice
Dim Sen_data1 As MyMessage
Sen_data1.Initialize
Sen_data1.Code=Rec_data1.Code
Sen_data1.Voice=bb
Dim bb11() As Byte
bb11=ser.ConvertObjectToBytes(Sen_data1)
If Rec_data1.Code=2 Then
For i=UsersCall2.Size-1 To 0 Step -1
Dim t As SOK=UsersCall2.Get(i)
If t.so.RemoteAddress.Trim=Rec_data1.Rec.Trim Then
Sock2=t.so
astream2.Write(bb11)
BytesToFile(File.DirApp,Rec_data1.Code&".wav",bb11)
Exit
End If
Next
End If
End Sub
public Sub BytesToFile (Dir As String, FileName As String, Data() As Byte)
Dim out As OutputStream = File.OpenOutput(Dir, FileName, True)
out.WriteBytes(Data, 0, Data.Length)
out.Close
End Sub