Functionality17.xaml.cs 1.3 KB
Newer Older
Mattia's avatar
Mattia committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
using System;
using System.Collections.Generic;
using Xamarin.Essentials;
using Xamarin.Forms;

namespace SampleApp.Views
{
    public partial class Functionality17 : ContentPage
    {
        float volume;
        float pitch;
        public Functionality17()
        {
            InitializeComponent();

            volume = 0.5f;
            pitch = 1.0f;

        }

        void Slider_Volume_ValueChanged(System.Object sender, Xamarin.Forms.ValueChangedEventArgs e)
        {
            volume = Convert.ToSingle(e.NewValue);
            var settings = new SpeechOptions()
            {
                Volume = Convert.ToSingle(e.NewValue)
                
            };
            
        }

        void Slider_Pitch_ValueChanged(System.Object sender, Xamarin.Forms.ValueChangedEventArgs e)
        {
            pitch = Convert.ToSingle(e.NewValue);
            var settings = new SpeechOptions()
            {
                Pitch = Convert.ToSingle(e.NewValue)

            };
            
        }

        void Button_Clicked(System.Object sender, System.EventArgs e)
        {
            var settings = new SpeechOptions()
            {
                Volume = volume,
                Pitch = pitch
            };
            TextToSpeech.SpeakAsync(TextToRead.Text, settings);
        }
        
    }
}