using System;

namespace Icarus.SoundEngine {
  /// <summary>
  /// I am a singleton which can be used to retrieve Sound Engine settings.
  /// Members are straightforward to access.
  /// </summary>
  public class SoundSettings {

    #region Singleton Stuff
    /* --------------- */
    /* Singleton Stuff */
    /* --------------- */

    /// <summary>
    /// Singleton instance.
    /// </summary>
    private static SoundSettings instance = new SoundSettings();
        
    /// <summary>
    /// Accessor/Modifier for singleton instance.
    /// </summary>
    public static SoundSettings Instance {
      get { return instance; }
      set { instance = value;}
    }
    #endregion

    #region Instance Variables
    /// <summary>
    /// Maximum number of sound effects that can be simultaneously.
    /// </summary>
    private int n_soundEffects;
    /// <summary>
    /// Maximum number of background music files that can be played simultaneously.
    /// </summary>
    private int n_bgMusic;
    /// <summary>
    /// Volume for sound, ranging from 0 to 100.
    /// </summary>
    private int soundVolume;
    /// <summary>
    /// Volume for music, ranging from 0 to 100.
    /// </summary>
    private int musicVolume;
    #endregion

    #region Accessors/Modifiers
    /* ------------------- */
    /* Accessors/Modifiers */
    /* ------------------- */

    /// <summary>
    /// This sets and accesses the GLOBAL maximum number of 
    /// sound effects that can be played.
    /// </summary>
    public int gs_n_soundEffects {
      get { return this.n_soundEffects; }
      set { this.n_soundEffects = value;}
    }        
        
    /// <summary>
    /// This sets and accesses the GLOBAL maximum number of 
    /// background music files that can be played.
    /// </summary>
    public int gs_n_bgMusic {
      get { return this.n_bgMusic; }
      set { this.n_bgMusic = value;}
    }

    /// <summary>
    /// This sets and accesses the GLOBAL value of volume for sound effects.
    /// </summary>
    public int gs_soundVolume {
      get { return this.soundVolume; }
      set { this.soundVolume = value;}
    }

    /// <summary>
    /// This sets and accesses the GLOBAL value of volume for background music.
    /// </summary>
    public int gs_musicVolume {
      get { return this.musicVolume; }
      set { this.musicVolume = value;}
    }
    #endregion

    #region Initialization
    /* -------------- */
    /* Initialization */
    /* -------------- */

    /// <summary>
    /// Initializes the Sound Settings to the default values for the Game Engine.
    /// </summary>
    private SoundSettings() {
      n_soundEffects = 64;
      n_bgMusic = 5;
      soundVolume = 100;
      musicVolume = 100;
    }

    /// <summary>
    /// Load the Sound Settings from fileName.
    /// Loads defaults then overwrites them with values in File.
    /// </summary>
    /// <param name="fileName">Name of File to load</param>
    private SoundSettings(string fileName) : this() {
    }
    #endregion

  }
}
