private void WriteFormatBlock() { MMCKINFO mmckinfoParentIn = new MMCKINFO(); // Get format info mmckinfoParentIn.ckid = new FourCC("fmt "); mmckinfoParentIn.ckSize = FORMATBLOCKSIZE; MMIOError rc = MMIO.CreateChunk(m_OutputFile, mmckinfoParentIn, RiffChunkFlags.None); MMIO.ThrowExceptionForError(rc); IntPtr ip = Marshal.AllocCoTaskMem(FORMATBLOCKSIZE); try { Marshal.StructureToPtr(m_wfe, ip, false); int iBytes = MMIO.Write(m_OutputFile, ip, FORMATBLOCKSIZE); if (iBytes < 0) { throw new Exception("mmioWrite failed"); } } finally { Marshal.FreeCoTaskMem(ip); } rc = MMIO.Ascend(m_OutputFile, mmckinfoParentIn, 0); MMIO.ThrowExceptionForError(rc); }
private void WriteDataBlock() { MMCKINFO mmckinfoSubchunkIn = new MMCKINFO(); mmckinfoSubchunkIn.ckid = new FourCC("data"); mmckinfoSubchunkIn.ckSize = m_AudioLength; MMIOError rc = MMIO.CreateChunk(m_OutputFile, mmckinfoSubchunkIn, 0); MMIO.ThrowExceptionForError(rc); }
private void WriteWaveHeader() { MMCKINFO mmckinfoParentIn = new MMCKINFO(); mmckinfoParentIn.fccType = new FourCC("WAVE"); mmckinfoParentIn.ckSize = m_AudioLength + m_DataOffset - 8; MMIOError rc = MMIO.CreateChunk(m_OutputFile, mmckinfoParentIn, RiffChunkFlags.CreateRiff); MMIO.ThrowExceptionForError(rc); }