|
@@ -89,7 +89,7 @@ namespace Bmp.WinForms
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- var meta = await Task.Run(() => InputSourceProvider.GetMeta(item.Name));
|
|
|
+ var meta = await Task.Run(() => InputSourceProvider.ReadMeta(item.Name));
|
|
|
if (meta.Error == null)
|
|
|
{
|
|
|
var fileName = Path.GetFileNameWithoutExtension(item.Name);
|
|
@@ -181,7 +181,7 @@ namespace Bmp.WinForms
|
|
|
_inputSource = await Task.Run(() => InputSourceProvider.CreateWaveStream(_currentListViewItem!.Name, _sl?.State?.DecodeDsdToPcm == true));
|
|
|
}
|
|
|
|
|
|
- private async Task DeInitOutputDevice()
|
|
|
+ private async Task DeInitOutputDeviceAsync()
|
|
|
{
|
|
|
var local = _outputDevice;
|
|
|
_outputDevice = null;
|
|
@@ -203,7 +203,7 @@ namespace Bmp.WinForms
|
|
|
|
|
|
private async Task<bool> ReInitOutputDevice()
|
|
|
{
|
|
|
- await DeInitOutputDevice();
|
|
|
+ await DeInitOutputDeviceAsync();
|
|
|
|
|
|
var finalState = EMOJI_PLAY_BIG;
|
|
|
|
|
@@ -355,7 +355,7 @@ namespace Bmp.WinForms
|
|
|
private async Task StopAsync()
|
|
|
{
|
|
|
_playbackState = UIPlaybackState.Stopped;
|
|
|
- await DeInitOutputDevice();
|
|
|
+ await DeInitOutputDeviceAsync();
|
|
|
|
|
|
if (_inputSource != null) await _inputSource.DisposeAsync();
|
|
|
_inputSource = null;
|
|
@@ -392,17 +392,44 @@ namespace Bmp.WinForms
|
|
|
private async Task PauseAsync()
|
|
|
{
|
|
|
_playbackState = UIPlaybackState.Paused;
|
|
|
- await DeInitOutputDevice();
|
|
|
+ await DeInitOutputDeviceAsync();
|
|
|
}
|
|
|
|
|
|
- private void TrackPrev()
|
|
|
+ private async Task TrackPrevAsync()
|
|
|
{
|
|
|
//TODO: 上一曲(按播放模式)
|
|
|
+ if (_currentListViewItem != null)
|
|
|
+ {
|
|
|
+ if (_currentListViewItem.ListView != null)
|
|
|
+ {
|
|
|
+ var nextIndex = _currentListViewItem.Index - 1;
|
|
|
+ if (nextIndex > 0)
|
|
|
+ {
|
|
|
+ await LoadItemAsync(MainListView.Items[nextIndex]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private void TrackNext()
|
|
|
+ private async Task TrackNextAsync()
|
|
|
{
|
|
|
//TODO: 下一曲(按播放模式)
|
|
|
+ if (_currentListViewItem != null)
|
|
|
+ {
|
|
|
+ if (_currentListViewItem.ListView != null)
|
|
|
+ {
|
|
|
+ var nextIndex = _currentListViewItem.Index + 1;
|
|
|
+ if (MainListView.Items.Count > nextIndex)
|
|
|
+ {
|
|
|
+ await LoadItemAsync(MainListView.Items[nextIndex]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //列表最后一项时
|
|
|
+ _playbackState = UIPlaybackState.Stopped;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// ----------------- playback event -----------------
|
|
@@ -420,7 +447,7 @@ namespace Bmp.WinForms
|
|
|
if (e.Exception == null)
|
|
|
{
|
|
|
//TODO: 正常播放结束 下一曲(按播放模式)
|
|
|
- _playbackState = UIPlaybackState.Stopped; //列表最后一项时
|
|
|
+ await TrackNextAsync();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -966,9 +993,9 @@ namespace Bmp.WinForms
|
|
|
|
|
|
private async void PauseButton_Click(object sender, EventArgs e) => await PauseAsync();
|
|
|
|
|
|
- private void PrevButton_Click(object sender, EventArgs e) => TrackPrev();
|
|
|
+ private async void PrevButton_Click(object sender, EventArgs e) => await TrackPrevAsync();
|
|
|
|
|
|
- private void NextButton_Click(object sender, EventArgs e) => TrackNext();
|
|
|
+ private async void NextButton_Click(object sender, EventArgs e) => await TrackNextAsync();
|
|
|
|
|
|
// ----------------- UI event: Others -----------------
|
|
|
|