Landau levels, response functions and magnetic oscillations from a generalized Onsager relation