Lionel allows you to do with with Legacy and the sensor tracks now. As for pre-sensor track days it is possible. You;d have to have an isolated block before the crossing and use a relay or IR sensor to know when the locomotive enters the block, and then have circuitry that sends the signals to blow the whistle/horn. The only problem is that you can only run the train one way through the crossing or else it'd signal after the crossing when coming from the other direction.