public static void Initialize( IConsole console, ISurface surface, IStyle style, IDrawings drawing, IShapes shapes, IImages images, IControls controls, ISounds sounds, IKeyboard keyboard, IMouse mouse, ITimer timer, IFlickr flickr, ISpeech speech, CancellationToken token) { TextWindow.Init(console); Desktop.Init(surface); GraphicsWindow.Init(style, surface, drawing, keyboard, mouse); Shapes.Init(shapes); ImageList.Init(images); Turtle.Init(surface, drawing, shapes); Controls.Init(controls); Sound.Init(sounds); Timer.Init(timer); Stack.Init(); Flickr.Init(flickr); Speech.Init(speech); Program.Init(token); }
public void Show(ISpeech speech) { Elements.DialoguePanel.SetActive(true); Elements.ApplySpeechSettings(speech.SpeechSettings); Elements.SpeakerText = speech.SpeakerName; Elements.SpeechText = (speech.AdditiveSpeech ? previousSpeechText : string.Empty) + speech.SpeechText; }
public static void Start(ISpeech speech) { if (run == false) { MainLoop(); } _speech = speech; }
internal static ISpeech GetMockSpeech(string speechText, ISpeechSettings speechSettings) { ISpeech speech = Substitute.For <ISpeech>(); speech.AdditiveSpeech.Returns(true); speech.SpeechText.Returns(speechText); speech.SpeakerName.Returns("Main Character"); speech.SpeechSettings.Returns(speechSettings); return(speech); }
// Main entry point for our application protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Create the speech object to use for speech recognition speech = new Speech(10); this.context = this; // Initialize the command matcher and application matcher to use to parse the user's input commandMatcher = new CommandStringMatcher(this.Assets.Open("dictionary.txt")); // Initialize suggestion manager with default commands suggestionManager = new SuggestionManager(this, commandMatcher.Dictionary); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // get the resources from the layout recordBtn = FindViewById <Button>(Resource.Id.recordBtn); textBox = FindViewById <EditText>(Resource.Id.outputTxt); enterBtn = FindViewById <Button>(Resource.Id.enterBtn); commandHeaderText = FindViewById <TextView>(Resource.Id.cmdPrompt); commandList = FindViewById <ListView>(Resource.Id.cmdList); // Create a button click event for the recordBtn : Nathan recordBtn.Click += delegate { // create the intent and start the activity var voiceIntent = speech.setUpIntent(new Intent()); StartActivityForResult(voiceIntent, 10); }; // coded by Julien enterBtn.Click += delegate { textCommand = textBox.Text; string arguments = commandMatcher.process(textCommand); if (!commandMatcher.KeyWord.Equals("")) { IAction action = Implementations.Action.createAction(context, commandMatcher.KeyWord); action.setArguments(arguments); action.run(); } else { this.ErrorMessage("No commands recognised."); var commands = suggestionManager.pullSpecificCommands(textCommand); this.CommandList(commands); } commandMatcher.KeyWord = ""; }; }
public static void Start(ISpeech speech) { if (run == false) { thisthread = new Thread(MainLoop); thisthread.Name = "Warning Engine"; thisthread.IsBackground = true; thisthread.Start(); } _speech = speech; }
//------------------------------------------------------------------------- public void initSpeech(string app_id, _eSpeechLanguage speech_language) { #if UNITY_ANDROID mISpeech = new AndroidSpeech(app_id, speech_language); Debug.Log("AndroidSpeech::"); #elif UNITY_IOS mISpeech = new IOSSpeech(app_id, speech_language); Debug.Log("IOSSpeech::"); #else Debug.LogError("Do not supported on this platform. "); #endif }
public RealSenseCamera() { Session = PXCMSession.CreateInstance(); _manager = Session.CreateSenseManager(); ConfigurePoses(); ConfigureGestures(); _speech = new Speech(); _eyesThresholds = new Dictionary<Direction, double> { { Direction.Up, 10}, { Direction.Down, 10}, { Direction.Left, 10}, { Direction.Right, 10} }; Debug.WriteLine("SDK Version {0}.{1}", Session.QueryVersion().major, Session.QueryVersion().minor); }
public RealSenseCamera() { Session = PXCMSession.CreateInstance(); _manager = Session.CreateSenseManager(); ConfigurePoses(); ConfigureGestures(); _speech = new Speech(); _eyesThresholds = new Dictionary <Direction, double> { { Direction.Up, 10 }, { Direction.Down, 10 }, { Direction.Left, 10 }, { Direction.Right, 10 } }; Debug.WriteLine("SDK Version {0}.{1}", Session.QueryVersion().major, Session.QueryVersion().minor); }
private async void GetSpeechData() { IPeopleRepository repository = PeopleRepository.Instance; try { speech = await repository.GetPoselSpeech(id); textView.TextFormatted = Html.FromHtml(speech.Tresc); if (viewSwitcher.CurrentView != contentLayout) { viewSwitcher.ShowPrevious(); } } catch (ApiRequestException ex) { (Activity as BaseActivity).ShowErrorDialog(ex.Message); } }
public IEnumerator Say_ShouldWriteAllSpeechTextOnElementSpeechText_WhenPresentingEnds() { // ARRANGE string targetText = "Hello World"; ICoroutineAccessor coroutineAccessor = DialogueTestHelpers.GetMockCoroutineAccessor(); ISpeech mockSpeech = DialogueTestHelpers.GetMockSpeech( targetText, DialogueTestHelpers.GetMockSpeechSettings() ); ITextPresenter mockTextPresenter = new MockTextPresenter(coroutineAccessor); TextMeshProUGUI txtSpeakerName = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>(); TextMeshProUGUI txtSpeechText = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>(); GameObject gameObject = new GameObject(); string speakerName = string.Empty; string speechText = string.Empty; IDialogueSystemElements mockDialogueSystemElements = Substitute.For <IDialogueSystemElements>(); mockDialogueSystemElements.DialoguePanel.Returns(gameObject); mockDialogueSystemElements.SpeakerNameDisplay.Returns(txtSpeakerName); mockDialogueSystemElements.SpeakerNameDisplay.Returns(txtSpeakerName); mockDialogueSystemElements.SpeechTextDisplay.Returns(txtSpeechText); mockDialogueSystemElements.SpeakerText.Returns(speakerName); mockDialogueSystemElements.SpeechText.Returns(speechText); IDialogueSystem dialogueSystem = new DialogueSystem( mockTextPresenter, coroutineAccessor, mockDialogueSystemElements ); // ACT dialogueSystem.Say(mockSpeech); while (dialogueSystem.IsSpeaking()) { yield return(new WaitForFixedUpdate()); } // ASSERT Assert.AreEqual(targetText, mockDialogueSystemElements.SpeechText); }
Boolean Init() { if (_speech != null) { return(true); } _speech = ObjectContainer.Current.Resolve <ISpeech>(); if (_speech != null) { return(true); } try { Assembly.Load("System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); var code = Assembly.GetExecutingAssembly().GetFileResource("MySpeech.cs").ToStr(); var sc = ScriptEngine.Create(code, false); sc.Compile(); _speech = sc.Type.CreateInstance() as ISpeech; if (_speech == null) { return(false); } if (!_speech.Init()) { return(false); } _speech.SpeechRecognized += _rg_SpeechRecognized; return(true); } catch (Exception ex) { XTrace.WriteException(ex); _speech.TryDispose(); return(false); } }
public void Show_ShouldDisplayAllTextInstantly() { // ARRANGE string targetText = "Hello World"; ITextPresenter textPresenter = Substitute.For <ITextPresenter>(); textPresenter.CurrentText.Returns(targetText); TextMeshProUGUI txtSpeakerName = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>(); TextMeshProUGUI txtSpeechText = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>(); GameObject gameObject = new GameObject(); string speakerName = string.Empty; string speechText = string.Empty; IDialogueSystemElements dialogueSystemElements = Substitute.For <IDialogueSystemElements>(); dialogueSystemElements.DialoguePanel.Returns(gameObject); dialogueSystemElements.SpeakerNameDisplay.Returns(txtSpeakerName); dialogueSystemElements.SpeakerNameDisplay.Returns(txtSpeakerName); dialogueSystemElements.SpeechTextDisplay.Returns(txtSpeechText); dialogueSystemElements.SpeakerText.Returns(speakerName); dialogueSystemElements.SpeechText.Returns(speechText); ISpeech speech = DialogueTestHelpers.GetMockSpeech( targetText, DialogueTestHelpers.GetMockSpeechSettings() ); IDialogueSystem dialogueSystem = new DialogueSystem( textPresenter, DialogueTestHelpers.GetMockCoroutineAccessor(), dialogueSystemElements ); // ACT dialogueSystem.Show(speech); // ASSERT Assert.AreEqual(speech.SpeechText, dialogueSystemElements.SpeechText); }
public void SetSpeaker(string speaker) { MakeConnection(); iSpeech = null; foreach (var v in languageSpeech.Keys) { if (v == speaker) { iSpeech = languageSpeech[v]; break; } } if (iSpeech == null) { return; } iSpeech.SetLanguage(speaker); iSpeech.SetSpeaker(speaker); }
public SpeechManager(string languageSpeechPair) { microsoftSpeech = new MicrosoftSpeech(); microsoftSpeech.SpeechStarted += OnSpeechStarted; microsoftSpeech.SpeechEnded += OnSpeechEnded; microsoftSpeech.VisemeUpdated += OnVisemeUpdated; iSpeech = microsoftSpeech; if (languageSpeechPair.ToLower().IndexOf("acapela") >= 0) { acapelaSpeech = new AcapelaSpeech(); acapelaSpeech.SpeechOpened += OnSpeechOpened; acapelaSpeech.SpeechStarted += OnSpeechStarted; acapelaSpeech.SpeechEnded += OnSpeechEnded; acapelaSpeech.VisemeUpdated += OnVisemeUpdated; } var langPair = languageSpeechPair.Split(','); for (var i = 0; i < langPair.Length; i += 2) { switch (langPair[i + 1].ToLower()) { case "diotek": diotekSpeech = new DiotekSpeech(langPair[i]); diotekSpeech.SpeechStarted += OnSpeechStarted; diotekSpeech.SpeechEnded += OnSpeechEnded; diotekSpeech.VisemeUpdated += OnVisemeUpdated; languageSpeech.Add(langPair[i], diotekSpeech); break; case "acapela": languageSpeech.Add(langPair[i], acapelaSpeech); break; case "microsoft": default: languageSpeech.Add(langPair[i], microsoftSpeech); break; } } }
IEnumerator Speaking(ISpeech speech) { Elements.DialoguePanel.SetActive(true); Elements.ApplySpeechSettings(speech.SpeechSettings); Elements.SpeakerText = speech.SpeakerName; previousSpeechText = Elements.SpeechText; textPresenter.Initialize(speech, speech.AdditiveSpeech ? previousSpeechText : string.Empty); textPresenter.Present(); while (textPresenter.IsPresenting) { if (skip) { textPresenter.Skip(); skip = false; } Elements.SpeechText = textPresenter.CurrentText; yield return(new WaitForSeconds(0.025f)); } Elements.SpeechText = textPresenter.CurrentText; StopSpeaking(); }
public void Initialize(ISpeech speech, string preppendText) { this.speech = speech; this.preppendText = preppendText; }
public AudioWriter(ISpeech speech, string source) : base(speech) { _source = source; }
internal static void Init(ISpeech speech) { _speech = speech; }
public TakeNotesCommand(ISpeech speech, string input) { this.speech = speech; this.input = input; }
public SayAsNumberWriter(ISpeech speech, int value) { _speech = speech; _value = value; }
public PauseWriter(ISpeech speech) : base(speech) { }
public TakeNotesCommand(ISpeech speech) { this.speech = speech; }
public SayWriter(ISpeech speech, string value) : base(speech) { _value = value; _writer = new PlainTextWriter(value); }
public override void ParseJObject(Object obj) { ISpeech wystapienie = obj as ISpeech; wystapienie.Tresc = (JsonObject as JValue).Value as string; }
void Update() { //on left mouse click if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { RaycastHit hitInfo = new RaycastHit(); Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition); bool traceHit = Physics.Raycast(mouseRay, out hitInfo); if (Inventory.myInv.CurrentSelectedItem == -1 && traceHit) { selectedObject = hitInfo.collider.gameObject; IClickAbleInterface canClick = selectedObject.GetComponent <IClickAbleInterface> (); ISpeech canTalk = selectedObject.GetComponent <ISpeech> (); if (canClick != null) { canClick.OnClick(); } if (canTalk != null) { movementScript.TrySetTalkToObject(selectedObject); } //check if we are holding over ha UI elemetn else if (!EventSystem.current.IsPointerOverGameObject()) { if (hitInfo.collider.gameObject.CompareTag("Actor") == false && hitInfo.collider.gameObject.CompareTag("Player") == false) { movementScript.TrySetMoveToLocationState(hitInfo.point); } } } mouseClicked = true; mouseLocationPrevFrame = Input.mousePosition; } //for dragging else if (Input.GetMouseButton(0) && mouseClicked) { RaycastHit hitInfo = new RaycastHit(); Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition); if (Inventory.myInv.CurrentSelectedItem == -1 && Physics.Raycast(mouseRay, out hitInfo)) { GameObject hitObject = hitInfo.collider.gameObject; IClickAbleInterface canClick = hitObject.GetComponent <IClickAbleInterface> (); if (canClick != null) { Vector3 mouseLocation = Input.mousePosition; Vector3 deltaMouseLocation = mouseLocation - mouseLocationPrevFrame; canClick.OnDragOver(deltaMouseLocation); } } mouseClicked = true; mouseLocationPrevFrame = Input.mousePosition; } //when releasing mouse else if (Input.GetMouseButtonUp(0)) { if (Inventory.myInv.CurrentSelectedItem == -1 && selectedObject != null) { IClickAbleInterface canClick = selectedObject.GetComponentInChildren <IClickAbleInterface> (); if (canClick != null) { canClick.OnClickRelease(); } selectedObject = null; } else if (Inventory.myInv.CurrentSelectedItem != -1) { RaycastHit hitInfo = new RaycastHit(); Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(mouseRay, out hitInfo)) { GameObject hitActor = hitInfo.collider.gameObject; IUseItem canUseItem = hitActor.GetComponent <IUseItem> (); if (canUseItem != null) { movementScript.TrySetUseItemOnObject(Inventory.myInv.CurrentSelectedItem, hitActor); } } Inventory.myInv.DeselectItem(); } mouseClicked = false; } }
protected BaseSpeach(ISpeech speech) { _speech = speech; }
public MainViewModel(IDialer dialer, IPhonewordTranslator phonewordTranslator, ISpeech speech) { this.Dialer = dialer; this.PhonewordTranslator = phonewordTranslator; this.Speech = speech; }
public void Say(ISpeech speech) { StopSpeaking(); speaking = coroutineAccessor.StartCoroutine(Speaking(speech)); }
public SayAsDateWriter(ISpeech speech, DateTime date) : base(speech) { _date = date; }
void Update() { //Debug.Log (agent.remainingDistance); float distanceToActor = 0.0f; switch (currentPlayerState) { case EPlayerState.Idle: break; case EPlayerState.WalkToLocation: agent.SetDestination(locationToReach); break; case EPlayerState.UseItemOnObject: agent.SetDestination(objectToUseItemOn.transform.position); distanceToActor = (objectToUseItemOn.transform.position - transform.position).magnitude; if (distanceToActor <= distanceItemCanBeUsed) { Inventory.myInv.TryUseItemOnActor(objectToUseItemOn, indexOfItem); agent.ResetPath(); TrySetIdleState(); } break; case EPlayerState.TalkToObject: agent.SetDestination(objectToTalkTo.transform.position); distanceToActor = (objectToTalkTo.transform.position - transform.position).magnitude; if (distanceToActor <= distanceItenCanBeTalkedTo) { ISpeech canTalk = objectToTalkTo.GetComponent <ISpeech> (); if (canTalk != null) { canTalk.OnTalkTo(); } agent.ResetPath(); TrySetIdleState(); } break; default: break; } /*if (Inventory.myInv.CurrentSelectedItem == -1) { * if (wayPoint != null) { * agent.SetDestination (wayPoint.transform.position); * * } * * if (Input.GetMouseButtonDown (0)) { * if (!EventSystem.current.IsPointerOverGameObject ()) { * locatePositionDown (); * } * } */ }