All pastes #765676 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-08 07:45 UTC
rendered paste body
    class AudioManager
    {
        private AudioEngine engine;
        private WaveBank waveBank;
        private SoundBank soundBank;

        private Cue cue = null;

        private List<Cue> cueList = new List<Cue>();

        public AudioManager(AudioEngine engine, WaveBank waveBank, SoundBank soundBank)
        {
            this.engine = engine;
            this.waveBank = waveBank;
            this.soundBank = soundBank;
        }

        public void playSound(string name)
        {
            cue = soundBank.GetCue(name);
            cue.Play();
            cueList.Add(cue);
            cue = null;
        }

        public void pauseSound(string name)
        {
            cue = soundBank.GetCue(name);
            if (!cue.IsPaused)
                cue.Pause();

            cue = null;
        }

        public void stopAllSound()
        {
            foreach (Cue c in cueList)
            {
                c.Stop(AudioStopOptions.AsAuthored);
            }
        }

        public void stopOneSound(string name)
        {
            cue = soundBank.GetCue(name);
            if (!cue.IsStopped || !cue.IsStopping)
            {
                cue.Stop(AudioStopOptions.AsAuthored);
                for (int i = cueList.Count - 1; i >= 0; i--)
                {
                    if (cue.Name.ToString() == name)
                    {
                        cueList.RemoveAt(i);
                        return;
                    }
                }
            }

            cue = null;
        }

        public void increaseSpeed(string name, float increment)
        {

        }

        public void increaseAllSpeed(float increment)
        {

        }

        public void decreaseSpeed(string name, float decrement)
        {

        }

        public void decreaseAllSpeed(float decrement)
        {

        }

        public void Update()
        {
            engine.Update();
        }
    }