JustKernel
Ray Of Hope
Virtualbox- Audio Architecture 3
some code snippets to explain the audio implementation in Virtualbox and how the code changed from earlier QEMU based monolithic blob.
Taking an example of AC97 Device: DevIchAc97.cpp
PPDMGSTVOICEIN voice_pi[2]; // corresponds to 2 LUNS in audio in direction (recording)
+ /** PCM out */
+ PPDMGSTVOICEOUT voice_po[2]; //corresponds to 2 LUNs in audio out direction (playing)
for (lun = 0; lun < 2; lun++)
{
//call intemediate audio driver (DrvAudio) to write the audio to the actual hardware for playing for both the LUNs simultaneously
copied = pThis->pDrv[lun]->pfnWrite(pThis->pDrv[lun], pThis->voice_po[lun], tmpbuf, to_copy);
}
Intermediate audio driver: DrvAudio.c
drvAudioWrite() // implementatio of pfnWrite
{
//calls the host backend to write the audio to the actual audio hardware attached to the host.
bytes = audio_pcm_sw_write(pThis, sw, buf, size);
}
audio_pcm_sw_write function implemented in the host audio driver (host backend) does the task of actually writing the samples on the audio hardware on the host.
mail_to : anshul_makkar@justkernel.com
Tags: audio
Leave a Reply