Refactor functions hasXyzAudio and addXyzAudio to reuse code