Ejemplo n.º 1
0
        private void btnMp3Test_Click(object sender, RoutedEventArgs e)
        {
            UpdateInfo();
            // byte folderSeq, fileSeq, playVol;

            if (!getMp3Folder(out byte folderSeq))
            {
                return;
            }
            if (!getMp3File(out byte fileSeq, false))
            {
                return;
            }
            if (!getMp3Vol(out byte playVol))
            {
                return;
            }

            // For MP3 command using 9600bps software serial, it'd be better to add 100ms delay between each command
            UBT.V2_MP3Stop();
            Thread.Sleep(100);
            if (playVol != 255)
            {
                UBT.V2_MP3SetVol(playVol);
                Thread.Sleep(100);
            }
            UBT.V2_MP3PlayFile(folderSeq, fileSeq);
            UpdateInfo(String.Format("播放 {0}档案 {1:0000}", (folderSeq == 0xFF ? "" : string.Format("{0:0000} 目录下的", folderSeq)), fileSeq));
        }