private void buildPlaylist() { blankPlaylist(); // For every number in the msgList, look up the corresponding word in enum words // if there is no IWMPMedia object with that name, create one and add it to the new playlist // else just add the one that already exists foreach (int number in msgList) { IWMPMedia clip; words word = (words)number; IWMPMedia dword = dictionary.get_Item(number); if (dword.name == word.ToString()) { playlist.appendItem(dword); } else { string addr = @"Resources\" + word.ToString() + ".wav"; clip = Player.newMedia(addr); clip.name = word.ToString(); playlist.appendItem(clip); } } Player.currentPlaylist = playlist; }
private void buildDictionary() { // Create playlists to hold Dictionary and message dictionary = Player.newPlaylist("Dictionary", null); playlist = Player.newPlaylist("ATIS", null); // For every word in enum words, create a corresponding IWMPMedia object int length = Enum.GetNames(typeof(words)).Length; for (int i = 0; i < length; i++) { words word = (words)i; string addr = @"Resources\" + word.ToString() + ".wav"; if (File.Exists(addr)) { IWMPMedia clip = Player.newMedia(addr); clip.name = word.ToString(); dictionary.appendItem(clip); } else { MessageBox.Show("Could not find the file " + addr); break; } } Player.settings.setMode("loop", true); Player.settings.autoStart = false; }