Are you using Mame32 for Windows? There is a bug in the latest versions of Mame32 where games will work normally, but as you play in a session and swap between games in the interface there will come a point when the sounds goes off. The only way around it is to come out of Mame32 altogether and go back in. This bug is documented on the Mame32 official site and they are no doubt working on it.