public void PlaySoundEffect(SoundEffect effect, FeedbackMode mode) { if (mode == FeedbackMode.Off || effect == SoundEffect.None || (mode == FeedbackMode.Default && Feedback.SoundMode != FeedbackMode.On)) { return; } switch (effect) { case SoundEffect.KeyClick: click.PlaySystemSound(); break; case SoundEffect.Return: modifier.PlaySystemSound(); break; case SoundEffect.Delete: delete.PlaySystemSound(); break; case SoundEffect.Info: notificationPlayer.Play(); break; case SoundEffect.Message: messagePlayer.Play(); break; case SoundEffect.Alert: alertPlayer.Play(); break; case SoundEffect.Alarm: alarmPlayer.Play(); break; case SoundEffect.Error: errorPlayer.Play(); break; } }
public void Play(string folder, string filename) { try { string file = System.IO.Path.Combine("Music", filename); Foundation.NSUrl Soundurl = Foundation.NSUrl.FromFilename(file); player = AVFoundation.AVAudioPlayer.FromUrl(Soundurl); player.CurrentTime = player.Duration * 2; player.NumberOfLoops = 1; player.Volume = 1.0f; player.FinishedPlaying += DidFinishPlaying; player.PrepareToPlay(); player.Play(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("PlaySound: Error: " + e.Message, true); } }
public void Play(int loops = 0) { aVAudioPlayer.NumberOfLoops = loops; aVAudioPlayer.Play(); }