本文介绍了如何理解音乐的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...

之前有这个问题,所以有人帮我!!!
但是答案不是我的问题的答案,我想知道音乐的长度,但是这段代码给了我音乐的分量(以字节为单位)...

Hi...

before a had this question so someones help me!!!
but the answers wasn''t answer of my question, i want to know the length of a music but this code give me the weight of a music (in bytes)...

OpenFileDialog dlgOpenFile = new OpenFileDialog();

            String filepath = "";
            string[] str;
            string nomeFich = "";
            dlgOpenFile.Filter = ("MP3 files (*.mp3)|*.mp3");

            if (dlgOpenFile.ShowDialog() == DialogResult.OK)
            {
                filepath = dlgOpenFile.FileName;

                long fileSize = 0;

                System.IO.FileInfo fi = new FileInfo(filepath);

                fileSize = fi.Length;

                progressBar1.Minimum = 0;

                progressBar1.Maximum = (int)fileSize;

                fileSize = fileSize / 1000000;

                for (int indice = 0; indice < fileSize; indice++)
                {
                    progressBar1.Value = indice;

                    SoundPlayer.URL = odf.FileName; 

                } 


在这里fileSize给我音乐的大小(例如5667434)_in bytes_;
如果此代码是错误的,那是什么问题,如果要进行此工作,我们需要另一个代码是什么?

祝你好运!


Here fileSize give me the size of music (e.g 5667434)_in bytes_;
if this code is wrong what''s the problem , if for this work we need another code what is it?

Good Luck!

推荐答案


这篇关于如何理解音乐的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 01:10