For audio out of 3.5mm jack:
sudo amixer cset numid=3 1
If you want it back to auto:
sudo amixer cset numid=3 0
For snes controller Tomee thing working:
I use a cheap usb snes controller copy by a company called Tomee.
I just installed joystick sudo apt-get install joystick
Calibrated and tested it jscal /dev/input/js0 jstest /dev/input/js0
For advmame I had to change a setting in the advmame.rc to help mame recognize the y-axis device_joystick raw
Once set up the gamepad has worked with almost everything I have installed.