Pages: [1]   Go Down
Author Topic: ADK2012 audio output  (Read 1416 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

refined-apps.com

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

refined-apps.com

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Pages: [1]   Go Up
Jump to: