Exemplo n.º 1
0
        private static Voice[] GetVoices()
        {
            Voice[] voices = null;
            var     audio  = Find.Any <InteractionAudio>();

            if (audio != null)
            {
                var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                var assetsRoot  = Path.Combine(userProfile, "Box", "VR Initiatives", "Engineering", "Assets");
                var keyFile     = Path.Combine(assetsRoot, "DevKeys", "azure-speech.txt");
                if (File.Exists(keyFile))
                {
                    var lines         = File.ReadAllLines(keyFile);
                    var azureApiKey   = lines[0];
                    var azureRegion   = lines[1];
                    var cache         = audio.GetCachingStrategy();
                    var voicesDecoder = new JsonFactory <Voice[]>();
                    var voicesClient  = new VoicesClient(azureRegion, azureApiKey, voicesDecoder, cache);
                    var voicesTask    = voicesClient.GetVoicesAsync();
                    voices = voicesTask.Result;
                }
            }

            return(voices);
        }
Exemplo n.º 2
0
        public async Task GetVoiceListClientAsync()
        {
            var voicesClient = new VoicesClient(region, subscriptionKey, new JsonFactory <Voice[]>());
            var voices       = await voicesClient
                               .GetVoicesAsync()
                               .ConfigureAwait(false);

            Assert.IsNotNull(voices);
            Assert.AreNotEqual(0, voices.Length);
        }