用C#做一个调用API的MP3播放器

用C#做一个调用API的MP3播放器


2024年5月22日发(作者:)

using System;

using c;

using ;

//using ;

using pServices;

using ;

namespace Mp3Player

{

class MP3

{

public MP3() { }

//定义API函数使用的字符串变量

[MarshalAs(Str, SizeConst = 260)]

private string Name = "";

[MarshalAs(Str, SizeConst = 128)]

private string durLength = "";

[MarshalAs(, SizeConst = 128)]

private string TemStr = "";

int ilong;

//定义播放状态枚举变量

public enum State

{

mPlaying = 1,

mPuase = 2,

mStop = 3

};

//结构变量

public struct structMCI

{

public bool bMut;

public int iDur;

public int iPos;

public int iVol;

public int iBal;

public string iName;

public State state;

};

public structMCI mc = new structMCI();

///

/// 当前播放状态的属性

///

public int GetState

{

get

{

if (ng == )

{

return 1;

}

else if ( == )

{

return 2;

}

return 3;

}

set

{

if (1 == value)

{

= ng;

}

else if (2 == value)

{

= ;

}

else if (3 == value)

{

= ;

}

}

}

///

/// 设计播放时间的显示格式

///

/// Tflag:true时显示前进用用时,false时为剩余时间并有'-'

///

public string PlayerNowTime(bool Tflag)

{

int total = CurrentPosition;

string t = "";

if (Tflag == false)

{

total = Duration - total;

t += "-";

}

int min = total / 60;

int second = total % 60;

if (min < 10)

{

t += "0";

}

t += ng();

t += ":";

if (second < 10)

{

t += "0";

}

t += ng();

return t;

}

///

/// 返回播放总时间

///

///

public string PlayerAllTime()

{


发布者:admin,转转请注明出处:http://www.yc00.com/news/1716338391a2727390.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信