Exemple #1
0
        /** @fn     void PlayCue( string strCueName )
         *  @brief  play a cue, one time
         *  @param  strCueName [in] the name of the cue to play
         */
        public void PlayCue(string strCueName)
        {
            if (m_waveBank.IsPrepared)
            {
                try
                {
                    SoundCue tempCue = new SoundCue(m_soundBank.GetCue(strCueName));
                    tempCue.Play();

                    m_lstSoundsPlaying.Add(tempCue);
                }
                catch (Exception e)
                {
                    Error.Trace("PlayCue Error: " + e.Message);
                }
            }
        }
Exemple #2
0
        /** @fn     void Update()
         *  @brief  update the sound manager - should be done once per frame
         */
        public void Update()
        {
            m_audioEngine.Update();

            ////////////////////////
            //Set the volumes
            m_acMusic.SetVolume(m_fMusicVolume * m_fTotalVolume);
            m_acSounds.SetVolume(m_fSoundVolume * m_fTotalVolume);

            //////////////////////
            //Replay looping sounds and delete finished sounds
            for (int i = 0; i < m_lstSoundsPlaying.Count; ++i)
            {
                SoundCue cue = m_lstSoundsPlaying[i];

                if (cue.IsPlaying == false)
                {
                    if (cue.LoopCount != 0)
                    {
                        SoundCue newCue = new SoundCue(m_soundBank.GetCue(cue.CueName));
                        newCue.LoopCount = cue.LoopCount - 1;

                        newCue.Play();

                        m_lstSoundsPlaying.RemoveAt(i);
                        i--;
                        m_lstSoundsPlaying.Add(newCue);
                    }
                    else //loop count IS 0
                    {
                        m_lstSoundsPlaying.RemoveAt(i);
                        --i;
                    }
                }
            }
        }