// Use this for initialization
    void Start()
    {
        //m_DictationRecognizer = new DictationRecognizer();
        //m_DictationRecognizer.InitialSilenceTimeoutSeconds = 30f;
        //m_DictationRecognizer.DictationResult += (text, confidence) =>
        //{
        //    if (canInput)
        //    {
        //        MakeSticky(text, Camera.main.transform.TransformPoint(new Vector3(0f, 0f, 1f)),0);
        //    }

        //};
        _speech = GameObject.Find("InputManager").GetComponent <speech>();

        CustomMessages.Instance.MessageHandlers[CustomMessages.TestMessageID.SharedSticky] = SharedSticky;

        // SharingStage should be valid at this point, but we may not be connected.
        if (SharingStage.Instance.IsConnected)
        {
            Connected();
        }
        else
        {
            SharingStage.Instance.SharingManagerConnected += Connected;
        }
    }
Exemple #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            speech speech = db.speeches.Find(id);

            db.speeches.Remove(speech);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
        //Upload file with a button (in svg view)
        public JsonResult UploadBlinedSVG()
        {
            string allSvgText = "";

            _eyeMusicModel =
                (eyemusic45.Models.ViewModels.eyeMusicModel)System.Web.HttpContext.Current.Session["Themodel"];
            vh = (eyeMusic2)System.Web.HttpContext.Current.Session["eyeMusic"];

            if (_eyeMusicModel == null || vh == null)
            {
                if (System.Web.HttpContext.Current.User.Identity.Name != "")
                {
                    session_dead(System.Web.HttpContext.Current.User.Identity.Name);
                }
                else
                {
                    not_session_dead();
                }
            }


            for (int i = 0; i < Request.Files.Count; i++)
            {
                _eyeMusicModel.currImagePathupload = "";
                _eyeMusicModel.theUri = "";

                HttpPostedFileBase file = Request.Files[i]; //Uploaded file
                if (file != null && file.ContentLength > 0)
                {
                    // extract only the fielname
                    var fileName = Path.GetFileName(file.FileName);

                    if (fileName.EndsWith(".svg"))
                    {
                        string path = Server.MapPath("~");

                        _eyeMusicModel.SvgGlobalName = Session.SessionID + _eyeMusicModel.dragid + Id_number_drag++ + fileName.Replace("%20", "_").Replace(".svg", "");
                        _eyeMusicModel.realpath      = path + "\\uploads\\" + _eyeMusicModel.SvgGlobalName + ".svg";
                        _eyeMusicModel.svgHtmlPath   = "\\uploads\\" + _eyeMusicModel.SvgGlobalName + ".wav";
                        _eyeMusicModel.NumberPath    = path + _eyeMusicModel.svgHtmlPath;

                        file.SaveAs(_eyeMusicModel.realpath);

                        speech addNumber = new speech(_eyeMusicModel.ScanSpeed, _eyeMusicModel.NumberPath, 350, 30, "e");
                        _eyeMusicModel.SvgNumbers = addNumber.add(file);

                        _eyeMusicModel.file.InputStream.Position = 0;
                        TextReader tr = new StreamReader(_eyeMusicModel.file.InputStream);

                        allSvgText = tr.ReadToEnd();

                        _eyeMusicModel.currImagePathupload = "/uploads/" + _eyeMusicModel.SvgGlobalName + ".svg";
                    }
                }
            }

            return(Json(_eyeMusicModel.currImagePathupload + "?" + allSvgText + "?" + _eyeMusicModel.SvgNumbers));
        }
Exemple #4
0
        public ActionResult UploadFilesSVG(string speed, string Time, string len, string couple)
        {
            //Formatting all parameters
            _eyeMusicModel =
                (eyemusic45.Models.ViewModels.eyeMusicModel)System.Web.HttpContext.Current.Session["Themodel"];
            vh = (eyeMusic2)System.Web.HttpContext.Current.Session["eyeMusic"];

            if (_eyeMusicModel == null || vh == null)
            {
                if (System.Web.HttpContext.Current.User.Identity.Name != "")
                {
                    session_dead(System.Web.HttpContext.Current.User.Identity.Name);
                }
                else
                {
                    not_session_dead();
                }
            }


            _eyeMusicModel.ScanSpeed           = Int32.Parse(speed);
            _eyeMusicModel.SvgNumbers          = "";
            _eyeMusicModel.currImagePathupload = "";
            _eyeMusicModel.theUri = "";

            string path = Server.MapPath("~");

            var fileName = Path.GetFileName(_eyeMusicModel.file.FileName);

            //the name of the file
            _eyeMusicModel.SvgGlobalName = Session.SessionID + _eyeMusicModel.dragid + Id_number_drag++ + fileName.Replace("%20", "_").Replace(".svg", "");
            // where to save the file
            _eyeMusicModel.realpath    = path + "\\uploads\\" + _eyeMusicModel.SvgGlobalName + ".svg";
            _eyeMusicModel.svgHtmlPath = "\\uploads\\" + _eyeMusicModel.SvgGlobalName + ".wav";
            _eyeMusicModel.NumberPath  = path + _eyeMusicModel.svgHtmlPath;
            //save the file in the real path
            _eyeMusicModel.file.SaveAs(_eyeMusicModel.realpath);



            if (Time != null && len != null)
            {
                //calls the class speech with all parameteres and returns the text and its location in the file for mespeak to read later
                speech addNumber = new speech(_eyeMusicModel.ScanSpeed, _eyeMusicModel.NumberPath, Int32.Parse(Time), Int32.Parse(couple), len);
                _eyeMusicModel.SvgNumbers = addNumber.add(_eyeMusicModel.file);
            }

            _eyeMusicModel.file.InputStream.Position = 0;
            //read the tr - the svg file that was saved in the server
            TextReader tr = new StreamReader(_eyeMusicModel.file.InputStream);

            string allSvgText = tr.ReadToEnd();

            _eyeMusicModel.currImagePathupload = "/uploads/" + _eyeMusicModel.SvgGlobalName + ".svg";
            //Return json with "numbers" - which have the text and all the speech parameters, and "text" - which has the real text of the svg file
            return(Json(new { image = _eyeMusicModel.currImagePathupload, voice = _eyeMusicModel.svgHtmlPath, numbers = _eyeMusicModel.SvgNumbers, text = allSvgText }));
        }
    // Use this for initialization
    void Start()
    {
        InputManager.Instance.PushFallbackInputHandler(gameObject);

        //m_DictationRecognizer = new DictationRecognizer();
        //m_DictationRecognizer.InitialSilenceTimeoutSeconds = 30f;
        //m_DictationRecognizer.DictationResult += (text, confidence) =>
        //{
        //    if (isDrag)
        //    {
        //        txt = text;
        //    }

        //};

        //if (PhraseRecognitionSystem.Status == SpeechSystemStatus.Running)
        //{
        //    PhraseRecognitionSystem.Shutdown();
        //}
        //m_DictationRecognizer.Start();

        //m_DictationRecognizer.DictationComplete += (completionCause) =>
        //{
        //    if (completionCause == DictationCompletionCause.TimeoutExceeded)
        //    {
        //        //音声認識を起動
        //        m_DictationRecognizer.Start();
        //    }
        //    else
        //    {
        //        //その他止まった原因に応じてハンドリング
        //    }
        //};

        _speech = GameObject.Find("InputManager").GetComponent <speech>();

        //Debug.Log(_speech);

        GameObject aaa = GameObject.Instantiate(error);

        errortex = aaa.GetComponent <TextMesh>();

        CustomMessages.Instance.MessageHandlers[CustomMessages.TestMessageID.VoiceLine]            = SharedVoiceLine;
        CustomMessages.Instance.MessageHandlers[CustomMessages.TestMessageID.DeleteShareVoiceLine] = ReceiveDeleteShareVoice;
        //CustomMessages.Instance.MessageHandlers[CustomMessages.TestMessageID.DeleteMyVoiceLine] = ReceiveDeleteMyVoice;
        //CustomMessages.Instance.MessageHandlers[CustomMessages.TestMessageID.ResetVoiceLine] = ReceiveResetVoice;

        // SharingStage should be valid at this point, but we may not be connected.
        if (SharingStage.Instance.IsConnected)
        {
            Connected();
        }
        else
        {
            SharingStage.Instance.SharingManagerConnected += Connected;
        }
    }
Exemple #6
0
 public ActionResult Edit([Bind(Include = "id,title,description_speech,date_speech")] speech speech)
 {
     if (ModelState.IsValid)
     {
         db.Entry(speech).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(speech));
 }
Exemple #7
0
        public ActionResult Create([Bind(Include = "id,title,description_speech,date_speech")] speech speech)
        {
            if (ModelState.IsValid)
            {
                db.speeches.Add(speech);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(speech));
        }
Exemple #8
0
        // GET: speeches/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            speech speech = db.speeches.Find(id);

            if (speech == null)
            {
                return(HttpNotFound());
            }
            return(View(speech));
        }
Exemple #9
0
        /// <summary>
        /// For create svg from urmola
        /// create the speech and init file names
        /// </summary>
        /// <param name="svg">the svg text</param>
        /// <returns></returns>
        public JsonResult speechFromSvgString(string svg, string speed, string Time, string len, string couple)
        {
            _eyeMusicModel =
                (eyemusic45.Models.ViewModels.eyeMusicModel)System.Web.HttpContext.Current.Session["Themodel"];
            vh = (eyeMusic2)System.Web.HttpContext.Current.Session["eyeMusic"];

            if (_eyeMusicModel == null || vh == null)
            {
                if (System.Web.HttpContext.Current.User.Identity.Name != "")
                {
                    session_dead(System.Web.HttpContext.Current.User.Identity.Name);
                }
                else
                {
                    not_session_dead();
                }
            }


            _eyeMusicModel.ScanSpeed           = Int32.Parse(speed);
            _eyeMusicModel.SvgNumbers          = "";
            _eyeMusicModel.currImagePathupload = "";
            _eyeMusicModel.theUri = "";

            string path = Server.MapPath("~");

            _eyeMusicModel.SvgGlobalName = Session.SessionID + _eyeMusicModel.dragid + Id_number_drag++;
            _eyeMusicModel.realpath      = path + "\\uploads\\" + _eyeMusicModel.SvgGlobalName + ".svg";
            _eyeMusicModel.svgHtmlPath   = "\\uploads\\" + _eyeMusicModel.SvgGlobalName + ".wav";
            _eyeMusicModel.NumberPath    = path + _eyeMusicModel.svgHtmlPath;

            if (Time != null && len != null)
            {
                //found the text for mespeak (at javascript)
                speech addNumber = new speech(_eyeMusicModel.ScanSpeed, _eyeMusicModel.NumberPath, Int32.Parse(Time), Int32.Parse(couple), len);
                _eyeMusicModel.SvgNumbers = addNumber.add(svg);
            }

            _eyeMusicModel.currImagePathupload = "/uploads/" + _eyeMusicModel.SvgGlobalName + ".svg";

            return(Json(new { voice = _eyeMusicModel.svgHtmlPath, numbers = _eyeMusicModel.SvgNumbers, text = svg }));
        }