public SoundWAV(DisposableI parent, string fileName, int instanceCount, bool looped, Loader.LoadedCallbackMethod loadedCallback) : base(parent) { try { audio = parent.FindParentOrSelfWithException<Audio>(); audio.UpdateCallback += Update; loadedFromContent = true; sound = parent.FindParentOrSelfWithException<RootDisposable>().Content.Load<SoundEffect>(Streams.StripFileExt(fileName)); for (int i = 0; i != instanceCount; ++i) { inactiveInstances.AddLast(new SoundWAVInstance(this, looped)); } } catch (Exception e) { FailedToLoad = true; Loader.AddLoadableException(e); Dispose(); if (loadedCallback != null) loadedCallback(this, false); return; } Loaded = true; if (loadedCallback != null) loadedCallback(this, true); }
public Music(DisposableI parent, string fileName) : base(parent) { audio = parent.FindParentOrSelfWithException<Audio>(); audio.UpdateCallback += Update; song = parent.FindParentOrSelfWithException<RootDisposable>().Content.Load<Song>(Streams.StripFileExt(fileName)); MediaPlayer.IsRepeating = true; }