override protected void triggerInternal(GameStateData previousGameState, GameStateData currentGameState) { if (AudioPlayer.folderChiefRadioCheck != null) { audioPlayer.playSpotterMessage(new QueuedMessage(SMOKE_TEST, 0, messageFragments: MessageContents(AudioPlayer.folderChiefRadioCheck)), false); } if (NoisyCartesianCoordinateSpotter.folderSpotterRadioCheck != null && !String.Equals(UserSettings.GetUserSettings().getString("spotter_name"), UserSettings.GetUserSettings().getString("chief_name"), StringComparison.InvariantCultureIgnoreCase)) // Don't play this if spotter and chief are the same person. { Thread.Sleep(800); audioPlayer.playSpotterMessage(new QueuedMessage(SMOKE_TEST_SPOTTER, 0, messageFragments: MessageContents(NoisyCartesianCoordinateSpotter.folderSpotterRadioCheck)), false); } PlaybackModerator.SetTracing(true /*enabled*/); DirectoryInfo soundDirectory = new DirectoryInfo(AudioPlayer.soundFilesPath); FileInfo[] filesInSoundDirectory = soundDirectory.GetFiles(); foreach (FileInfo fileInSoundDirectory in filesInSoundDirectory) { if (fileInSoundDirectory.Name == "read_number_tests.txt") { for (int i = 0; i < 10; i++) { audioPlayer.playMessage(new QueuedMessage("int" + i, 0, messageFragments: MessageContents(Utilities.random.Next(3100)), abstractEvent: this)); audioPlayer.wakeMonitorThreadForRegularMessages(DateTime.UtcNow); } for (int i = 0; i < 10; i++) { audioPlayer.playMessage(new QueuedMessage("time" + i, 0, messageFragments: MessageContents(TimeSpan.FromSeconds(Utilities.random.Next(4000) + ((float)Utilities.random.Next(9) / 10f))), abstractEvent: this)); audioPlayer.wakeMonitorThreadForRegularMessages(DateTime.UtcNow); } for (int i = 0; i < 10; i++) { audioPlayer.playMessage(new QueuedMessage("time" + i, 0, messageFragments: MessageContents(TimeSpan.FromSeconds(Utilities.random.Next(60) + ((float)Utilities.random.Next(9) / 10f))), abstractEvent: this)); audioPlayer.wakeMonitorThreadForRegularMessages(DateTime.UtcNow); } for (int i = 0; i < 5; i++) { audioPlayer.playMessage(new QueuedMessage("time" + i, 0, messageFragments: MessageContents(TimeSpan.FromSeconds(Utilities.random.NextDouble())), abstractEvent: this)); audioPlayer.wakeMonitorThreadForRegularMessages(DateTime.UtcNow); } break; } } testDriverNames(); }
private void beepOutInTest() { PlaybackModerator.SetTracing(true /*enabled*/); QueuedMessage inTheMiddleMessage = new QueuedMessage("spotter/in_the_middle", 2); audioPlayer.playSpotterMessage(inTheMiddleMessage, true); Thread.Sleep(5000); audioPlayer.playMessage(new QueuedMessage("position/bad_start", 0, abstractEvent: this)); audioPlayer.wakeMonitorThreadForRegularMessages(DateTime.UtcNow); Thread.Sleep(5000); inTheMiddleMessage = new QueuedMessage("spotter/in_the_middle", 2); audioPlayer.playSpotterMessage(inTheMiddleMessage, true); return; }
private void messageInterruptTest() { PlaybackModerator.SetTracing(true /*enabled*/); List <String> rawDriverNames = new List <string>(); List <MessageFragment> fragments = new List <MessageFragment>(); fragments.Add(MessageFragment.Text(Strategy.folderClearTrackOnPitExit)); fragments.Add(MessageFragment.Text(Strategy.folderWeShouldEmergeInPosition)); fragments.Add(MessageFragment.Integer(12)); fragments.Add(MessageFragment.Text(Strategy.folderBetween)); fragments.Add(MessageFragment.Opponent(makeTempDriver("bakus", rawDriverNames))); fragments.Add(MessageFragment.Text(Strategy.folderAnd)); fragments.Add(MessageFragment.Opponent(makeTempDriver("fillingham", rawDriverNames))); audioPlayer.playMessage(new QueuedMessage("check", 0, messageFragments: fragments, abstractEvent: this)); audioPlayer.wakeMonitorThreadForRegularMessages(DateTime.UtcNow); fragments = new List <MessageFragment>(); fragments.Add(MessageFragment.Text(Strategy.folderClearTrackOnPitExit)); fragments.Add(MessageFragment.Text(Strategy.folderWeShouldEmergeInPosition)); fragments.Add(MessageFragment.Integer(12)); fragments.Add(MessageFragment.Text(Strategy.folderBetween)); fragments.Add(MessageFragment.Opponent(makeTempDriver("bakus", rawDriverNames))); fragments.Add(MessageFragment.Text(Strategy.folderAnd)); fragments.Add(MessageFragment.Opponent(makeTempDriver("fillingham", rawDriverNames))); audioPlayer.playMessage(new QueuedMessage("check", 0, messageFragments: fragments, abstractEvent: this)); audioPlayer.wakeMonitorThreadForRegularMessages(DateTime.UtcNow); Thread.Sleep(2500); audioPlayer.playMessageImmediately(new QueuedMessage(NoisyCartesianCoordinateSpotter.folderEnableSpotter, 0)); QueuedMessage inTheMiddleMessage = new QueuedMessage("spotter/in_the_middle", 0); //inTheMiddleMessage.expiryTime = (DateTime.UtcNow.Ticks / TimeSpan.TicksPerMillisecond) + 2000; audioPlayer.playSpotterMessage(inTheMiddleMessage, true); }