amixer cset numid=3 <n>
where n is 0=auto, 1=headphones, 2=hdmi (http://elinux.org/R-Pi_Troubleshooting).
At the OpenMAX programming level you can choose between them using the Broadcom OpenMAX extension type OMX_CONFIG_BRCMAUDIOSOURCETYPE
OMX_SetParameter(handle, OMX_IndexConfigBrcmAudioDestination, &arDest)
where arDest.sName can be either "local" or "hdmi". (This is in the hello_audio example.)
When I plug in a USB sound card ALSA can see it as device hw:1 (card 1). I can play to it using
aplay -D hw:1,0 ...
and even set it as the default audio out by adding this to /etc/asound.conf
But how I do I tell OpenMAX to use this as the output device? It still plays to the original devices even if I have reset the ALSA default. Is there some alternative string I should use besides "local" and "hdmi"? If so, how do I figure out what that string is?