A major shortcoming of theories of long-period magnetic pulsations is the separate treatment of the problems of wave excitation and resonant coupling. This could account for many substantial discrepancies between the waveguide/cavity mode theories and observations. A unified approach leading to a new type of field line resonance excitation mechanism is presented. It is shown that in a steady state the direct coupling of the waveguide modes to the local field line oscillations provides a natural and very efficient transfer of energy from the magnetosheath flow to the shear Alfvén waves deep within the magnetosphere even in the ideal magnetohydrodynamic limit. The role of ionospheric dissipation is examined, and many well-known observational features are recovered. The e-folding lengths of the generated waves are estimated. The presented mechanism of energy transport from the velocity shear into resonant Alfvén waves could play an important role in many applications of solar-terrestrial physics and astrophysics.