<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Hi,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>     Thanks for the clarification - now the audio plays just fine.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>     I have now moved on to Audio Input part, and have the same questions -</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">    What is the format of the buffer that contains the data in VRDECallbackAudioIn?</span></div><div
 style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Regards,</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Sriram<br><span class="tab"></span><span class="tab"></span></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Vitali Pelenjow <Vitali.Pelenjow@oracle.com><br> <b><span style="font-weight: bold;">To:</span></b> Sriram Murthy <sriramsm@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> "vbox-dev@virtualbox.org" <vbox-dev@virtualbox.org> <br> <b><span
 style="font-weight: bold;">Sent:</span></b> Friday, June 21, 2013 12:20 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [vbox-dev] VRDEAudtioSamples<br> </font> </div> <div class="y_msg_container"><br>Hi,<br><br>see comments inline.<br><br>On 6/21/2013 12:01 AM, Sriram Murthy wrote:<br>> Hi,<br>>      I am trying to write a simple extension pack for a college <br>> project, that reads the AudioSamples being provided by <br>> VRDEAudioSamples to be played back by an ALSA player.<br>>      As a first step, I want to save the samples to a .wav file, so <br>> that aplay can read it and play it. Towards this, I have the following <br>> questions, and will be glad if someone could<br>>      please answer these questions -<br>>      1) How to convert the various values encoded in VRDEAUDIOFORMAT <br>> to nSamplesPerSec, nAvgBytesPerSec, nBlockAlign and
 other information <br>> required for a wav header?<br>Well, obviously nSamplesPerSec = VRDE_AUDIO_FMT_SAMPLE_FREQ,<br>nAvgBytesPerSec = VRDE_AUDIO_FMT_SAMPLE_FREQ * <br>VRDE_AUDIO_FMT_BYTES_PER_SAMPLE<br>etc.<br><br>>      2) How do I interpret the data in the buffer that is being <br>> provided as part of VRDEAudioSamples?<br>For historical reasons, a sample is always a struct { int64_t <br>leftChannel; int64_t rightChannel; } for all formats.<br>So the pvSamples parameter points to the array of such structures. <br>cSamples is the number of elements in the array.<br>Actually the leftChannel and rightChannel values are limited to 32 bit. <br>That is for a unsigned format<br>the range is from 0 to 0xFFFFFFFF and for signed 0x80000000 to 0x7FFFFFFF.<br><br>>      3) Also, how do I calculate the total number of bytes that are <br>> being passed as part of VRDEAudioSamples?<br>cSamples * sizeof(int64_t) *
 2<br><br>Vitali<br><br><br></div> </div> </div>  </div></body></html>