Working a CNC shop with three turret presses, we wore plugs. Earmuffs in 94 degree afternoon heat, not so much, it would linger until we got off at 2AM. Flanged plugs were preferred and we cut the cords off as we were working on press brakes, too, and moving material around. Cords would get snagged. Foam was discarded when it got dirty, one time use up to a few days, flanged would go months, even a year. MUCH more economical and that was supplied, which was a huge recommendation considering how frugal management was over expenses. I haven't worked that shop in over ten years - still have the plugs and they still work. Foam is ok for a backup or one time use, but flanged is superior - and what the Army used, too. At one point it was a required unitorm item to wear.
If indoors or under a canopy, double up with plugs and muffs. I've just about got to the point I won't shoot unless it's open air.