Index: src/mlx/common.py
===================================================================
--- src/mlx/common.py	(revision 740)
+++ src/mlx/common.py	(revision 800)
@@ -27,19 +27,4 @@
     pygobject = False
     import gobject
-    try:
-        import pygst
-        pygst.require('0.10')
-        import gst
-
-        def gst_init():
-            pass
-
-        def gst_element_factory_make(what):
-            return gst.element_factory_make(what)
-
-        GST_STATE_PLAYING=gst.STATE_PLAYING
-        GST_MESSAGE_EOS=gst.MESSAGE_EOS
-    except:
-        pass
 else:
     print "Using PyGObject"
@@ -47,18 +32,2 @@
 
     from gi.repository import GObject as gobject
-
-    try:
-        from gi.repository import Gst as gst
-
-        def gst_init():
-            gst.init()
-
-        def gst_element_factory_make(what):
-            return gst.ElementFactory.make(what)
-
-        GST_STATE_PLAYING=gst.State.PLAYING
-        GST_MESSAGE_EOS=gst.MessageType.EOS
-    except:
-        import traceback
-        traceback.print_exc()
-        pass
Index: src/mlx/mlx.py
===================================================================
--- src/mlx/mlx.py	(revision 573)
+++ src/mlx/mlx.py	(revision 800)
@@ -2,5 +2,5 @@
 from config import Config
 from i18n import setLanguage
-from sound import initializeSound, finalizeSound
+from sound import preInitializeSound, initializeSound, finalizeSound
 from util import secondaryInstallation
 from const import VERSION
@@ -78,4 +78,6 @@
     setLanguage(programDirectory, config.getLanguage())
 
+    preInitializeSound()
+
     from .gui.gui import GUI
     gui = GUI(programDirectory, config)
Index: src/mlx/sound.py
===================================================================
--- src/mlx/sound.py	(revision 585)
+++ src/mlx/sound.py	(revision 800)
@@ -157,4 +157,9 @@
     _thread = None
 
+    def preInitializeSound():
+        """Perform any-pre initialization.
+
+        This does nothing on Windows."""
+
     def initializeSound(soundsDirectory):
         """Initialize the sound handling with the given directory containing
@@ -179,79 +184,217 @@
 
 else: # os.name!="nt"
-    import threading
+    from multiprocessing import Process, Queue
+    from threading import Thread, Lock
+
+    COMMAND_STARTSOUND = 1
+    COMMAND_QUIT = 2
+
+    REPLY_FINISHED = 101
+    REPLY_FAILED = 102
+    REPLY_QUIT = 103
+
+    _initialized = False
+    _process = None
+    _thread = None
+    _inQueue = None
+    _outQueue = None
+    _nextReference = 1
+    _ref2Data = {}
+    _lock = Lock()
+
+    def _processFn(inQueue, outQueue):
+        """The function running in the helper process created.
+
+        It tries to load the Gst module. If successful, True is sent back,
+        otherwise False followed by the exception caught and the function
+        quits.
+
+        In case of successful initialization, the directory of the sound files
+        is read, the command reader thread is created and the gobject main loop
+        is executed."""
+        try:
+            import gi.repository
+            gi.require_version("Gst", "1.0")
+            from gi.repository import Gst
+            from gi.repository import GObject as gobject
+
+            Gst.init(None)
+        except Exception, e:
+            outQueue.put(False)
+            outQueue.put(e)
+            return
+
+        outQueue.put(True)
+
+        soundsDirectory = inQueue.get()
+
+        _bins = set()
+
+        mainLoop = None
+
+        def _handlePlayBinMessage(bus, message, bin, reference):
+            """Handle messages related to a playback."""
+            if bin in _bins:
+                if message.type==Gst.MessageType.EOS:
+                    _bins.remove(bin)
+                    if reference is not None:
+                        outQueue.put((REPLY_FINISHED, (reference,)))
+                elif message.type==Gst.MessageType.ERROR:
+                    _bins.remove(bin)
+                    if reference is not None:
+                        outQueue.put((REPLY_FAILED, (reference,)))
+
+        def _handleCommand(command, args):
+            """Handle commands sent to the server."""
+            if command==COMMAND_STARTSOUND:
+                (name, reference) = args
+                try:
+                    playBin = Gst.ElementFactory.make("playbin", "player")
+
+                    bus = playBin.get_bus()
+                    bus.add_signal_watch()
+                    bus.connect("message", _handlePlayBinMessage,
+                                playBin, reference)
+
+                    path = os.path.join(soundsDirectory, name)
+                    playBin.set_property( "uri", "file://%s" % (path,))
+
+                    playBin.set_state(Gst.State.PLAYING)
+                    _bins.add(playBin)
+                except Exception as e:
+                    if reference is not None:
+                        outQueue.put((REPLY_FAILED, (reference,)))
+            elif command==COMMAND_QUIT:
+                outQueue.put((REPLY_QUIT, None))
+                mainLoop.quit()
+
+        def _processCommands():
+            """Process incoming commands.
+
+            It is to be executed in a separate thread and it reads the incoming
+            queue for commands. The commands with their arguments are added to the
+            idle queue of gobject so that _handleCommand will be called by them.
+
+            If COMMAND_QUIT is received, the thread exits."""
+
+            while True:
+                (command, args) = inQueue.get()
+
+                gobject.idle_add(_handleCommand, command, args)
+                if command==COMMAND_QUIT:
+                    break
+
+        commandThread = Thread(target = _processCommands)
+        commandThread.daemon = True
+        commandThread.start()
+
+
+        mainLoop = gobject.MainLoop()
+        mainLoop.run()
+
+        commandThread.join()
+
+    def _handleInQueue():
+        """Handle the incoming queue in the main program.
+
+        It reads the replies sent by the helper process. In case of
+        REPLY_FINISHED and REPLY_FAILED the appropriate callback is called. In
+        case of REPLY_QUIT, the thread quits as well."""
+        while True:
+            (reply, args) = _inQueue.get()
+            if reply==REPLY_FINISHED or reply==REPLY_FAILED:
+                (reference,) = args
+                callback = None
+                extra = None
+                with _lock:
+                    (callback, extra) = _ref2Data.get(reference, (None, None))
+                    if callback is not None:
+                        del _ref2Data[reference]
+                if callback is not None:
+                    callback(reply==REPLY_FINISHED, extra)
+            elif reply==REPLY_QUIT:
+                break
+
+    def preInitializeSound():
+        """Start the sound handling process and create the thread handling the
+        incoming queue."""
+        global _thread
+        global _process
+        global _inQueue
+        global _outQueue
+
+        _inQueue = Queue()
+        _outQueue = Queue()
+
+        _process = Process(target = _processFn, args = (_outQueue, _inQueue))
+        _process.start()
+
+        _thread = Thread(target = _handleInQueue)
+        _thread.daemon = True
+
+    def initializeSound(soundsDirectory):
+        """Initialize the sound handling. It reads a boolean from the incoming
+        queue indicating if the libraries could be loaded by the process.
+
+        If the boolean is True, the thread handling the incoming replies is
+        started and the directory containing the sounds file is written to the
+        output queue.
+
+        Otherwise the exception is read from the queue, and printed with an
+        error message."""
+        global _initialized
+        _initialized = _inQueue.get()
+
+        if _initialized:
+            _thread.start()
+            _outQueue.put(soundsDirectory)
+        else:
+            exception = _inQueue.get()
+            print "The Gst library is missing from your system. It is needed for sound playback on Linux:"
+            print exception
+
+    def startSound(name, finishCallback = None, extra = None):
+        """Start playing back the given sound.
+
+        If a callback is given, a new reference is acquired and the callback is
+        registered with it. Then a COMMAND_STARTSOUND command is written to the
+        output queue"""
+        if _initialized:
+            reference = None
+            if finishCallback is not None:
+                with _lock:
+                    global _nextReference
+                    reference = _nextReference
+                    _nextReference += 1
+                    _ref2Data[reference] = (finishCallback, extra)
+
+            _outQueue.put((COMMAND_STARTSOUND, (name, reference)))
+
+    def finalizeSound():
+        """Finalize the sound handling.
+
+        COMMAND_QUIT is sent to the helper process, and then it is joined."""
+        if _initialized:
+            _outQueue.put((COMMAND_QUIT, None))
+            _process.join()
+            _thread.join()
+
+#------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
+
+if __name__ == "__main__":
     import time
-    try:
-        from common import gst_init, gobject, gst_element_factory_make
-        from common import GST_STATE_PLAYING, GST_MESSAGE_EOS
-
-        _soundsDirectory = None
-        _bins = set()
-
-        def initializeSound(soundsDirectory):
-            """Initialize the sound handling with the given directory containing
-            the sound files."""
-            gst_init()
-            global _soundsDirectory
-            _soundsDirectory = soundsDirectory
-
-        def startSound(name, finishCallback = None, extra = None):
-            """Start playing back the given sound."""
-            try:
-                playBin = gst_element_factory_make("playbin")
-
-                bus = playBin.get_bus()
-                bus.enable_sync_message_emission()
-                bus.add_signal_watch()
-                bus.connect("message", _handlePlayBinMessage,
-                            playBin, finishCallback, extra)
-
-                path = os.path.join(_soundsDirectory, name)
-                playBin.set_property( "uri", "file://%s" % (path,))
-
-                playBin.set_state(GST_STATE_PLAYING)
-                _bins.add(playBin)
-            except Exception, e:
-                print "mlx.sound.startSound: " + str(e)
-                if finishCallback is not None:
-                    finishCallback(False, extra)
-
-        def finalizeSound():
-            """Finalize the sound handling."""
-            pass
-
-        def _handlePlayBinMessage(bus, message, bin, finishCallback, extra):
-            """Handle the end of the playback of a sound file."""
-
-            # if message.type==GST_MESSAGE_EOS:
-            #     _bins.remove(bin)
-            #     if finishCallback is not None:
-            #         finishCallback(True, extra)
-
-    except:
-        print "The Gst library is missing from your system. It is needed for sound playback on Linux"
-        traceback.print_exc()
-        def initializeSound(soundsDirectory):
-            """Initialize the sound handling with the given directory containing
-            the sound files."""
-            pass
-
-        def startSound(name, finishCallback = None, extra = None):
-            """Start playing back the given sound.
-
-            FIXME: it does not do anything currently, but it should."""
-            print "sound.startSound:", name
-
-        def finalizeSound():
-            """Finalize the sound handling."""
-            pass
-
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-
-if __name__ == "__main__":
+
     def callback(result, extra):
         print "callback", result, extra
 
-    initializeSound("e:\\home\\vi\\tmp")
+    preInitializeSound()
+
+    soundsPath = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
+                                              "..", "..", "sounds"))
+    print "soundsPath:", soundsPath
+    initializeSound(soundsPath)
+    startSound("notam.mp3", finishCallback = callback, extra= "notam.mp3")
+    time.sleep(5)
     startSound("malev.mp3", finishCallback = callback, extra="malev.mp3")
     time.sleep(5)
@@ -261,5 +404,9 @@
     time.sleep(5)
     startSound("ding.wav", finishCallback = callback, extra="ding3.wav")
+    time.sleep(5)
+    startSound("dong.wav", finishCallback = callback, extra="dong3.wav")
     time.sleep(50)
 
-#------------------------------------------------------------------------------
+    finalizeSound()
+
+#------------------------------------------------------------------------------
