Generalized Heisenberg-Virasoro algebras