They're legal but, like a stereo in the car, if you crank up the tunes loud enough that you can't hear a siren then you're doing a no no. What some people do is speakers w/ earplugs. Some say that it actually makes it easier to hear the tunes and still hear sirens because the plugs touch the speaker and start transferring the sound physically so wind noise doesn't factor in as much.
No, they are not legal. If the speakers inside the helmet cover both ears you are in violation. Notice the code doesn't say they have to be turned on. Negates any argument about on or off.
You can use\wear a speaker in one ear or run earplugs in both. That's it. Your chances of getting caught with with the two speakers? Fairly slim.
Note that this is also the law when riding a bicycle.
As far as wearing earplugs..I always do. They lessen the fatigue you get from the wind noise and protect your hearing. I use these:
http://www.bigearinc.com/Products/BE-SP.aspx