code reorganization for re-usage of sample-player