Currently, this function behaves unconditionally as if `org-clock-sound' was set to t. I attach a patch of how I fixed it for my needs: