C# 在音频 CD 上写入/刻录大型 wav 文件
我用这篇文章来编写音频 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
I used this article to write Audio CD
Creating Audio CDs using IMAPI2
Following this article i can write Audio CD, but with smaller wav files (upto 30 min audio file)
And OutOfMemoryException is thrown on line
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);
}
I tried to create IStream some other ways but IMAPI2 API gives following error
E_IMAPI_DF2RAW_STREAM_NOT_SUPPORTED
(HRESULT)0xC0AA060D
The provided audio stream is not valid.
So, please can any buddy help me to write very large wav file to Audio CD
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论