File size: 773 Bytes
d82cf6a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import atexit

import pyglet


def get_audio_device_manager():
    global _audio_device_manager

    if _audio_device_manager:
        return _audio_device_manager

    _audio_device_manager = None

    if pyglet.compat_platform == 'win32':
        from pyglet.media.devices.win32 import Win32AudioDeviceManager
        _audio_device_manager = Win32AudioDeviceManager()

    return _audio_device_manager


def _delete_manager():
    """Deletes existing manager. If audio device manager is stored anywhere.
    Required to remove handlers before exit, as it can cause problems with the event system's weakrefs."""
    global _audio_device_manager
    _audio_device_manager = None


global _audio_device_manager
_audio_device_manager = None

atexit.register(_delete_manager)