/// <summary> /// 开始播放音频文件 /// </summary> public void Play() { strTmp = ""; strTmp = strTmp.PadLeft(127, Convert.ToChar(" ")); AudioAPI.mciSendString("play media repeat", strTmp, strTmp.Length, 0); mc.state = State.Playing; }
/// <summary> /// 暂停播放音频文件 /// </summary> public void Pause() { strTmp = ""; strTmp = strTmp.PadLeft(128, Convert.ToChar(" ")); ilong = AudioAPI.mciSendString("pause media", strTmp, strTmp.Length, 0); mc.state = State.Puased; }
/// <summary> /// 开始播放音频文件 /// </summary> public void Play(int handle) { strTmp = ""; strTmp = strTmp.PadLeft(127, Convert.ToChar(" ")); //AudioAPI.mciSendString("seek to %0", null, 0, 0); AudioAPI.mciSendString("play media notify", strTmp, strTmp.Length, handle); mc.state = State.Playing; }
/// <summary> /// 停止播放音频文件 /// </summary> public void Stop() { strTmp = ""; strTmp = strTmp.PadLeft(128, Convert.ToChar(" ")); //ilong = AudioAPI.mciSendString("stop media", strTmp, 128, 0); ilong = AudioAPI.mciSendString("close media", strTmp, 128, 0); ilong = AudioAPI.mciSendString("close all", strTmp, 128, 0); mc.state = State.Stoped; }
/// <summary> /// 继续播放音频文件 /// </summary> public void Resume() { if (mc.state == State.Puased) { strTmp = ""; strTmp = strTmp.PadLeft(128, Convert.ToChar(" ")); ilong = AudioAPI.mciSendString("resume media", strTmp, strTmp.Length, 0); mc.state = State.Playing; } }