Fixed numerous issues and added locking

Added thread locking, fixed getPosition, setPosition, unloadSound and proper OpenAL error fetching.
Merge pull request #3175 from wronex/patch-2

Fixed numerous issues and added locking