C#中函数库方式重复播放MP3音乐

public void play()

        {

            this.TemStr = "";

            this.TemStr = this.TemStr.PadLeft(0x7f, Convert.ToChar(" "));

            APIClass.mciSendString(@"close temp_alias", null, 0, 0);

            //int ret = APIClass.mciSendString(@"open """ + this.TemStr + @""" alias temp_alias", null, 0, 0);

            int ret = APIClass.mciSendString(this.Name, null, 0, 0);

            //int ret = APIClass.mciSendString("play media", this.TemStr, this.TemStr.Length, 0);

            ret = APIClass.mciSendString("play temp_alias repeat", null, 0, 0);

            this.mc.state = State.mPlaying;

        }

这种方式很适合用于开发智能广播系统或是定时闹钟程序。

P.S: 注释掉的两行是用于非重复播放

你可能感兴趣的:(C#)