ADK2012 audio output

I'm trying to extend the USBHost/ADK lib to ADK2012. I'm interested in the audio output. Basically, I want to know the audio latency of such a solution.

So far, I find the correct interface (audioIf=1) & endpoint. I set the correct device configuration "1" (I checked this) and try to select the alternate setting that contains an endpoint (alternate setting altSet=1). However, if I check the active alternate setting, I get a 0 back.

The relevant code:

rcode = pUsb->ctrlReq(bAddress, 0 /* control endpoint /,
USB_SETUP_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD| USB_SETUP_RECIPIENT_INTERFACE,
USB_REQUEST_SET_INTERFACE, altSet /
valLo /,0 / valHi /, audioIf / index /, 0 / total /, 0 / bytes /, NULL / data /, NULL / read parser */ );
TRACE_USBHOST(printf("AndroidAccessory2::Init : set interface %d\r\n", rcode); )
if (rcode) {
goto FailSetConf;
}

delay(2000);

rcode = pUsb->ctrlReq(bAddress, 0 /* control endpoint /,
USB_SETUP_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD| USB_SETUP_RECIPIENT_INTERFACE,
USB_REQUEST_GET_INTERFACE, 0 /
valLo /, 0 / valHi /, audioIf / index /, 1 / total /, 1 / bytes /, &alt/ data /, NULL / read parser */ );
TRACE_USBHOST(printf("AndroidAccessory2::Init : alternate setting set %d\r\n", alt); )
if (rcode) {
goto FailSetConf;
}

I compared it with the code from the google ADK2012 download, but cannot find the difference/error. Any tips?

aleu:
I'm trying to extend the USBHost/ADK lib to ADK2012. I'm interested in the audio output. Basically, I want to know the audio latency of such a solution.

So far, I find the correct interface (audioIf=1) & endpoint. I set the correct device configuration "1" (I checked this) and try to select the alternate setting that contains an endpoint (alternate setting altSet=1). However, if I check the active alternate setting, I get a 0 back.

The relevant code:

rcode = pUsb->ctrlReq(bAddress, 0 /* control endpoint /,
USB_SETUP_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD| USB_SETUP_RECIPIENT_INTERFACE,
USB_REQUEST_SET_INTERFACE, altSet /
valLo /,0 / valHi /, audioIf / index /, 0 / total /, 0 / bytes /, NULL / data /, NULL / read parser */ );
TRACE_USBHOST(printf("AndroidAccessory2::Init : set interface %d\r\n", rcode); )
if (rcode) {
goto FailSetConf;
}

delay(2000);

rcode = pUsb->ctrlReq(bAddress, 0 /* control endpoint /,
USB_SETUP_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD| USB_SETUP_RECIPIENT_INTERFACE,
USB_REQUEST_GET_INTERFACE, 0 /
valLo /, 0 / valHi /, audioIf / index /, 1 / total /, 1 / bytes /, &alt/ data /, NULL / read parser */ );
TRACE_USBHOST(printf("AndroidAccessory2::Init : alternate setting set %d\r\n", alt); )
if (rcode) {
goto FailSetConf;
}

I compared it with the code from the google ADK2012 download, but cannot find the difference/error. Any tips?

Perhaps we just need common music player to output Audio via MicroUSB? What code do you use on Due side? I am also interested in Audio out via MicroUSB.

On the due side, I hacked the USBHost lib that comes with the arduino ui.

In the meantime, I got audio out working (more or less) by following the instructions in http://arduino.cc/forum/index.php/topic,139279.0.html. Audio output still stutters slightly and latency is high (> 200ms).

I also checked the switch to alternate setting based on that version. It seems like the android devices switch but don't report the correct alternate setting.

Why don't you just use ADK2012 IDE which already implement USB audio?