core/soundcvt: fix some bugs and switch to generic sample reader/writers