[vbox-dev] VRDEAudtioSamples

Sriram Murthy sriramsm at yahoo.com
Sat Jun 22 07:33:17 GMT 2013

     Thanks for the clarification - now the audio plays just fine.
     I have now moved on to Audio Input part, and have the same questions -
    What is the format of the buffer that contains the data in VRDECallbackAudioIn?

 From: Vitali Pelenjow <Vitali.Pelenjow at oracle.com>
To: Sriram Murthy <sriramsm at yahoo.com> 
Cc: "vbox-dev at virtualbox.org" <vbox-dev at virtualbox.org> 
Sent: Friday, June 21, 2013 12:20 AM
Subject: Re: [vbox-dev] VRDEAudtioSamples


see comments inline.

On 6/21/2013 12:01 AM, Sriram Murthy wrote:
> Hi,
>      I am trying to write a simple extension pack for a college 
> project, that reads the AudioSamples being provided by 
> VRDEAudioSamples to be played back by an ALSA player.
>      As a first step, I want to save the samples to a .wav file, so 
> that aplay can read it and play it. Towards this, I have the following 
> questions, and will be glad if someone could
>      please answer these questions -
>      1) How to convert the various values encoded in VRDEAUDIOFORMAT 
> to nSamplesPerSec, nAvgBytesPerSec, nBlockAlign and other information 
> required for a wav header?
Well, obviously nSamplesPerSec = VRDE_AUDIO_FMT_SAMPLE_FREQ,

>      2) How do I interpret the data in the buffer that is being 
> provided as part of VRDEAudioSamples?
For historical reasons, a sample is always a struct { int64_t 
leftChannel; int64_t rightChannel; } for all formats.
So the pvSamples parameter points to the array of such structures. 
cSamples is the number of elements in the array.
Actually the leftChannel and rightChannel values are limited to 32 bit. 
That is for a unsigned format
the range is from 0 to 0xFFFFFFFF and for signed 0x80000000 to 0x7FFFFFFF.

>      3) Also, how do I calculate the total number of bytes that are 
> being passed as part of VRDEAudioSamples?
cSamples * sizeof(int64_t) * 2

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20130622/5ea67b43/attachment.html>

More information about the vbox-dev mailing list