xbmc/xbmc — pull request #2970 by FernetMenta (2013-07-14 11:38:27+00:00)
Title: grAEken: add ActiveAE as an additional audio engine

@fritsch and I have implemented an additional audio engine ActiveAE. We have just finished the first iteration and want to open discussion.
The name is derived from the active object pattern. ActiveAE is pure event driven. Almost all communication is done by message passing via ports. The high level behavior is implemented using a hierarchical state machine. This is field proven technology, billions of lines of code in the real-time domain work exactly this way.
In this first iteration we focused on architecture and behavior. I am sure there are dozens of little things in the code which can be improved. PRs to this branch are welcome.
ActiveAE is an additional audio engine which can be activated by setting environment variable AE_ENGINE to ACTIVE on Linux and Windows.

Noteworthy:
-	ActiveAE uses ffmpeg for resampling, remapping, and conversion
-	Sox resampler can easily be used by activation through ffmpeg. @FlyingRat has already started this work
-	It can handle planar audio formats. With some additional changes there is no need any more for dvdplayer to convert to float.
-	The viz is in sync with audible audio
-	Proper draining of streams, dvdplayer can change between audio formats without losing some seconds of audio
-	Proper calculation of audio delay across the various stages
-	Keep-alive of AVRs by injecting silent noise into pure silence. (streamsilence)
-	Drainmode (streamsilence =0). Currently only working with ALSA. If no stream is active, the sink gets drained when playing no sound. This has the advantage that GUI sounds are not delayed by the audio buffer length. (some receivers or TVs may be too slow to support this)

Open Topics:
-	@wsoltys has been trying to implement drain for Windows sinks, WIP. As long as this is not implemented streamsilence has to be set to true.
-	Streamsilence has become an important setting and should be moved to gui settings.
-	Rename audio mode ANALOG. Actually it disables bitstreaming