嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 1 元微信扫码支付:1 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
一款可以录入语音和转换文字的C#源代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace FaceDeal
{
public partial class F_rec : Form
{
//系统录音
[DllImport("winmm.dll", EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
public static extern int mciSendString(
string lpstrCommand,
string lpstrReturnString,
int uReturnLength,
int hwndCallback
);
//系统放 播放音乐 wav mp3
[DllImport("winmm.dll")]
public static extern bool PlaySound(string pszSound, int hmod, int fdwSound);//播放windows音乐,重载
public F_rec()
{
InitializeComponent();
}
private void Start_Click(object sender, EventArgs e)
{
mciSendString("set wave bitpersample 8", "", 0, 0);
mciSendString("set wave samplespersec 20000", "", 0, 0);
mciSendString("set wave channels 2", "", 0, 0);
mciSendString("set wave format tag pcm", "", 0, 0);
mciSendString("open new type WAVEAudio alias movie", "", 0, 0);
mciSendString("record movie", "", 0, 0);
}
private void end_Click(object sender, EventArgs e)
{
string strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
strPath = strPath "/1.wav";
//MessageBox.Show("" strPath);
mciSendString("stop movie", "", 0, 0);
mciSendString("save movie 1.wav", "", 0, 0);
mciSendString("close movie", "", 0, 0);
try
{
if (strPath == "")
{ return; }//为空不放
int SND_FILENAME = 0x00020000;
int SND_ASYNC = 0x0001;
PlaySound(strPath, 0, SND_ASYNC | SND_FILENAME);//播放音乐
}
catch (Exception ex)
{
//myClass.clsLogHelper.m_CreateErrorLogTxt("m_SystemPlayWav win系统放wav文件", strPlayFile, ex.Message.ToString());
}
}
private void m_SystemStopPlayWav()
{
try
{
PlaySound(null, 0, 0x40 | 0x04 | 0x02);
}
catch (Exception ex)
{
//myClass.clsLogHelper.m_CreateErrorLogTxt("m_SystemStopPlayWav win停止放wav文件", "", ex.Message.ToString());
}
}
}
}