function now automatically chooses the correct trialfun depending on visual or auditory modality