Example #1
0
    public void Update()
    {
        AudioClip clip = null;

        lock (self_locker) {
            if (this._audioBytes != null)
            {
                clip             = RTMAudioManager.DncodeAdpcmData(this._audioBytes);
                this._audioBytes = null;
            }
        }

        if (clip != null)
        {
            Debug.Log("audio play!");
            RTMAudioManager.PlayAudioClip(clip, Vector3.zero);
        }
    }
Example #2
0
        public void OnRecord(AudioClip clip)
        {
            byte[] data = RTMAudioManager.EncodeAudioClip(clip);
            Debug.Log("end record, adpcm bytearray len: " + data.Length);

            if (sendClient != null)
            {
                sendClient.SendAudio(777779, data, "", 0, 20 * 1000, (cbd) => {
                    if (cbd.GetException() != null)
                    {
                        Debug.Log(cbd.GetException());
                    }
                    else
                    {
                        Debug.Log("778899 send audio!");
                    }
                });
            }
        }