I guess you might have five hi-hat samples mapped to different note values -- e.g. closed A4, half-closed A#4, half-open B4, open C5, foot-down C#5. Then as you lift your foot off the pedal (value goes from 127 to 0) when you press some key on the keyboard (e.g. D5) the sample that plays back varies from the A4 - C5 key. Ideally, when you put your foot down after the B4 or C5 samples, you'd get C#5.
Or, in a more simple scenario, you have just two samples -- open and closed. If a non-continuous switch is pressed down, when you press a key (D5) you get the closed sample; when the switch is up, you get the open sample.
It's all getting a bit complicated...