Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();

            Form1.server = this;
            //recogSAPI = new AudioRecog_SAPI();
            //recogSAPI.RecognitionSuccessful += new AudioRecog.RecognitionSuccessfulDelegate(r_RecognitionSuccessful);
            //recogSphinx = new AudioRecog_CMUSphinx();
            //recogSphinx.RecognitionSuccessful += new AudioRecog.RecognitionSuccessfulDelegate(r_RecognitionSuccessful);
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");
            Talker = new SpeechOut();
            Talker.AddEndpoint("beast", null);
            lwrf = new LWRF();
            clkActions = new Dictionary<string, Tuple<bool, bool,string>>();
            Recog = new AudioRecogHolder();
            Recog.RegisterRecogEngine(new AudioRecog_SAPI());
            Recog.RegisterRecogEngine(new AudioRecog_CMUSphinx());
            Recog.RecognitionSuccessful += new AudioRecogHolder.RecognitionSuccessfulDelegate(Recog_RecognitionSuccessful);
            mControllables = new List<IControllable>();

            //Controllables
            theWorld = TheWorld.CreateTestWorld();
            mControllables.Add(theWorld);
            clk = new AlarmClock();
            clk.ControllableEvent += new IControllableEventDelegate(clk_ControllableEvent);
            mControllables.Add(clk);
            List<Device> devs = theWorld.ListDevicesByCaps(null, EDeviceCapabilities.Special_XBMC);
            if (devs != null)
            {
                foreach (Device d in devs)
                {
                    XBMC xbmc = new XBMC(d.ID, d.Args["port"], d.Args["user"], d.Args["pass"]);
                    if (!xbmc.VerifyConnection())
                    {
                        Form1.updateLog("Couldn't connect to XBMC at " + d.ID + ":" + d.Args["port"],
                            ELogLevel.Warning, ELogType.XBMC);
                        d.Disable();
                        continue;
                    }
                    xbmc.ControllableEvent += new IControllableEventDelegate(xbmc_ControllableEvent);
                    mControllables.Add(xbmc);
                    d.Instance = xbmc;
                }
            }

            protos = new DeviceProtocolMappings();
            protos.SetWorld(theWorld);

            List<string> done = new List<string>();
            foreach (IControllable ic in mControllables)
            {
                Recog.AddControllable(ic);
            }

            p = new AudioProto();
            p.Listen(s_port);
            p.NewAudioStream += new AudioProto.NewAudioStreamDelegate(p_NewAudioStream);

            prog1.Minimum = 0;
            prog1.Maximum = 250;
            prog2.Minimum = 0;
            prog2.Maximum = 250;
            prog3.Minimum = 0;
            prog3.Maximum = 250;
            progCmd1.Minimum = 0;
            progCmd1.Maximum = 250;
            progCmd2.Minimum = 0;
            progCmd2.Maximum = 250;
            progCmd3.Minimum = 0;
            progCmd3.Maximum = 250;
            UpdateControlD += new UpdateControlDelegate(UpdateControl);
            tick = new System.Timers.Timer();
            tick.Elapsed += new ElapsedEventHandler(tick_Elapsed);
            tick.Interval = 1000;
            tick.Start();
        }
Esempio n. 2
0
 public DeviceProtocolMappings()
 {
     mLWRF = new LWRF();
     //AudioProto is handled by AudioProtoConnection
 }