private IEnumerator LoadWavCoroutine(string fileName)
    {
        networkUIManager.ShowClientInfo("File is loading... please wait...");
        StartCoroutine(audioSerializer.LoadAudioClipToByte(fileName));
        while (audioSerializer.isLoading == true)
        {
            yield return(null);
        }
        networkUIManager.ShowClientInfo("File loading complete!");
        int size    = audioSerializer.loadedAudio.Length;
        int fracNum = (size / 1024) + 1;

        Debug.Log(size.ToString());
        Debug.Log(fracNum.ToString());
        FileMessage[] message = new FileMessage[fracNum];

        for (int i = 0; i < message.Length; i++)
        {
            message[i]          = new FileMessage();
            message[i].contents = new byte[1024];
            Debug.Log(i);
            Buffer.BlockCopy(audioSerializer.loadedAudio, 1024 * i, message[i].contents, 0, 1024);
            message[i].fileType = FileType.Wav;
            message[i].fileName = fileName;
            message[i].maxFrac  = fracNum;
            message[i].fracNum  = i + 1;
        }

        for (int i = 0; i < message.Length; i++)
        {
            client.Send(CustomMsgType.FileMsgType, message[i]);
            yield return(null);
        }
    }
Beispiel #2
0
 public IEnumerator FileLoadCoroutine()
 {
     clientUIManager.ShowClientInfo("File is loading... please wait...");
     StartCoroutine(audioSerializer.LoadAudioClipToByte(inputMessage));
     while (audioSerializer.isLoading == true)
     {
         yield return(null);
     }
     clientUIManager.ShowClientInfo("File loading complete!");
     StartFeature();
 }
Beispiel #3
0
 public IEnumerator WavEncodingCoroutine(string fileName)
 {
     StartCoroutine(audioSerializer.LoadAudioClipToByte(fileName));
     while (audioSerializer.isLoading == true)
     {
         yield return(null);
     }
     byte[] wavDataTemp = audioSerializer.loadedAudio;
     Debug.Log(wavDataTemp.Length);
     packetNum = (wavDataTemp.Length / 1024) + 1;
     Debug.Log(packetNum);
     wavFileData = new byte[1024 * packetNum];
     wavDataTemp.CopyTo(wavFileData, 0);
 }