Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Xna.Framework.Media;
- using System;
- namespace AudioResumeTest
- {
- public interface IMusicPlayer
- {
- bool IsMuted { get; set; }
- bool IsRepeating { get; set; }
- float Volume { get; set; }
- TimeSpan PlayPosition { get; set; }
- void Play(Song s);
- void Play(Song s, TimeSpan startPosition);
- void Stop();
- }
- public class MonoGameMusicPlayer : IMusicPlayer
- {
- public bool IsMuted { get => MediaPlayer.IsMuted; set => MediaPlayer.IsMuted = value; }
- public bool IsRepeating { get => MediaPlayer.IsRepeating; set => MediaPlayer.IsRepeating = value; }
- public float Volume { get => MediaPlayer.Volume; set => MediaPlayer.Volume = value; }
- public TimeSpan PlayPosition { get => MediaPlayer.PlayPosition; set => MediaPlayer.PlayPosition = value; }
- public void Play(Song s)
- {
- MediaPlayer.Play(s);
- }
- public void Play(Song s, TimeSpan startPosition)
- {
- MediaPlayer.Play(s, startPosition);
- }
- public void Stop()
- {
- MediaPlayer.Stop();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement