Exemplo n.º 1
0
        /// <inheritdoc/>
        public void Play(AudioSampleType type, AudioPriorityBracket priority)
        {
            // Play audio if it is in the correct priority bracket...
            if (priority == AudioPriorityBracket.Pack && !mAudioPlayer.IsPlaying)
            {
                var audioFile = GetAudioSampleFile(type);
                if (audioFile != null)
                {
                    // Play the pack manager audio
                    mAudioPlayer.Play(audioFile.URI);
                }
            }
            // Force.
            else if (priority == AudioPriorityBracket.PackForce)
            {
                // Stop all playing the current audio first...
                foreach (KeyValuePair <AudioSampleType, AudioSample> audio in mAudioSamples)
                {
                    audio.Value.Stop();
                }

                var audioFile = GetAudioSampleFile(type);
                if (audioFile != null)
                {
                    // Play the pack manager priority audio
                    mAudioPlayer.Play(audioFile.URI);
                }
            }
            // Otherwise play lower bracket audio, if the pack manager is not playing atm...
            else if (!mAudioPlayer.IsPlaying)
            {
                // Play on sample bracket
                GetAudioSample(type)?.Play();
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public void Play(AudioSampleType type, AudioPriorityBracket priority = AudioPriorityBracket.Sample)
        {
            // We do not want to play any audio.
            if (IoC.DataContent.PreferencesData.AudioAlertType == AudioAlertType.None)
            {
                return;
            }

            switch (IoC.DataContent.PreferencesData.AudioAlertType)
            {
            // Standard.
            case AudioAlertType.Standard:
                mAudioPacks[AudioAlertType.Standard].Play(type, priority);
                break;

            default:
                // Log it.
                IoC.Logger.Log("A selected audio alert level value is out of box!", LogLevel.Error);
                Debugger.Break();
                break;
            }
        }