How to avoid clicks in audio playout?


In the JUCE audio demo it’s possible to select a wav-file and then start and stop playout of the selected file. However, a problem I have is that there are clicks in playout if I switch between start and stop back and forth.
Naturally, I would like to avoid this by introducing some fade-in/out.
Can anyone please give me some hints on how (and where) to do this (for instance how to access the playout buffer) ?

Thanks in advance!