1. better c/c++ separation and definitions
2. fix some compilation warnings and errors
3. better cross-platform code
adding a producer-consumer pattern for alsa
(not tested yet...)