我用这篇文章写了音频CD
Creating Audio CDs using IMAPI2
根据这篇文章,我可以编写音频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