Ejemplo n.º 1
0
        public static void Dispose()
        {
            if (GlobalResources.speechRecogniserReference != null)
            {
                GlobalResources.speechRecogniserReference.recognizeAsyncCancel();
                GlobalResources.speechRecogniserReference.stopTriggerRecogniser();

                // these stop calls return immediately but take a millisecond or so to complete their work. Don't
                // attempt to Dispose until this work is (probably) complete. Doing so will make the Dispose call
                // hang for 30 seconds.
                // VL: this seems like the SRE bug where there's a race between recognizeAsyncCancel and Dispose.
                // Alternatively, this could be some mistake in the way we shut SRE down, but I've not found any solution.
                System.Threading.Thread.Sleep(100);

                GlobalResources.speechRecogniserReference.Dispose();
                GlobalResources.speechRecogniserReference = null;
            }

            if (GlobalResources.audioPlayerReference != null)
            {
                GlobalResources.audioPlayerReference.Dispose();
                GlobalResources.audioPlayerReference = null;
            }

            if (GlobalResources.controllerConfigurationReference != null)
            {
                GlobalResources.controllerConfigurationReference.Dispose();
                GlobalResources.controllerConfigurationReference = null;
            }
        }
Ejemplo n.º 2
0
 public CrewChief()
 {
     speechRecogniser = new SpeechRecogniser(this);
     audioPlayer      = new AudioPlayer(this);
     audioPlayer.initialise();
     eventsList.Add("Timings", new Timings(audioPlayer));
     eventsList.Add("Position", new Position(audioPlayer));
     eventsList.Add("LapCounter", new LapCounter(audioPlayer));
     eventsList.Add("LapTimes", new LapTimes(audioPlayer));
     eventsList.Add("Penalties", new Penalties(audioPlayer));
     eventsList.Add("MandatoryPitStops", new MandatoryPitStops(audioPlayer));
     eventsList.Add("Fuel", new Fuel(audioPlayer));
     eventsList.Add("Opponents", new Opponents(audioPlayer));
     eventsList.Add("RaceTime", new RaceTime(audioPlayer));
     eventsList.Add("TyreMonitor", new TyreMonitor(audioPlayer));
     eventsList.Add("EngineMonitor", new EngineMonitor(audioPlayer));
     eventsList.Add("DamageReporting", new DamageReporting(audioPlayer));
     eventsList.Add("PushNow", new PushNow(audioPlayer));
     eventsList.Add("FlagsMonitor", new FlagsMonitor(audioPlayer));
     eventsList.Add("ConditionsMonitor", new ConditionsMonitor(audioPlayer));
     eventsList.Add("OvertakingAidsMonitor", new OvertakingAidsMonitor(audioPlayer));
     sessionEndMessages = new SessionEndMessages(audioPlayer);
     DriverNameHelper.readRawNamesToUsableNamesFiles(AudioPlayer.soundFilesPath);
 }