Solution (source code)

= Solution

Use the same <Fourier transform> convention, now in the sense of <tempered distributions>, since the homogeneous oscillations are not integrable. Transforming gives
$$
\bigl[q^2-(\omega+r)^2\bigr]\widetilde\phi(\omega)=0.
$$
Since $q>0$, the two roots are distinct. A <distribution> annihilated by this polynomial is a linear combination of <Dirac delta distributions> at its roots:
$$
\widetilde\phi(\omega)=2\pi A\delta(\omega+r-q)+2\pi B\delta(\omega+r+q).
$$
<Fourier inversion> therefore gives
$$
\boxed{\phi(t)=A e^{i(q-r)t}+B e^{-i(q+r)t}
=e^{-irt}\bigl(C\cos qt+D\sin qt\bigr).}
$$
The constants may be complex. Differentiating the factor $e^{-irt}$ also verifies that the original <ordinary differential equation> reduces to $\ddot\psi+q^2\psi=0$ for $\phi=e^{-irt}\psi$.