invoke ASIO_StartAudioOutput,MyProcessAudioProcedure,0
invoke Sleep,13000
invoke ASIO_CloseDevice

; this is the callback. 16-bit stereo
MyProcessAudioProcedure proc pData,NumSamples
; here, fill-in pData with NumSamples*4 bytes of audio data (two WORDs)
MyProcessAudioProcedure endp

Now, this has been my aim for some time - easy init/use/close of soundcard. This code for now supports only ASIO, 16-bit stereo, little to none configuration. 48kHz sampling rate is fixed - you can't have 44100Hz on any card (not on my Audigy, at least) :/
But at least, the latency is 96samples :) (well, I used the control panel inside my app at some time, the driver remembers app settings)

It had been a while since I last saw BSOD on my PC, while toying with the ASIO api.
Frustrating, but the ASIO COM object is a mixture of COM, C++ and C-call methods... until I find that out - I got a dozen of BSODs T_T
But finally, it's stable, no BSODs anymore - just fun and speed :>

At some time (not definitely soon) I'll have to convert the code to an easy-to-use .lib, add DirectSound, and supply configuration-dialogs.

To test the example, put a 16-bit stereo "input.wav" file in the current directory. It'll play for 13 seconds
Posted on 2005-11-11 16:26:25 by Ultrano