Пример #1
0
 // Use this for initialization
 void Start()
 {
     #if UNITY_IPHONE
     string iflyID = "54be5c4f";
     m_dataPath = Path.GetTempPath();
     #elif UNITY_ANDROID
     string iflyID = "54c0b179";
     m_dataPath = Application.persistentDataPath;
     #else
     string iflyID = "54bef90a";
     m_dataPath = Path.GetTempPath();
     #endif
     Debug.Log("datapath=" + m_dataPath);
     CallAxVoice.Init(m_dataPath, "http://www.dashengine.com/upload_voice", iflyID);
 }
Пример #2
0
    void OnAxVoiceRecordMessage(string[] args)
    {
        uint   voiceID = System.UInt32.Parse(args[0]);
        string type    = args[1];
        string success = args[2];
        string result  = args[3];

        if (type == "complete")
        {
            Debug.Log("Record complete, voiceid=" + voiceID + ", success=" + success + ", result=" + result);
            //begin upload
            CallAxVoice.UploadVoice(currentVoiceID);

            m_voiceID = args[0];
        }
    }
Пример #3
0
    void UserForm(int id)
    {
        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal();
        m_serverURL = GUILayout.TextField(m_serverURL, GUILayout.MaxWidth(m_windowWidth - 200), GUILayout.Height(m_lineHeight));
        if (GUILayout.Button("GET", GUILayout.Width(200), GUILayout.Height(m_lineHeight)))
        {
            StartCoroutine(debugGetServerURL());
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Create", GUILayout.Height(m_lineHeight)))
        {
            currentVoiceID = CallAxVoice.CreatVoice(m_serverURL);
            m_voiceID      = "" + currentVoiceID;
            Debug.Log("Create Voice, voiceid=" + currentVoiceID);
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(m_lineHeight);

        GUILayout.BeginHorizontal();
        m_voiceID = GUILayout.TextField(m_voiceID, GUILayout.Height(m_lineHeight));
        if (GUILayout.Button("GET", GUILayout.Width(200), GUILayout.Height(m_lineHeight)))
        {
            StartCoroutine(debugGetVoiceID());
        }
        GUILayout.EndHorizontal();


        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Download", GUILayout.Width(m_windowWidth / 4), GUILayout.Height(m_lineHeight)))
        {
            CallAxVoice.DownloadVoice(System.UInt32.Parse(m_voiceID));
            Debug.Log("Begin Download Voice, voiceid=" + currentVoiceID);
        }
        if (GUILayout.Button("Play", GUILayout.Width(m_windowWidth / 4), GUILayout.Height(m_lineHeight)))
        {
            CallAxVoice.PlayVoice(System.UInt32.Parse(m_voiceID));
            Debug.Log("Begin Play Voice, voiceid=" + currentVoiceID);
        }
        if (GUILayout.Button("Stop", GUILayout.Width(m_windowWidth / 4), GUILayout.Height(m_lineHeight)))
        {
            CallAxVoice.StopVoice();
            Debug.Log("Stop Current Voice");
        }
        if (GUILayout.Button("Text", GUILayout.Width(m_windowWidth / 4), GUILayout.Height(m_lineHeight)))
        {
            CallAxVoice.Voice2Text(System.UInt32.Parse(m_voiceID));
            Debug.Log("Convert To Text");
        }
        GUILayout.EndHorizontal();

        GUILayout.Label(strResult, GUILayout.Height(m_lineHeight * 2));

        if (GUILayout.RepeatButton(recordButtonText, GUILayout.Height(m_lineHeight * 2)))
        {
            if (!recordStatus)
            {
                currentVoiceID = CallAxVoice.BeginRecord();
                Debug.Log("Begin Record, voiceid=" + currentVoiceID);
                recordButtonText = "Recording...";
            }
            recordStatus = true;
        }
        else if (Event.current.type == EventType.Repaint)
        {
            if (recordStatus)
            {
                CallAxVoice.CompleteRecord(currentVoiceID);
                recordButtonText = "BeginRecord";
                Debug.Log("Stop Record...");
            }
            recordStatus = false;
        }

        GUILayout.EndVertical();
    }
Пример #4
0
 // Update is called once per frame
 void Update()
 {
     CallAxVoice.DispatchMessage("Main Camera");
 }