Пример #1
0
        /// <summary>
        /// Plays a sound
        /// </summary>
        /// <param name="sound">Which sound to play</param>
        /// <returns>XACT cue to be used if you want to stop this particular looped sound. Can NOT be ignored.  If the cue returned goes out of scope, the sound stops!!</returns>
        public static SoundEffectInstance Play(eSounds sound)
        {
            SoundEffectInstance returnValue = mSoundEffects[sound].CreateInstance();

            returnValue.Play();
            return(returnValue);
        }
Пример #2
0
    public AudioClip GetSound(eSounds sound)
    {
        for (int i = 0; i < numSoundsPresent; i++)
        {
            if (soundMaps[i].soundType == sound)
            {
                return(soundMaps[i].soundClip);
            }
        }

        return(null);
    }
        public SoundEffectInstance GetInstaceOf(eSounds i_SoundName)
        {
            SoundEffectInstance instance = m_SoundEffects[i_SoundName].CreateInstance();

            if (i_SoundName == eSounds.BGMusic)
            {
                m_BGMusicInstances.Add(instance);
            }
            else
            {
                m_FXInstances.Add(instance);
            }

            return(instance);
        }
Пример #4
0
        private void playSound(eSounds type, bool bSpeaker)
        {
            // Console.Beep(frequency, duration)
            // The frequency ranges between 37 and 32767, although the higher tones are not audible by the human ear.
            // The duration is 1000 for one second.
            switch (type)
            {
            case eSounds.TraceStart:
                if (bSpeaker)
                {
                    Console.Beep(800, 1000);
                }
                else
                {
                    System.Media.SystemSounds.Beep.Play();
                }
                break;

            case eSounds.TraceEnd:
                if (bSpeaker)
                {
                    Console.Beep(800, 250);
                }
                else
                {
                    System.Media.SystemSounds.Beep.Play();
                }
                break;

            case eSounds.TraceError:
                if (bSpeaker)
                {
                    Console.Beep(800, 3000);
                }
                else
                {
                    System.Media.SystemSounds.Exclamation.Play();
                }
                break;

            case eSounds.DriveInserted:
                if (bSpeaker)
                {
                    Console.Beep(800, 500);
                }
                else
                {
                    System.Media.SystemSounds.Asterisk.Play();
                }
                break;

            case eSounds.DriveRemoved:
                if (bSpeaker)
                {
                    Console.Beep(800, 250);
                }
                else
                {
                    System.Media.SystemSounds.Asterisk.Play();
                }
                break;

            case eSounds.CopyStart:
                if (bSpeaker)
                {
                    Console.Beep(800, 500);
                }
                else
                {
                    System.Media.SystemSounds.Hand.Play();
                }
                break;

            case eSounds.CopyEnd:
                if (bSpeaker)
                {
                    Console.Beep(800, 1000);
                }
                else
                {
                    System.Media.SystemSounds.Beep.Play();
                }
                break;
            }
        }
Пример #5
0
 public void PlaySound(eSounds sound)
 {
     AudioSource freeAudioSource = GetFreeAudioSource();
 }
Пример #6
0
 /// <summary>
 /// Plays a sound
 /// </summary>
 /// <param name="sound">Which sound to play</param>
 /// <returns>Nothing!  This cue will play through to completion and then free itself.</returns>
 public static void PlayCue(eSounds sound)
 {
     mSoundEffects[sound].Play();
 }