pc-king Therefore, it's important that the correct samples are played. So if I release or press the sustain pedal while holding down a key, the other sample must be switched to.
It doesn't work exactly like that. It's only the loud attack portion of a note that has enough energy to excite the open strings (when all dampers are open). However, if you first play a note without the damper pedal and hold it and then press the damper pedal, the resonances will be much lower, especially if you pressed the pedal after the attack portion. In practice you might not even hear them once short time has elapsed. Just switching from the non-sustain sample to the sustain one is wrong and will lead to audible artifacts. This is one particular behavior where Pianoteq is apparently better (or even some digital pianos with modeled resonances such as the recent Yamaha pianos, maybe Kawai too). But IMO, switching from non-damper to damper sample should be done only if there's a re-pedaling immediately after the note is played. Half a second later and it better stays with the original non-damper sample, that would be more realistic than switching to a full-blown damper pedal sample.
The opposite: playing first a note with the damper pedal, holding the note with your finger and then releasing the damper pedal, is a valid case where the samples can be switched though.