I'm trying to write a program in C++ that is able to burn an Audio CD without gaps between the tracks. From what I found, this has only recently been made possible using IMAPI, but should be possible since Windows XP SP2 and Vista SP1. The problem is that I can't find any example code on how to do this.
What I did find is that I need to use IRawCDImageCreator, which can be burnt with IDiscFormat2RawCD, and which exposes a function AddTrack.
First I used following code, which succeeds, to create the MsftDiscFormat2RawCD object.
IDiscFormat2RawCD *rawCD;
if (!SUCCEEDED(CoCreateInstance(__uuidof(MsftDiscFormat2RawCD), NULL, CLSCTX_INPROC_SERVER, __uuidof(IDiscFormat2RawCD), (LPVOID*)&rawCD))) return -1; Next I try to create the IRawCDImageCreator:
IRawCDImageCreator *imageCreator;
HRESULT res = CoCreateInstance(__uuidof(MsftRawCDImageCreator), NULL, CLSCTX_INPROC_SERVER, __uuidof(IRawCDImageCreator), (LPVOID*)&imageCreator); if (!SUCCEEDED(res)) return -2;
This fails however, with error code E_NOINTERFACE.
The IMAPI Interfaces page appears to indicate that I am using the correct object.
About E_NOINTERFACE I did find this blog post which says something about apartment threading, but I'm not sure how I could change this, and why creating the first object works without problems.