Exemple #1
0
        //lime
        //ffmpeg
        public async Task <ActionResult> Index(BingApi ba)
        {
            //      string pathIn = Path.Combine(Server.MapPath("~/Resources/"), "audio.webm");
            // string pathIn = (Path.Combine(@"c:\AZ", "audio.webm"));
            //   string pathOut = Path.Combine(Server.MapPath("~/Resources/"), "audio.wav");
            string serverPath    = Server.MapPath("~/Resources");
            string pathIn        = Path.Combine(serverPath, "audio.webm");
            string pathOut       = Path.Combine(serverPath, "audio.wav");
            string converterPath = Path.Combine(serverPath, "ffmpeg", "ffmpeg.exe");

            Process.Start(converterPath, $"-y -i {pathIn} -acodec pcm_u8 -ar 48000 {pathOut}").WaitForExit(1000);

            try
            {
                await ba.StartButton_Click(pathOut);
            }
            catch (Exception e)
            {
                ba._logText = e.ToString();
            }

            ViewBag.logs = "you can start to speak";
            while (ba._logText == null)
            {
                ;
            }
            ViewBag.logs = ba._logText;
            return(View("Index"));
        }
Exemple #2
0
 public ActionResult Index()
 {
     ba           = new BingApi();
     ViewBag.logs = ba._logText;
     return(View());
 }
Exemple #3
0
        public void CalcularRuta(Location origen, Location destino)
        {
            double          distancia = 0;
            double          duracion  = 0;
            List <Location> locations = Points.getPoints(origen, destino, out distancia, out duracion);
            MapPolyline     routeline = new MapPolyline();

            routeline.Locations       = new LocationCollection();
            routeline.Stroke          = color;
            routeline.StrokeThickness = 5;

            foreach (Location i in locations)
            {
                double latitud  = i.Latitude;
                double longitud = i.Longitude;

                Location t = new Location(latitud, longitud);
                routeline.Locations.Add(t);
            }

            route_layer.Children.Add(routeline);

            //se crea un template para el mapa
            ////TextBlock tb = new TextBlock();
            ////tb.Text = "Distancia: " + distancia / 1000 + " km\nDuración: " + duracion + " Seg";
            ////tb.FontSize = 25;
            ////tb.Background = Brushes.White;
            ////route_layer.AddChild(tb, routeline.Locations[0]);

            if (distancia < 1000)
            {
                panelBusqueda.Distancia = Math.Round(distancia, 2) + " metros";
            }
            else
            {
                panelBusqueda.Distancia = Math.Round(distancia / 1000, 2) + " Kilometros";
            }

            if (duracion < 60)
            {
                panelBusqueda.Tiempo = Math.Round(duracion, 2) + " segundos";
            }
            else if (duracion < 3600)
            {
                panelBusqueda.Tiempo = Math.Round(duracion / 60, 2) + " minutos";
            }
            else
            {
                panelBusqueda.Tiempo = Math.Round(duracion / 60 / 60, 2) + " horas";
            }

            BingApi mc = new BingApi();

            mc.Distancia = distancia;
            mc.Tiempo    = duracion;

            if (ZMX_SeCalcularonDatos != null)
            {
                ZMX_SeCalcularonDatos(this, mc);
            }
        }