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