This project has moved and is read-only. For the latest updates, please go here.

ASIO drivers

Dec 8, 2011 at 1:37 AM


I've been trying, without much success, to get ASIO working, using a Blackmagic Intensity video capture care which offers ASIO drivers. I'm using only four source files from NAudio: ASIODriver, ASIODriverExt, ASIOSampleConvertor (sic), and ASIOStructures. I commented out the SampleConvertor method as it isn't referred to elsewhere in those four files, and caused a huge dependency tree around WaveFormat.

I have it working to the point where I can GetASIODriverByName() and interrogate the device for channel numbers and names, selected and available sample rates, etc. There are a few glitches, including the fact that it claims to have zero inputs and eight outputs, but it seems to be working to some degree.

I can call init() with IntPtr.Zero as SysRef (basically the HWND argument). I'm writing a console app and don't have a HWND to give it, but all accounts state that zero should be fine here and the driver does not complain.

I can't get it to accept a createBuffers() call. Here's what I'm doing, where drv is the ASIODriver instance:



                ASIOBufferInfo buf = new ASIOBufferInfo();
                buf.isInput = true;
                buf.channelNum = 0;
                buf.pBuffer0 = Marshal.AllocHGlobal(960 * 16);
                buf.pBuffer1 = Marshal.AllocHGlobal(960 * 16);

                ASIOCallbacks cbs = new ASIOCallbacks();
                cbs.pbufferSwitch = new ASIOCallbacks.ASIOBufferSwitchCallBack(BufferSwitched);

                IntPtr bufptr = Marshal.AllocHGlobal(Marshal.SizeOf(buf));
                Marshal.StructureToPtr(buf, bufptr, false);

                drv.createBuffers(bufptr, 1, 960 * 16, cbs);

Buffer sizes are hardcoded for convenience while experimenting, would of course be dynamically calculated ordinarily.

Running that causes this:

Error code [ASE_InvalidParameter] while calling ASIO method <createBuffers>, DeckLink ASIO Driver open Failure!

The C# wrapper seems to expose an awful lot of COM interop to the user - I'd be happy to help in any way I can with improving things, but can anyone suggest what might be going on here?

I appreciate it may also be a fault in the Blackmagic driver, but I can't really tell from here.



Dec 12, 2011 at 11:40 AM

have you tried using the ASIOOut class? This is intended to hide the complexity of these C# wrappers from the user