Pulsations, grain condensation, and mass loss in long-period variable stars