public void initialise() { DirectoryInfo soundDirectory = new DirectoryInfo(soundFilesPath); backgroundFilesPath = Path.Combine(soundFilesPath, "background_sounds"); if (!soundDirectory.Exists) { Console.WriteLine("Unable to find sound directory " + soundDirectory.FullName); return; } if (soundPackVersion == -1) { Console.WriteLine("Unable to get sound pack version"); } else if (soundPackVersion < minimumSoundPackVersion) { Console.WriteLine("The sound pack version in use is " + soundPackVersion + " but this version of the app requires version " + minimumSoundPackVersion + " or greater."); Console.WriteLine("You must update your sound pack to run this application"); return; } else { Console.WriteLine("Minimum sound pack version = " + minimumSoundPackVersion + " using sound pack version " + soundPackVersion + " and driver names version " + driverNamesVersion); } if (this.soundCache == null) { soundCache = new SoundCache(new DirectoryInfo(soundFilesPath), new String[] { "numbers", "pearls_of_wisdom", "spotter", "acknowledge" }, sweary, allowCaching); } initialised = true; }
public void Dispose() { if (soundCache != null) { try { soundCache.StopAndUnloadAll(); } catch (Exception) { } soundCache = null; } }