/// <summary> /// Play a sound /// </summary> public void Play() { Debug.Assert(this.soundClip != null, "Playing an uninitialized sound!"); this.isPaused = false; this.soundClip = Azul.Audio.playSound(this.fileName, this.willLoop, this.isPaused, true); }
// // Constructors // public AudioSource() : base() { this.soundClip = null; this.fileName = null; this.name = Name.UNINITIALIZED; this.willLoop = false; this.isPaused = true; }
/// <summary> /// For deleting a sound /// </summary> public override void Reset() { this.Stop(); this.soundClip = null; this.fileName = null; this.name = Name.UNINITIALIZED; this.isPaused = true; this.willLoop = false; }
// // Methods // /// <summary> /// Initialized the sound into memory. For manager use only. /// </summary> /// <param name="newFileName"></param> /// <param name="shouldLoop"></param> public void LoadAudio(Name newName, string newFileName, bool shouldLoop) { // Set the names this.name = newName; this.fileName = newFileName; this.willLoop = shouldLoop; this.isPaused = true; // Create the Azul.Sound for this source into memory this.soundClip = null; this.soundClip = Azul.Audio.playSound(this.fileName, this.willLoop, this.isPaused, true); }
/// <summary> /// Stop a sound /// </summary> public void Stop() { this.isPaused = true; // Bail if (this.soundClip == null) { return; } this.Pause(); this.soundClip = Azul.Audio.playSound(this.fileName, this.willLoop, this.isPaused, true); }