public MainPageViewModel(INavigationService navigationService, ITextToSpeech textToSpeechService, IAuthenticationService authenticationService, IDatabaseService databaseService, IUserDialogs userDialogsService, IStorageService storageService) : base(navigationService) { Title = "Strona główna"; _textToSpeechService = textToSpeechService; _authenticationService = authenticationService; _databaseService = databaseService; _userDialogsService = userDialogsService; _storageService = storageService; TestTTSCommand = new DelegateCommand(async() => await TestTTS()); SignOutCommand = new DelegateCommand(async() => await SignOut()); AddWordCommand = new DelegateCommand(async() => await AddWord()); FilterWordsCommand = new DelegateCommand <string>((cat) => GetFilteredWords(cat)); CloseFilteredWordsCommand = new DelegateCommand(CloseFilteredWords); DeleteWordFromSentenceCommand = new DelegateCommand <Word>((word) => DeleteWordFromSentence(word)); TapTestCommand = new DelegateCommand <Word>((word) => TapTest(word)); DeleteWordCommand = new DelegateCommand <Word>(async(word) => await DeleteWord(word)); EditWordCommand = new DelegateCommand <Word>(async(word) => await EditWord(word)); SentenceToRead = new ObservableCollection <Word>(); FilteredWords = new List <Word>(); IsCatListVisible = true; }
public ProductsViewModel(IProductsService productsService, ITextToSpeech textToSpeech) { _productsService = productsService; _textToSpeech = textToSpeech; DownloadProducts(); _textToSpeech.Speak("IoC and DI"); }
public SpeakPageViewModel(INavigationService navigationService, IPageDialogService dialogService, ITextToSpeech textToSpeech) : this() { _navigationService = navigationService; _dialogService = dialogService; _textToSpeech = textToSpeech; }
public EnhanceYourChill(Configuration config, Random random, ITextToSpeech tts, IGuildSpeechQueueCollection ttsQueue) { _config = config; _random = random; _tts = tts; _ttsQueue = ttsQueue; }
private void SetupNotifications() { if (this.notifications != null) { this.notifications.Close(); this.notifications = null; } this.notifications = new NotificationHandler(this.gablarski); var enabledSpeech = new MutableLookup <ITextToSpeech, NotificationType>(); foreach (var enabled in Settings.EnabledNotifications) { Type type = Type.GetType(enabled.Key); if (type == null) { LogManager.GetLogger("Notifications").WarnFormat("Notifier {0} not found", enabled.Key); continue; } object n = Activator.CreateInstance(type); var notifier = n as INotifier; if (notifier != null) { this.notifications.AddNotifier(notifier, enabled); } else if (n is ITextToSpeech) { enabledSpeech.Add((ITextToSpeech)n, enabled); } } if (enabledSpeech.Count > 0) { foreach (var enabled in enabledSpeech) { ITextToSpeech tts = enabled.Key; tts.Media = this.mediaPlayerIntegration; var format = tts.SupportedFormats.OrderByDescending(af => af.SampleRate).FirstOrDefault(); if (format == null) { format = new AudioFormat(WaveFormatEncoding.LPCM, 1, 16, 44100); } var source = this.gablarski.Sources.CreateFake("speech", format, (short)(format.SampleRate / 100)); this.speechSources.Add(tts, source); tts.AudioSource = source; this.gablarski.Audio.Attach(this.audioPlayback, source, new AudioEnginePlaybackOptions()); this.notifications.AddNotifier(tts, enabled); } this.notifications.SpeechReceiver = this.gablarski.Sources; } this.notifications.MediaController = this.mediaPlayerIntegration; }
public DialogsViewModel(ISpeechDialogs dialogs, ITextToSpeech tts) { this.List = new List <ListItemViewModel> { new ListItemViewModel { Text = "Actions", Command = new Command(() => dialogs.Actions(new ActionsConfig("Choose your destiny") .SetShowDialog(this.ShowDialogs) .SetSpeakChoices(true) .Choice("Fatality", () => tts.Speak("Flawless Victory")) .Choice("Friendship", () => tts.Speak("Friendship")) .Choice("Bability", () => tts.Speak("Cute")) )) }, new ListItemViewModel { Text = "Confirm", Command = new Command(async() => { var result = await dialogs.Confirm("Shutdown your phone?", "Yes", "No", this.ShowDialogs); tts.Speak(result ? "Your phone will now self destruct" : "Too Bad"); }) }, new ListItemViewModel { Text = "Prompt", Command = new Command(async() => { var result = await dialogs.Prompt("Tell me your life story.... quickly!"); tts.Speak(result + " - BORING"); }) } }; }
public StoryService(IHackerNewsService hackerNewsService, IStoryRepository storyRepository, IStoryCommentsRepository storyCommentsRepository, ITextToSpeech textToSpeech) { _hackerNewsService = hackerNewsService; _storyRepository = storyRepository; this.storyCommentsRepository = storyCommentsRepository; _textToSpeech = textToSpeech; }
public RepeatingWordsViewModel(INavigationService navigationServcie, IDialogService dialogService, IUnitOfWork unitOfWork, IAnimationService animationService, ITextToSpeech speechService, IFirstLanguage firstLanguageService) : base(navigationServcie, dialogService) { _animationService = animationService; _unitOfWork = unitOfWork; _firstLanguageService = firstLanguageService; _speechService = speechService; Model = new RepeatingWordsModel(); VoiceActingCommand = new Command(async() => await _speechService.Speak(Model.CurrentWord.EngWord)); EditCurrentWordCommand = new Command(async() => { _isEditing = true; await NavigationService.NavigateToAsync <CreateWordViewModel>(Model.CurrentWord); }); EnterTranslateCommand = new Command(async() => { await _animationService.AnimationFade(WorkContainerView, 0); await ShowEnterTranslate(); await _animationService.AnimationFade(WorkContainerView, 1); }); SelectFromWordsCommand = new Command(async() => { await _animationService.AnimationFade(WorkContainerView, 0); await ShowSelectFromWords(); await _animationService.AnimationFade(WorkContainerView, 1); }); LearningCardsCommand = new Command(async() => { await _animationService.AnimationFade(WorkContainerView, 0); await ShowLearningCards(); await _animationService.AnimationFade(WorkContainerView, 1); }); AppearingCommand = new Command(async() => await AppearingPage()); }
public ConversationViewModel(ISpeechRecognizer speech, ITextToSpeech tts) { this.speech = speech; this.tts = tts; this.Start = new Command(() => this.DoConversation()); speech.WhenListeningStatusChanged().Subscribe(x => this.IsListening = x); }
private bool Equals(TTSMessage other) { return(ITTSVoice.Equals(Voice, other.Voice) && string.Equals(Text, other.Text) && TTSDestination.Equals(Destination, other.Destination) && TTSMessageState.Equals(State, other.State) && uint.Equals(NumConsumers, other.NumConsumers) && double.Equals(Duration, other.Duration) && uint.Equals(Key, other.Key) && ITextToSpeech.Equals(TTS, other.TTS)); }
public ConversationViewModel() { this.speech = CrossSpeechRecognition.Current; this.tts = CrossTextToSpeech.Current; this.Start = ReactiveCommand.CreateFromTask(this.DoConversation); this.speech.WhenListeningStatusChanged().Subscribe(x => this.IsListening = x); }
public MoviesDetailPageViewModel(INavigationService navigationService, ITextToSpeech textToSpeech) : base(navigationService) { this.navigationService = navigationService; this.textToSpeech = textToSpeech; SpeakCommand = new DelegateCommand(Speak); }
public MainPageViewModel(ITextToSpeech textToSpeech, IDeviceService device) { _textToSpeech = textToSpeech; SpeakCommand = new DelegateCommand(OnSpeakCommandExecuted, () => !IsExecuting && !string.IsNullOrEmpty(Text)) .ObservesProperty(() => IsExecuting) .ObservesProperty(() => Text); Text = $"This text will be spoken by {device.RuntimePlatform}"; }
private void btnStop_Click(object sender, EventArgs e) { if (_current == null) { return; } _current.Stop(); _current = null; }
private void InitTextToSpeechService() { try { textToSpeechService = DependencyService.Get <ITextToSpeech>(); } catch (Exception ex) { Device.BeginInvokeOnMainThread(async() => { await DisplayAlert("Cannot initialize text to speech service", ex.Message, "OK"); }); } }
public QuoteManager(IQuoteLoader loader, ITextToSpeech tts) { if (Instance != null) { throw new Exception("Can only create a single QuoteManager."); } Instance = this; this.loader = loader; this.tts = tts; Quotes = new ObservableCollection <GreatQuote>(loader.Load()); }
public QuoteManager(IQuoteLoader loader, ITextToSpeech textToSpeech) { if (Instance != null) { throw new Exception("Can only create a single QuoteManager."); } _loader = loader; _textToSpeech = textToSpeech; Quotes = new ObservableCollection <GreatQuoteViewModel>(loader.Load()); }
public HomeController(ILogger <HomeController> logger , MSVisionAPIService visionAPIService , IWebHostEnvironment hostingEnv , ITextToSpeech textToSpeech ) { _logger = logger; _visioinAPIService = visionAPIService; _hostingEnv = hostingEnv; _textToSpeech = textToSpeech; }
private QuoteManager(IQuoteLoader quoteLoader, ITextToSpeech textToSpeech) { if (Instance != null) { throw new Exception("Can only create a single QuoteManager."); } Instance = this; this.loader = quoteLoader; this.tts = textToSpeech; Quotes = new ObservableCollection <GreatQuoteViewModel>(loader.Load()); }
protected override void OnDisappearing() { base.OnDisappearing(); if (_performer != null) _performer.Dispose(); if (_textToSpeech != null) _textToSpeech.Dispose(); //_soundService.Dispose(); _performer = null; _textToSpeech = null; //_soundService = null; }
private void button_Clicked(object sender, EventArgs e) { game.SetButton((Button)sender); if (game.CheckWinner(buttons)) { ITextToSpeech speech = DependencyService.Get <ITextToSpeech>(); if (speech != null) { speech.Speak("Game over"); } GameOverStackLayout.IsVisible = true; } }
public void SayQuote() { ITextToSpeech tts = ServiceLocator.Instance.Resolve <ITextToSpeech>(); if (tts != null) { string text = QuoteText; if (!string.IsNullOrEmpty(Author)) { text += " by " + Author; } tts.Speak(text); } }
private void btnPlay_Click(object sender, EventArgs e) { if (_current != null && !_current.IsStopped()) { MessageBox.Show("Trình phát giọng nói vẫn đang chạy!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (_current != null) { _current.Stop(); } _current = chkVietnamese.Checked ? new Factory().MakeVNSpeech(txtContent.Text) : new Factory().MakeLocal(txtContent.Text); _current.Speak(); }
public ItemsViewModel() { Title = "AC"; Groups = new ObservableCollection <GroupOfItems>(); LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand()); try{ SpeechToText = DependencyService.Get <ISpeechToText>(); TextToSpeech = DependencyService.Get <ITextToSpeech>(); } catch (Exception ex) { Text = ex.Message; UpdateText(); } SetUpSubscribes(); }
internal LoginSession(Client client, AccountId accountId) { if (AccountId.IsNullOrEmpty(accountId)) { throw new ArgumentNullException(nameof(accountId)); } if (client == null) { throw new ArgumentNullException(nameof(client)); } Key = accountId; _accountHandle = accountId.ToString(); _groupHandle = "sg_" + _accountHandle; _client = client; _ttsSubSystem = new TextToSpeech(_client); VxClient.Instance.EventMessageReceived += Instance_EventMessageReceived; }
/// <summary> /// Creates a new TTS message in the NotEnqueued state. /// </summary> /// <param name="text">The text to be synthesized into speech.</param> /// <param name="name">The destination for this message.</param> /// <remarks> /// To synthesize this text into speech and inject it into the destination, /// use ILoginSession.TTS.Speak(), or ILoginSession.TTS.Messages.Enqueue(). /// </remarks> public TTSMessage(string text, TTSDestination destination) { if (text.Length > VivoxCoreInstance.VX_TTS_CHARACTER_COUNT_LIMIT) { throw new ArgumentOutOfRangeException($"{GetType().Name}: {text.Length} exceeds the " + $"{VivoxCoreInstance.VX_TTS_CHARACTER_COUNT_LIMIT} maximum characters allowed for input text"); } _text = text; _destination = destination; _voice = null; _state = TTSMessageState.NotEnqueued; _numConsumers = 0; _duration = 0.0; _key = 0; _ttsSubSystem = null; }
public void SayQuote(GreatQuote quote) { if (quote == null) { throw new ArgumentNullException("quote"); } ITextToSpeech tts = ServiceLocator.Instance.Resolve <ITextToSpeech>(); var text = quote.QuoteText; if (!string.IsNullOrWhiteSpace(quote.Author)) { text += $" by {quote.Author}"; } tts.Speak(text); }
/// <summary> /// Adds a notifier. /// </summary> /// <param name="notifier">The notifier to add.</param> /// <param name="enabledNotifications">The notifications to enable for this <paramref name="notifier"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="notifier"/> or <paramref name="enabledNotifications"/> is <c>null</c>.</exception> public void AddNotifier(ITextToSpeech notifier, IEnumerable <NotificationType> enabledNotifications) { if (notifier == null) { throw new ArgumentNullException("notifier"); } if (enabledNotifications == null) { throw new ArgumentNullException("enabledNotifications"); } lock (this.speechNotifiers) { foreach (NotificationType type in enabledNotifications) { this.speechNotifiers.Add(type, notifier); } } }
public void SayQuote(Quote quote) { if (quote == null) { throw new ArgumentNullException(nameof(quote)); } ITextToSpeech tts = DependencyService.Get <ITextToSpeech>(); if (tts != null) { string text = quote.QuoteText; if (!string.IsNullOrWhiteSpace(quote.Author)) { text += "; by " + quote.Author; } tts.Speak(text); } }
public App(ITextToSpeech textToSpeech) { InitializeComponent(); //var textToSpeach = DependencyService.Get<ITextToSpeech>(); var unityContainer = new UnityContainer(); // register dependencies unityContainer.RegisterType <IProductsService, ProductsService>(); unityContainer.RegisterInstance(typeof(ITextToSpeech), textToSpeech); unityContainer.RegisterInstance(typeof(ProductsViewModel));//optional var unityServiceLocator = new UnityServiceLocator(unityContainer); ServiceLocator.SetLocatorProvider(() => unityServiceLocator); MainPage = new NavigationPage(new ProductsPage()); }
public DependencyPage() { var label = new Label { Text = FirstTextBlock }; var button = new Button { Text = "Dependency Locator", TextColor = Color.White, BackgroundColor = Color.FromHex("#8BC34A") }; button.Clicked += (sender, e) => { ITextToSpeech speaker = DependencyService.Get <ITextToSpeech> (); if (speaker != null) { speaker.Speak(FirstTextBlock); } }; var button2 = new Button { Text = "From Plugin", TextColor = Color.White, BackgroundColor = Color.FromHex("#8BC34A") }; button2.Clicked += (sender, e) => { label.Text = SecondTextBlock; CrossTextToSpeech.Current.Speak(label.Text); }; Content = new StackLayout { Padding = new Thickness(10), Spacing = 10, Children = { label, button, button2 } }; }
public TimeSetRunPage(TimeSet timeSet) { this.TimeSet = timeSet; _isEnglish = timeSet.IsEnglish; Title = "执行倒计时"; BackgroundColor = Color.FromHex("#eee"); _textToSpeech = DependencyService.Get<ITextToSpeech>().New(); _textToSpeech.Inited += _textToSpeech_Init; _textToSpeech.InitedError += _textToSpeech_InitedError; _textToSpeech.Init(TimeSet.VoiceEngine); _soundService = DependencyService.Get<ISoundService>(); // _performer = new Performer(this.TimeSet); _performer.Speak += performer_Speak; _performer.PrepareTick += performer_PrepareTick; _performer.Tick += performer_HeartBeat; _performer.CurrentSecondChanged += performer_CurrentSecondChanged; _performer.StageChanged += performer_StageChanged; InitView(); //_textToSpeech.Speak(timeSet.Name); }
private void SetupTTS () { this.tts = Modules.TextToSpeech.FirstOrDefault (tts => tts.GetType().GetSimpleName() == Settings.TextToSpeech); playPhonetic.Enabled = (this.tts != null); }
public TextToSpeechController(ITextToSpeech textToSpeech,IVoiceEnhancer voiceEnhancer) { _textToSpeech = textToSpeech; _voiceEnhancer = voiceEnhancer; }
public static void SetTextToSpeech (ITextToSpeech speech) { TextToSpeech = speech; }
/// <summary> /// Adds a notifier. /// </summary> /// <param name="notifier">The notifier to add.</param> /// <param name="enabledNotifications">The notifications to enable for this <paramref name="notifier"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="notifier"/> or <paramref name="enabledNotifications"/> is <c>null</c>.</exception> public void AddNotifier(ITextToSpeech notifier, IEnumerable<NotificationType> enabledNotifications) { if (notifier == null) throw new ArgumentNullException ("notifier"); if (enabledNotifications == null) throw new ArgumentNullException ("enabledNotifications"); lock (this.speechNotifiers) { foreach (NotificationType type in enabledNotifications) this.speechNotifiers.Add (type, notifier); } }
/// <summary> /// Removes the notifier. /// </summary> /// <param name="notifier">The notifier to remove.</param> /// <returns><c>true</c> if <paramref name="notifier"/> was found and removed.</returns> /// <exception cref="ArgumentNullException"><paramref name="notifier"/> is <c>null</c>.</exception> public bool RemoveNotifier(ITextToSpeech notifier) { if (notifier == null) throw new ArgumentNullException ("notifier"); bool found = false; lock (this.speechNotifiers) { foreach (var g in new MutableLookup<NotificationType, ITextToSpeech> (this.speechNotifiers).Where (g => g.Contains (notifier))) { if (this.speechNotifiers.Remove (g.Key, notifier)) found = true; } } return found; }
public MainPageViewModel(ITextToSpeech textToSpeech) { _textToSpeech = textToSpeech; SpeakCommand = new DelegateCommand(Speak); }
public SetVolumeContext(ITextToSpeech textToSpeech, IVolumeSetter volumeSetter) { _textToSpeech = textToSpeech; _volumeSetter = volumeSetter; }
/// <summary> /// Constructor /// </summary> /// <param name="speechEngine">The speech engine plugin</param> /// <param name="conversionService">The service to use for converting numbers</param> public PracticeViewModel(ITextToSpeech speechEngine, INumberConversionService conversionService) { _speechEngine = speechEngine; _conversionService = conversionService; }