我用这篇文章来写音频 CD
在这篇文章之后,我可以写音频 CD,但使用更小的 wav 文件(最多 30 分钟的音频文件)
并在线抛出 OutOfMemoryException
IntPtr fileData = Marshal.AllocHGlobal((IntPtr)SizeOnDisc);
public void PrepareStream()
{
byte[] waveData = new byte[SizeOnDisc];
//
// The size of the stream must be a multiple of the sector size 2352
// SizeOnDisc rounds up to the next sector size
//
IntPtr fileData = Marshal.AllocHGlobal((IntPtr)SizeOnDisc);
FileStream fileStream = File.OpenRead(filePath);
int sizeOfHeader = Marshal.SizeOf(typeof(WAV_HEADER));
//
// Skip over the Wav header data, because it only needs the actual data
//
fileStream.Read(waveData, sizeOfHeader, (int)m_fileLength - sizeOfHeader);
Marshal.Copy(waveData, 0, fileData, (int)m_fileLength - sizeOfHeader);
CreateStreamOnHGlobal(fileData, true, out wavStream);
}
我尝试以其他方式创建 IStream,但 IMAPI2 API 给出以下错误 E_IMAPI_DF2RAW_STREAM_NOT_SUPPORTED (HRESULT)0xC0AA060D 提供的音频流无效。
所以,请任何朋友帮我将非常大的 wav 文件写入音频 CD