Exemple #1
0
        public HttpResponseMessage IncomingCall([FromBody] VoiceData dataFromCall)
        {
            HttpResponseMessage rs;
            string response;

            if (dataFromCall.isActive == "1")
            {
                string text = "Welcome, playing an Audio to you now...";

                response  = "<Response>";
                response += "<Say>" + text + "</Say>";

                //Plays an audio from an mp3 file sitting on a webserver
                response += "<Play url=\"http://api.edislodger.com/logs/audio.mp3\"/>";

                response += "</Response>";

                rs         = Request.CreateResponse(HttpStatusCode.Created, response);
                rs.Content = new StringContent(response, Encoding.UTF8, "text/plain");

                return(rs);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        public override void OnRecognized(ref PXCMVoiceRecognition.Recognition data)
        {
            if (data.label < 0)
            {
                _track.OnVoiceInput(new VoiceData("Dictation", data.dictation));
            }
            else
            {
                //form.ClearScores();
                VoiceData voiceData = new VoiceData("Command");
                for (int i = 0; i < 4; i++)
                {
                    int  label      = data.nBest[i].label;
                    uint confidence = data.nBest[i].confidence;
                    if (label < 0 || confidence == 0)
                    {
                        continue;
                    }

                    voiceData.Commands.Add(VoiceTracking.GameCommands[label], confidence);
                    //scores += VoiceTracking.GameCommands[label] + ":" + confidence + ",";
                }
                _track.OnVoiceInput(voiceData);
            }
        }
Exemple #3
0
 public void OnVoiceInput(VoiceData data)
 {
     if (VoiceEvent != null)
     {
         VoiceEvent(data);
     }
 }
Exemple #4
0
    void Awake()
    {
        voiceData = new VoiceData();

        filePath = Application.streamingAssetsPath + "/FreqData.json";
        DataRead();
    }
Exemple #5
0
    public List <VoiceData> GetVoiceTypeList()
    {
        List <VoiceData> list = new List <VoiceData>();

        if (curVoiceType != ChatInfo.Type.World)
        {
            list.Add(new VoiceData(ChatInfo.Type.World));
        }
        if (curVoiceType != ChatInfo.Type.Guild && GameCenter.mainPlayerMng.MainPlayerInfo.GuildName != string.Empty)
        {
            list.Add(new VoiceData(ChatInfo.Type.Guild));
        }
        if (curVoiceType != ChatInfo.Type.Team && GameCenter.teamMng.isInTeam)
        {
            list.Add(new VoiceData(ChatInfo.Type.Team));
        }
        List <string> infoList     = GetAllPrivateInfoList();
        int           privateCount = infoList.Count < 5 ? infoList.Count : 5;

        for (int i = 0, max = privateCount; i < max; i++)
        {
            VoiceData voiceData = new VoiceData(infoList[i]);
            if (!list.Contains(voiceData))
            {
                if (curVoicePrivateNmae != infoList[i] && infoList[i] != GameCenter.mainPlayerMng.MainPlayerInfo.Name)
                {
                    list.Add(voiceData);
                }
            }
            continue;
        }

        list.Sort(SotVoiceType);
        return(list);
    }
Exemple #6
0
    private void Start()
    {
        voiceData = FindObjectOfType <JsonProcess>().voiceData;

        //キーワード登録
        VoiceApply();

        juliusText = GameObject.Find("Canvas/VoiceWord").GetComponent <Text>();
    }
        private void OnVoiceSelect(Data data)
        {
            VoiceData voice = data as VoiceData;

            if (voice == null)
            {
                throw new WatsonException("Unexpected data type");
            }

            m_Voice = voice.Voice;
        }
Exemple #8
0
    protected int SotVoiceType(VoiceData voiceData1, VoiceData voiceData2)
    {
        int vd1 = 0;
        int vd2 = 0;

        switch (voiceData1.type)
        {
        case ChatInfo.Type.World:
            vd1 = 4;
            break;

        case ChatInfo.Type.Guild:
            vd1 = 3;
            break;

        case ChatInfo.Type.Team:
            vd1 = 2;
            break;

        case ChatInfo.Type.Private:
            vd1 = 1;
            break;
        }

        switch (voiceData2.type)
        {
        case ChatInfo.Type.World:
            vd2 = 4;
            break;

        case ChatInfo.Type.Guild:
            vd2 = 3;
            break;

        case ChatInfo.Type.Team:
            vd2 = 2;
            break;

        case ChatInfo.Type.Private:
            vd2 = 1;
            break;
        }

        if (vd1 > vd2)
        {
            return(1);
        }
        if (vd1 < vd2)
        {
            return(-1);
        }
        return(0);
    }
Exemple #9
0
        private void SoundEngineRecordCallback(byte[] data)
        {
            if (GetAsyncKeyState(TalkVKey) == 0 || !IsConnected)
            {
                return;
            }
            var voiceData = new VoiceData();

            voiceData.UserSession = UserSession;
            voiceData.SetDataFromBytes(data);
            WriteMessage(Message.Create(MessageType.Voice, voiceData));
        }
    void PlayNextSequencedClip()
    {
        VoiceData newAudio = sequenceSaying[sequenceID];

        print(onSequence + " " + newAudio.audioClip + " " + sequenceID + "    count: " + sequenceSaying.Count);
        PlayClip(newAudio.audioClip);
        sequenceID++;
        if (sequenceSaying.Count == sequenceID)
        {
            onSequence = false;
            Done();
        }
    }
Exemple #11
0
    public void OnVM(byte[] data, int length, ulong sender)
    {
        SNet_Identity go = null;

        SNet_Identity.find(sender, out go);

        Transform lobbyPlayer = SNet_Manager.instance.lobbyMemberHolder.Find(sender.ToString());

        bool voiceDisable = false;

        if (lobbyPlayer.Find("voiceDisable").GetComponent <Toggle>().isOn)
        {
            voiceDisable = true;
        }

        if (go != null && go.controller.UI_PlayerAgent != null)
        {
            Transform voice = go.controller.UI_PlayerAgent.Find("voice");
            voice.GetComponent <UIVisibility>().Open();

            GameObject g = voice.Find("blocked").gameObject;
            if (g.activeSelf != voiceDisable)
            {
                g.SetActive(voiceDisable);
            }
        }

        lobbyPlayer.Find("speaking").GetComponent <UIVisibility>().Open();

        if (voiceDisable)
        {
            return;
        }

        VoiceData vd = vdList.Find(x => x.id == sender);

        if (vd == null)
        {
            vd = new VoiceData(sender);
            vdList.Add(vd);
        }

        if (Client.Instance.Voice.Decompress(data, length, vd.ms))
        {
            if (vd.ms.Length > stepSize && vd.playOffset == 0)
            {
                // The data is enough to play.
                vd.playOffset = 1;
            }
        }
    }
Exemple #12
0
 public void Show(VoiceData _voiceData)
 {
     voiceData      = _voiceData;
     voiceType.text = GameCenter.chatMng.ChatType((int)voiceData.type);
     if (string.IsNullOrEmpty(voiceData.privateName) || voiceData.type != ChatInfo.Type.Private)
     {
         privateName.gameObject.SetActive(false);
     }
     else
     {
         privateName.gameObject.SetActive(true);
         privateName.text = voiceData.privateName;
     }
 }
Exemple #13
0
        public void SendVoice(ServerClient sender, VoiceData voiceData)
        {
            if (Type != ChannelType.VoiceChat && Type != ChannelType.Both)
            {
                return;
            }

            foreach (ServerClient client in VoiceClients)
            {
                if (client != sender)
                {
                    client.SendPacket(voiceData);
                }
            }
        }
Exemple #14
0
        public void ReceiveVoiceData(VoiceData voiceData)
        {
            ClientChannel channel;

            if (Channels.TryGetValue(voiceData.channelID, out channel))
            {
                ClientUser user = GetUser(voiceData.userID);
                channel.ReceiveVoiceData(user, voiceData.data);
            }
            else
            {
                // TODO: GetChannels

                Console.WriteLine("Channel not found " + voiceData.channelID);
            }
        }
        private async void Player(VoiceData data)
        {
            if (data.source.Contains("http://"))
            {
                var file   = await(await appFolder.CreateFolderAsync("WelcomeVoice", CreationCollisionOption.OpenIfExists)).CreateFileAsync(data.id.ToString() + ".mp3", CreationCollisionOption.ReplaceExisting);
                var downer = new Windows.Networking.BackgroundTransfer.BackgroundDownloader();
                var downop = downer.CreateDownload(new Uri(data.source), file);
                await downop.StartAsync();

                mediaplayer.SetSource(await file.OpenReadAsync(), file.ContentType);
            }
            else
            {
                var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(data.source));

                mediaplayer.SetSource(await file.OpenReadAsync(), file.ContentType);
            }
        }
Exemple #16
0
        public static void Instance_VoiceEvent(VoiceData data)
        {
            if (data.Key == "ListeningStarted")
            {
                ChooseAudioDevice.Instance.CloseWindow();
                return;
            }
            else if (data.Key == "Alert")
            {
                //
            }
            else if (data.Key == "Command")
            {
                if (data.Commands.Count > 0)
                {
                    var sorted  = data.Commands.OrderBy(obj => obj.Value).Reverse();
                    var command = sorted.ElementAt(0).Key;
                    MainWindow.Instance.ExecuteVoiceCommand(command);
                }
            }

            //MessageBox.Show("VoiceEvent: " + key + ", " + values);
        }
Exemple #17
0
        //  private static List<string> a;

        public void AddVoiceData(VoiceData prVoice)
        {
            _voiceData.Add(prVoice);
        }
Exemple #18
0
 /// <summary>
 /// データの読み取り
 /// </summary>
 public void DataRead()
 {
     //ファイルの読み取り
     json      = File.ReadAllText(filePath, Encoding.UTF8);
     voiceData = JsonUtility.FromJson <VoiceData>(json);
 }
 private async void Player(VoiceData data)
 {
     if(data.source.Contains("http://"))
     {
         var file = await (await appFolder.CreateFolderAsync("WelcomeVoice", CreationCollisionOption.OpenIfExists)).CreateFileAsync(data.id.ToString() + ".mp3", CreationCollisionOption.ReplaceExisting);
         var downer = new Windows.Networking.BackgroundTransfer.BackgroundDownloader();
         var downop= downer.CreateDownload(new Uri(data.source), file);
         await downop.StartAsync();
         mediaplayer.SetSource(await file.OpenReadAsync(), file.ContentType);
     }
     else
     {
         var file =await StorageFile.GetFileFromApplicationUriAsync(new Uri(data.source));
         mediaplayer.SetSource(await file.OpenReadAsync(), file.ContentType);
     }
 }
Exemple #20
0
 private void SoundEngineRecordCallback(byte[] data)
 {
     if (GetAsyncKeyState(TalkVKey) == 0 || !IsConnected) return;
     var voiceData = new VoiceData();
     voiceData.UserSession = UserSession;
     voiceData.SetDataFromBytes(data);
     WriteMessage(Message.Create(MessageType.Voice, voiceData));
 }