![]() Starting the specific endpoint device and recording its data flow MessageBox.Show( " No capture device detected and/or connected") If (nCaptureDevices = 0 & nLoopbackDevices = 0) String strLoopbackDevice = (i,ĮnumWasapiDeviceTypes.WASAPI_DEVICE_TYPE_LOOPBACK) Ĭ(strLoopbackDevice) enumerate loopback devices int nLoopbackDevices = 0 Ī (enumWasapiDeviceTypes.WASAPI_DEVICE_TYPE_LOOPBACK,įor ( int i = 0 i < nLoopbackDevices i++) String strCaptureDevice = (i,ĮnumWasapiDeviceTypes.WASAPI_DEVICE_TYPE_CAPTURE) Ĭ(strCaptureDevice) enumerate audio input devices int nCaptureDevices = 0 Ī (enumWasapiDeviceTypes.WASAPI_DEVICE_TYPE_CAPTURE,įor ( int i = 0 i < nCaptureDevices i++) Enumerating various types of audio endpoint devices (render, capture and loopback)Īfter the drivers initialization we can enumerate available audio endpoint devices through the combination of WASAPI.DeviceGetCount and WASAPI.DeviceGetDesc methods that will also allow to fill a couple of combo boxes on the user interface due to the fact that we will use this sample as a recording system, we are mainly interested in enumerating capture and loopback devices while for playback we will use the system default device: MessageBox.Show( " This sample can only work on Windows Vista or higher versions.ĪudioSoundRecorder1.InitRecordingSystem() If (nReturn = enumErrorCodes.ERR_INVALID_PLATFORM) initialize usage of WASAPI audio driversĮnumErrorCodes nReturn = audioSoundRecorder1.InitDriversType (enumDriverTypes.DRIVER_TYPE_WASAPI) Private void Form1_Load( object sender, EventArgs e) NET accesses audio devices through DirectSound and WDM drivers so, in order to leverage WASAPI, we need to specify to the component that we want to use a different kind of drivers through the InitDriversType method, then we can initialize the component through the mandatory call to the InitRecordingSystem method: Initializing the WASAPI subsystem and the component’s recording systemīy default Audio Sound Recorder for. The user interface of our sample application will look like this: In this tutorial we want to see how to start a recording session, from a capture device or from a loopback device, in order to store incoming audio data into an output sound file of a specific audio format with the possibility to playback the same file once the recording session is stopped. Stopping the recording session and the specific audio endpoint device.Starting the specific endpoint device and recording its data flow.Enumerating various types of audio endpoint devices (render, capture and loopback).The main points related to the usage of WASAPI features through the Audio Sound Recorder for. NET allows developers leveraging in a easy way a subset of WASAPI features in order to create and manage audio streams to and from audio endpoint devices inside their applications. NET can be of help in managing WASAPI easilyĪs seen for most of the APIs developed by Microsoft, WASAPI consists of a combination of several COM interfaces whose usage is not always straightforward: Audio Sound Recorder for. Loopback devices are recording devices that capture the mixing of all of the audio streams being rendered by a specific render device, also if audio streams are being played by third-party multimedia application like Windows Media Player: each render device always has a corresponding loopback device.Capture devices are recording devices where audio data flows from the audio endpoint device, that captures the audio stream, to the application. ![]() Render devices are playback devices where audio data flows from the application to the audio endpoint device, which renders the audio stream.One of the new Core Audio APIs is the Windows Audio Session API (also known as WASAPI) which can manage three different types of devices: Starting from Windows Vista, Microsoft has rewritten the multimedia sub-system of the Windows operating system from the ground-up at the same time Microsoft introduced a new API named Core Audio API which allows interacting with the multimedia sub-system and with audio endpoint devices (sound cards).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |