using System;
using System.Collections.Generic;
using System.Text;

namespace Vortex.Audio {

	/// <summary>
	/// Callback handler for sound stop event
	/// </summary>
	public delegate void SoundStopHandler(SoundStopEventInfo eventInfo);

	/// <summary>
	/// Enumerates possible reasons of sound stop
	/// </summary>
	public enum SoundStopReason {
		///<summary>Sound thread reached its end and finished</summary>
		FinishedPlaying = IrrKlang.StopEventCause.SoundFinishedPlaying,
		///<summary>User stopped sound playing manually</summary>
		StoppedByUser = IrrKlang.StopEventCause.SoundStoppedByUser,
		///<summary>Sound is unexpectedly terminated because of source removal</summary>
		StoppedBySourceRemoval = IrrKlang.StopEventCause.SoundStoppedBySourceRemoval
	}

	/// <summary>
	/// Contains information about sound stop event
	/// </summary>
	public class SoundStopEventInfo {
		private Sound _sound;
		private SoundStopReason _reason;

		/// <summary>
		/// Initializes a new instance of the <see cref="SoundStopEventInfo"/> class.
		/// </summary>
		/// <param name="sound">The sound object.</param>
		/// <param name="reason">The reason of sound stop.</param>
		public SoundStopEventInfo(Sound sound, SoundStopReason reason) {
			_sound = sound;
			_reason = reason;
		}

		/// <summary>
		/// Gets the sound which is stopped.
		/// </summary>
		/// <value>The sound which is stopped.</value>
		public Sound Sound {
			get { return _sound; }
		}

		/// <summary>
		/// Gets the reason of sound stop.
		/// </summary>
		/// <value>The reason of sound stop.</value>
		public SoundStopReason Reason {
			get { return _reason; }
		}
	}
}
