关于画声音波形以及设置录音源遇到的几个问题
谁有这方面的研究,源码太长。 不能贴。。 有研究 或 可以帮忙改改的 留下邮箱,我发你们 。 因为学C#不久。 很多代码东抄西抄,东转转西转转。所以很多地方转不成功。
主要是 winmm.dll 函数的调用。我在C#2005里调用时出现各种各样的错误,以下是一些函数。 我已经实现了波形的显示,但是不准确。 音源设置那里,不知是什么原因 调试时 说 内存已坏 的提示。
// WaveIn calls
[DllImport(mmdll)]
public static extern int waveInGetNumDevs();
[DllImport(mmdll)]
public static extern int waveInAddBuffer(IntPtr hwi, ref WaveHdr pwh, int cbwh);
[DllImport(mmdll)]
public static extern int waveInClose(IntPtr hwi);
[DllImport(mmdll)]
public static extern int waveInOpen(out IntPtr phwi, int uDeviceID, WaveFormat lpFormat, WaveDelegate dwCallback, int dwInstance, int dwFlags);
[DllImport(mmdll)]
public static extern int waveInPrepareHeader(IntPtr hWaveIn, ref WaveHdr lpWaveInHdr, int uSize);
[DllImport(mmdll)]
public static extern int waveInUnprepareHeader(IntPtr hWaveIn, ref WaveHdr lpWaveInHdr, int uSize);
[DllImport(mmdll)]
public static extern int waveInReset(IntPtr hwi);
[DllImport(mmdll)]
public static extern int waveInStart(IntPtr hwi);
[DllImport(mmdll)]
public static extern int waveInStop(IntPtr hwi);
//设置音源dll
[DllImport(mmdll)]
public static extern int mixerGetNumDevs();
[DllImport(mmdll)]
public static extern int mixerOpen(out int phmx,int uMxID,int dwCallback,int dwInstance,int fdwOpen);
[DllImport(mmdll)]
public static extern int mixerClose(int hmx);
[DllImport(mmdll)]
public static extern int mixerGetDevCaps(int uMxID,ref MIXERCAPS pmxcaps,int cbmxcaps);
[DllImport(mmdll)]
public static extern int mixerGetLineControls(int hmxobj,out MIXERLINECONTROLS pmxlc,uint fdwControls);
[DllImport(mmdll)]
public static extern int mixerGetLineInfo(int hmxobj, out MIXERLINE pmxl, uint fdwInf);
[DllImport(mmdll)]
public static extern int mixerGetControlDetails(int hmxobj, out MIXERCONTROLDETAILS pmxlc, int fdwDetails);
[DllImport(mmdll)]
public static extern int mixerSetControlDetails(int hmxobj, out MIXERCONTROLDETAILS pmxcd, uint fdwDetails);