T
Technics
Ok I will be as clearer as I can (sorry for english/technical
mistakes)
I would like to write an audio application that supports ASIO drivers.
I downloaded the ASIO sdk from Stainberg and I read the docs and
viewed the code provided. The sdk retrieve the varius ASIO drivers
available from windows registry. The various drivers are COM objects
wich must be loaded dinamically after retrieving the CLSID from the
registry.
In C++ this is done by the following statement:
rc = CoCreateInstance(lpdrv->clsid,0,CLSCTX_INPROC_SERVER,lpdrv-
As you can notice the interface CLSID is the same as object's CLSID.
asiodrv type is IASIO:
interface IASIO : public IUnknown
{
virtual ASIOBool init(void *sysHandle) = 0;
virtual void getDriverName(char *name) = 0;
....
virtual ASIOError future(long selector,void *opt) = 0;
virtual ASIOError outputReady() = 0;
};
In C# i tried to do the following:
Type ASIODriverObjectType = Type.GetTypeFromCLSID(drvlist[dID].clsid,
true);
drvlist[dID].asiodrv =
(IASIO)Activator.CreateInstance(ASIODriverObjectType);
where IASIO is the following:
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[Guid("a91eaba1-cf4c-11d3-b96a-00a0c9c7b61a")]
public interface IASIO
{
[return: MarshalAs(UnmanagedType.Bool)]
bool init([In,Out] ref IntPtr sysHandle);
void getDriverName([Out, MarshalAs(UnmanagedType.LPStr)] out
string name);
....
}
1. Is there a way to specify the Guid attribute for the interface
during runtime (or not specify it at all)? Infact if I don't specify
the attribute, I get an E_NOINTERFACE error during conversion into
IASIO at the CreateInstence line.
2. When I call init function from the asiodrv object i created I get
an AccessViolationException can anybody tell me why this happens? Is
my way of doing things correct?
Thank you!
mistakes)
I would like to write an audio application that supports ASIO drivers.
I downloaded the ASIO sdk from Stainberg and I read the docs and
viewed the code provided. The sdk retrieve the varius ASIO drivers
available from windows registry. The various drivers are COM objects
wich must be loaded dinamically after retrieving the CLSID from the
registry.
In C++ this is done by the following statement:
rc = CoCreateInstance(lpdrv->clsid,0,CLSCTX_INPROC_SERVER,lpdrv-
clsid,asiodrv);
As you can notice the interface CLSID is the same as object's CLSID.
asiodrv type is IASIO:
interface IASIO : public IUnknown
{
virtual ASIOBool init(void *sysHandle) = 0;
virtual void getDriverName(char *name) = 0;
....
virtual ASIOError future(long selector,void *opt) = 0;
virtual ASIOError outputReady() = 0;
};
In C# i tried to do the following:
Type ASIODriverObjectType = Type.GetTypeFromCLSID(drvlist[dID].clsid,
true);
drvlist[dID].asiodrv =
(IASIO)Activator.CreateInstance(ASIODriverObjectType);
where IASIO is the following:
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[Guid("a91eaba1-cf4c-11d3-b96a-00a0c9c7b61a")]
public interface IASIO
{
[return: MarshalAs(UnmanagedType.Bool)]
bool init([In,Out] ref IntPtr sysHandle);
void getDriverName([Out, MarshalAs(UnmanagedType.LPStr)] out
string name);
....
}
1. Is there a way to specify the Guid attribute for the interface
during runtime (or not specify it at all)? Infact if I don't specify
the attribute, I get an E_NOINTERFACE error during conversion into
IASIO at the CreateInstence line.
2. When I call init function from the asiodrv object i created I get
an AccessViolationException can anybody tell me why this happens? Is
my way of doing things correct?
Thank you!