public void AddAudioFile(AudioModel playfile) { if (PlayList.Contains(playfile) != true) { PlayList.Add(playfile); } }
public bool JumpPlay(int index) { if (PlayList == null) { return(false); } if (index < 0 && index >= PlayList.Count - 1) { return(false); } Closed(); _nowPlayData = PlayList[index]; Open(); SetVolume(PlayVolume); Play(); _playindex = index; return(true); }
public bool PreviousPlay() { if (PlayList == null) { return(false); } if (_playindex - 1 < 0) { return(false); } Closed(); _nowPlayData = PlayList[_playindex - 1]; Open(); SetVolume(PlayVolume); Play(); _playindex = _playindex - 1; return(true); }
public bool NextPlay() { if (PlayList == null) { return(false); } if (_playindex + 1 >= PlayList.Count) { return(false); } Closed(); _nowPlayData = PlayList[_playindex + 1]; Open(); SetVolume(PlayVolume); Play(); _playindex = _playindex + 1; return(true); }
public AudioPlayHelper(List <AudioModel> playList) { PlayList = new List <AudioModel>(playList); _nowPlayData = PlayList[0]; _playindex = 0; var playTimer = new Timer { Enabled = true, Interval = 1000 }; playTimer.Tick += playTimer_Tick; }
public AudioPlayHelper(AudioModel playdata) { _nowPlayData = (AudioModel)playdata.Clone(); PlayList.Add(_nowPlayData); _playindex = 0; var playTimer = new Timer { Enabled = true, Interval = 1000 }; playTimer.Tick += playTimer_Tick; }
public AudioPlayHelper() { _playindex = -1; PlayList = new List <AudioModel>(); _nowPlayData = new AudioModel(); var playTimer = new Timer { Enabled = true, Interval = 1000 }; playTimer.Tick += playTimer_Tick; }
public void RemoveAudioFile(AudioModel playaudio) { if (PlayList.Contains(playaudio) != true) { return; } if (playaudio.Equals(_nowPlayData)) { Closed(); } PlayList.Remove(playaudio); if (_playindex >= 0 && _playindex < PlayList.Count) { _nowPlayData = PlayList[_playindex]; } }
private void playTimer_Tick(object sender, EventArgs e) { if (PlayState != PlayState.Playing) { return; } DoOrder(string.Format("status {0} position", _nowPlayData.AliasMovie), _nowplaytime, _nowplaytime.Capacity); var returntimeThread = new Thread(ThreadReturnTime) { IsBackground = true }; returntimeThread.Start(_nowplaytime); if (!_nowplaytime.Equals(PlayLenght)) { return; } Closed(); _palystate = PlayState.Closed; if (EventAudioPlayEnd != null) { EventAudioPlayEnd(); } if (IsRandLoop) { _random = new Random((int)DateTime.Now.Ticks); _playindex = _random.Next(0, PlayList.Count); _nowPlayData = PlayList[_playindex]; JumpPlay(_playindex); return; } if (IsListLoop) { if (_playindex + 1 >= PlayList.Count) { _playindex = 0; } else { _playindex = _playindex + 1; } _nowPlayData = PlayList[_playindex]; JumpPlay(_playindex); return; } if (!IsSingleLoop) { return; } JumpPlay(_playindex); }