/* Generated by Cython 0.24.1 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "C:\\Python34\\include\\SDL2\\SDL.h",
            "C:\\Python34\\include\\SDL2\\SDL_mixer.h"
        ],
        "extra_compile_args": [
            "-ggdb",
            "-O2"
        ],
        "include_dirs": [
            "C:\\Python34\\include\\SDL2",
            "/usr/local/include/SDL2",
            "/usr/include/SDL2"
        ],
        "libraries": [
            "SDL2",
            "SDL2_mixer"
        ],
        "library_dirs": [
            "C:\\Python34\\libs"
        ]
    },
    "module_name": "audio_interface"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_24_1"
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
  #define CYTHON_USE_PYLONG_INTERNALS 1
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if PY_VERSION_HEX >= 0x030500B1
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
typedef struct {
    unaryfunc am_await;
    unaryfunc am_aiter;
    unaryfunc am_anext;
} __Pyx_PyAsyncMethodsStruct;
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
#else
#define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)

#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__Pinball__mpf_mc__mpfmc__core__audio__audio_interface
#define __PYX_HAVE_API__Pinball__mpf_mc__mpfmc__core__audio__audio_interface
#include "string.h"
#include "stdio.h"
#include "stdlib.h"
#include "SDL.h"
#include "SDL_mixer.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER) && defined (_M_X64)
    #define __Pyx_sst_abs(value) _abs64(value)
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "Pinball\\mpf_mc\\mpfmc\\core\\audio\\audio_interface.pyx",
};

/*--- Type declarations ---*/
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr;
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bytes;
union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bit;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_DuckingSettings;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_DuckingSettings __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_DuckingSettings;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundSettings;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundSettings __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundSettings;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoopState;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoopState __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoopState;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataPlaySound;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataPlaySound __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataPlaySound;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataStopSound;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataStopSound __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataStopSound;
union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageData;
typedef union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageData __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageData;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageDataLooping;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageDataLooping __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageDataLooping;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageDataMarker;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageDataMarker __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageDataMarker;
union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageData;
typedef union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageData __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageData;
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer;
typedef struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer;
struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer_range;
struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player;

/* "audio_interface.pxi":166
 * # ---------------------------------------------------------------------------
 * 
 * cdef enum TrackType:             # <<<<<<<<<<<<<<
 *     # Enumeration of the possible track types
 *     track_type_none = 0
 */
enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackType {
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_none = 0,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_standard = 1,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_playlist = 2,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_live_loop = 3
};

/* "audio_interface.pxi":195
 *     SoundPlayer *sound_players
 * 
 * cdef enum SoundPlayerStatus:             # <<<<<<<<<<<<<<
 *     # Enumeration of the possible sound player status values.
 *     player_idle = 0
 */
enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus {
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle = 0,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_pending = 1,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_replacing = 2,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_fading_in = 3,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_fading_out = 4,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_playing = 5,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_finished = 6,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_stopping = 7
};

/* "audio_interface.pxi":214
 *     Sint32 release_duration
 * 
 * cdef enum DuckingStage:             # <<<<<<<<<<<<<<
 *     ducking_stage_idle = 0
 *     ducking_stage_delay = 1
 */
enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_DuckingStage {
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_ducking_stage_idle = 0,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_ducking_stage_delay = 1,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_ducking_stage_attack = 2,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_ducking_stage_hold = 3,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_ducking_stage_release = 4,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_ducking_stage_finished = 5
};

/* "audio_interface.pxi":222
 *     ducking_stage_finished = 5
 * 
 * cdef enum FadingStatus:             # <<<<<<<<<<<<<<
 *     fading_status_not_fading = 0
 *     fading_status_fading_in = 1
 */
enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus {
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_not_fading = 0,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_fading_in = 1,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_fading_out = 2
};

/* "audio_interface.pxi":293
 * # ---------------------------------------------------------------------------
 * 
 * cdef enum RequestMessage:             # <<<<<<<<<<<<<<
 *     request_not_in_use = 0               # Message is not in use and is available
 *     request_sound_play = 1               # Request to play a sound
 */
enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessage {
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_not_in_use = 0,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_play = 1,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_replace = 2,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_stop = 3,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_stop_looping = 4
};

/* "audio_interface.pxi":335
 * # ---------------------------------------------------------------------------
 * 
 * cdef enum NotificationMessage:             # <<<<<<<<<<<<<<
 *     notification_not_in_use = 0               # Message is not in use and is available
 *     notification_sound_started = 1            # Notification that a sound has started playing
 */
enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage {
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_not_in_use = 0,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_started = 1,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_stopped = 2,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_looping = 3,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_marker = 4,
  __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_player_idle = 5
};

/* "audio_interface.pxi":135
 * # specific data structures used in the MPF media controller audio library:
 * 
 * cdef struct Sample16Bytes:             # <<<<<<<<<<<<<<
 *     # Structure that represents two bytes of a 16-bit sample.  This is used in
 *     # the union below (nested structs are not permitted in Cython so it is
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bytes {
  Uint8 byte0;
  Uint8 byte1;
};

/* "audio_interface.pxi":142
 *     Uint8 byte1
 * 
 * cdef union Sample16Bit:             # <<<<<<<<<<<<<<
 *     # Union structure that represents a single 16-bit sample value.  A union is
 *     # utilized to make it easy to access the individual bytes in the sample.
 */
union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bit {
  Sint16 value;
  struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bytes bytes;
};

/* "audio_interface.pxi":173
 *     track_type_live_loop = 3
 * 
 * ctypedef struct TrackState:             # <<<<<<<<<<<<<<
 *     # Common track state variables (for all track types)
 *     TrackType type
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState {
  enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackType type;
  void *type_state;
  int active;
  int number;
  Uint8 volume;
  int buffer_size;
  void *buffer;
  int ducking_is_active;
  Uint8 ducking_control_points[8];
};

/* "audio_interface.pxi":190
 * # ---------------------------------------------------------------------------
 * 
 * ctypedef struct TrackStandardState:             # <<<<<<<<<<<<<<
 *     # State variables for TrackStandard tracks
 *     int sound_player_count
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState {
  int sound_player_count;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer *sound_players;
};

/* "audio_interface.pxi":206
 *     player_stopping = 7
 * 
 * ctypedef struct DuckingSettings:             # <<<<<<<<<<<<<<
 *     int track_bit_mask
 *     Sint32 attack_start_pos
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_DuckingSettings {
  int track_bit_mask;
  Sint32 attack_start_pos;
  Sint32 attack_duration;
  Uint8 attenuation_volume;
  Sint32 release_start_pos;
  Sint32 release_duration;
};

/* "audio_interface.pxi":227
 *     fading_status_fading_out = 2
 * 
 * ctypedef struct SoundSettings:             # <<<<<<<<<<<<<<
 *     Mix_Chunk *chunk
 *     Uint8 volume
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundSettings {
  struct Mix_Chunk *chunk;
  Uint8 volume;
  int loops_remaining;
  int current_loop;
  Uint32 sample_pos;
  long sound_id;
  long sound_instance_id;
  int sound_priority;
  enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus fading_status;
  Uint32 fade_in_steps;
  Uint32 fade_out_steps;
  Uint32 fade_steps_remaining;
  int marker_count;
  Uint32 markers[8];
  int sound_has_ducking;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_DuckingSettings ducking_settings;
  enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_DuckingStage ducking_stage;
  Uint8 ducking_control_points[8];
};

/* "audio_interface.pxi":247
 *     Uint8 ducking_control_points[CONTROL_POINTS_PER_BUFFER]
 * 
 * ctypedef struct SoundPlayer:             # <<<<<<<<<<<<<<
 *     # The SoundPlayer keeps track of the current sample position in the source audio
 *     # chunk and is also keeps track of variables for sound looping and determining when the
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer {
  enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus status;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundSettings current;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundSettings next;
  int track_num;
  int player;
};

/* "audio_interface.pxi":262
 * # ---------------------------------------------------------------------------
 * 
 * ctypedef struct TrackLiveLoopState:             # <<<<<<<<<<<<<<
 *     # State variables for TrackLiveLoop tracks
 *     SoundPlayer *master_sound_player
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoopState {
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer *master_sound_player;
  int slave_sound_player_count;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer *slave_sound_players;
};

/* "audio_interface.pxi":273
 * # ---------------------------------------------------------------------------
 * 
 * ctypedef struct AudioCallbackData:             # <<<<<<<<<<<<<<
 *     # A pointer to this struct is passed to the main audio callback function and
 *     # is the only way data is made available to the main audio thread.  Must not
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData {
  int sample_rate;
  int audio_channels;
  Uint32 buffer_size;
  Uint8 master_volume;
  int track_count;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState **tracks;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer **request_messages;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **notification_messages;
  struct SDL_mutex *mutex;
  FILE *c_log_file;
};

/* "audio_interface.pxi":301
 * 
 * 
 * ctypedef struct RequestMessageDataPlaySound:             # <<<<<<<<<<<<<<
 *     Mix_Chunk *chunk
 *     Uint8 volume
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataPlaySound {
  struct Mix_Chunk *chunk;
  Uint8 volume;
  int loops;
  int priority;
  Uint32 start_at_position;
  Uint32 fade_in_duration;
  Uint32 fade_out_duration;
  int marker_count;
  Uint32 markers[8];
  int sound_has_ducking;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_DuckingSettings ducking_settings;
};

/* "audio_interface.pxi":314
 *     DuckingSettings ducking_settings
 * 
 * ctypedef struct RequestMessageDataStopSound:             # <<<<<<<<<<<<<<
 *     Uint32 fade_out_duration
 * 
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataStopSound {
  Uint32 fade_out_duration;
};

/* "audio_interface.pxi":317
 *     Uint32 fade_out_duration
 * 
 * ctypedef union RequestMessageData:             # <<<<<<<<<<<<<<
 *     RequestMessageDataPlaySound play
 *     RequestMessageDataStopSound stop
 */
union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageData {
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataPlaySound play;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataStopSound stop;
};

/* "audio_interface.pxi":321
 *     RequestMessageDataStopSound stop
 * 
 * ctypedef struct RequestMessageContainer:             # <<<<<<<<<<<<<<
 *     RequestMessage message
 *     long sound_id
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer {
  enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessage message;
  long sound_id;
  long sound_instance_id;
  int track;
  int player;
  Uint32 time;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageData data;
};

/* "audio_interface.pxi":343
 *     notification_player_idle = 5              # Notification that a player is now idle and ready to play another sound
 * 
 * ctypedef struct NotificationMessageDataLooping:             # <<<<<<<<<<<<<<
 *     int loop_count
 *     int loops_remaining
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageDataLooping {
  int loop_count;
  int loops_remaining;
};

/* "audio_interface.pxi":347
 *     int loops_remaining
 * 
 * ctypedef struct NotificationMessageDataMarker:             # <<<<<<<<<<<<<<
 *     int id
 * 
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageDataMarker {
  int id;
};

/* "audio_interface.pxi":350
 *     int id
 * 
 * ctypedef union NotificationMessageData:             # <<<<<<<<<<<<<<
 *     NotificationMessageDataLooping looping
 *     NotificationMessageDataMarker marker
 */
union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageData {
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageDataLooping looping;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageDataMarker marker;
};

/* "audio_interface.pxi":354
 *     NotificationMessageDataMarker marker
 * 
 * ctypedef struct NotificationMessageContainer:             # <<<<<<<<<<<<<<
 *     NotificationMessage message
 *     long sound_id
 */
struct __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer {
  enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage message;
  long sound_id;
  long sound_instance_id;
  int track;
  int player;
  Uint32 time;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageData data;
};

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1399
 *             buffer_pos += samples_per_control_point
 * 
 * cdef inline void apply_volume_to_buffer_range(Uint8 *buffer, Uint32 start_pos, Uint8 volume, Uint32 length=2) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Applies the specified volume to a range of samples in an audio buffer at the specified
 */
struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer_range {
  int __pyx_n;
  Uint32 length;
};

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2307
 *         return sound_player, lowest_priority
 * 
 *     cdef bint _play_sound_on_sound_player(self, sound_instance, int player, bint force=False):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound using the specified sound player
 */
struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player {
  int __pyx_n;
  int force;
};

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":59
 * #    AudioInterface class
 * # ---------------------------------------------------------------------------
 * cdef class AudioInterface:             # <<<<<<<<<<<<<<
 *     """
 *     The AudioInterface class provides a management wrapper around the SDL2 and SDL_Mixer
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface {
  PyObject_HEAD
  struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_vtab;
  int sample_rate;
  int audio_channels;
  int buffer_samples;
  int buffer_size;
  int supported_formats;
  PyObject *tracks;
  PyObject *mc;
  PyObject *log;
  PyObject *sound_instances_by_id;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *audio_callback_data;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1587
 * #    Track base class
 * # ---------------------------------------------------------------------------
 * cdef class Track:             # <<<<<<<<<<<<<<
 *     """
 *     Track base class
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track {
  PyObject_HEAD
  struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_vtab;
  PyObject *_sound_instances_by_id;
  PyObject *_name;
  int _number;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *_audio_callback_data;
  struct SDL_mutex *mutex;
  PyObject *log;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *state;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1721
 * #    TrackStandard class
 * # ---------------------------------------------------------------------------
 * cdef class TrackStandard(Track):             # <<<<<<<<<<<<<<
 *     """
 *     Track class
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track __pyx_base;
  PyObject *_sound_queue;
  PyObject *_sound_queue_items;
  int _max_simultaneous_sounds;
  int _queue_entry_id;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState *type_state;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2580
 * #    TrackLiveLoop class
 * # ---------------------------------------------------------------------------
 * cdef class TrackLiveLoop(Track):             # <<<<<<<<<<<<<<
 *     """
 *     TrackLiveLoop class
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track __pyx_base;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoopState *type_state;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2722
 * #    MixChunkContainer class
 * # ---------------------------------------------------------------------------
 * cdef class MixChunkContainer:             # <<<<<<<<<<<<<<
 *     """
 *     MixChunkContainer is a wrapper class to manage a SDL_Mixer Mix_Chunk C pointer (points
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer {
  PyObject_HEAD
  struct Mix_Chunk *chunk;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":245
 * 
 *     @staticmethod
 *     def string_to_gain(gain):             # <<<<<<<<<<<<<<
 *         """Converts a string to a gain value (0.0 to 1.0)"""
 *         cdef str gain_string = str(gain).upper()
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain {
  PyObject_HEAD
  PyObject *__pyx_v_gain_string;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":250
 * 
 *         if gain_string.endswith('DB'):
 *             gain_string = ''.join(i for i in gain_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return min(max(AudioInterface.db_to_gain(float(gain_string)), 0.0), 1.0)
 * 
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain *__pyx_outer_scope;
  Py_UCS4 __pyx_v_i;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":270
 * 
 *     @staticmethod
 *     def string_to_secs(time):             # <<<<<<<<<<<<<<
 *         """Decodes a string of real-world time into a float of seconds.
 *         Example inputs:
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs {
  PyObject_HEAD
  PyObject *__pyx_v_time_string;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":289
 * 
 *         if time_string.endswith('MS') or time_string.endswith('MSEC'):
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) / 1000.0
 * 
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *__pyx_outer_scope;
  Py_UCS4 __pyx_v_i;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":293
 * 
 *         elif time_string.endswith('S') or time_string.endswith('SEC'):
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string)
 * 
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *__pyx_outer_scope;
  Py_UCS4 __pyx_v_i;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":297
 * 
 *         elif 'D' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) * 86400
 * 
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *__pyx_outer_scope;
  Py_UCS4 __pyx_v_i;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":301
 * 
 *         elif 'H' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) * 3600
 * 
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *__pyx_outer_scope;
  Py_UCS4 __pyx_v_i;
};


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":305
 * 
 *         elif 'M' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) * 60
 * 
 */
struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *__pyx_outer_scope;
  Py_UCS4 __pyx_v_i;
};



/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":59
 * #    AudioInterface class
 * # ---------------------------------------------------------------------------
 * cdef class AudioInterface:             # <<<<<<<<<<<<<<
 *     """
 *     The AudioInterface class provides a management wrapper around the SDL2 and SDL_Mixer
 */

struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface {
  void (*audio_callback)(void *, Uint8 *, int);
};
static struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface;


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1587
 * #    Track base class
 * # ---------------------------------------------------------------------------
 * cdef class Track:             # <<<<<<<<<<<<<<
 *     """
 *     Track base class
 */

struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track {
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *(*get_state)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *);
};
static struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track;


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1721
 * #    TrackStandard class
 * # ---------------------------------------------------------------------------
 * cdef class TrackStandard(Track):             # <<<<<<<<<<<<<<
 *     """
 *     Track class
 */

struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard {
  struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track __pyx_base;
  int (*_get_idle_sound_player)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *);
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *(*_get_available_request_message)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *);
  PyObject *(*_get_sound_player_with_lowest_priority)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *);
  int (*_play_sound_on_sound_player)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *, PyObject *, int, struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player *__pyx_optional_args);
  int (*_get_player_playing_sound_instance)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *, PyObject *);
};
static struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard;


/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2580
 * #    TrackLiveLoop class
 * # ---------------------------------------------------------------------------
 * cdef class TrackLiveLoop(Track):             # <<<<<<<<<<<<<<
 *     """
 *     TrackLiveLoop class
 */

struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop {
  struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track __pyx_base;
};
static struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* KeywordStringCheck.proto */
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* GetModuleGlobalName.proto */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyThreadStateGet.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = PyThreadState_GET();
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* None.proto */
static CYTHON_INLINE long __Pyx_div_long(long, long);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2,
                                             int is_tuple, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* MergeKeywords.proto */
static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping);

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

/* unicode_iter.proto */
static CYTHON_INLINE int __Pyx_init_unicode_iteration(
    PyObject* ustring, Py_ssize_t *length, void** data, int *kind);

/* ListCompAppend.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* unicode_tailmatch.proto */
static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
                                     Py_ssize_t start, Py_ssize_t end, int direction);

/* pyobject_as_double.proto */
static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj)\
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
 likely(PyInt_CheckExact(obj)) ?\
 PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
#else
#define __Pyx_PyObject_AsDouble(obj)\
((likely(PyFloat_CheckExact(obj))) ?\
 PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#endif

/* PyIntFromDouble.proto */
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value);
#else
#define __Pyx_PyInt_FromDouble(value) PyLong_FromDouble(value)
#endif

/* PyUnicodeContains.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_ContainsTF(PyObject* substring, PyObject* text, int eq) {
    int result = PyUnicode_Contains(text, substring);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* IncludeStringH.proto */
#include <string.h>

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* SaveResetException.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* GetException.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* ListAppend.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* PyErrExceptionMatches.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* ArgTypeTest.proto */
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* PyIntBinop.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* None.proto */
static CYTHON_INLINE int __Pyx_div_int(int, int);

/* UnaryNegOverflows.proto */
#define UNARY_NEG_WOULD_OVERFLOW(x)\
        (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

/* PyObjectSetAttrStr.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

/* py_dict_clear.proto */
#define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0)

/* PyIntBinop.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
    PyObject_RichCompare(op1, op2, Py_EQ)
    #endif

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* GetNameInClass.proto */
static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name);

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint8(Uint8 value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint32(Uint32 value);

static PyObject* __pyx_convert__to_py___pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataStopSound(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataStopSound s);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus value);

/* ClassMethod.proto */
#include "descrobject.h"
static PyObject* __Pyx_Method_ClassMethod(PyObject *method);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE Uint32 __Pyx_PyInt_As_Uint32(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE Uint8 __Pyx_PyInt_As_Uint8(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE Sint32 __Pyx_PyInt_As_Sint32(PyObject *);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* SwapException.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *);
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static int __Pyx_Coroutine_clear(PyObject *self);
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
#endif

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_audio_callback(void *__pyx_v_data, Uint8 *__pyx_v_output_buffer, int __pyx_v_length); /* proto*/
static __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_get_state(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self); /* proto*/
static int __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_idle_sound_player(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto*/
static __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_available_request_message(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_sound_player_with_lowest_priority(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto*/
static int __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance, int __pyx_v_player, struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player *__pyx_optional_args); /* proto*/
static int __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_player_playing_sound_instance(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto*/

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'cpython.pycapsule' */

/* Module declarations from 'cython' */

/* Module declarations from 'Pinball.mpf_mc.mpfmc.core.audio.audio_interface' */
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr = 0;
static PyTypeObject *__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr = 0;
static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_process_request_messages(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *); /*proto*/
static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_process_standard_track_request_message(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *); /*proto*/
static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_standard_track_mix_playing_sounds(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *, Uint32, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *); /*proto*/
static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_end_of_sound_processing(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer *, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **, Uint32); /*proto*/
static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_started_notification(int, int, long, long, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **, Uint32); /*proto*/
static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_stopped_notification(int, int, long, long, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **, Uint32); /*proto*/
static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_looping_notification(int, int, long, long, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **, Uint32); /*proto*/
static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_marker_notification(int, int, long, long, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **, Uint32, int); /*proto*/
static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_track_ducking(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *, Uint32, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *); /*proto*/
static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer_range(Uint8 *, Uint32, Uint8, struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer_range *__pyx_optional_args); /*proto*/
static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer(Uint8 *, int, Uint8); /*proto*/
static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_mix_sound_sample_to_buffer(Uint8 *, Uint32, Uint8, Uint8 *, Uint32); /*proto*/
static CYTHON_INLINE Uint8 __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_lerpU8(float, Uint8, Uint8); /*proto*/
static CYTHON_INLINE float __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_in_out_quad(float); /*proto*/
static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_mix_track_to_output(Uint8 *, Uint8, Uint8 *, Uint32); /*proto*/
static int __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_get_available_notification_message(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **); /*proto*/
#define __Pyx_MODULE_NAME "Pinball.mpf_mc.mpfmc.core.audio.audio_interface"
int __pyx_module_is_main_Pinball__mpf_mc__mpfmc__core__audio__audio_interface = 0;

/* Implementation of 'Pinball.mpf_mc.mpfmc.core.audio.audio_interface' */
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_round;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_KeyError;
static const char __pyx_k_0[] = "0";
static const char __pyx_k_1[] = "1";
static const char __pyx_k_D[] = "D";
static const char __pyx_k_H[] = "H";
static const char __pyx_k_M[] = "M";
static const char __pyx_k_S[] = "S";
static const char __pyx_k_31[] = "31";
static const char __pyx_k_DB[] = "DB";
static const char __pyx_k_MS[] = "MS";
static const char __pyx_k__6[] = "";
static const char __pyx_k_db[] = "db";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_mc[] = "mc";
static const char __pyx_k_SDL[] = "SDL {}.{}.{}";
static const char __pyx_k_SEC[] = "SEC";
static const char __pyx_k__28[] = ".";
static const char __pyx_k_all[] = "__all__";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_num[] = "num";
static const char __pyx_k_ogg[] = "ogg";
static const char __pyx_k_pow[] = "pow";
static const char __pyx_k_put[] = "put";
static const char __pyx_k_wav[] = "wav";
static const char __pyx_k_MSEC[] = "MSEC";
static const char __pyx_k_NONE[] = "NONE";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_flac[] = "flac";
static const char __pyx_k_gain[] = "gain";
static const char __pyx_k_idle[] = "idle";
static const char __pyx_k_info[] = "info";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_load[] = "load";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_math[] = "math";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_rate[] = "rate";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_Empty[] = "Empty";
static const char __pyx_k_Track[] = "Track";
static const char __pyx_k_chunk[] = "chunk";
static const char __pyx_k_clear[] = "clear";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_debug[] = "debug";
static const char __pyx_k_delay[] = "delay";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_loops[] = "loops";
static const char __pyx_k_lower[] = "lower";
static const char __pyx_k_qsize[] = "qsize";
static const char __pyx_k_queue[] = "queue";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_round[] = "round";
static const char __pyx_k_sound[] = "sound";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_upper[] = "upper";
static const char __pyx_k_attack[] = "attack";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_loaded[] = "loaded";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_number[] = "number";
static const char __pyx_k_player[] = "player";
static const char __pyx_k_status[] = "status";
static const char __pyx_k_volume[] = "volume";
static const char __pyx_k_Track_2[] = "<Track.{}.{}>";
static const char __pyx_k_Track_3[] = "Track.";
static const char __pyx_k_disable[] = "disable";
static const char __pyx_k_ducking[] = "ducking";
static const char __pyx_k_enabled[] = "enabled";
static const char __pyx_k_fade_in[] = "fade_in";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_loading[] = "loading";
static const char __pyx_k_logging[] = "logging";
static const char __pyx_k_markers[] = "markers";
static const char __pyx_k_pending[] = "pending";
static const char __pyx_k_playing[] = "playing";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_process[] = "process";
static const char __pyx_k_release[] = "release";
static const char __pyx_k_unknown[] = "unknown";
static const char __pyx_k_version[] = "__version__";
static const char __pyx_k_warning[] = "warning";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_Loaded_s[] = "Loaded %s";
static const char __pyx_k_channels[] = "channels";
static const char __pyx_k_exp_time[] = "exp_time";
static const char __pyx_k_fade_out[] = "fade_out";
static const char __pyx_k_finished[] = "finished";
static const char __pyx_k_priority[] = "priority";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_sound_id[] = "sound_id";
static const char __pyx_k_start_at[] = "start_at";
static const char __pyx_k_stopping[] = "stopping";
static const char __pyx_k_Exception[] = "Exception";
static const char __pyx_k_SDL_Mixer[] = "SDL_Mixer {}.{}.{}";
static const char __pyx_k_container[] = "container";
static const char __pyx_k_fade_in_2[] = "fade in";
static const char __pyx_k_file_name[] = "file_name";
static const char __pyx_k_getLogger[] = "getLogger";
static const char __pyx_k_get_track[] = "get_track";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_replacing[] = "replacing";
static const char __pyx_k_track_num[] = "track_num";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_db_to_gain[] = "db_to_gain";
static const char __pyx_k_fade_out_2[] = "fade out";
static const char __pyx_k_get_nowait[] = "get_nowait";
static const char __pyx_k_initialize[] = "initialize";
static const char __pyx_k_not_fading[] = "not fading";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_sample_pos[] = "sample_pos";
static const char __pyx_k_set_marker[] = "set_marker";
static const char __pyx_k_set_queued[] = "set_queued";
static const char __pyx_k_stop_sound[] = "stop_sound";
static const char __pyx_k_attenuation[] = "attenuation";
static const char __pyx_k_buffer_size[] = "buffer_size";
static const char __pyx_k_c_file_name[] = "c_file_name";
static const char __pyx_k_gain_string[] = "gain_string";
static const char __pyx_k_get_version[] = "get_version";
static const char __pyx_k_has_ducking[] = "has_ducking";
static const char __pyx_k_queue_sound[] = "_queue_sound";
static const char __pyx_k_sample_rate[] = "sample_rate";
static const char __pyx_k_set_expired[] = "set_expired";
static const char __pyx_k_set_looping[] = "set_looping";
static const char __pyx_k_set_pending[] = "set_pending";
static const char __pyx_k_set_playing[] = "set_playing";
static const char __pyx_k_set_stopped[] = "set_stopped";
static const char __pyx_k_time_string[] = "time_string";
static const char __pyx_k_marker_count[] = "marker_count";
static const char __pyx_k_old_instance[] = "old_instance";
static const char __pyx_k_power_of_two[] = "power_of_two";
static const char __pyx_k_set_canceled[] = "set_canceled";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_version_info[] = "__version_info__";
static const char __pyx_k_Initialized_s[] = "Initialized %s";
static const char __pyx_k_PriorityQueue[] = "PriorityQueue";
static const char __pyx_k_TrackLiveLoop[] = ".TrackLiveLoop";
static const char __pyx_k_TrackStandard[] = ".TrackStandard.";
static const char __pyx_k_fading_status[] = "fading_status";
static const char __pyx_k_release_point[] = "release_point";
static const char __pyx_k_status_values[] = "status_values";
static const char __pyx_k_AudioException[] = "AudioException";
static const char __pyx_k_AudioInterface[] = "AudioInterface";
static const char __pyx_k_Track_LiveLoop[] = "<Track.{}.LiveLoop.{}>";
static const char __pyx_k_Track_Standard[] = "<Track.{}.Standard.{}>";
static const char __pyx_k_audio_channels[] = "audio_channels";
static const char __pyx_k_buffer_samples[] = "buffer_samples";
static const char __pyx_k_get_max_tracks[] = "get_max_tracks";
static const char __pyx_k_get_next_sound[] = "_get_next_sound";
static const char __pyx_k_max_queue_time[] = "max_queue_time";
static const char __pyx_k_sound_instance[] = "sound_instance";
static const char __pyx_k_string_to_gain[] = "string_to_gain";
static const char __pyx_k_string_to_secs[] = "string_to_secs";
static const char __pyx_k_track_bit_mask[] = "track_bit_mask";
static const char __pyx_k_get_max_markers[] = "get_max_markers";
static const char __pyx_k_get_sdl_version[] = "get_sdl_version";
static const char __pyx_k_stop_all_sounds[] = "stop_all_sounds";
static const char __pyx_k_Queueing_sound_s[] = "Queueing sound %s";
static const char __pyx_k_SDL_Init_error_s[] = "SDL_Init error - %s";
static const char __pyx_k_fade_out_seconds[] = "fade_out_seconds";
static const char __pyx_k_load_sound_chunk[] = "load_sound_chunk";
static const char __pyx_k_MixChunkContainer[] = "MixChunkContainer";
static const char __pyx_k_fade_out_duration[] = "fade_out_duration";
static const char __pyx_k_py_byte_file_name[] = "py_byte_file_name";
static const char __pyx_k_sound_instance_id[] = "sound_instance_id";
static const char __pyx_k_unload_sound_chunk[] = "unload_sound_chunk";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_audio_callback_data[] = "audio_callback_data";
static const char __pyx_k_fading_status_values[] = "fading_status_values";
static const char __pyx_k_Mix_OpenAudio_error_s[] = "Mix_OpenAudio error - %s";
static const char __pyx_k_get_sdl_mixer_version[] = "get_sdl_mixer_version";
static const char __pyx_k_player_status_to_text[] = "player_status_to_text";
static const char __pyx_k_sound_instances_by_id[] = "sound_instances_by_id";
static const char __pyx_k_Enabling_audio_playback[] = "Enabling audio playback";
static const char __pyx_k_max_simultaneous_sounds[] = "max_simultaneous_sounds";
static const char __pyx_k_remove_sound_from_queue[] = "_remove_sound_from_queue";
static const char __pyx_k_Disabling_audio_playback[] = "Disabling audio playback";
static const char __pyx_k_audio_interface_instance[] = "audio_interface_instance";
static const char __pyx_k_ducking_release_duration[] = "ducking_release_duration";
static const char __pyx_k_Getting_sound_from_queue_s[] = "Getting sound from queue %s";
static const char __pyx_k_player_fading_status_to_text[] = "player_fading_status_to_text";
static const char __pyx_k_process_notification_message[] = "process_notification_message";
static const char __pyx_k_remove_all_sounds_from_queue[] = "_remove_all_sounds_from_queue";
static const char __pyx_k_string_to_gain_locals_genexpr[] = "string_to_gain.<locals>.genexpr";
static const char __pyx_k_string_to_secs_locals_genexpr[] = "string_to_secs.<locals>.genexpr";
static const char __pyx_k_play_sound_on_sound_player_s_s[] = "_play_sound_on_sound_player: %s, %s, %s";
static const char __pyx_k_Add_track_failed_the_track_name[] = "Add track failed - the track name '%s' already exists.";
static const char __pyx_k_All_internal_audio_messages_are[] = "All internal audio messages are currently in use, could not stop sound %s";
static const char __pyx_k_All_sound_players_are_currently[] = "All sound players are currently in use, could not play sound %s";
static const char __pyx_k_Audio_Library_This_library_requ[] = "\nAudio Library\n\nThis library requires both the SDL2 and SDL_Mixer libraries.\n";
static const char __pyx_k_Exception_returned_by_the_audio[] = "Exception returned by the audio module";
static const char __pyx_k_Pinball_mpf_mc_mpfmc_core_audio[] = "Pinball.mpf_mc.mpfmc.core.audio.audio_interface";
static const char __pyx_k_Processing_notification_message[] = "Processing notification message %d for sound instance (id: %d)";
static const char __pyx_k_Received_a_notification_message[] = "Received a notification message for a sound instance (id: %d) that is no longer managed in the audio library. Notification will be discarded.";
static const char __pyx_k_Settings_in_use_rate_d_channels[] = "Settings in use - rate: %d, channels: %d, buffer: %d samples";
static const char __pyx_k_Unable_to_open_audio_for_output[] = "Unable to open audio for output (Mix_OpenAudio failed: %s)";
static const char __pyx_k_play_sound_No_idle_sound_player[] = "play_sound - No idle sound player is available.";
static const char __pyx_k_Add_track_failed_the_maximum_num[] = "Add track failed - the maximum number of tracks (%d) has been reached.";
static const char __pyx_k_Adding_sound_instance_s_to_activ[] = "Adding sound instance %s to active sound dictionary";
static const char __pyx_k_Allocated_track_audio_buffer_d_b[] = "Allocated track audio buffer (%d bytes)";
static const char __pyx_k_Buffer_samples_is_required_to_be[] = "Buffer samples is required to be a power of two";
static const char __pyx_k_D_Development_Pinball_mpf_mc_mpf[] = "D:\\Development\\Pinball\\mpf_mc\\mpfmc\\core\\audio\\audio_interface.pyx";
static const char __pyx_k_Discarding_expired_sound_from_qu[] = "Discarding expired sound from queue %s";
static const char __pyx_k_Must_be_overridden_in_derived_cl[] = "Must be overridden in derived class";
static const char __pyx_k_NOTE_You_may_experience_noise_an[] = "NOTE: You may experience noise and other undesirable sound artifacts when you set your buffer at 1024 or smaller.";
static const char __pyx_k_Next_pending_sound_in_queue_is_s[] = "Next pending sound in queue is still loading, re-queueing sound %s";
static const char __pyx_k_Removing_pending_sound_from_queu[] = "Removing pending sound from queue %s";
static const char __pyx_k_Removing_sound_instance_s_from_a[] = "Removing sound instance %s from active sound dictionary";
static const char __pyx_k_Retrieving_next_pending_sound_fr[] = "Retrieving next pending sound from queue %s";
static const char __pyx_k_Settings_requested_rate_d_channe[] = "Settings requested - rate: %d, channels: %d, buffer: %d samples";
static const char __pyx_k_Shutting_down_and_cleaning_up_al[] = "Shutting down and cleaning up allocated memory...";
static const char __pyx_k_Sound_s_is_set_to_begin_playback[] = "Sound %s is set to begin playback on player %d (loops=%d)";
static const char __pyx_k_Specified_sound_is_not_loaded_co[] = "Specified sound is not loaded, could not play sound %s";
static const char __pyx_k_Status_Player_d_Status_s_Sound_d[] = "Status - Player %d: Status=%s, Sound=%d, SoundInstance=%dPriority=%d, Loops=%d, SamplePos=%d";
static const char __pyx_k_Stopping_all_sounds_and_removing[] = "Stopping all sounds and removing any pending sounds from queue";
static const char __pyx_k_Stopping_sound_s_and_removing_an[] = "Stopping sound %s and removing any pending instances from queue";
static const char __pyx_k_The_maximum_number_of_simultaneo[] = "The maximum number of simultaneous sounds per track is %d";
static const char __pyx_k_The_minimum_number_of_simultaneo[] = "The minimum number of simultaneous sounds per track is 1";
static const char __pyx_k_The_s_live_loop_track_has_succes[] = "The '%s' live loop track has successfully been created.";
static const char __pyx_k_The_s_standard_track_has_success[] = "The '%s' standard track has successfully been created.";
static const char __pyx_k_Unable_to_initialize_Audio_Inter[] = "Unable to initialize Audio Interface: Buffer samples is required to be a power of two";
static const char __pyx_k_Unable_to_initialize_SDL_SDL_Ini[] = "Unable to initialize SDL (SDL_Init call failed: %s)";
static const char __pyx_k_Unable_to_load_sound_from_source[] = "Unable to load sound from source file '{}' - {}";
static const char __pyx_k_Unknown_notification_message_rec[] = "Unknown notification message received on %s track";
static const char __pyx_k_play_sound_Processing_sound_s_fo[] = "play_sound - Processing sound '%s' for playback.";
static const char __pyx_k_play_sound_Sound_player_d_is_ava[] = "play_sound - Sound player %d is available for playback";
static const char __pyx_k_play_sound_Sound_player_d_is_cur[] = "play_sound - Sound player %d is currently playing the sound with the lowest priority (%d).";
static const char __pyx_k_play_sound_Sound_priority_d_is_h[] = "play_sound - Sound priority (%d) is higher than the lowest sound currently playing (%d). Forcing playback on sound player %d.";
static const char __pyx_k_play_sound_Sound_priority_d_is_l[] = "play_sound - Sound priority (%d) is less than or equal to the lowest sound currently playing (%d). Sound could not be playedimmediately and has now expired (max_queue_time = 0) and will not be played.";
static const char __pyx_k_play_sound_Sound_s_was_not_loade[] = "play_sound - Sound %s was not loaded and therefore has been queued for playback.";
static const char __pyx_k_replace_sound_Could_not_locate_s[] = "replace_sound - Could not locate specified sound instance to replace";
static const char __pyx_k_replace_sound_Preparing_to_repla[] = "replace_sound - Preparing to replace existing sound with a new sound instance";
static const char __pyx_k_All_internal_audio_messages_are_2[] = "All internal audio messages are currently in use, could not stop all sounds";
static const char __pyx_k_All_internal_audio_messages_are_3[] = "All internal audio messages are currently in use, could not play sound %s";
static const char __pyx_k_play_sound_Processing_sound_s_fo_2[] = "play_sound - Processing sound '%s' for playback (%s).";
static const char __pyx_k_play_sound_Sound_priority_d_is_l_2[] = "play_sound - Sound priority (%d) is less than or equal to the lowest sound currently playing (%d). Sound will be queued for playback.";
static const char __pyx_k_play_sound_Sound_s_was_not_loade_2[] = "play_sound - Sound %s was not loaded and max_queue_time = 0, therefore it has been discarded and will not be played.";
static PyObject *__pyx_kp_u_0;
static PyObject *__pyx_kp_u_1;
static PyObject *__pyx_kp_u_31;
static PyObject *__pyx_kp_u_Add_track_failed_the_maximum_num;
static PyObject *__pyx_kp_u_Add_track_failed_the_track_name;
static PyObject *__pyx_kp_u_Adding_sound_instance_s_to_activ;
static PyObject *__pyx_kp_u_All_internal_audio_messages_are;
static PyObject *__pyx_kp_u_All_internal_audio_messages_are_2;
static PyObject *__pyx_kp_u_All_internal_audio_messages_are_3;
static PyObject *__pyx_kp_u_All_sound_players_are_currently;
static PyObject *__pyx_kp_u_Allocated_track_audio_buffer_d_b;
static PyObject *__pyx_n_s_AudioException;
static PyObject *__pyx_n_u_AudioException;
static PyObject *__pyx_n_u_AudioInterface;
static PyObject *__pyx_kp_u_Buffer_samples_is_required_to_be;
static PyObject *__pyx_n_u_D;
static PyObject *__pyx_n_u_DB;
static PyObject *__pyx_kp_s_D_Development_Pinball_mpf_mc_mpf;
static PyObject *__pyx_kp_u_Disabling_audio_playback;
static PyObject *__pyx_kp_u_Discarding_expired_sound_from_qu;
static PyObject *__pyx_n_s_Empty;
static PyObject *__pyx_kp_u_Enabling_audio_playback;
static PyObject *__pyx_n_s_Exception;
static PyObject *__pyx_kp_s_Exception_returned_by_the_audio;
static PyObject *__pyx_kp_u_Getting_sound_from_queue_s;
static PyObject *__pyx_n_u_H;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_kp_u_Initialized_s;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_kp_u_Loaded_s;
static PyObject *__pyx_n_u_M;
static PyObject *__pyx_n_u_MS;
static PyObject *__pyx_n_u_MSEC;
static PyObject *__pyx_n_u_MixChunkContainer;
static PyObject *__pyx_kp_u_Mix_OpenAudio_error_s;
static PyObject *__pyx_kp_u_Must_be_overridden_in_derived_cl;
static PyObject *__pyx_n_u_NONE;
static PyObject *__pyx_kp_u_NOTE_You_may_experience_noise_an;
static PyObject *__pyx_kp_u_Next_pending_sound_in_queue_is_s;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio;
static PyObject *__pyx_n_s_PriorityQueue;
static PyObject *__pyx_kp_u_Processing_notification_message;
static PyObject *__pyx_kp_u_Queueing_sound_s;
static PyObject *__pyx_kp_u_Received_a_notification_message;
static PyObject *__pyx_kp_u_Removing_pending_sound_from_queu;
static PyObject *__pyx_kp_u_Removing_sound_instance_s_from_a;
static PyObject *__pyx_kp_u_Retrieving_next_pending_sound_fr;
static PyObject *__pyx_n_u_S;
static PyObject *__pyx_kp_u_SDL;
static PyObject *__pyx_kp_u_SDL_Init_error_s;
static PyObject *__pyx_kp_u_SDL_Mixer;
static PyObject *__pyx_n_u_SEC;
static PyObject *__pyx_kp_u_Settings_in_use_rate_d_channels;
static PyObject *__pyx_kp_u_Settings_requested_rate_d_channe;
static PyObject *__pyx_kp_u_Shutting_down_and_cleaning_up_al;
static PyObject *__pyx_kp_u_Sound_s_is_set_to_begin_playback;
static PyObject *__pyx_kp_u_Specified_sound_is_not_loaded_co;
static PyObject *__pyx_kp_u_Status_Player_d_Status_s_Sound_d;
static PyObject *__pyx_kp_u_Stopping_all_sounds_and_removing;
static PyObject *__pyx_kp_u_Stopping_sound_s_and_removing_an;
static PyObject *__pyx_kp_u_The_maximum_number_of_simultaneo;
static PyObject *__pyx_kp_u_The_minimum_number_of_simultaneo;
static PyObject *__pyx_kp_u_The_s_live_loop_track_has_succes;
static PyObject *__pyx_kp_u_The_s_standard_track_has_success;
static PyObject *__pyx_n_u_Track;
static PyObject *__pyx_kp_u_TrackLiveLoop;
static PyObject *__pyx_kp_u_TrackStandard;
static PyObject *__pyx_kp_u_Track_2;
static PyObject *__pyx_kp_u_Track_3;
static PyObject *__pyx_kp_u_Track_LiveLoop;
static PyObject *__pyx_kp_u_Track_Standard;
static PyObject *__pyx_kp_u_Unable_to_initialize_Audio_Inter;
static PyObject *__pyx_kp_u_Unable_to_initialize_SDL_SDL_Ini;
static PyObject *__pyx_kp_u_Unable_to_load_sound_from_source;
static PyObject *__pyx_kp_u_Unable_to_open_audio_for_output;
static PyObject *__pyx_kp_u_Unknown_notification_message_rec;
static PyObject *__pyx_kp_u__28;
static PyObject *__pyx_kp_u__6;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_attack;
static PyObject *__pyx_n_s_attenuation;
static PyObject *__pyx_n_s_audio_callback_data;
static PyObject *__pyx_n_u_audio_channels;
static PyObject *__pyx_n_s_audio_interface_instance;
static PyObject *__pyx_n_s_buffer_samples;
static PyObject *__pyx_n_u_buffer_samples;
static PyObject *__pyx_n_s_buffer_size;
static PyObject *__pyx_n_u_buffer_size;
static PyObject *__pyx_n_s_c_file_name;
static PyObject *__pyx_n_s_channels;
static PyObject *__pyx_n_s_chunk;
static PyObject *__pyx_n_s_clear;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_container;
static PyObject *__pyx_n_s_db;
static PyObject *__pyx_n_s_db_to_gain;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_delay;
static PyObject *__pyx_n_s_disable;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_ducking;
static PyObject *__pyx_n_s_ducking_release_duration;
static PyObject *__pyx_n_s_enabled;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_exp_time;
static PyObject *__pyx_n_s_fade_in;
static PyObject *__pyx_kp_u_fade_in_2;
static PyObject *__pyx_n_s_fade_out;
static PyObject *__pyx_kp_u_fade_out_2;
static PyObject *__pyx_n_s_fade_out_duration;
static PyObject *__pyx_n_s_fade_out_seconds;
static PyObject *__pyx_n_s_fading_status;
static PyObject *__pyx_n_u_fading_status;
static PyObject *__pyx_n_s_fading_status_values;
static PyObject *__pyx_n_s_file_name;
static PyObject *__pyx_n_u_finished;
static PyObject *__pyx_n_u_flac;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_gain;
static PyObject *__pyx_n_s_gain_string;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_getLogger;
static PyObject *__pyx_n_s_get_max_markers;
static PyObject *__pyx_n_s_get_max_tracks;
static PyObject *__pyx_n_s_get_next_sound;
static PyObject *__pyx_n_s_get_nowait;
static PyObject *__pyx_n_s_get_sdl_mixer_version;
static PyObject *__pyx_n_s_get_sdl_version;
static PyObject *__pyx_n_s_get_track;
static PyObject *__pyx_n_s_get_version;
static PyObject *__pyx_n_u_has_ducking;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_u_idle;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_info;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_initialize;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_kwargs;
static PyObject *__pyx_n_s_load;
static PyObject *__pyx_n_s_load_sound_chunk;
static PyObject *__pyx_n_s_loaded;
static PyObject *__pyx_n_s_loading;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_loops;
static PyObject *__pyx_n_u_loops;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_marker_count;
static PyObject *__pyx_n_s_markers;
static PyObject *__pyx_n_s_math;
static PyObject *__pyx_n_s_max_queue_time;
static PyObject *__pyx_n_s_max_simultaneous_sounds;
static PyObject *__pyx_n_s_mc;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_kp_u_not_fading;
static PyObject *__pyx_n_s_num;
static PyObject *__pyx_n_s_number;
static PyObject *__pyx_n_u_ogg;
static PyObject *__pyx_n_s_old_instance;
static PyObject *__pyx_n_u_pending;
static PyObject *__pyx_kp_u_play_sound_No_idle_sound_player;
static PyObject *__pyx_kp_u_play_sound_Processing_sound_s_fo;
static PyObject *__pyx_kp_u_play_sound_Processing_sound_s_fo_2;
static PyObject *__pyx_kp_u_play_sound_Sound_player_d_is_ava;
static PyObject *__pyx_kp_u_play_sound_Sound_player_d_is_cur;
static PyObject *__pyx_kp_u_play_sound_Sound_priority_d_is_h;
static PyObject *__pyx_kp_u_play_sound_Sound_priority_d_is_l;
static PyObject *__pyx_kp_u_play_sound_Sound_priority_d_is_l_2;
static PyObject *__pyx_kp_u_play_sound_Sound_s_was_not_loade;
static PyObject *__pyx_kp_u_play_sound_Sound_s_was_not_loade_2;
static PyObject *__pyx_kp_u_play_sound_on_sound_player_s_s;
static PyObject *__pyx_n_u_player;
static PyObject *__pyx_n_s_player_fading_status_to_text;
static PyObject *__pyx_n_s_player_status_to_text;
static PyObject *__pyx_n_u_playing;
static PyObject *__pyx_n_s_pow;
static PyObject *__pyx_n_s_power_of_two;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_priority;
static PyObject *__pyx_n_u_priority;
static PyObject *__pyx_n_s_process;
static PyObject *__pyx_n_s_process_notification_message;
static PyObject *__pyx_n_s_put;
static PyObject *__pyx_n_s_py_byte_file_name;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qsize;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_queue;
static PyObject *__pyx_n_s_queue_sound;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_rate;
static PyObject *__pyx_n_s_release;
static PyObject *__pyx_n_s_release_point;
static PyObject *__pyx_n_s_remove_all_sounds_from_queue;
static PyObject *__pyx_n_s_remove_sound_from_queue;
static PyObject *__pyx_kp_u_replace_sound_Could_not_locate_s;
static PyObject *__pyx_kp_u_replace_sound_Preparing_to_repla;
static PyObject *__pyx_n_u_replacing;
static PyObject *__pyx_n_s_round;
static PyObject *__pyx_n_u_sample_pos;
static PyObject *__pyx_n_u_sample_rate;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_set_canceled;
static PyObject *__pyx_n_s_set_expired;
static PyObject *__pyx_n_s_set_looping;
static PyObject *__pyx_n_s_set_marker;
static PyObject *__pyx_n_s_set_pending;
static PyObject *__pyx_n_s_set_playing;
static PyObject *__pyx_n_s_set_queued;
static PyObject *__pyx_n_s_set_stopped;
static PyObject *__pyx_n_s_sound;
static PyObject *__pyx_n_u_sound_id;
static PyObject *__pyx_n_s_sound_instance;
static PyObject *__pyx_n_u_sound_instance_id;
static PyObject *__pyx_n_s_sound_instances_by_id;
static PyObject *__pyx_n_s_start_at;
static PyObject *__pyx_n_s_staticmethod;
static PyObject *__pyx_n_s_status;
static PyObject *__pyx_n_u_status;
static PyObject *__pyx_n_s_status_values;
static PyObject *__pyx_n_s_stop_all_sounds;
static PyObject *__pyx_n_s_stop_sound;
static PyObject *__pyx_n_u_stopping;
static PyObject *__pyx_n_s_string_to_gain;
static PyObject *__pyx_n_s_string_to_gain_locals_genexpr;
static PyObject *__pyx_n_s_string_to_secs;
static PyObject *__pyx_n_s_string_to_secs_locals_genexpr;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_u_time;
static PyObject *__pyx_n_s_time_string;
static PyObject *__pyx_n_s_track_bit_mask;
static PyObject *__pyx_n_s_track_num;
static PyObject *__pyx_n_u_unknown;
static PyObject *__pyx_n_s_unload_sound_chunk;
static PyObject *__pyx_n_s_upper;
static PyObject *__pyx_n_s_version;
static PyObject *__pyx_n_s_version_info;
static PyObject *__pyx_n_s_volume;
static PyObject *__pyx_n_u_volume;
static PyObject *__pyx_n_s_warning;
static PyObject *__pyx_n_u_wav;
static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface___cinit__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kw); /* proto */
static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_2__init__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_rate, PyObject *__pyx_v_channels, PyObject *__pyx_v_buffer_samples); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_4__del__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_6initialize(int __pyx_v_rate, int __pyx_v_channels, int __pyx_v_buffer_samples, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_8power_of_two(int __pyx_v_num); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_10db_to_gain(float __pyx_v_db); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_gain_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_12string_to_gain(PyObject *__pyx_v_gain); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14convert_seconds_to_samples(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, float __pyx_v_seconds); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_16convert_seconds_to_buffer_length(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, float __pyx_v_seconds); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_18convert_buffer_length_to_seconds(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, int __pyx_v_buffer_length); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_3genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_6genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_9genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_12genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_20string_to_secs(PyObject *__pyx_v_time); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_22string_to_samples(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_samples); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_24get_version(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_26get_sdl_version(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_28get_sdl_mixer_version(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_30supported_extensions(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_32get_master_volume(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_34set_master_volume(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, float __pyx_v_volume); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_36get_settings(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7enabled___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_38enable(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_40disable(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_42get_max_tracks(); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_44get_max_markers(); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_46get_track_count(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_48get_track(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, int __pyx_v_track_num); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_50get_track_by_name(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_52create_standard_track(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_name, int __pyx_v_max_simultaneous_sounds, float __pyx_v_volume); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_54create_live_loop_track(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_name, float __pyx_v_volume); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_56load_sound_chunk(PyObject *__pyx_v_file_name); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_58unload_sound_chunk(PyObject *__pyx_v_container); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_60stop_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_62stop_all_sounds(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_64process(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_66get_in_use_request_message_count(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_68get_in_use_notification_message_count(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self); /* proto */
static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate_2__set__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track___cinit__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kw); /* proto */
static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_2__init__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, PyObject *__pyx_v_sound_instances_by_id, PyObject *__pyx_v_audio_callback_data, PyObject *__pyx_v_name, int __pyx_v_track_num, int __pyx_v_buffer_size, float __pyx_v_volume); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_4__repr__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_4name___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self); /* proto */
static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume_2__set__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, float __pyx_v_volume); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6number___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_in_memory_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_streaming_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6play_sound(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_8stop_sound(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_10stop_sound_looping(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_12stop_all_sounds(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_14process(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self); /* proto */
static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard___init__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instances_by_id, PyObject *__pyx_v_audio_callback_data, PyObject *__pyx_v_name, int __pyx_v_track_num, int __pyx_v_buffer_size, int __pyx_v_max_simultaneous_sounds, float __pyx_v_volume); /* proto */
static void __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_2__dealloc__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_4__repr__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_in_memory_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_streaming_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_23max_simultaneous_sounds___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_6process(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_8process_notification_message(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, int __pyx_v_message_num); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_10_get_next_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_12_remove_sound_from_queue(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_14_remove_all_sounds_from_queue(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_16play_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_18replace_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_old_instance, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_20_queue_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance, PyObject *__pyx_v_exp_time); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_22stop_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_24stop_sound_looping(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_26stop_all_sounds(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, float __pyx_v_fade_out_seconds); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_28get_status(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_30get_sound_queue_count(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_32get_sound_players_in_use_count(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_34sound_is_playing(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_36sound_instance_is_playing(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_38sound_is_in_queue(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_40sound_instance_is_in_queue(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_42player_status_to_text(int __pyx_v_status); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_44player_fading_status_to_text(int __pyx_v_fading_status); /* proto */
static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop___cinit__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kw); /* proto */
static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_2__init__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self, PyObject *__pyx_v_mc, PyObject *__pyx_v_audio_callback_data, PyObject *__pyx_v_name, int __pyx_v_track_num, int __pyx_v_buffer_size, float __pyx_v_volume); /* proto */
static void __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_4__dealloc__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_6__repr__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_in_memory_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_streaming_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_8play_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_10stop_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_12stop_sound_looping(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_14stop_all_sounds(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_16process(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self); /* proto */
static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer___init__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_self); /* proto */
static void __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_2__dealloc__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6loaded___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6length___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_self); /* proto */
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_32;
static PyObject *__pyx_int_1024;
static PyObject *__pyx_int_4096;
static PyObject *__pyx_int_44100;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__32;
static PyObject *__pyx_codeobj__34;
static PyObject *__pyx_codeobj__36;
static PyObject *__pyx_codeobj__38;
static PyObject *__pyx_codeobj__39;
static PyObject *__pyx_codeobj__40;
static PyObject *__pyx_codeobj__42;
static PyObject *__pyx_codeobj__44;
static PyObject *__pyx_codeobj__46;
static PyObject *__pyx_codeobj__48;

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":76
 *     cdef AudioCallbackData *audio_callback_data
 * 
 *     def __cinit__(self, *args, **kw):             # <<<<<<<<<<<<<<
 *         self.sample_rate = 0
 *         self.audio_channels = 0
 */

/* Python wrapper */
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kw = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface___cinit__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), __pyx_v_args, __pyx_v_kw);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kw);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface___cinit__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kw) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":77
 * 
 *     def __cinit__(self, *args, **kw):
 *         self.sample_rate = 0             # <<<<<<<<<<<<<<
 *         self.audio_channels = 0
 *         self.buffer_samples = 0
 */
  __pyx_v_self->sample_rate = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":78
 *     def __cinit__(self, *args, **kw):
 *         self.sample_rate = 0
 *         self.audio_channels = 0             # <<<<<<<<<<<<<<
 *         self.buffer_samples = 0
 *         self.buffer_size = 0
 */
  __pyx_v_self->audio_channels = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":79
 *         self.sample_rate = 0
 *         self.audio_channels = 0
 *         self.buffer_samples = 0             # <<<<<<<<<<<<<<
 *         self.buffer_size = 0
 *         self.supported_formats = 0
 */
  __pyx_v_self->buffer_samples = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":80
 *         self.audio_channels = 0
 *         self.buffer_samples = 0
 *         self.buffer_size = 0             # <<<<<<<<<<<<<<
 *         self.supported_formats = 0
 *         self.audio_callback_data = NULL
 */
  __pyx_v_self->buffer_size = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":81
 *         self.buffer_samples = 0
 *         self.buffer_size = 0
 *         self.supported_formats = 0             # <<<<<<<<<<<<<<
 *         self.audio_callback_data = NULL
 * 
 */
  __pyx_v_self->supported_formats = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":82
 *         self.buffer_size = 0
 *         self.supported_formats = 0
 *         self.audio_callback_data = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, rate=44100, channels=2, buffer_samples=4096):
 */
  __pyx_v_self->audio_callback_data = NULL;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":76
 *     cdef AudioCallbackData *audio_callback_data
 * 
 *     def __cinit__(self, *args, **kw):             # <<<<<<<<<<<<<<
 *         self.sample_rate = 0
 *         self.audio_channels = 0
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":84
 *         self.audio_callback_data = NULL
 * 
 *     def __init__(self, rate=44100, channels=2, buffer_samples=4096):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes the AudioInterface.
 */

/* Python wrapper */
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_2__init__[] = "\n        Initializes the AudioInterface.\n        Args:\n            rate: The audio sample rate used in the library\n            channels: The number of channels to use (1=mono, 2=stereo)\n            buffer_samples: The audio buffer size to use (in number of samples, must be power of two)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_2__init__;
#endif
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rate = 0;
  PyObject *__pyx_v_channels = 0;
  PyObject *__pyx_v_buffer_samples = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rate,&__pyx_n_s_channels,&__pyx_n_s_buffer_samples,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)__pyx_int_44100);
    values[1] = ((PyObject *)__pyx_int_2);
    values[2] = ((PyObject *)__pyx_int_4096);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rate);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_channels);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buffer_samples);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 84, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rate = values[0];
    __pyx_v_channels = values[1];
    __pyx_v_buffer_samples = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 84, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_2__init__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), __pyx_v_rate, __pyx_v_channels, __pyx_v_buffer_samples);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_2__init__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_rate, PyObject *__pyx_v_channels, PyObject *__pyx_v_buffer_samples) {
  long __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  long __pyx_t_14;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":92
 *             buffer_samples: The audio buffer size to use (in number of samples, must be power of two)
 *         """
 *         self.log = logging.getLogger("AudioInterface")             # <<<<<<<<<<<<<<
 * 
 *         # Initialize threading in the extension library and acquire the Python global interpreter lock
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->log);
  __Pyx_DECREF(__pyx_v_self->log);
  __pyx_v_self->log = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":95
 * 
 *         # Initialize threading in the extension library and acquire the Python global interpreter lock
 *         PyEval_InitThreads()             # <<<<<<<<<<<<<<
 * 
 *         # Make sure buffer samples is a power of two (required by SDL2)
 */
  PyEval_InitThreads();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":98
 * 
 *         # Make sure buffer samples is a power of two (required by SDL2)
 *         if not AudioInterface.power_of_two(buffer_samples):             # <<<<<<<<<<<<<<
 *             self.log.error('Buffer samples is required to be a power of two')
 *             raise AudioException("Unable to initialize Audio Interface: "
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface), __pyx_n_s_power_of_two); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buffer_samples); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_buffer_samples);
    __Pyx_GIVEREF(__pyx_v_buffer_samples);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_buffer_samples);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (__pyx_t_6) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":99
 *         # Make sure buffer samples is a power of two (required by SDL2)
 *         if not AudioInterface.power_of_two(buffer_samples):
 *             self.log.error('Buffer samples is required to be a power of two')             # <<<<<<<<<<<<<<
 *             raise AudioException("Unable to initialize Audio Interface: "
 *                                  "Buffer samples is required to be a power of two")
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":100
 *         if not AudioInterface.power_of_two(buffer_samples):
 *             self.log.error('Buffer samples is required to be a power of two')
 *             raise AudioException("Unable to initialize Audio Interface: "             # <<<<<<<<<<<<<<
 *                                  "Buffer samples is required to be a power of two")
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_AudioException); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 100, __pyx_L1_error)

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":98
 * 
 *         # Make sure buffer samples is a power of two (required by SDL2)
 *         if not AudioInterface.power_of_two(buffer_samples):             # <<<<<<<<<<<<<<
 *             self.log.error('Buffer samples is required to be a power of two')
 *             raise AudioException("Unable to initialize Audio Interface: "
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":104
 * 
 *         # Warn if a small buffer is used
 *         if buffer_samples <= 1024:             # <<<<<<<<<<<<<<
 *             self.log.warning('NOTE: You may experience noise and other undesirable sound artifacts '
 *                              'when you set your buffer at 1024 or smaller.')
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_buffer_samples, __pyx_int_1024, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":105
 *         # Warn if a small buffer is used
 *         if buffer_samples <= 1024:
 *             self.log.warning('NOTE: You may experience noise and other undesirable sound artifacts '             # <<<<<<<<<<<<<<
 *                              'when you set your buffer at 1024 or smaller.')
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_warning); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":104
 * 
 *         # Warn if a small buffer is used
 *         if buffer_samples <= 1024:             # <<<<<<<<<<<<<<
 *             self.log.warning('NOTE: You may experience noise and other undesirable sound artifacts '
 *                              'when you set your buffer at 1024 or smaller.')
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":109
 * 
 *         # Initialize the SDL audio system
 *         if SDL_Init(SDL_INIT_AUDIO) < 0:             # <<<<<<<<<<<<<<
 *             self.log.error('SDL_Init error - %s' % SDL_GetError())
 *             raise AudioException('Unable to initialize SDL (SDL_Init call failed: %s)' % SDL_GetError())
 */
  __pyx_t_6 = ((SDL_Init(SDL_INIT_AUDIO) < 0) != 0);
  if (__pyx_t_6) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":110
 *         # Initialize the SDL audio system
 *         if SDL_Init(SDL_INIT_AUDIO) < 0:
 *             self.log.error('SDL_Init error - %s' % SDL_GetError())             # <<<<<<<<<<<<<<
 *             raise AudioException('Unable to initialize SDL (SDL_Init call failed: %s)' % SDL_GetError())
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyBytes_FromString(SDL_GetError()); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_SDL_Init_error_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":111
 *         if SDL_Init(SDL_INIT_AUDIO) < 0:
 *             self.log.error('SDL_Init error - %s' % SDL_GetError())
 *             raise AudioException('Unable to initialize SDL (SDL_Init call failed: %s)' % SDL_GetError())             # <<<<<<<<<<<<<<
 * 
 *         # Initialize the SDL_Mixer library to establish the output audio format and encoding
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_AudioException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyBytes_FromString(SDL_GetError()); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Unable_to_initialize_SDL_SDL_Ini, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 111, __pyx_L1_error)

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":109
 * 
 *         # Initialize the SDL audio system
 *         if SDL_Init(SDL_INIT_AUDIO) < 0:             # <<<<<<<<<<<<<<
 *             self.log.error('SDL_Init error - %s' % SDL_GetError())
 *             raise AudioException('Unable to initialize SDL (SDL_Init call failed: %s)' % SDL_GetError())
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":115
 *         # Initialize the SDL_Mixer library to establish the output audio format and encoding
 *         # (sample rate, bit depth, buffer size)
 *         if Mix_OpenAudio(rate, AUDIO_S16SYS, channels, buffer_samples):             # <<<<<<<<<<<<<<
 *             self.log.error('Mix_OpenAudio error - %s' % SDL_GetError())
 *             raise AudioException('Unable to open audio for output (Mix_OpenAudio failed: %s)' % SDL_GetError())
 */
  __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_rate); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_channels); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_buffer_samples); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
  __pyx_t_6 = (Mix_OpenAudio(__pyx_t_8, AUDIO_S16SYS, __pyx_t_9, __pyx_t_10) != 0);
  if (__pyx_t_6) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":116
 *         # (sample rate, bit depth, buffer size)
 *         if Mix_OpenAudio(rate, AUDIO_S16SYS, channels, buffer_samples):
 *             self.log.error('Mix_OpenAudio error - %s' % SDL_GetError())             # <<<<<<<<<<<<<<
 *             raise AudioException('Unable to open audio for output (Mix_OpenAudio failed: %s)' % SDL_GetError())
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyBytes_FromString(SDL_GetError()); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Mix_OpenAudio_error_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":117
 *         if Mix_OpenAudio(rate, AUDIO_S16SYS, channels, buffer_samples):
 *             self.log.error('Mix_OpenAudio error - %s' % SDL_GetError())
 *             raise AudioException('Unable to open audio for output (Mix_OpenAudio failed: %s)' % SDL_GetError())             # <<<<<<<<<<<<<<
 * 
 *         self.log.info("Initialized %s", AudioInterface.get_version())
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_AudioException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyBytes_FromString(SDL_GetError()); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Unable_to_open_audio_for_output, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 117, __pyx_L1_error)

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":115
 *         # Initialize the SDL_Mixer library to establish the output audio format and encoding
 *         # (sample rate, bit depth, buffer size)
 *         if Mix_OpenAudio(rate, AUDIO_S16SYS, channels, buffer_samples):             # <<<<<<<<<<<<<<
 *             self.log.error('Mix_OpenAudio error - %s' % SDL_GetError())
 *             raise AudioException('Unable to open audio for output (Mix_OpenAudio failed: %s)' % SDL_GetError())
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":119
 *             raise AudioException('Unable to open audio for output (Mix_OpenAudio failed: %s)' % SDL_GetError())
 * 
 *         self.log.info("Initialized %s", AudioInterface.get_version())             # <<<<<<<<<<<<<<
 *         self.log.debug("Loaded %s", AudioInterface.get_sdl_version())
 *         self.log.debug("Loaded %s", AudioInterface.get_sdl_mixer_version())
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface), __pyx_n_s_get_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_Initialized_s);
  __Pyx_GIVEREF(__pyx_kp_u_Initialized_s);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_11, __pyx_kp_u_Initialized_s);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_11, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":120
 * 
 *         self.log.info("Initialized %s", AudioInterface.get_version())
 *         self.log.debug("Loaded %s", AudioInterface.get_sdl_version())             # <<<<<<<<<<<<<<
 *         self.log.debug("Loaded %s", AudioInterface.get_sdl_mixer_version())
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface), __pyx_n_s_get_sdl_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  __pyx_t_3 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_Loaded_s);
  __Pyx_GIVEREF(__pyx_kp_u_Loaded_s);
  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_kp_u_Loaded_s);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":121
 *         self.log.info("Initialized %s", AudioInterface.get_version())
 *         self.log.debug("Loaded %s", AudioInterface.get_sdl_version())
 *         self.log.debug("Loaded %s", AudioInterface.get_sdl_mixer_version())             # <<<<<<<<<<<<<<
 * 
 *         # Lock SDL from calling the audio callback functions
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface), __pyx_n_s_get_sdl_mixer_version); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  __pyx_t_4 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_7) {
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_Loaded_s);
  __Pyx_GIVEREF(__pyx_kp_u_Loaded_s);
  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_kp_u_Loaded_s);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":124
 * 
 *         # Lock SDL from calling the audio callback functions
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         # Determine the actual audio format in use by the opened audio device.  This may or may not match
 */
  SDL_LockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":128
 *         # Determine the actual audio format in use by the opened audio device.  This may or may not match
 *         # the parameters used to initialize the audio interface.
 *         self.buffer_samples = buffer_samples             # <<<<<<<<<<<<<<
 *         self.log.debug('Settings requested - rate: %d, channels: %d, buffer: %d samples',
 *                        rate, channels, buffer_samples)
 */
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_buffer_samples); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L1_error)
  __pyx_v_self->buffer_samples = __pyx_t_10;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":129
 *         # the parameters used to initialize the audio interface.
 *         self.buffer_samples = buffer_samples
 *         self.log.debug('Settings requested - rate: %d, channels: %d, buffer: %d samples',             # <<<<<<<<<<<<<<
 *                        rate, channels, buffer_samples)
 *         Mix_QuerySpec(&self.sample_rate, NULL, &self.audio_channels)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":130
 *         self.buffer_samples = buffer_samples
 *         self.log.debug('Settings requested - rate: %d, channels: %d, buffer: %d samples',
 *                        rate, channels, buffer_samples)             # <<<<<<<<<<<<<<
 *         Mix_QuerySpec(&self.sample_rate, NULL, &self.audio_channels)
 *         self.log.debug('Settings in use - rate: %d, channels: %d, buffer: %d samples',
 */
  __pyx_t_4 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  __pyx_t_3 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_Settings_requested_rate_d_channe);
  __Pyx_GIVEREF(__pyx_kp_u_Settings_requested_rate_d_channe);
  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_kp_u_Settings_requested_rate_d_channe);
  __Pyx_INCREF(__pyx_v_rate);
  __Pyx_GIVEREF(__pyx_v_rate);
  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_v_rate);
  __Pyx_INCREF(__pyx_v_channels);
  __Pyx_GIVEREF(__pyx_v_channels);
  PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_11, __pyx_v_channels);
  __Pyx_INCREF(__pyx_v_buffer_samples);
  __Pyx_GIVEREF(__pyx_v_buffer_samples);
  PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_11, __pyx_v_buffer_samples);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":131
 *         self.log.debug('Settings requested - rate: %d, channels: %d, buffer: %d samples',
 *                        rate, channels, buffer_samples)
 *         Mix_QuerySpec(&self.sample_rate, NULL, &self.audio_channels)             # <<<<<<<<<<<<<<
 *         self.log.debug('Settings in use - rate: %d, channels: %d, buffer: %d samples',
 *                        self.sample_rate, self.audio_channels, self.buffer_samples)
 */
  Mix_QuerySpec((&__pyx_v_self->sample_rate), NULL, (&__pyx_v_self->audio_channels));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":132
 *                        rate, channels, buffer_samples)
 *         Mix_QuerySpec(&self.sample_rate, NULL, &self.audio_channels)
 *         self.log.debug('Settings in use - rate: %d, channels: %d, buffer: %d samples',             # <<<<<<<<<<<<<<
 *                        self.sample_rate, self.audio_channels, self.buffer_samples)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":133
 *         Mix_QuerySpec(&self.sample_rate, NULL, &self.audio_channels)
 *         self.log.debug('Settings in use - rate: %d, channels: %d, buffer: %d samples',
 *                        self.sample_rate, self.audio_channels, self.buffer_samples)             # <<<<<<<<<<<<<<
 * 
 *         # Set the size of the track audio buffers (samples * channels * size of 16-bit int) for 16-bit audio
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->sample_rate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->audio_channels); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->buffer_samples); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_12 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  __pyx_t_13 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (__pyx_t_12) {
    __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_Settings_in_use_rate_d_channels);
  __Pyx_GIVEREF(__pyx_kp_u_Settings_in_use_rate_d_channels);
  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_11, __pyx_kp_u_Settings_in_use_rate_d_channels);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_11, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_11, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_11, __pyx_t_7);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_7 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":136
 * 
 *         # Set the size of the track audio buffers (samples * channels * size of 16-bit int) for 16-bit audio
 *         self.buffer_size = self.buffer_samples * self.audio_channels * sizeof(Uint16)             # <<<<<<<<<<<<<<
 * 
 *         # Allocate memory for the audio callback data structure
 */
  __pyx_v_self->buffer_size = ((__pyx_v_self->buffer_samples * __pyx_v_self->audio_channels) * (sizeof(Uint16)));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":139
 * 
 *         # Allocate memory for the audio callback data structure
 *         self.audio_callback_data = <AudioCallbackData*> PyMem_Malloc(sizeof(AudioCallbackData))             # <<<<<<<<<<<<<<
 * 
 *         # Initialize the audio callback data structure
 */
  __pyx_v_self->audio_callback_data = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *)PyMem_Malloc((sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData))));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":142
 * 
 *         # Initialize the audio callback data structure
 *         self.audio_callback_data.sample_rate = self.sample_rate             # <<<<<<<<<<<<<<
 *         self.audio_callback_data.audio_channels = self.audio_channels
 *         self.audio_callback_data.buffer_size = self.buffer_size
 */
  __pyx_t_10 = __pyx_v_self->sample_rate;
  __pyx_v_self->audio_callback_data->sample_rate = __pyx_t_10;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":143
 *         # Initialize the audio callback data structure
 *         self.audio_callback_data.sample_rate = self.sample_rate
 *         self.audio_callback_data.audio_channels = self.audio_channels             # <<<<<<<<<<<<<<
 *         self.audio_callback_data.buffer_size = self.buffer_size
 *         self.audio_callback_data.master_volume = MIX_MAX_VOLUME // 2
 */
  __pyx_t_10 = __pyx_v_self->audio_channels;
  __pyx_v_self->audio_callback_data->audio_channels = __pyx_t_10;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":144
 *         self.audio_callback_data.sample_rate = self.sample_rate
 *         self.audio_callback_data.audio_channels = self.audio_channels
 *         self.audio_callback_data.buffer_size = self.buffer_size             # <<<<<<<<<<<<<<
 *         self.audio_callback_data.master_volume = MIX_MAX_VOLUME // 2
 *         self.audio_callback_data.track_count = 0
 */
  __pyx_t_10 = __pyx_v_self->buffer_size;
  __pyx_v_self->audio_callback_data->buffer_size = __pyx_t_10;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":145
 *         self.audio_callback_data.audio_channels = self.audio_channels
 *         self.audio_callback_data.buffer_size = self.buffer_size
 *         self.audio_callback_data.master_volume = MIX_MAX_VOLUME // 2             # <<<<<<<<<<<<<<
 *         self.audio_callback_data.track_count = 0
 *         self.audio_callback_data.tracks = <TrackState**> PyMem_Malloc(MAX_TRACKS * sizeof(TrackState*))
 */
  __pyx_v_self->audio_callback_data->master_volume = __Pyx_div_long(MIX_MAX_VOLUME, 2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":146
 *         self.audio_callback_data.buffer_size = self.buffer_size
 *         self.audio_callback_data.master_volume = MIX_MAX_VOLUME // 2
 *         self.audio_callback_data.track_count = 0             # <<<<<<<<<<<<<<
 *         self.audio_callback_data.tracks = <TrackState**> PyMem_Malloc(MAX_TRACKS * sizeof(TrackState*))
 *         self.audio_callback_data.c_log_file = NULL
 */
  __pyx_v_self->audio_callback_data->track_count = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":147
 *         self.audio_callback_data.master_volume = MIX_MAX_VOLUME // 2
 *         self.audio_callback_data.track_count = 0
 *         self.audio_callback_data.tracks = <TrackState**> PyMem_Malloc(MAX_TRACKS * sizeof(TrackState*))             # <<<<<<<<<<<<<<
 *         self.audio_callback_data.c_log_file = NULL
 *         #self.audio_callback_data.c_log_file = fopen("D:\\Temp\\Dev\\MPFMC_AudioLibrary.log", "wb")
 */
  __pyx_v_self->audio_callback_data->tracks = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState **)PyMem_Malloc((8 * (sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *)))));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":148
 *         self.audio_callback_data.track_count = 0
 *         self.audio_callback_data.tracks = <TrackState**> PyMem_Malloc(MAX_TRACKS * sizeof(TrackState*))
 *         self.audio_callback_data.c_log_file = NULL             # <<<<<<<<<<<<<<
 *         #self.audio_callback_data.c_log_file = fopen("D:\\Temp\\Dev\\MPFMC_AudioLibrary.log", "wb")
 * 
 */
  __pyx_v_self->audio_callback_data->c_log_file = NULL;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":152
 * 
 *         # Initialize request messages
 *         self.audio_callback_data.request_messages = <RequestMessageContainer**> PyMem_Malloc(             # <<<<<<<<<<<<<<
 *             MAX_REQUEST_MESSAGES * sizeof(RequestMessageContainer*))
 * 
 */
  __pyx_v_self->audio_callback_data->request_messages = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer **)PyMem_Malloc((32 * (sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *)))));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":155
 *             MAX_REQUEST_MESSAGES * sizeof(RequestMessageContainer*))
 * 
 *         for i in range(MAX_REQUEST_MESSAGES):             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.request_messages[i] = <RequestMessageContainer*> PyMem_Malloc(sizeof(RequestMessageContainer))
 *             self.audio_callback_data.request_messages[i].message = request_not_in_use
 */
  for (__pyx_t_14 = 0; __pyx_t_14 < 32; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":156
 * 
 *         for i in range(MAX_REQUEST_MESSAGES):
 *             self.audio_callback_data.request_messages[i] = <RequestMessageContainer*> PyMem_Malloc(sizeof(RequestMessageContainer))             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.request_messages[i].message = request_not_in_use
 *             self.audio_callback_data.request_messages[i].sound_id = 0
 */
    (__pyx_v_self->audio_callback_data->request_messages[__pyx_v_i]) = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *)PyMem_Malloc((sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer))));

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":157
 *         for i in range(MAX_REQUEST_MESSAGES):
 *             self.audio_callback_data.request_messages[i] = <RequestMessageContainer*> PyMem_Malloc(sizeof(RequestMessageContainer))
 *             self.audio_callback_data.request_messages[i].message = request_not_in_use             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.request_messages[i].sound_id = 0
 *             self.audio_callback_data.request_messages[i].sound_instance_id = 0
 */
    (__pyx_v_self->audio_callback_data->request_messages[__pyx_v_i])->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_not_in_use;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":158
 *             self.audio_callback_data.request_messages[i] = <RequestMessageContainer*> PyMem_Malloc(sizeof(RequestMessageContainer))
 *             self.audio_callback_data.request_messages[i].message = request_not_in_use
 *             self.audio_callback_data.request_messages[i].sound_id = 0             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.request_messages[i].sound_instance_id = 0
 *             self.audio_callback_data.request_messages[i].track = 0
 */
    (__pyx_v_self->audio_callback_data->request_messages[__pyx_v_i])->sound_id = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":159
 *             self.audio_callback_data.request_messages[i].message = request_not_in_use
 *             self.audio_callback_data.request_messages[i].sound_id = 0
 *             self.audio_callback_data.request_messages[i].sound_instance_id = 0             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.request_messages[i].track = 0
 *             self.audio_callback_data.request_messages[i].player = 0
 */
    (__pyx_v_self->audio_callback_data->request_messages[__pyx_v_i])->sound_instance_id = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":160
 *             self.audio_callback_data.request_messages[i].sound_id = 0
 *             self.audio_callback_data.request_messages[i].sound_instance_id = 0
 *             self.audio_callback_data.request_messages[i].track = 0             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.request_messages[i].player = 0
 *             self.audio_callback_data.request_messages[i].time = 0
 */
    (__pyx_v_self->audio_callback_data->request_messages[__pyx_v_i])->track = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":161
 *             self.audio_callback_data.request_messages[i].sound_instance_id = 0
 *             self.audio_callback_data.request_messages[i].track = 0
 *             self.audio_callback_data.request_messages[i].player = 0             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.request_messages[i].time = 0
 * 
 */
    (__pyx_v_self->audio_callback_data->request_messages[__pyx_v_i])->player = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":162
 *             self.audio_callback_data.request_messages[i].track = 0
 *             self.audio_callback_data.request_messages[i].player = 0
 *             self.audio_callback_data.request_messages[i].time = 0             # <<<<<<<<<<<<<<
 * 
 *         # Initialize notification messages
 */
    (__pyx_v_self->audio_callback_data->request_messages[__pyx_v_i])->time = 0;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":165
 * 
 *         # Initialize notification messages
 *         self.audio_callback_data.notification_messages = <NotificationMessageContainer**> PyMem_Malloc(             # <<<<<<<<<<<<<<
 *             MAX_NOTIFICATION_MESSAGES * sizeof(NotificationMessageContainer*))
 * 
 */
  __pyx_v_self->audio_callback_data->notification_messages = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **)PyMem_Malloc((32 * (sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer *)))));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":168
 *             MAX_NOTIFICATION_MESSAGES * sizeof(NotificationMessageContainer*))
 * 
 *         for i in range(MAX_REQUEST_MESSAGES):             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.notification_messages[i] = <NotificationMessageContainer*> PyMem_Malloc(sizeof(NotificationMessageContainer))
 *             self.audio_callback_data.notification_messages[i].message = notification_not_in_use
 */
  for (__pyx_t_14 = 0; __pyx_t_14 < 32; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":169
 * 
 *         for i in range(MAX_REQUEST_MESSAGES):
 *             self.audio_callback_data.notification_messages[i] = <NotificationMessageContainer*> PyMem_Malloc(sizeof(NotificationMessageContainer))             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.notification_messages[i].message = notification_not_in_use
 *             self.audio_callback_data.notification_messages[i].sound_id = 0
 */
    (__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_i]) = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer *)PyMem_Malloc((sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer))));

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":170
 *         for i in range(MAX_REQUEST_MESSAGES):
 *             self.audio_callback_data.notification_messages[i] = <NotificationMessageContainer*> PyMem_Malloc(sizeof(NotificationMessageContainer))
 *             self.audio_callback_data.notification_messages[i].message = notification_not_in_use             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.notification_messages[i].sound_id = 0
 *             self.audio_callback_data.notification_messages[i].sound_instance_id = 0
 */
    (__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_i])->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_not_in_use;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":171
 *             self.audio_callback_data.notification_messages[i] = <NotificationMessageContainer*> PyMem_Malloc(sizeof(NotificationMessageContainer))
 *             self.audio_callback_data.notification_messages[i].message = notification_not_in_use
 *             self.audio_callback_data.notification_messages[i].sound_id = 0             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.notification_messages[i].sound_instance_id = 0
 *             self.audio_callback_data.notification_messages[i].track = 0
 */
    (__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_i])->sound_id = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":172
 *             self.audio_callback_data.notification_messages[i].message = notification_not_in_use
 *             self.audio_callback_data.notification_messages[i].sound_id = 0
 *             self.audio_callback_data.notification_messages[i].sound_instance_id = 0             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.notification_messages[i].track = 0
 *             self.audio_callback_data.notification_messages[i].player = 0
 */
    (__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_i])->sound_instance_id = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":173
 *             self.audio_callback_data.notification_messages[i].sound_id = 0
 *             self.audio_callback_data.notification_messages[i].sound_instance_id = 0
 *             self.audio_callback_data.notification_messages[i].track = 0             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.notification_messages[i].player = 0
 *             self.audio_callback_data.notification_messages[i].time = 0
 */
    (__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_i])->track = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":174
 *             self.audio_callback_data.notification_messages[i].sound_instance_id = 0
 *             self.audio_callback_data.notification_messages[i].track = 0
 *             self.audio_callback_data.notification_messages[i].player = 0             # <<<<<<<<<<<<<<
 *             self.audio_callback_data.notification_messages[i].time = 0
 * 
 */
    (__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_i])->player = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":175
 *             self.audio_callback_data.notification_messages[i].track = 0
 *             self.audio_callback_data.notification_messages[i].player = 0
 *             self.audio_callback_data.notification_messages[i].time = 0             # <<<<<<<<<<<<<<
 * 
 *         self.audio_callback_data.mutex = SDL_CreateMutex()
 */
    (__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_i])->time = 0;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":177
 *             self.audio_callback_data.notification_messages[i].time = 0
 * 
 *         self.audio_callback_data.mutex = SDL_CreateMutex()             # <<<<<<<<<<<<<<
 * 
 *         # Initialize the supported SDL_Mixer library formats
 */
  __pyx_v_self->audio_callback_data->mutex = SDL_CreateMutex();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":180
 * 
 *         # Initialize the supported SDL_Mixer library formats
 *         self.supported_formats = Mix_Init(MIX_INIT_OGG)             # <<<<<<<<<<<<<<
 * 
 *         # Unlock the SDL audio callback functions
 */
  __pyx_v_self->supported_formats = Mix_Init(MIX_INIT_OGG);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":183
 * 
 *         # Unlock the SDL audio callback functions
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *         self.tracks = list()
 */
  SDL_UnlockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":185
 *         SDL_UnlockAudio()
 * 
 *         self.tracks = list()             # <<<<<<<<<<<<<<
 *         self.sound_instances_by_id = dict()
 * 
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->tracks);
  __Pyx_DECREF(__pyx_v_self->tracks);
  __pyx_v_self->tracks = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":186
 * 
 *         self.tracks = list()
 *         self.sound_instances_by_id = dict()             # <<<<<<<<<<<<<<
 * 
 *     def __del__(self):
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->sound_instances_by_id);
  __Pyx_DECREF(__pyx_v_self->sound_instances_by_id);
  __pyx_v_self->sound_instances_by_id = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":84
 *         self.audio_callback_data = NULL
 * 
 *     def __init__(self, rate=44100, channels=2, buffer_samples=4096):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes the AudioInterface.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":188
 *         self.sound_instances_by_id = dict()
 * 
 *     def __del__(self):             # <<<<<<<<<<<<<<
 *         """Shut down the audio interface and clean up allocated memory"""
 *         self.log.debug("Shutting down and cleaning up allocated memory...")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_5__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_4__del__[] = "AudioInterface.__del__(self)\nShut down the audio interface and clean up allocated memory";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_5__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_4__del__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_4__del__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  long __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  long __pyx_t_4;
  __Pyx_RefNannySetupContext("__del__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":190
 *     def __del__(self):
 *         """Shut down the audio interface and clean up allocated memory"""
 *         self.log.debug("Shutting down and cleaning up allocated memory...")             # <<<<<<<<<<<<<<
 * 
 *         # Stop audio processing (will stop all SDL callbacks)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":193
 * 
 *         # Stop audio processing (will stop all SDL callbacks)
 *         self.disable()             # <<<<<<<<<<<<<<
 * 
 *         # Remove tracks
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_disable); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":196
 * 
 *         # Remove tracks
 *         self.tracks.clear()             # <<<<<<<<<<<<<<
 * 
 *         # Free all allocated memory
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->tracks, __pyx_n_s_clear); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":199
 * 
 *         # Free all allocated memory
 *         for i in range(MAX_REQUEST_MESSAGES):             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.audio_callback_data.request_messages[i])
 *         for i in range(MAX_NOTIFICATION_MESSAGES):
 */
  for (__pyx_t_4 = 0; __pyx_t_4 < 32; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":200
 *         # Free all allocated memory
 *         for i in range(MAX_REQUEST_MESSAGES):
 *             PyMem_Free(self.audio_callback_data.request_messages[i])             # <<<<<<<<<<<<<<
 *         for i in range(MAX_NOTIFICATION_MESSAGES):
 *             PyMem_Free(self.audio_callback_data.notification_messages[i])
 */
    PyMem_Free((__pyx_v_self->audio_callback_data->request_messages[__pyx_v_i]));
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":201
 *         for i in range(MAX_REQUEST_MESSAGES):
 *             PyMem_Free(self.audio_callback_data.request_messages[i])
 *         for i in range(MAX_NOTIFICATION_MESSAGES):             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.audio_callback_data.notification_messages[i])
 * 
 */
  for (__pyx_t_4 = 0; __pyx_t_4 < 32; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":202
 *             PyMem_Free(self.audio_callback_data.request_messages[i])
 *         for i in range(MAX_NOTIFICATION_MESSAGES):
 *             PyMem_Free(self.audio_callback_data.notification_messages[i])             # <<<<<<<<<<<<<<
 * 
 *         PyMem_Free(self.audio_callback_data.request_messages)
 */
    PyMem_Free((__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_i]));
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":204
 *             PyMem_Free(self.audio_callback_data.notification_messages[i])
 * 
 *         PyMem_Free(self.audio_callback_data.request_messages)             # <<<<<<<<<<<<<<
 *         PyMem_Free(self.audio_callback_data.notification_messages)
 * 
 */
  PyMem_Free(__pyx_v_self->audio_callback_data->request_messages);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":205
 * 
 *         PyMem_Free(self.audio_callback_data.request_messages)
 *         PyMem_Free(self.audio_callback_data.notification_messages)             # <<<<<<<<<<<<<<
 * 
 *         PyMem_Free(self.audio_callback_data.tracks)
 */
  PyMem_Free(__pyx_v_self->audio_callback_data->notification_messages);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":207
 *         PyMem_Free(self.audio_callback_data.notification_messages)
 * 
 *         PyMem_Free(self.audio_callback_data.tracks)             # <<<<<<<<<<<<<<
 *         SDL_DestroyMutex(self.audio_callback_data.mutex)
 *         PyMem_Free(self.audio_callback_data)
 */
  PyMem_Free(__pyx_v_self->audio_callback_data->tracks);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":208
 * 
 *         PyMem_Free(self.audio_callback_data.tracks)
 *         SDL_DestroyMutex(self.audio_callback_data.mutex)             # <<<<<<<<<<<<<<
 *         PyMem_Free(self.audio_callback_data)
 * 
 */
  SDL_DestroyMutex(__pyx_v_self->audio_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":209
 *         PyMem_Free(self.audio_callback_data.tracks)
 *         SDL_DestroyMutex(self.audio_callback_data.mutex)
 *         PyMem_Free(self.audio_callback_data)             # <<<<<<<<<<<<<<
 * 
 *         # SDL_Mixer no longer needed
 */
  PyMem_Free(__pyx_v_self->audio_callback_data);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":212
 * 
 *         # SDL_Mixer no longer needed
 *         Mix_Quit()             # <<<<<<<<<<<<<<
 *         SDL_Quit()
 * 
 */
  Mix_Quit();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":213
 *         # SDL_Mixer no longer needed
 *         Mix_Quit()
 *         SDL_Quit()             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  SDL_Quit();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":188
 *         self.sound_instances_by_id = dict()
 * 
 *     def __del__(self):             # <<<<<<<<<<<<<<
 *         """Shut down the audio interface and clean up allocated memory"""
 *         self.log.debug("Shutting down and cleaning up allocated memory...")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":216
 * 
 *     @staticmethod
 *     def initialize(int rate=44100, int channels=2, int buffer_samples=4096, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes and retrieves the audio interface instance.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7initialize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_6initialize[] = "AudioInterface.initialize(int rate=44100, int channels=2, int buffer_samples=4096, **kwargs)\n\n        Initializes and retrieves the audio interface instance.\n        Args:\n            rate: The audio sample rate used in the library\n            channels: The number of channels to use (1=mono, 2=stereo)\n            buffer_samples: The audio buffer size in number of samples (must be power of two)\n\n        Returns:\n            An AudioInterface object instance.\n        ";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7initialize = {"initialize", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7initialize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_6initialize};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7initialize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_rate;
  int __pyx_v_channels;
  int __pyx_v_buffer_samples;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("initialize (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rate,&__pyx_n_s_channels,&__pyx_n_s_buffer_samples,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rate);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_channels);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buffer_samples);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "initialize") < 0)) __PYX_ERR(0, 216, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_rate = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_rate == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error)
    } else {
      __pyx_v_rate = ((int)0xAC44);
    }
    if (values[1]) {
      __pyx_v_channels = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_channels == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error)
    } else {
      __pyx_v_channels = ((int)2);
    }
    if (values[2]) {
      __pyx_v_buffer_samples = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_buffer_samples == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error)
    } else {
      __pyx_v_buffer_samples = ((int)0x1000);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("initialize", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 216, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_6initialize(__pyx_v_rate, __pyx_v_channels, __pyx_v_buffer_samples, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_6initialize(int __pyx_v_rate, int __pyx_v_channels, int __pyx_v_buffer_samples, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_audio_interface_instance = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("initialize", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":228
 *         """
 *         # Initialize the audio instance and return it
 *         audio_interface_instance = AudioInterface(rate=rate,             # <<<<<<<<<<<<<<
 *                                                   channels=channels,
 *                                                   buffer_samples=buffer_samples,
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rate, __pyx_t_3) < 0) __PYX_ERR(0, 228, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":229
 *         # Initialize the audio instance and return it
 *         audio_interface_instance = AudioInterface(rate=rate,
 *                                                   channels=channels,             # <<<<<<<<<<<<<<
 *                                                   buffer_samples=buffer_samples,
 *                                                   **kwargs)
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_channels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_channels, __pyx_t_3) < 0) __PYX_ERR(0, 228, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":230
 *         audio_interface_instance = AudioInterface(rate=rate,
 *                                                   channels=channels,
 *                                                   buffer_samples=buffer_samples,             # <<<<<<<<<<<<<<
 *                                                   **kwargs)
 *         return audio_interface_instance
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_buffer_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_buffer_samples, __pyx_t_3) < 0) __PYX_ERR(0, 228, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":231
 *                                                   channels=channels,
 *                                                   buffer_samples=buffer_samples,
 *                                                   **kwargs)             # <<<<<<<<<<<<<<
 *         return audio_interface_instance
 * 
 */
  if (__Pyx_MergeKeywords(__pyx_t_1, __pyx_v_kwargs) < 0) __PYX_ERR(0, 231, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":228
 *         """
 *         # Initialize the audio instance and return it
 *         audio_interface_instance = AudioInterface(rate=rate,             # <<<<<<<<<<<<<<
 *                                                   channels=channels,
 *                                                   buffer_samples=buffer_samples,
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_audio_interface_instance = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":232
 *                                                   buffer_samples=buffer_samples,
 *                                                   **kwargs)
 *         return audio_interface_instance             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_audio_interface_instance));
  __pyx_r = ((PyObject *)__pyx_v_audio_interface_instance);
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":216
 * 
 *     @staticmethod
 *     def initialize(int rate=44100, int channels=2, int buffer_samples=4096, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes and retrieves the audio interface instance.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_audio_interface_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":235
 * 
 *     @staticmethod
 *     def power_of_two(int num):             # <<<<<<<<<<<<<<
 *         """ Returns whether or not the supplied number is a power of 2 """
 *         return ((num & (num - 1)) == 0) and num != 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_9power_of_two(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_8power_of_two[] = "AudioInterface.power_of_two(int num)\n Returns whether or not the supplied number is a power of 2 ";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_9power_of_two = {"power_of_two", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_9power_of_two, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_8power_of_two};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_9power_of_two(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_num;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("power_of_two (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_num,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "power_of_two") < 0)) __PYX_ERR(0, 235, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_num = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_num == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("power_of_two", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 235, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.power_of_two", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_8power_of_two(__pyx_v_num);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_8power_of_two(int __pyx_v_num) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("power_of_two", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":237
 *     def power_of_two(int num):
 *         """ Returns whether or not the supplied number is a power of 2 """
 *         return ((num & (num - 1)) == 0) and num != 0             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((__pyx_v_num & (__pyx_v_num - 1)) == 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_num != 0);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":235
 * 
 *     @staticmethod
 *     def power_of_two(int num):             # <<<<<<<<<<<<<<
 *         """ Returns whether or not the supplied number is a power of 2 """
 *         return ((num & (num - 1)) == 0) and num != 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.power_of_two", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":240
 * 
 *     @staticmethod
 *     def db_to_gain(float db):             # <<<<<<<<<<<<<<
 *         """Converts a value in decibels (-inf to 0.0) to a gain (0.0 to 1.0)"""
 *         return pow(10, db / 20.0)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11db_to_gain(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_10db_to_gain[] = "AudioInterface.db_to_gain(float db)\nConverts a value in decibels (-inf to 0.0) to a gain (0.0 to 1.0)";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11db_to_gain = {"db_to_gain", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11db_to_gain, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_10db_to_gain};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11db_to_gain(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_db;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("db_to_gain (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_db,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_db)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "db_to_gain") < 0)) __PYX_ERR(0, 240, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_db = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_db == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("db_to_gain", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 240, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.db_to_gain", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_10db_to_gain(__pyx_v_db);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_10db_to_gain(float __pyx_v_db) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("db_to_gain", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":242
 *     def db_to_gain(float db):
 *         """Converts a value in decibels (-inf to 0.0) to a gain (0.0 to 1.0)"""
 *         return pow(10, db / 20.0)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pow); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble((((double)__pyx_v_db) / 20.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_int_10);
  __Pyx_GIVEREF(__pyx_int_10);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_int_10);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":240
 * 
 *     @staticmethod
 *     def db_to_gain(float db):             # <<<<<<<<<<<<<<
 *         """Converts a value in decibels (-inf to 0.0) to a gain (0.0 to 1.0)"""
 *         return pow(10, db / 20.0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.db_to_gain", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":245
 * 
 *     @staticmethod
 *     def string_to_gain(gain):             # <<<<<<<<<<<<<<
 *         """Converts a string to a gain value (0.0 to 1.0)"""
 *         cdef str gain_string = str(gain).upper()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_13string_to_gain(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_12string_to_gain[] = "AudioInterface.string_to_gain(gain)\nConverts a string to a gain value (0.0 to 1.0)";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_13string_to_gain = {"string_to_gain", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_13string_to_gain, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_12string_to_gain};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_13string_to_gain(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gain = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("string_to_gain (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gain,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gain)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "string_to_gain") < 0)) __PYX_ERR(0, 245, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_gain = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("string_to_gain", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 245, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_gain", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_12string_to_gain(__pyx_v_gain);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_gain_2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":250
 * 
 *         if gain_string.endswith('DB'):
 *             gain_string = ''.join(i for i in gain_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return min(max(AudioInterface.db_to_gain(float(gain_string)), 0.0), 1.0)
 * 
 */

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_gain_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *)__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_gain_2generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_string_to_gain_locals_genexpr, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!gen)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_gain.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_gain_2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 250, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_gain_string)) { __Pyx_RaiseClosureNameError("gain_string"); __PYX_ERR(0, 250, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_gain_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(0, 250, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_gain_string);
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_gain_string;
  __pyx_t_6 = __Pyx_init_unicode_iteration(__pyx_t_1, (&__pyx_t_3), (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 250, __pyx_L1_error)
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7++) {
    __pyx_t_2 = __pyx_t_7;
    __pyx_cur_scope->__pyx_v_i = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_4, __pyx_t_2);
    __pyx_t_8 = Py_UNICODE_ISALPHA(__pyx_cur_scope->__pyx_v_i); 
    __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
    if (__pyx_t_9) {
      __pyx_t_10 = PyUnicode_FromOrdinal(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 250, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":245
 * 
 *     @staticmethod
 *     def string_to_gain(gain):             # <<<<<<<<<<<<<<
 *         """Converts a string to a gain value (0.0 to 1.0)"""
 *         cdef str gain_string = str(gain).upper()
 */

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_12string_to_gain(PyObject *__pyx_v_gain) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  double __pyx_t_5;
  double __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  double __pyx_t_9;
  double __pyx_t_10;
  __Pyx_RefNannySetupContext("string_to_gain", 0);
  __pyx_cur_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain *)__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":247
 *     def string_to_gain(gain):
 *         """Converts a string to a gain value (0.0 to 1.0)"""
 *         cdef str gain_string = str(gain).upper()             # <<<<<<<<<<<<<<
 * 
 *         if gain_string.endswith('DB'):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_gain);
  __Pyx_GIVEREF(__pyx_v_gain);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_gain);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_upper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_gain_string = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":249
 *         cdef str gain_string = str(gain).upper()
 * 
 *         if gain_string.endswith('DB'):             # <<<<<<<<<<<<<<
 *             gain_string = ''.join(i for i in gain_string if not i.isalpha())
 *             return min(max(AudioInterface.db_to_gain(float(gain_string)), 0.0), 1.0)
 */
  if (unlikely(__pyx_cur_scope->__pyx_v_gain_string == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "endswith");
    __PYX_ERR(0, 249, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyUnicode_Tailmatch(__pyx_cur_scope->__pyx_v_gain_string, __pyx_n_u_DB, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 249, __pyx_L1_error)
  if ((__pyx_t_4 != 0)) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":250
 * 
 *         if gain_string.endswith('DB'):
 *             gain_string = ''.join(i for i in gain_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return min(max(AudioInterface.db_to_gain(float(gain_string)), 0.0), 1.0)
 * 
 */
    __pyx_t_1 = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_gain_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_gain_string);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_gain_string, ((PyObject*)__pyx_t_1));
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":251
 *         if gain_string.endswith('DB'):
 *             gain_string = ''.join(i for i in gain_string if not i.isalpha())
 *             return min(max(AudioInterface.db_to_gain(float(gain_string)), 0.0), 1.0)             # <<<<<<<<<<<<<<
 * 
 *         return min(max(float(gain_string), 0.0), 1.0)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = 1.0;
    __pyx_t_6 = 0.0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface), __pyx_n_s_db_to_gain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyNumber_Float(__pyx_cur_scope->__pyx_v_gain_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_8, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {
      __pyx_t_3 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_4) {
      __pyx_t_8 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __pyx_t_8;
      __pyx_t_8 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":249
 *         cdef str gain_string = str(gain).upper()
 * 
 *         if gain_string.endswith('DB'):             # <<<<<<<<<<<<<<
 *             gain_string = ''.join(i for i in gain_string if not i.isalpha())
 *             return min(max(AudioInterface.db_to_gain(float(gain_string)), 0.0), 1.0)
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":253
 *             return min(max(AudioInterface.db_to_gain(float(gain_string)), 0.0), 1.0)
 * 
 *         return min(max(float(gain_string), 0.0), 1.0)             # <<<<<<<<<<<<<<
 * 
 *     def convert_seconds_to_samples(self, float seconds):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = 1.0;
  __pyx_t_6 = 0.0;
  __pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_cur_scope->__pyx_v_gain_string); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L1_error)
  if (((__pyx_t_6 > __pyx_t_9) != 0)) {
    __pyx_t_10 = __pyx_t_6;
  } else {
    __pyx_t_10 = __pyx_t_9;
  }
  __pyx_t_6 = __pyx_t_10;
  if (((__pyx_t_5 < __pyx_t_6) != 0)) {
    __pyx_t_10 = __pyx_t_5;
  } else {
    __pyx_t_10 = __pyx_t_6;
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":245
 * 
 *     @staticmethod
 *     def string_to_gain(gain):             # <<<<<<<<<<<<<<
 *         """Converts a string to a gain value (0.0 to 1.0)"""
 *         cdef str gain_string = str(gain).upper()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_gain", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":255
 *         return min(max(float(gain_string), 0.0), 1.0)
 * 
 *     def convert_seconds_to_samples(self, float seconds):             # <<<<<<<<<<<<<<
 *         """Converts the specified number of seconds into samples (based on current sample rate)"""
 *         return int(self.sample_rate * seconds)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_15convert_seconds_to_samples(PyObject *__pyx_v_self, PyObject *__pyx_arg_seconds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14convert_seconds_to_samples[] = "AudioInterface.convert_seconds_to_samples(self, float seconds)\nConverts the specified number of seconds into samples (based on current sample rate)";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_15convert_seconds_to_samples(PyObject *__pyx_v_self, PyObject *__pyx_arg_seconds) {
  float __pyx_v_seconds;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert_seconds_to_samples (wrapper)", 0);
  assert(__pyx_arg_seconds); {
    __pyx_v_seconds = __pyx_PyFloat_AsFloat(__pyx_arg_seconds); if (unlikely((__pyx_v_seconds == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.convert_seconds_to_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14convert_seconds_to_samples(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), ((float)__pyx_v_seconds));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14convert_seconds_to_samples(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, float __pyx_v_seconds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convert_seconds_to_samples", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":257
 *     def convert_seconds_to_samples(self, float seconds):
 *         """Converts the specified number of seconds into samples (based on current sample rate)"""
 *         return int(self.sample_rate * seconds)             # <<<<<<<<<<<<<<
 * 
 *     def convert_seconds_to_buffer_length(self, float seconds):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromDouble((__pyx_v_self->sample_rate * __pyx_v_seconds)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":255
 *         return min(max(float(gain_string), 0.0), 1.0)
 * 
 *     def convert_seconds_to_samples(self, float seconds):             # <<<<<<<<<<<<<<
 *         """Converts the specified number of seconds into samples (based on current sample rate)"""
 *         return int(self.sample_rate * seconds)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.convert_seconds_to_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":259
 *         return int(self.sample_rate * seconds)
 * 
 *     def convert_seconds_to_buffer_length(self, float seconds):             # <<<<<<<<<<<<<<
 *         """Convert the specified number of seconds into a buffer length (based on current
 *         sample rate, the number of audio channels, and the number of bytes per sample)."""
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_17convert_seconds_to_buffer_length(PyObject *__pyx_v_self, PyObject *__pyx_arg_seconds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_16convert_seconds_to_buffer_length[] = "AudioInterface.convert_seconds_to_buffer_length(self, float seconds)\nConvert the specified number of seconds into a buffer length (based on current\n        sample rate, the number of audio channels, and the number of bytes per sample).";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_17convert_seconds_to_buffer_length(PyObject *__pyx_v_self, PyObject *__pyx_arg_seconds) {
  float __pyx_v_seconds;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert_seconds_to_buffer_length (wrapper)", 0);
  assert(__pyx_arg_seconds); {
    __pyx_v_seconds = __pyx_PyFloat_AsFloat(__pyx_arg_seconds); if (unlikely((__pyx_v_seconds == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.convert_seconds_to_buffer_length", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_16convert_seconds_to_buffer_length(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), ((float)__pyx_v_seconds));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_16convert_seconds_to_buffer_length(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, float __pyx_v_seconds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convert_seconds_to_buffer_length", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":262
 *         """Convert the specified number of seconds into a buffer length (based on current
 *         sample rate, the number of audio channels, and the number of bytes per sample)."""
 *         return int(seconds * self.sample_rate * self.audio_channels * BYTES_PER_SAMPLE)             # <<<<<<<<<<<<<<
 * 
 *     def convert_buffer_length_to_seconds(self, int buffer_length):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromDouble((((__pyx_v_seconds * __pyx_v_self->sample_rate) * __pyx_v_self->audio_channels) * 2.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":259
 *         return int(self.sample_rate * seconds)
 * 
 *     def convert_seconds_to_buffer_length(self, float seconds):             # <<<<<<<<<<<<<<
 *         """Convert the specified number of seconds into a buffer length (based on current
 *         sample rate, the number of audio channels, and the number of bytes per sample)."""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.convert_seconds_to_buffer_length", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":264
 *         return int(seconds * self.sample_rate * self.audio_channels * BYTES_PER_SAMPLE)
 * 
 *     def convert_buffer_length_to_seconds(self, int buffer_length):             # <<<<<<<<<<<<<<
 *         """Convert the specified buffer length into a time in seconds (based on current
 *         sample rate, the number of audio channels, and the number of bytes per sample)."""
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_19convert_buffer_length_to_seconds(PyObject *__pyx_v_self, PyObject *__pyx_arg_buffer_length); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_18convert_buffer_length_to_seconds[] = "AudioInterface.convert_buffer_length_to_seconds(self, int buffer_length)\nConvert the specified buffer length into a time in seconds (based on current\n        sample rate, the number of audio channels, and the number of bytes per sample).";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_19convert_buffer_length_to_seconds(PyObject *__pyx_v_self, PyObject *__pyx_arg_buffer_length) {
  int __pyx_v_buffer_length;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert_buffer_length_to_seconds (wrapper)", 0);
  assert(__pyx_arg_buffer_length); {
    __pyx_v_buffer_length = __Pyx_PyInt_As_int(__pyx_arg_buffer_length); if (unlikely((__pyx_v_buffer_length == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 264, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.convert_buffer_length_to_seconds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_18convert_buffer_length_to_seconds(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), ((int)__pyx_v_buffer_length));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_18convert_buffer_length_to_seconds(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, int __pyx_v_buffer_length) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("convert_buffer_length_to_seconds", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":267
 *         """Convert the specified buffer length into a time in seconds (based on current
 *         sample rate, the number of audio channels, and the number of bytes per sample)."""
 *         return round(buffer_length / (self.sample_rate * self.audio_channels * BYTES_PER_SAMPLE), 3)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((__pyx_v_self->sample_rate * __pyx_v_self->audio_channels) * 2);
  if (unlikely(__pyx_t_1 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 267, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble((((double)__pyx_v_buffer_length) / ((double)__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":264
 *         return int(seconds * self.sample_rate * self.audio_channels * BYTES_PER_SAMPLE)
 * 
 *     def convert_buffer_length_to_seconds(self, int buffer_length):             # <<<<<<<<<<<<<<
 *         """Convert the specified buffer length into a time in seconds (based on current
 *         sample rate, the number of audio channels, and the number of bytes per sample)."""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.convert_buffer_length_to_seconds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":270
 * 
 *     @staticmethod
 *     def string_to_secs(time):             # <<<<<<<<<<<<<<
 *         """Decodes a string of real-world time into a float of seconds.
 *         Example inputs:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_21string_to_secs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_20string_to_secs[] = "AudioInterface.string_to_secs(time)\nDecodes a string of real-world time into a float of seconds.\n        Example inputs:\n\n        234ms\n        2s\n        None\n\n        If no \"s\" or \"ms\" is provided, this method assumes \"seconds.\"\n\n        If time is 'None' or a string of 'None', this method returns 0.0.\n\n        Returns:\n            Float. The examples listed above return 0.234, 2.0 and 0.0,\n            respectively\n        ";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_21string_to_secs = {"string_to_secs", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_21string_to_secs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_20string_to_secs};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_21string_to_secs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_time = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("string_to_secs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_time,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_time)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "string_to_secs") < 0)) __PYX_ERR(0, 270, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_time = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("string_to_secs", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 270, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_secs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_20string_to_secs(__pyx_v_time);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_2generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":289
 * 
 *         if time_string.endswith('MS') or time_string.endswith('MSEC'):
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) / 1000.0
 * 
 */

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *)__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_2generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_string_to_secs_locals_genexpr, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!gen)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_secs.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_2generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 289, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string)) { __Pyx_RaiseClosureNameError("time_string"); __PYX_ERR(0, 289, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(0, 289, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string);
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string;
  __pyx_t_6 = __Pyx_init_unicode_iteration(__pyx_t_1, (&__pyx_t_3), (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 289, __pyx_L1_error)
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7++) {
    __pyx_t_2 = __pyx_t_7;
    __pyx_cur_scope->__pyx_v_i = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_4, __pyx_t_2);
    __pyx_t_8 = Py_UNICODE_ISALPHA(__pyx_cur_scope->__pyx_v_i); 
    __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
    if (__pyx_t_9) {
      __pyx_t_10 = PyUnicode_FromOrdinal(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 289, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_5generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":293
 * 
 *         elif time_string.endswith('S') or time_string.endswith('SEC'):
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string)
 * 
 */

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_3genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *)__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_5generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_string_to_secs_locals_genexpr, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!gen)) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_secs.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_5generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 293, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string)) { __Pyx_RaiseClosureNameError("time_string"); __PYX_ERR(0, 293, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(0, 293, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string);
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string;
  __pyx_t_6 = __Pyx_init_unicode_iteration(__pyx_t_1, (&__pyx_t_3), (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 293, __pyx_L1_error)
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7++) {
    __pyx_t_2 = __pyx_t_7;
    __pyx_cur_scope->__pyx_v_i = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_4, __pyx_t_2);
    __pyx_t_8 = Py_UNICODE_ISALPHA(__pyx_cur_scope->__pyx_v_i); 
    __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
    if (__pyx_t_9) {
      __pyx_t_10 = PyUnicode_FromOrdinal(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 293, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_8generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":297
 * 
 *         elif 'D' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) * 86400
 * 
 */

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_6genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *)__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_8generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_string_to_secs_locals_genexpr, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!gen)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_secs.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_8generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 297, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string)) { __Pyx_RaiseClosureNameError("time_string"); __PYX_ERR(0, 297, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(0, 297, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string);
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string;
  __pyx_t_6 = __Pyx_init_unicode_iteration(__pyx_t_1, (&__pyx_t_3), (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 297, __pyx_L1_error)
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7++) {
    __pyx_t_2 = __pyx_t_7;
    __pyx_cur_scope->__pyx_v_i = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_4, __pyx_t_2);
    __pyx_t_8 = Py_UNICODE_ISALPHA(__pyx_cur_scope->__pyx_v_i); 
    __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
    if (__pyx_t_9) {
      __pyx_t_10 = PyUnicode_FromOrdinal(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_11generator4(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":301
 * 
 *         elif 'H' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) * 3600
 * 
 */

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_9genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *)__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_11generator4, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_string_to_secs_locals_genexpr, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!gen)) __PYX_ERR(0, 301, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_secs.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_11generator4(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 301, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string)) { __Pyx_RaiseClosureNameError("time_string"); __PYX_ERR(0, 301, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(0, 301, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string);
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string;
  __pyx_t_6 = __Pyx_init_unicode_iteration(__pyx_t_1, (&__pyx_t_3), (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7++) {
    __pyx_t_2 = __pyx_t_7;
    __pyx_cur_scope->__pyx_v_i = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_4, __pyx_t_2);
    __pyx_t_8 = Py_UNICODE_ISALPHA(__pyx_cur_scope->__pyx_v_i); 
    __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
    if (__pyx_t_9) {
      __pyx_t_10 = PyUnicode_FromOrdinal(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_14generator5(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":305
 * 
 *         elif 'M' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) * 60
 * 
 */

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_12genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *)__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_14generator5, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_string_to_secs_locals_genexpr, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!gen)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_secs.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_14generator5(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 305, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string)) { __Pyx_RaiseClosureNameError("time_string"); __PYX_ERR(0, 305, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(0, 305, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string);
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_time_string;
  __pyx_t_6 = __Pyx_init_unicode_iteration(__pyx_t_1, (&__pyx_t_3), (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 305, __pyx_L1_error)
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7++) {
    __pyx_t_2 = __pyx_t_7;
    __pyx_cur_scope->__pyx_v_i = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_4, __pyx_t_2);
    __pyx_t_8 = Py_UNICODE_ISALPHA(__pyx_cur_scope->__pyx_v_i); 
    __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
    if (__pyx_t_9) {
      __pyx_t_10 = PyUnicode_FromOrdinal(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 305, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":270
 * 
 *     @staticmethod
 *     def string_to_secs(time):             # <<<<<<<<<<<<<<
 *         """Decodes a string of real-world time into a float of seconds.
 *         Example inputs:
 */

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_20string_to_secs(PyObject *__pyx_v_time) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  double __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("string_to_secs", 0);
  __pyx_cur_scope = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *)__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":286
 *             respectively
 *         """
 *         cdef str time_string = str(time).upper()             # <<<<<<<<<<<<<<
 * 
 *         if time_string.endswith('MS') or time_string.endswith('MSEC'):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_time);
  __Pyx_GIVEREF(__pyx_v_time);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_time);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_upper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_time_string = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":288
 *         cdef str time_string = str(time).upper()
 * 
 *         if time_string.endswith('MS') or time_string.endswith('MSEC'):             # <<<<<<<<<<<<<<
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) / 1000.0
 */
  if (unlikely(__pyx_cur_scope->__pyx_v_time_string == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "endswith");
    __PYX_ERR(0, 288, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyUnicode_Tailmatch(__pyx_cur_scope->__pyx_v_time_string, __pyx_n_u_MS, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 288, __pyx_L1_error)
  if (!(__pyx_t_5 != 0)) {
  } else {
    __pyx_t_4 = (__pyx_t_5 != 0);
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(__pyx_cur_scope->__pyx_v_time_string == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "endswith");
    __PYX_ERR(0, 288, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyUnicode_Tailmatch(__pyx_cur_scope->__pyx_v_time_string, __pyx_n_u_MSEC, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 288, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_5 != 0);
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":289
 * 
 *         if time_string.endswith('MS') or time_string.endswith('MSEC'):
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) / 1000.0
 * 
 */
    __pyx_t_1 = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_time_string);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_time_string, ((PyObject*)__pyx_t_1));
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":290
 *         if time_string.endswith('MS') or time_string.endswith('MSEC'):
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) / 1000.0             # <<<<<<<<<<<<<<
 * 
 *         elif time_string.endswith('S') or time_string.endswith('SEC'):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_AsDouble(__pyx_cur_scope->__pyx_v_time_string); if (unlikely(__pyx_t_6 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L1_error)
    __pyx_t_1 = PyFloat_FromDouble((__pyx_t_6 / 1000.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":288
 *         cdef str time_string = str(time).upper()
 * 
 *         if time_string.endswith('MS') or time_string.endswith('MSEC'):             # <<<<<<<<<<<<<<
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) / 1000.0
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":292
 *             return float(time_string) / 1000.0
 * 
 *         elif time_string.endswith('S') or time_string.endswith('SEC'):             # <<<<<<<<<<<<<<
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string)
 */
  if (unlikely(__pyx_cur_scope->__pyx_v_time_string == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "endswith");
    __PYX_ERR(0, 292, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyUnicode_Tailmatch(__pyx_cur_scope->__pyx_v_time_string, __pyx_n_u_S, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 292, __pyx_L1_error)
  if (!(__pyx_t_5 != 0)) {
  } else {
    __pyx_t_4 = (__pyx_t_5 != 0);
    goto __pyx_L6_bool_binop_done;
  }
  if (unlikely(__pyx_cur_scope->__pyx_v_time_string == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "endswith");
    __PYX_ERR(0, 292, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyUnicode_Tailmatch(__pyx_cur_scope->__pyx_v_time_string, __pyx_n_u_SEC, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 292, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_5 != 0);
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_4) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":293
 * 
 *         elif time_string.endswith('S') or time_string.endswith('SEC'):
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string)
 * 
 */
    __pyx_t_1 = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_time_string);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_time_string, ((PyObject*)__pyx_t_1));
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":294
 *         elif time_string.endswith('S') or time_string.endswith('SEC'):
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string)             # <<<<<<<<<<<<<<
 * 
 *         elif 'D' in time_string:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_cur_scope->__pyx_v_time_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":292
 *             return float(time_string) / 1000.0
 * 
 *         elif time_string.endswith('S') or time_string.endswith('SEC'):             # <<<<<<<<<<<<<<
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string)
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":296
 *             return float(time_string)
 * 
 *         elif 'D' in time_string:             # <<<<<<<<<<<<<<
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) * 86400
 */
  if (unlikely(__pyx_cur_scope->__pyx_v_time_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 296, __pyx_L1_error)
  }
  __pyx_t_4 = (__Pyx_PyUnicode_ContainsTF(__pyx_n_u_D, __pyx_cur_scope->__pyx_v_time_string, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 296, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":297
 * 
 *         elif 'D' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) * 86400
 * 
 */
    __pyx_t_1 = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_6genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_time_string);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_time_string, ((PyObject*)__pyx_t_1));
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":298
 *         elif 'D' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) * 86400             # <<<<<<<<<<<<<<
 * 
 *         elif 'H' in time_string:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_AsDouble(__pyx_cur_scope->__pyx_v_time_string); if (unlikely(__pyx_t_6 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L1_error)
    __pyx_t_1 = PyFloat_FromDouble((__pyx_t_6 * 86400.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":296
 *             return float(time_string)
 * 
 *         elif 'D' in time_string:             # <<<<<<<<<<<<<<
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) * 86400
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":300
 *             return float(time_string) * 86400
 * 
 *         elif 'H' in time_string:             # <<<<<<<<<<<<<<
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) * 3600
 */
  if (unlikely(__pyx_cur_scope->__pyx_v_time_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 300, __pyx_L1_error)
  }
  __pyx_t_5 = (__Pyx_PyUnicode_ContainsTF(__pyx_n_u_H, __pyx_cur_scope->__pyx_v_time_string, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 300, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":301
 * 
 *         elif 'H' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) * 3600
 * 
 */
    __pyx_t_1 = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_9genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_time_string);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_time_string, ((PyObject*)__pyx_t_1));
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":302
 *         elif 'H' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) * 3600             # <<<<<<<<<<<<<<
 * 
 *         elif 'M' in time_string:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_AsDouble(__pyx_cur_scope->__pyx_v_time_string); if (unlikely(__pyx_t_6 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error)
    __pyx_t_1 = PyFloat_FromDouble((__pyx_t_6 * 3600.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":300
 *             return float(time_string) * 86400
 * 
 *         elif 'H' in time_string:             # <<<<<<<<<<<<<<
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) * 3600
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":304
 *             return float(time_string) * 3600
 * 
 *         elif 'M' in time_string:             # <<<<<<<<<<<<<<
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) * 60
 */
  if (unlikely(__pyx_cur_scope->__pyx_v_time_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 304, __pyx_L1_error)
  }
  __pyx_t_4 = (__Pyx_PyUnicode_ContainsTF(__pyx_n_u_M, __pyx_cur_scope->__pyx_v_time_string, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 304, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":305
 * 
 *         elif 'M' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())             # <<<<<<<<<<<<<<
 *             return float(time_string) * 60
 * 
 */
    __pyx_t_1 = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14string_to_secs_12genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_time_string);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_time_string, ((PyObject*)__pyx_t_1));
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":306
 *         elif 'M' in time_string:
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) * 60             # <<<<<<<<<<<<<<
 * 
 *         elif not time_string or time_string == 'NONE':
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_AsDouble(__pyx_cur_scope->__pyx_v_time_string); if (unlikely(__pyx_t_6 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L1_error)
    __pyx_t_1 = PyFloat_FromDouble((__pyx_t_6 * 60.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":304
 *             return float(time_string) * 3600
 * 
 *         elif 'M' in time_string:             # <<<<<<<<<<<<<<
 *             time_string = ''.join(i for i in time_string if not i.isalpha())
 *             return float(time_string) * 60
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":308
 *             return float(time_string) * 60
 * 
 *         elif not time_string or time_string == 'NONE':             # <<<<<<<<<<<<<<
 *             return 0.0
 * 
 */
  __pyx_t_4 = (__pyx_cur_scope->__pyx_v_time_string != Py_None) && (__Pyx_PyUnicode_IS_TRUE(__pyx_cur_scope->__pyx_v_time_string) != 0);
  __pyx_t_7 = ((!__pyx_t_4) != 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_5 = __pyx_t_7;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_time_string, __pyx_n_u_NONE, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 308, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_7 != 0);
  __pyx_t_5 = __pyx_t_4;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_5) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":309
 * 
 *         elif not time_string or time_string == 'NONE':
 *             return 0.0             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_float_0_0);
    __pyx_r = __pyx_float_0_0;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":308
 *             return float(time_string) * 60
 * 
 *         elif not time_string or time_string == 'NONE':             # <<<<<<<<<<<<<<
 *             return 0.0
 * 
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":312
 * 
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 return float(time_string)
 *             except:
 */
  /*else*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":313
 *         else:
 *             try:
 *                 return float(time_string)             # <<<<<<<<<<<<<<
 *             except:
 *                 return 0.0
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_cur_scope->__pyx_v_time_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L14_try_return;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":312
 * 
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 return float(time_string)
 *             except:
 */
      }
      __pyx_L10_error:;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":314
 *             try:
 *                 return float(time_string)
 *             except:             # <<<<<<<<<<<<<<
 *                 return 0.0
 * 
 */
      /*except:*/ {
        __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_secs", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 314, __pyx_L12_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":315
 *                 return float(time_string)
 *             except:
 *                 return 0.0             # <<<<<<<<<<<<<<
 * 
 *     def string_to_samples(self, samples):
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_float_0_0);
        __pyx_r = __pyx_float_0_0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L13_except_return;
      }
      __pyx_L12_except_error:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":312
 * 
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 return float(time_string)
 *             except:
 */
      __Pyx_PyThreadState_assign
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L14_try_return:;
      __Pyx_PyThreadState_assign
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      goto __pyx_L0;
      __pyx_L13_except_return:;
      __Pyx_PyThreadState_assign
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      goto __pyx_L0;
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":270
 * 
 *     @staticmethod
 *     def string_to_secs(time):             # <<<<<<<<<<<<<<
 *         """Decodes a string of real-world time into a float of seconds.
 *         Example inputs:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_secs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":317
 *                 return 0.0
 * 
 *     def string_to_samples(self, samples):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a string to an integer value representing the number of samples.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_23string_to_samples(PyObject *__pyx_v_self, PyObject *__pyx_v_samples); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_22string_to_samples[] = "AudioInterface.string_to_samples(self, samples)\n\n        Converts a string to an integer value representing the number of samples.\n        Args:\n            samples: String containing either a time string or an integer number\n                of samples.\n\n        Returns:\n            Integer containing the number of samples.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_23string_to_samples(PyObject *__pyx_v_self, PyObject *__pyx_v_samples) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("string_to_samples (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_22string_to_samples(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), ((PyObject *)__pyx_v_samples));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_22string_to_samples(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_samples) {
  PyObject *__pyx_v_samples_string = 0;
  float __pyx_v_seconds;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  float __pyx_t_8;
  __Pyx_RefNannySetupContext("string_to_samples", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":327
 *             Integer containing the number of samples.
 *         """
 *         cdef str samples_string = str(samples).upper()             # <<<<<<<<<<<<<<
 * 
 *         # If the string contains only digits we assume it is already in samples
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_samples);
  __Pyx_GIVEREF(__pyx_v_samples);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_samples);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_upper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 327, __pyx_L1_error)
  __pyx_v_samples_string = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":330
 * 
 *         # If the string contains only digits we assume it is already in samples
 *         try:             # <<<<<<<<<<<<<<
 *             return int(float(samples_string))
 *         except:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":331
 *         # If the string contains only digits we assume it is already in samples
 *         try:
 *             return int(float(samples_string))             # <<<<<<<<<<<<<<
 *         except:
 *             pass
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_v_samples_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7_try_return;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":330
 * 
 *         # If the string contains only digits we assume it is already in samples
 *         try:             # <<<<<<<<<<<<<<
 *             return int(float(samples_string))
 *         except:
 */
    }
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":332
 *         try:
 *             return int(float(samples_string))
 *         except:             # <<<<<<<<<<<<<<
 *             pass
 * 
 */
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    __pyx_L7_try_return:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":330
 * 
 *         # If the string contains only digits we assume it is already in samples
 *         try:             # <<<<<<<<<<<<<<
 *             return int(float(samples_string))
 *         except:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":337
 *         # Time strings are also permitted and will be converted to seconds
 *         # and then to samples using the current sample rate.
 *         cdef float seconds = AudioInterface.string_to_secs(samples_string)             # <<<<<<<<<<<<<<
 *         return int(self.sample_rate * seconds)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface), __pyx_n_s_string_to_secs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_samples_string); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_samples_string);
    __Pyx_GIVEREF(__pyx_v_samples_string);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_samples_string);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 337, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_seconds = __pyx_t_8;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":338
 *         # and then to samples using the current sample rate.
 *         cdef float seconds = AudioInterface.string_to_secs(samples_string)
 *         return int(self.sample_rate * seconds)             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_FromDouble((__pyx_v_self->sample_rate * __pyx_v_seconds)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":317
 *                 return 0.0
 * 
 *     def string_to_samples(self, samples):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a string to an integer value representing the number of samples.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.string_to_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_samples_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":341
 * 
 *     @classmethod
 *     def get_version(cls):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieves the current version of the audio interface library
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_25get_version(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_24get_version[] = "AudioInterface.get_version(type cls)\n\n        Retrieves the current version of the audio interface library\n        :return: Audio interface library version string\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_25get_version(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_version (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_24get_version(((PyTypeObject*)__pyx_v_cls));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_24get_version(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_version", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":346
 *         :return: Audio interface library version string
 *         """
 *         return __version__             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":341
 * 
 *     @classmethod
 *     def get_version(cls):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieves the current version of the audio interface library
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":349
 * 
 *     @classmethod
 *     def get_sdl_version(cls):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the version of the SDL library
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_27get_sdl_version(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_26get_sdl_version[] = "AudioInterface.get_sdl_version(type cls)\n\n        Returns the version of the SDL library\n        :return: SDL library version string\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_27get_sdl_version(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sdl_version (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_26get_sdl_version(((PyTypeObject*)__pyx_v_cls));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_26get_sdl_version(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  struct SDL_version __pyx_v_version;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("get_sdl_version", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":355
 *         """
 *         cdef SDL_version version
 *         SDL_GetVersion(&version)             # <<<<<<<<<<<<<<
 *         return 'SDL {}.{}.{}'.format(version.major, version.minor, version.patch)
 * 
 */
  SDL_GetVersion((&__pyx_v_version));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":356
 *         cdef SDL_version version
 *         SDL_GetVersion(&version)
 *         return 'SDL {}.{}.{}'.format(version.major, version.minor, version.patch)             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_SDL, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_Uint8(__pyx_v_version.major); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_Uint8(__pyx_v_version.minor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_Uint8(__pyx_v_version.patch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":349
 * 
 *     @classmethod
 *     def get_sdl_version(cls):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the version of the SDL library
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_sdl_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":359
 * 
 *     @classmethod
 *     def get_sdl_mixer_version(cls):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the version of the dynamically linked SDL_Mixer library
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_29get_sdl_mixer_version(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_28get_sdl_mixer_version[] = "AudioInterface.get_sdl_mixer_version(type cls)\n\n        Returns the version of the dynamically linked SDL_Mixer library\n        :return: SDL_Mixer library version string\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_29get_sdl_mixer_version(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sdl_mixer_version (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_28get_sdl_mixer_version(((PyTypeObject*)__pyx_v_cls));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_28get_sdl_mixer_version(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  struct SDL_version const *__pyx_v_version;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("get_sdl_mixer_version", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":364
 *         :return: SDL_Mixer library version string
 *         """
 *         cdef const SDL_version *version = Mix_Linked_Version()             # <<<<<<<<<<<<<<
 *         return 'SDL_Mixer {}.{}.{}'.format(version.major, version.minor, version.patch)
 * 
 */
  __pyx_v_version = Mix_Linked_Version();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":365
 *         """
 *         cdef const SDL_version *version = Mix_Linked_Version()
 *         return 'SDL_Mixer {}.{}.{}'.format(version.major, version.minor, version.patch)             # <<<<<<<<<<<<<<
 * 
 *     def supported_extensions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_SDL_Mixer, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_Uint8(__pyx_v_version->major); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_Uint8(__pyx_v_version->minor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_Uint8(__pyx_v_version->patch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":359
 * 
 *     @classmethod
 *     def get_sdl_mixer_version(cls):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the version of the dynamically linked SDL_Mixer library
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_sdl_mixer_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":367
 *         return 'SDL_Mixer {}.{}.{}'.format(version.major, version.minor, version.patch)
 * 
 *     def supported_extensions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the file extensions that are supported by the audio interface.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_31supported_extensions(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_30supported_extensions[] = "AudioInterface.supported_extensions(self)\n\n        Get the file extensions that are supported by the audio interface.\n        Returns:\n            A list of file extensions supported.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_31supported_extensions(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("supported_extensions (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_30supported_extensions(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_30supported_extensions(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_v_extensions = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("supported_extensions", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":373
 *             A list of file extensions supported.
 *         """
 *         extensions = ["wav"]             # <<<<<<<<<<<<<<
 *         if self.supported_formats & MIX_INIT_FLAC:
 *             extensions.append("flac")
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_u_wav);
  __Pyx_GIVEREF(__pyx_n_u_wav);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_wav);
  __pyx_v_extensions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":374
 *         """
 *         extensions = ["wav"]
 *         if self.supported_formats & MIX_INIT_FLAC:             # <<<<<<<<<<<<<<
 *             extensions.append("flac")
 *         if self.supported_formats & MIX_INIT_OGG:
 */
  __pyx_t_2 = ((__pyx_v_self->supported_formats & MIX_INIT_FLAC) != 0);
  if (__pyx_t_2) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":375
 *         extensions = ["wav"]
 *         if self.supported_formats & MIX_INIT_FLAC:
 *             extensions.append("flac")             # <<<<<<<<<<<<<<
 *         if self.supported_formats & MIX_INIT_OGG:
 *             extensions.append("ogg")
 */
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_extensions, __pyx_n_u_flac); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 375, __pyx_L1_error)

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":374
 *         """
 *         extensions = ["wav"]
 *         if self.supported_formats & MIX_INIT_FLAC:             # <<<<<<<<<<<<<<
 *             extensions.append("flac")
 *         if self.supported_formats & MIX_INIT_OGG:
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":376
 *         if self.supported_formats & MIX_INIT_FLAC:
 *             extensions.append("flac")
 *         if self.supported_formats & MIX_INIT_OGG:             # <<<<<<<<<<<<<<
 *             extensions.append("ogg")
 *         return extensions
 */
  __pyx_t_2 = ((__pyx_v_self->supported_formats & MIX_INIT_OGG) != 0);
  if (__pyx_t_2) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":377
 *             extensions.append("flac")
 *         if self.supported_formats & MIX_INIT_OGG:
 *             extensions.append("ogg")             # <<<<<<<<<<<<<<
 *         return extensions
 * 
 */
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_extensions, __pyx_n_u_ogg); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 377, __pyx_L1_error)

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":376
 *         if self.supported_formats & MIX_INIT_FLAC:
 *             extensions.append("flac")
 *         if self.supported_formats & MIX_INIT_OGG:             # <<<<<<<<<<<<<<
 *             extensions.append("ogg")
 *         return extensions
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":378
 *         if self.supported_formats & MIX_INIT_OGG:
 *             extensions.append("ogg")
 *         return extensions             # <<<<<<<<<<<<<<
 * 
 *     def get_master_volume(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_extensions);
  __pyx_r = __pyx_v_extensions;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":367
 *         return 'SDL_Mixer {}.{}.{}'.format(version.major, version.minor, version.patch)
 * 
 *     def supported_extensions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the file extensions that are supported by the audio interface.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.supported_extensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_extensions);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":380
 *         return extensions
 * 
 *     def get_master_volume(self):             # <<<<<<<<<<<<<<
 *         return round(self.audio_callback_data.master_volume / MIX_MAX_VOLUME, 2)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_33get_master_volume(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_32get_master_volume[] = "AudioInterface.get_master_volume(self)";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_33get_master_volume(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_master_volume (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_32get_master_volume(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_32get_master_volume(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("get_master_volume", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":381
 * 
 *     def get_master_volume(self):
 *         return round(self.audio_callback_data.master_volume / MIX_MAX_VOLUME, 2)             # <<<<<<<<<<<<<<
 * 
 *     def set_master_volume(self, float volume):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(MIX_MAX_VOLUME == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 381, __pyx_L1_error)
  }
  __pyx_t_1 = PyFloat_FromDouble((((double)__pyx_v_self->audio_callback_data->master_volume) / ((double)MIX_MAX_VOLUME))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_2);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":380
 *         return extensions
 * 
 *     def get_master_volume(self):             # <<<<<<<<<<<<<<
 *         return round(self.audio_callback_data.master_volume / MIX_MAX_VOLUME, 2)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_master_volume", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":383
 *         return round(self.audio_callback_data.master_volume / MIX_MAX_VOLUME, 2)
 * 
 *     def set_master_volume(self, float volume):             # <<<<<<<<<<<<<<
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         self.audio_callback_data.master_volume = <Uint8>min(max(volume * MIX_MAX_VOLUME, 0), MIX_MAX_VOLUME)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_35set_master_volume(PyObject *__pyx_v_self, PyObject *__pyx_arg_volume); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_34set_master_volume[] = "AudioInterface.set_master_volume(self, float volume)";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_35set_master_volume(PyObject *__pyx_v_self, PyObject *__pyx_arg_volume) {
  float __pyx_v_volume;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_master_volume (wrapper)", 0);
  assert(__pyx_arg_volume); {
    __pyx_v_volume = __pyx_PyFloat_AsFloat(__pyx_arg_volume); if (unlikely((__pyx_v_volume == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 383, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.set_master_volume", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_34set_master_volume(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), ((float)__pyx_v_volume));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_34set_master_volume(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, float __pyx_v_volume) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  long __pyx_t_2;
  float __pyx_t_3;
  float __pyx_t_4;
  __Pyx_RefNannySetupContext("set_master_volume", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":384
 * 
 *     def set_master_volume(self, float volume):
 *         SDL_LockMutex(self.audio_callback_data.mutex)             # <<<<<<<<<<<<<<
 *         self.audio_callback_data.master_volume = <Uint8>min(max(volume * MIX_MAX_VOLUME, 0), MIX_MAX_VOLUME)
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 */
  SDL_LockMutex(__pyx_v_self->audio_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":385
 *     def set_master_volume(self, float volume):
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         self.audio_callback_data.master_volume = <Uint8>min(max(volume * MIX_MAX_VOLUME, 0), MIX_MAX_VOLUME)             # <<<<<<<<<<<<<<
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 * 
 */
  __pyx_t_1 = MIX_MAX_VOLUME;
  __pyx_t_2 = 0;
  __pyx_t_3 = (__pyx_v_volume * MIX_MAX_VOLUME);
  if (((__pyx_t_2 > __pyx_t_3) != 0)) {
    __pyx_t_4 = __pyx_t_2;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  __pyx_t_3 = __pyx_t_4;
  if (((__pyx_t_1 < __pyx_t_3) != 0)) {
    __pyx_t_4 = __pyx_t_1;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  __pyx_v_self->audio_callback_data->master_volume = ((Uint8)__pyx_t_4);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":386
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         self.audio_callback_data.master_volume = <Uint8>min(max(volume * MIX_MAX_VOLUME, 0), MIX_MAX_VOLUME)
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def get_settings(self):
 */
  SDL_UnlockMutex(__pyx_v_self->audio_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":383
 *         return round(self.audio_callback_data.master_volume / MIX_MAX_VOLUME, 2)
 * 
 *     def set_master_volume(self, float volume):             # <<<<<<<<<<<<<<
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         self.audio_callback_data.master_volume = <Uint8>min(max(volume * MIX_MAX_VOLUME, 0), MIX_MAX_VOLUME)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":388
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 * 
 *     def get_settings(self):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the current audio interface settings. This method is only intended for testing purposes.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_37get_settings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_36get_settings[] = "AudioInterface.get_settings(self)\n\n        Gets the current audio interface settings. This method is only intended for testing purposes.\n        Returns:\n            A dictionary containing the current audio interface settings or None if the\n            audio interface is not enabled.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_37get_settings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_settings (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_36get_settings(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_36get_settings(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_settings", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":395
 *             audio interface is not enabled.
 *         """
 *         if self.enabled:             # <<<<<<<<<<<<<<
 *             return {'sample_rate': self.sample_rate,
 *                     'audio_channels': self.audio_channels,
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_enabled); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":396
 *         """
 *         if self.enabled:
 *             return {'sample_rate': self.sample_rate,             # <<<<<<<<<<<<<<
 *                     'audio_channels': self.audio_channels,
 *                     'buffer_samples': self.buffer_samples,
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->sample_rate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_sample_rate, __pyx_t_3) < 0) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":397
 *         if self.enabled:
 *             return {'sample_rate': self.sample_rate,
 *                     'audio_channels': self.audio_channels,             # <<<<<<<<<<<<<<
 *                     'buffer_samples': self.buffer_samples,
 *                     'buffer_size': self.buffer_size
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->audio_channels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_audio_channels, __pyx_t_3) < 0) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":398
 *             return {'sample_rate': self.sample_rate,
 *                     'audio_channels': self.audio_channels,
 *                     'buffer_samples': self.buffer_samples,             # <<<<<<<<<<<<<<
 *                     'buffer_size': self.buffer_size
 *                     }
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->buffer_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_buffer_samples, __pyx_t_3) < 0) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":399
 *                     'audio_channels': self.audio_channels,
 *                     'buffer_samples': self.buffer_samples,
 *                     'buffer_size': self.buffer_size             # <<<<<<<<<<<<<<
 *                     }
 *         else:
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_buffer_size, __pyx_t_3) < 0) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":395
 *             audio interface is not enabled.
 *         """
 *         if self.enabled:             # <<<<<<<<<<<<<<
 *             return {'sample_rate': self.sample_rate,
 *                     'audio_channels': self.audio_channels,
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":402
 *                     }
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":388
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 * 
 *     def get_settings(self):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the current audio interface settings. This method is only intended for testing purposes.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_settings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":405
 * 
 *     @property
 *     def enabled(self):             # <<<<<<<<<<<<<<
 *         cdef void *data
 *         SDL_LockAudio()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7enabled_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7enabled_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7enabled___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7enabled___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  void *__pyx_v_data;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":407
 *     def enabled(self):
 *         cdef void *data
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 *         data = Mix_GetMusicHookData()
 *         SDL_UnlockAudio()
 */
  SDL_LockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":408
 *         cdef void *data
 *         SDL_LockAudio()
 *         data = Mix_GetMusicHookData()             # <<<<<<<<<<<<<<
 *         SDL_UnlockAudio()
 *         return data != NULL
 */
  __pyx_v_data = Mix_GetMusicHookData();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":409
 *         SDL_LockAudio()
 *         data = Mix_GetMusicHookData()
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *         return data != NULL
 * 
 */
  SDL_UnlockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":410
 *         data = Mix_GetMusicHookData()
 *         SDL_UnlockAudio()
 *         return data != NULL             # <<<<<<<<<<<<<<
 * 
 *     def enable(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_data != NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":405
 * 
 *     @property
 *     def enabled(self):             # <<<<<<<<<<<<<<
 *         cdef void *data
 *         SDL_LockAudio()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.enabled.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":412
 *         return data != NULL
 * 
 *     def enable(self):             # <<<<<<<<<<<<<<
 *         """
 *         Enables audio playback (begins audio processing)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_39enable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_38enable[] = "AudioInterface.enable(self)\n\n        Enables audio playback (begins audio processing)\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_39enable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("enable (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_38enable(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_38enable(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("enable", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":416
 *         Enables audio playback (begins audio processing)
 *         """
 *         self.log.debug("Enabling audio playback")             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockAudio()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":418
 *         self.log.debug("Enabling audio playback")
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 *         # Establish custom music hook/callback function
 *         Mix_HookMusic(AudioInterface.audio_callback, <void*>self.audio_callback_data)
 */
  SDL_LockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":420
 *         SDL_LockAudio()
 *         # Establish custom music hook/callback function
 *         Mix_HookMusic(AudioInterface.audio_callback, <void*>self.audio_callback_data)             # <<<<<<<<<<<<<<
 *         SDL_UnlockAudio()
 * 
 */
  Mix_HookMusic(__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_audio_callback, ((void *)__pyx_v_self->audio_callback_data));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":421
 *         # Establish custom music hook/callback function
 *         Mix_HookMusic(AudioInterface.audio_callback, <void*>self.audio_callback_data)
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     def disable(self):
 */
  SDL_UnlockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":412
 *         return data != NULL
 * 
 *     def enable(self):             # <<<<<<<<<<<<<<
 *         """
 *         Enables audio playback (begins audio processing)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.enable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":423
 *         SDL_UnlockAudio()
 * 
 *     def disable(self):             # <<<<<<<<<<<<<<
 *         """
 *         Disables audio playback (stops audio processing)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_41disable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_40disable[] = "AudioInterface.disable(self)\n\n        Disables audio playback (stops audio processing)\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_41disable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("disable (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_40disable(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_40disable(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("disable", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":427
 *         Disables audio playback (stops audio processing)
 *         """
 *         self.log.debug("Disabling audio playback")             # <<<<<<<<<<<<<<
 * 
 *         self.stop_all_sounds()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":429
 *         self.log.debug("Disabling audio playback")
 * 
 *         self.stop_all_sounds()             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockAudio()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop_all_sounds); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":431
 *         self.stop_all_sounds()
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 *         # Remove custom music hook/callback function
 *         Mix_HookMusic(NULL, NULL)
 */
  SDL_LockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":433
 *         SDL_LockAudio()
 *         # Remove custom music hook/callback function
 *         Mix_HookMusic(NULL, NULL)             # <<<<<<<<<<<<<<
 *         SDL_UnlockAudio()
 * 
 */
  Mix_HookMusic(NULL, NULL);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":434
 *         # Remove custom music hook/callback function
 *         Mix_HookMusic(NULL, NULL)
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  SDL_UnlockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":423
 *         SDL_UnlockAudio()
 * 
 *     def disable(self):             # <<<<<<<<<<<<<<
 *         """
 *         Disables audio playback (stops audio processing)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.disable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":437
 * 
 *     @staticmethod
 *     def get_max_tracks():             # <<<<<<<<<<<<<<
 *         """ Returns the maximum number of tracks allowed. """
 *         return MAX_TRACKS
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_43get_max_tracks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_42get_max_tracks[] = "AudioInterface.get_max_tracks()\n Returns the maximum number of tracks allowed. ";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_43get_max_tracks = {"get_max_tracks", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_43get_max_tracks, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_42get_max_tracks};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_43get_max_tracks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_max_tracks (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("get_max_tracks", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "get_max_tracks", 0))) return NULL;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_42get_max_tracks();

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_42get_max_tracks() {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_max_tracks", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":439
 *     def get_max_tracks():
 *         """ Returns the maximum number of tracks allowed. """
 *         return MAX_TRACKS             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_int_8);
  __pyx_r = __pyx_int_8;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":437
 * 
 *     @staticmethod
 *     def get_max_tracks():             # <<<<<<<<<<<<<<
 *         """ Returns the maximum number of tracks allowed. """
 *         return MAX_TRACKS
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":442
 * 
 *     @staticmethod
 *     def get_max_markers():             # <<<<<<<<<<<<<<
 *         """Return the maximum number of markers allowed per sound"""
 *         return MAX_MARKERS
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_45get_max_markers(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_44get_max_markers[] = "AudioInterface.get_max_markers()\nReturn the maximum number of markers allowed per sound";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_45get_max_markers = {"get_max_markers", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_45get_max_markers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_44get_max_markers};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_45get_max_markers(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_max_markers (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("get_max_markers", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "get_max_markers", 0))) return NULL;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_44get_max_markers();

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_44get_max_markers() {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_max_markers", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":444
 *     def get_max_markers():
 *         """Return the maximum number of markers allowed per sound"""
 *         return MAX_MARKERS             # <<<<<<<<<<<<<<
 * 
 *     def get_track_count(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_int_8);
  __pyx_r = __pyx_int_8;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":442
 * 
 *     @staticmethod
 *     def get_max_markers():             # <<<<<<<<<<<<<<
 *         """Return the maximum number of markers allowed per sound"""
 *         return MAX_MARKERS
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":446
 *         return MAX_MARKERS
 * 
 *     def get_track_count(self):             # <<<<<<<<<<<<<<
 *         """ Returns the number of tracks that have been created. """
 *         return len(self.tracks)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_47get_track_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_46get_track_count[] = "AudioInterface.get_track_count(self)\n Returns the number of tracks that have been created. ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_47get_track_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_track_count (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_46get_track_count(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_46get_track_count(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  __Pyx_RefNannySetupContext("get_track_count", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":448
 *     def get_track_count(self):
 *         """ Returns the number of tracks that have been created. """
 *         return len(self.tracks)             # <<<<<<<<<<<<<<
 * 
 *     def get_track(self, int track_num):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->tracks;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 448, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":446
 *         return MAX_MARKERS
 * 
 *     def get_track_count(self):             # <<<<<<<<<<<<<<
 *         """ Returns the number of tracks that have been created. """
 *         return len(self.tracks)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_track_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":450
 *         return len(self.tracks)
 * 
 *     def get_track(self, int track_num):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the track with the specified track number.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_49get_track(PyObject *__pyx_v_self, PyObject *__pyx_arg_track_num); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_48get_track[] = "AudioInterface.get_track(self, int track_num)\n\n        Returns the track with the specified track number.\n        Args:\n            track_num: The track number to retrieve\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_49get_track(PyObject *__pyx_v_self, PyObject *__pyx_arg_track_num) {
  int __pyx_v_track_num;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_track (wrapper)", 0);
  assert(__pyx_arg_track_num); {
    __pyx_v_track_num = __Pyx_PyInt_As_int(__pyx_arg_track_num); if (unlikely((__pyx_v_track_num == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 450, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_track", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_48get_track(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), ((int)__pyx_v_track_num));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_48get_track(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, int __pyx_v_track_num) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("get_track", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":456
 *             track_num: The track number to retrieve
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             return self.tracks[track_num]
 *         except IndexError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":457
 *         """
 *         try:
 *             return self.tracks[track_num]             # <<<<<<<<<<<<<<
 *         except IndexError:
 *             return None
 */
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(__pyx_v_self->tracks == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 457, __pyx_L3_error)
      }
      __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->tracks, __pyx_v_track_num, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 457, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":456
 *             track_num: The track number to retrieve
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             return self.tracks[track_num]
 *         except IndexError:
 */
    }
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":458
 *         try:
 *             return self.tracks[track_num]
 *         except IndexError:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_track", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 458, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":459
 *             return self.tracks[track_num]
 *         except IndexError:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def get_track_by_name(self, str name not None):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":456
 *             track_num: The track number to retrieve
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             return self.tracks[track_num]
 *         except IndexError:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":450
 *         return len(self.tracks)
 * 
 *     def get_track(self, int track_num):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the track with the specified track number.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_track", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":461
 *             return None
 * 
 *     def get_track_by_name(self, str name not None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the track with the specified name.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_51get_track_by_name(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_50get_track_by_name[] = "AudioInterface.get_track_by_name(self, unicode name)\n\n        Returns the track with the specified name.\n        Args:\n            name: The track name to retrieve\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_51get_track_by_name(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_track_by_name (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 0, "name", 1))) __PYX_ERR(0, 461, __pyx_L1_error)
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_50get_track_by_name(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), ((PyObject*)__pyx_v_name));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_50get_track_by_name(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_v_track = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("get_track_by_name", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":467
 *             name: The track name to retrieve
 *         """
 *         name = name.lower()             # <<<<<<<<<<<<<<
 *         for track in self.tracks:
 *             if name == track.name:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_name, ((PyObject*)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":468
 *         """
 *         name = name.lower()
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             if name == track.name:
 *                 return track
 */
  if (unlikely(__pyx_v_self->tracks == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 468, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->tracks; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 468, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_track, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":469
 *         name = name.lower()
 *         for track in self.tracks:
 *             if name == track.name:             # <<<<<<<<<<<<<<
 *                 return track
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_track, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 469, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":470
 *         for track in self.tracks:
 *             if name == track.name:
 *                 return track             # <<<<<<<<<<<<<<
 * 
 *         return None
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_track);
      __pyx_r = __pyx_v_track;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":469
 *         name = name.lower()
 *         for track in self.tracks:
 *             if name == track.name:             # <<<<<<<<<<<<<<
 *                 return track
 * 
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":468
 *         """
 *         name = name.lower()
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             if name == track.name:
 *                 return track
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":472
 *                 return track
 * 
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def create_standard_track(self, str name not None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":461
 *             return None
 * 
 *     def get_track_by_name(self, str name not None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the track with the specified name.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_track_by_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_track);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":474
 *         return None
 * 
 *     def create_standard_track(self, str name not None,             # <<<<<<<<<<<<<<
 *                               int max_simultaneous_sounds=MAX_SIMULTANEOUS_SOUNDS_DEFAULT,
 *                               float volume=1.0):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_53create_standard_track(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_52create_standard_track[] = "AudioInterface.create_standard_track(self, unicode name, int max_simultaneous_sounds=8, float volume=1.0)\n\n        Creates a new standard track in the audio interface\n        Args:\n            name: The name of the new track\n            max_simultaneous_sounds: The maximum number of sounds that may be played at one time on the track\n            volume: The track volume (0.0 to 1.0)\n\n        Returns:\n            A Track object for the newly created track\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_53create_standard_track(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  int __pyx_v_max_simultaneous_sounds;
  float __pyx_v_volume;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_standard_track (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_max_simultaneous_sounds,&__pyx_n_s_volume,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_simultaneous_sounds);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_volume);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_standard_track") < 0)) __PYX_ERR(0, 474, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_max_simultaneous_sounds = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_max_simultaneous_sounds == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 475, __pyx_L3_error)
    } else {
      __pyx_v_max_simultaneous_sounds = ((int)8);
    }
    if (values[2]) {
      __pyx_v_volume = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_volume == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 476, __pyx_L3_error)
    } else {
      __pyx_v_volume = ((float)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_standard_track", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 474, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.create_standard_track", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 0, "name", 1))) __PYX_ERR(0, 474, __pyx_L1_error)
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_52create_standard_track(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), __pyx_v_name, __pyx_v_max_simultaneous_sounds, __pyx_v_volume);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_52create_standard_track(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_name, int __pyx_v_max_simultaneous_sounds, float __pyx_v_volume) {
  int __pyx_v_track_num;
  PyObject *__pyx_v_track = NULL;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_new_track = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *__pyx_t_11;
  __Pyx_RefNannySetupContext("create_standard_track", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":487
 *             A Track object for the newly created track
 *         """
 *         cdef int track_num = len(self.tracks)             # <<<<<<<<<<<<<<
 *         if track_num == MAX_TRACKS:
 *             self.log.error("Add track failed - the maximum number of tracks "
 */
  __pyx_t_1 = __pyx_v_self->tracks;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 487, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_track_num = __pyx_t_2;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":488
 *         """
 *         cdef int track_num = len(self.tracks)
 *         if track_num == MAX_TRACKS:             # <<<<<<<<<<<<<<
 *             self.log.error("Add track failed - the maximum number of tracks "
 *                            "(%d) has been reached.", MAX_TRACKS)
 */
  __pyx_t_3 = ((__pyx_v_track_num == 8) != 0);
  if (__pyx_t_3) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":489
 *         cdef int track_num = len(self.tracks)
 *         if track_num == MAX_TRACKS:
 *             self.log.error("Add track failed - the maximum number of tracks "             # <<<<<<<<<<<<<<
 *                            "(%d) has been reached.", MAX_TRACKS)
 *             return None
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":491
 *             self.log.error("Add track failed - the maximum number of tracks "
 *                            "(%d) has been reached.", MAX_TRACKS)
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         # Make sure track name does not already exist (no duplicates allowed)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":488
 *         """
 *         cdef int track_num = len(self.tracks)
 *         if track_num == MAX_TRACKS:             # <<<<<<<<<<<<<<
 *             self.log.error("Add track failed - the maximum number of tracks "
 *                            "(%d) has been reached.", MAX_TRACKS)
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":494
 * 
 *         # Make sure track name does not already exist (no duplicates allowed)
 *         name = name.lower()             # <<<<<<<<<<<<<<
 *         for track in self.tracks:
 *             if name == track.name:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_lower); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 494, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 494, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_name, ((PyObject*)__pyx_t_4));
  __pyx_t_4 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":495
 *         # Make sure track name does not already exist (no duplicates allowed)
 *         name = name.lower()
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             if name == track.name:
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)
 */
  if (unlikely(__pyx_v_self->tracks == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 495, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_v_self->tracks; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 495, __pyx_L1_error)
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_track, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":496
 *         name = name.lower()
 *         for track in self.tracks:
 *             if name == track.name:             # <<<<<<<<<<<<<<
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)
 *                 return None
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_track, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":497
 *         for track in self.tracks:
 *             if name == track.name:
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_Add_track_failed_the_track_name);
      __Pyx_GIVEREF(__pyx_kp_u_Add_track_failed_the_track_name);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_Add_track_failed_the_track_name);
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_name);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":498
 *             if name == track.name:
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         # Make sure audio callback function cannot be called while we are changing the track data
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":496
 *         name = name.lower()
 *         for track in self.tracks:
 *             if name == track.name:             # <<<<<<<<<<<<<<
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)
 *                 return None
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":495
 *         # Make sure track name does not already exist (no duplicates allowed)
 *         name = name.lower()
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             if name == track.name:
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":501
 * 
 *         # Make sure audio callback function cannot be called while we are changing the track data
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         # Create the new standard track
 */
  SDL_LockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":505
 *         # Create the new standard track
 *         new_track = TrackStandard(self.sound_instances_by_id,
 *                                   pycapsule.PyCapsule_New(self.audio_callback_data, NULL, NULL),             # <<<<<<<<<<<<<<
 *                                   name,
 *                                   track_num,
 */
  __pyx_t_4 = PyCapsule_New(__pyx_v_self->audio_callback_data, NULL, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":507
 *                                   pycapsule.PyCapsule_New(self.audio_callback_data, NULL, NULL),
 *                                   name,
 *                                   track_num,             # <<<<<<<<<<<<<<
 *                                   self.buffer_size,
 *                                   max_simultaneous_sounds,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_track_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":508
 *                                   name,
 *                                   track_num,
 *                                   self.buffer_size,             # <<<<<<<<<<<<<<
 *                                   max_simultaneous_sounds,
 *                                   volume)
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->buffer_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":509
 *                                   track_num,
 *                                   self.buffer_size,
 *                                   max_simultaneous_sounds,             # <<<<<<<<<<<<<<
 *                                   volume)
 *         self.tracks.append(new_track)
 */
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_simultaneous_sounds); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":510
 *                                   self.buffer_size,
 *                                   max_simultaneous_sounds,
 *                                   volume)             # <<<<<<<<<<<<<<
 *         self.tracks.append(new_track)
 * 
 */
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_volume); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":504
 * 
 *         # Create the new standard track
 *         new_track = TrackStandard(self.sound_instances_by_id,             # <<<<<<<<<<<<<<
 *                                   pycapsule.PyCapsule_New(self.audio_callback_data, NULL, NULL),
 *                                   name,
 */
  __pyx_t_9 = PyTuple_New(7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_v_self->sound_instances_by_id);
  __Pyx_GIVEREF(__pyx_v_self->sound_instances_by_id);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_self->sound_instances_by_id);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_t_6);
  __pyx_t_4 = 0;
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_t_8 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard), __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_new_track = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":511
 *                                   max_simultaneous_sounds,
 *                                   volume)
 *         self.tracks.append(new_track)             # <<<<<<<<<<<<<<
 * 
 *         # Update audio callback data with new track
 */
  if (unlikely(__pyx_v_self->tracks == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    __PYX_ERR(0, 511, __pyx_L1_error)
  }
  __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_self->tracks, ((PyObject *)__pyx_v_new_track)); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 511, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":514
 * 
 *         # Update audio callback data with new track
 *         self.audio_callback_data.track_count = len(self.tracks)             # <<<<<<<<<<<<<<
 *         self.audio_callback_data.tracks[track_num] = new_track.state
 * 
 */
  __pyx_t_6 = __pyx_v_self->tracks;
  __Pyx_INCREF(__pyx_t_6);
  if (unlikely(__pyx_t_6 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 514, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_6); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 514, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_self->audio_callback_data->track_count = __pyx_t_2;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":515
 *         # Update audio callback data with new track
 *         self.audio_callback_data.track_count = len(self.tracks)
 *         self.audio_callback_data.tracks[track_num] = new_track.state             # <<<<<<<<<<<<<<
 * 
 *         # Allow audio callback function to be called again
 */
  __pyx_t_11 = __pyx_v_new_track->__pyx_base.state;
  (__pyx_v_self->audio_callback_data->tracks[__pyx_v_track_num]) = __pyx_t_11;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":518
 * 
 *         # Allow audio callback function to be called again
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("The '%s' standard track has successfully been created.", name)
 */
  SDL_UnlockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":520
 *         SDL_UnlockAudio()
 * 
 *         self.log.debug("The '%s' standard track has successfully been created.", name)             # <<<<<<<<<<<<<<
 * 
 *         return new_track
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_debug); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = NULL;
  __pyx_t_2 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_2 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_8) {
    __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_The_s_standard_track_has_success);
  __Pyx_GIVEREF(__pyx_kp_u_The_s_standard_track_has_success);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_2, __pyx_kp_u_The_s_standard_track_has_success);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_2, __pyx_v_name);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":522
 *         self.log.debug("The '%s' standard track has successfully been created.", name)
 * 
 *         return new_track             # <<<<<<<<<<<<<<
 * 
 *     def create_live_loop_track(self, str name not None, float volume=1.0):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_new_track));
  __pyx_r = ((PyObject *)__pyx_v_new_track);
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":474
 *         return None
 * 
 *     def create_standard_track(self, str name not None,             # <<<<<<<<<<<<<<
 *                               int max_simultaneous_sounds=MAX_SIMULTANEOUS_SOUNDS_DEFAULT,
 *                               float volume=1.0):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.create_standard_track", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_track);
  __Pyx_XDECREF((PyObject *)__pyx_v_new_track);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":524
 *         return new_track
 * 
 *     def create_live_loop_track(self, str name not None, float volume=1.0):             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new live loop track in the audio interface
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_55create_live_loop_track(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_54create_live_loop_track[] = "AudioInterface.create_live_loop_track(self, unicode name, float volume=1.0)\n\n        Creates a new live loop track in the audio interface\n        Args:\n            name: The name of the new track\n            volume: The track volume (0.0 to 1.0)\n\n        Returns:\n            A Track object for the newly created track\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_55create_live_loop_track(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  float __pyx_v_volume;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_live_loop_track (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_volume,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_volume);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_live_loop_track") < 0)) __PYX_ERR(0, 524, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_volume = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_volume == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 524, __pyx_L3_error)
    } else {
      __pyx_v_volume = ((float)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_live_loop_track", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 524, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.create_live_loop_track", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 0, "name", 1))) __PYX_ERR(0, 524, __pyx_L1_error)
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_54create_live_loop_track(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), __pyx_v_name, __pyx_v_volume);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_54create_live_loop_track(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_name, float __pyx_v_volume) {
  int __pyx_v_track_num;
  PyObject *__pyx_v_track = NULL;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_new_track = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *__pyx_t_10;
  __Pyx_RefNannySetupContext("create_live_loop_track", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":534
 *             A Track object for the newly created track
 *         """
 *         cdef int track_num = len(self.tracks)             # <<<<<<<<<<<<<<
 *         if track_num == MAX_TRACKS:
 *             self.log.error("Add track failed - the maximum number of tracks "
 */
  __pyx_t_1 = __pyx_v_self->tracks;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 534, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 534, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_track_num = __pyx_t_2;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":535
 *         """
 *         cdef int track_num = len(self.tracks)
 *         if track_num == MAX_TRACKS:             # <<<<<<<<<<<<<<
 *             self.log.error("Add track failed - the maximum number of tracks "
 *                            "(%d) has been reached.", MAX_TRACKS)
 */
  __pyx_t_3 = ((__pyx_v_track_num == 8) != 0);
  if (__pyx_t_3) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":536
 *         cdef int track_num = len(self.tracks)
 *         if track_num == MAX_TRACKS:
 *             self.log.error("Add track failed - the maximum number of tracks "             # <<<<<<<<<<<<<<
 *                            "(%d) has been reached.", MAX_TRACKS)
 *             return None
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":538
 *             self.log.error("Add track failed - the maximum number of tracks "
 *                            "(%d) has been reached.", MAX_TRACKS)
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         # Make sure track name does not already exist (no duplicates allowed)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":535
 *         """
 *         cdef int track_num = len(self.tracks)
 *         if track_num == MAX_TRACKS:             # <<<<<<<<<<<<<<
 *             self.log.error("Add track failed - the maximum number of tracks "
 *                            "(%d) has been reached.", MAX_TRACKS)
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":541
 * 
 *         # Make sure track name does not already exist (no duplicates allowed)
 *         name = name.lower()             # <<<<<<<<<<<<<<
 *         for track in self.tracks:
 *             if name == track.name:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_lower); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 541, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 541, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_name, ((PyObject*)__pyx_t_4));
  __pyx_t_4 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":542
 *         # Make sure track name does not already exist (no duplicates allowed)
 *         name = name.lower()
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             if name == track.name:
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)
 */
  if (unlikely(__pyx_v_self->tracks == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 542, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_v_self->tracks; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 542, __pyx_L1_error)
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_track, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":543
 *         name = name.lower()
 *         for track in self.tracks:
 *             if name == track.name:             # <<<<<<<<<<<<<<
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)
 *                 return None
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_track, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":544
 *         for track in self.tracks:
 *             if name == track.name:
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 544, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_Add_track_failed_the_track_name);
      __Pyx_GIVEREF(__pyx_kp_u_Add_track_failed_the_track_name);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_Add_track_failed_the_track_name);
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_name);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":545
 *             if name == track.name:
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         # Make sure audio callback function cannot be called while we are changing the track data
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":543
 *         name = name.lower()
 *         for track in self.tracks:
 *             if name == track.name:             # <<<<<<<<<<<<<<
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)
 *                 return None
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":542
 *         # Make sure track name does not already exist (no duplicates allowed)
 *         name = name.lower()
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             if name == track.name:
 *                 self.log.error("Add track failed - the track name '%s' already exists.", name)
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":548
 * 
 *         # Make sure audio callback function cannot be called while we are changing the track data
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         # Create the new live loop track
 */
  SDL_LockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":552
 *         # Create the new live loop track
 *         new_track = TrackLiveLoop(self.mc,
 *                                   pycapsule.PyCapsule_New(self.audio_callback_data, NULL, NULL),             # <<<<<<<<<<<<<<
 *                                   name,
 *                                   track_num,
 */
  __pyx_t_4 = PyCapsule_New(__pyx_v_self->audio_callback_data, NULL, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":554
 *                                   pycapsule.PyCapsule_New(self.audio_callback_data, NULL, NULL),
 *                                   name,
 *                                   track_num,             # <<<<<<<<<<<<<<
 *                                   self.buffer_size,
 *                                   volume)
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_track_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":555
 *                                   name,
 *                                   track_num,
 *                                   self.buffer_size,             # <<<<<<<<<<<<<<
 *                                   volume)
 *         self.tracks.append(new_track)
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->buffer_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":556
 *                                   track_num,
 *                                   self.buffer_size,
 *                                   volume)             # <<<<<<<<<<<<<<
 *         self.tracks.append(new_track)
 * 
 */
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_volume); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":551
 * 
 *         # Create the new live loop track
 *         new_track = TrackLiveLoop(self.mc,             # <<<<<<<<<<<<<<
 *                                   pycapsule.PyCapsule_New(self.audio_callback_data, NULL, NULL),
 *                                   name,
 */
  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_self->mc);
  __Pyx_GIVEREF(__pyx_v_self->mc);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self->mc);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_8);
  __pyx_t_4 = 0;
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop), __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_new_track = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":557
 *                                   self.buffer_size,
 *                                   volume)
 *         self.tracks.append(new_track)             # <<<<<<<<<<<<<<
 * 
 *         # Update audio callback data with new track
 */
  if (unlikely(__pyx_v_self->tracks == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    __PYX_ERR(0, 557, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->tracks, ((PyObject *)__pyx_v_new_track)); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 557, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":560
 * 
 *         # Update audio callback data with new track
 *         self.audio_callback_data.track_count = len(self.tracks)             # <<<<<<<<<<<<<<
 *         self.audio_callback_data.tracks[track_num] = new_track.state
 * 
 */
  __pyx_t_8 = __pyx_v_self->tracks;
  __Pyx_INCREF(__pyx_t_8);
  if (unlikely(__pyx_t_8 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 560, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_8); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_self->audio_callback_data->track_count = __pyx_t_2;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":561
 *         # Update audio callback data with new track
 *         self.audio_callback_data.track_count = len(self.tracks)
 *         self.audio_callback_data.tracks[track_num] = new_track.state             # <<<<<<<<<<<<<<
 * 
 *         # Allow audio callback function to be called again
 */
  __pyx_t_10 = __pyx_v_new_track->__pyx_base.state;
  (__pyx_v_self->audio_callback_data->tracks[__pyx_v_track_num]) = __pyx_t_10;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":564
 * 
 *         # Allow audio callback function to be called again
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("The '%s' live loop track has successfully been created.", name)
 */
  SDL_UnlockAudio();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":566
 *         SDL_UnlockAudio()
 * 
 *         self.log.debug("The '%s' live loop track has successfully been created.", name)             # <<<<<<<<<<<<<<
 * 
 *         return new_track
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = NULL;
  __pyx_t_2 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_2 = 1;
    }
  }
  __pyx_t_1 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_The_s_live_loop_track_has_succes);
  __Pyx_GIVEREF(__pyx_kp_u_The_s_live_loop_track_has_succes);
  PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_2, __pyx_kp_u_The_s_live_loop_track_has_succes);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_2, __pyx_v_name);
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":568
 *         self.log.debug("The '%s' live loop track has successfully been created.", name)
 * 
 *         return new_track             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_new_track));
  __pyx_r = ((PyObject *)__pyx_v_new_track);
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":524
 *         return new_track
 * 
 *     def create_live_loop_track(self, str name not None, float volume=1.0):             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new live loop track in the audio interface
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.create_live_loop_track", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_track);
  __Pyx_XDECREF((PyObject *)__pyx_v_new_track);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":571
 * 
 *     @staticmethod
 *     def load_sound_chunk(str file_name):             # <<<<<<<<<<<<<<
 *         """
 *         Loads an audio file into a MixChunkContainer wrapper object for use in a Sound object.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_57load_sound_chunk(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_56load_sound_chunk[] = "AudioInterface.load_sound_chunk(unicode file_name)\n\n        Loads an audio file into a MixChunkContainer wrapper object for use in a Sound object.\n        Used in asset loading for Sound objects.\n        Args:\n            file_name: The audio file name to load.\n\n        Returns:\n            A MixChunkContainer wrapper object containing a pointer to the sound sample\n            in memory.  None is returned if the sound file was unable to be loaded.\n        ";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_57load_sound_chunk = {"load_sound_chunk", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_57load_sound_chunk, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_56load_sound_chunk};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_57load_sound_chunk(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load_sound_chunk (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file_name,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_file_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load_sound_chunk") < 0)) __PYX_ERR(0, 571, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_file_name = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load_sound_chunk", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 571, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.load_sound_chunk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_name), (&PyUnicode_Type), 1, "file_name", 1))) __PYX_ERR(0, 571, __pyx_L1_error)
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_56load_sound_chunk(__pyx_v_file_name);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_56load_sound_chunk(PyObject *__pyx_v_file_name) {
  PyObject *__pyx_v_py_byte_file_name = NULL;
  char *__pyx_v_c_file_name;
  struct Mix_Chunk *__pyx_v_chunk;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_mc = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("load_sound_chunk", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":587
 *         # 2) convert the python byte string to a C char* (can just do an assign)
 *         # 3) the C char* string is now ready for use in calls to the C library
 *         py_byte_file_name = file_name.encode('UTF-8')             # <<<<<<<<<<<<<<
 *         cdef char *c_file_name = py_byte_file_name
 * 
 */
  if (unlikely(__pyx_v_file_name == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode");
    __PYX_ERR(0, 587, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_file_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_py_byte_file_name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":588
 *         # 3) the C char* string is now ready for use in calls to the C library
 *         py_byte_file_name = file_name.encode('UTF-8')
 *         cdef char *c_file_name = py_byte_file_name             # <<<<<<<<<<<<<<
 * 
 *         # Attempt to load the file
 */
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_py_byte_file_name); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 588, __pyx_L1_error)
  __pyx_v_c_file_name = __pyx_t_2;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":591
 * 
 *         # Attempt to load the file
 *         cdef Mix_Chunk *chunk = Mix_LoadWAV(c_file_name)             # <<<<<<<<<<<<<<
 *         if chunk == NULL:
 *             raise AudioException("Unable to load sound from source file '{}' - {}"
 */
  __pyx_v_chunk = Mix_LoadWAV(__pyx_v_c_file_name);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":592
 *         # Attempt to load the file
 *         cdef Mix_Chunk *chunk = Mix_LoadWAV(c_file_name)
 *         if chunk == NULL:             # <<<<<<<<<<<<<<
 *             raise AudioException("Unable to load sound from source file '{}' - {}"
 *                                  .format(file_name, SDL_GetError()))
 */
  __pyx_t_3 = ((__pyx_v_chunk == NULL) != 0);
  if (__pyx_t_3) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":593
 *         cdef Mix_Chunk *chunk = Mix_LoadWAV(c_file_name)
 *         if chunk == NULL:
 *             raise AudioException("Unable to load sound from source file '{}' - {}"             # <<<<<<<<<<<<<<
 *                                  .format(file_name, SDL_GetError()))
 * 
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_AudioException); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":594
 *         if chunk == NULL:
 *             raise AudioException("Unable to load sound from source file '{}' - {}"
 *                                  .format(file_name, SDL_GetError()))             # <<<<<<<<<<<<<<
 * 
 *         # Create a Python container object to wrap the Mix_Chunk C pointer
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unable_to_load_sound_from_source, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyBytes_FromString(SDL_GetError()); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_9 = 1;
      }
    }
    __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_file_name);
    __Pyx_GIVEREF(__pyx_v_file_name);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_file_name);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 593, __pyx_L1_error)

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":592
 *         # Attempt to load the file
 *         cdef Mix_Chunk *chunk = Mix_LoadWAV(c_file_name)
 *         if chunk == NULL:             # <<<<<<<<<<<<<<
 *             raise AudioException("Unable to load sound from source file '{}' - {}"
 *                                  .format(file_name, SDL_GetError()))
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":597
 * 
 *         # Create a Python container object to wrap the Mix_Chunk C pointer
 *         cdef MixChunkContainer mc = MixChunkContainer()             # <<<<<<<<<<<<<<
 *         mc.chunk = chunk
 *         return mc
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mc = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":598
 *         # Create a Python container object to wrap the Mix_Chunk C pointer
 *         cdef MixChunkContainer mc = MixChunkContainer()
 *         mc.chunk = chunk             # <<<<<<<<<<<<<<
 *         return mc
 * 
 */
  __pyx_v_mc->chunk = __pyx_v_chunk;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":599
 *         cdef MixChunkContainer mc = MixChunkContainer()
 *         mc.chunk = chunk
 *         return mc             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mc));
  __pyx_r = ((PyObject *)__pyx_v_mc);
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":571
 * 
 *     @staticmethod
 *     def load_sound_chunk(str file_name):             # <<<<<<<<<<<<<<
 *         """
 *         Loads an audio file into a MixChunkContainer wrapper object for use in a Sound object.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.load_sound_chunk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_byte_file_name);
  __Pyx_XDECREF((PyObject *)__pyx_v_mc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":602
 * 
 *     @staticmethod
 *     def unload_sound_chunk(container):             # <<<<<<<<<<<<<<
 *         """
 *         Unloads the source sample (Mix_Chunk) from the supplied container (used in Sound
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_59unload_sound_chunk(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_58unload_sound_chunk[] = "AudioInterface.unload_sound_chunk(container)\n\n        Unloads the source sample (Mix_Chunk) from the supplied container (used in Sound\n        asset unloading).  The sound will no longer be in memory.\n        Args:\n            container: A MixChunkContainer object\n        ";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_59unload_sound_chunk = {"unload_sound_chunk", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_59unload_sound_chunk, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_58unload_sound_chunk};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_59unload_sound_chunk(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_container = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unload_sound_chunk (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_container,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_container)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unload_sound_chunk") < 0)) __PYX_ERR(0, 602, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_container = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("unload_sound_chunk", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 602, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.unload_sound_chunk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_58unload_sound_chunk(__pyx_v_container);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_58unload_sound_chunk(PyObject *__pyx_v_container) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_mc = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("unload_sound_chunk", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":609
 *             container: A MixChunkContainer object
 *         """
 *         if not isinstance(container, MixChunkContainer):             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_container, __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":610
 *         """
 *         if not isinstance(container, MixChunkContainer):
 *             return             # <<<<<<<<<<<<<<
 * 
 *         cdef MixChunkContainer mc = container
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":609
 *             container: A MixChunkContainer object
 *         """
 *         if not isinstance(container, MixChunkContainer):             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":612
 *             return
 * 
 *         cdef MixChunkContainer mc = container             # <<<<<<<<<<<<<<
 *         if mc.chunk != NULL:
 *             SDL_LockAudio()
 */
  if (!(likely(((__pyx_v_container) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_container, __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer))))) __PYX_ERR(0, 612, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_container;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_mc = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":613
 * 
 *         cdef MixChunkContainer mc = container
 *         if mc.chunk != NULL:             # <<<<<<<<<<<<<<
 *             SDL_LockAudio()
 *             Mix_FreeChunk(mc.chunk)
 */
  __pyx_t_2 = ((__pyx_v_mc->chunk != NULL) != 0);
  if (__pyx_t_2) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":614
 *         cdef MixChunkContainer mc = container
 *         if mc.chunk != NULL:
 *             SDL_LockAudio()             # <<<<<<<<<<<<<<
 *             Mix_FreeChunk(mc.chunk)
 *             SDL_UnlockAudio()
 */
    SDL_LockAudio();

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":615
 *         if mc.chunk != NULL:
 *             SDL_LockAudio()
 *             Mix_FreeChunk(mc.chunk)             # <<<<<<<<<<<<<<
 *             SDL_UnlockAudio()
 *             mc.chunk = NULL
 */
    Mix_FreeChunk(__pyx_v_mc->chunk);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":616
 *             SDL_LockAudio()
 *             Mix_FreeChunk(mc.chunk)
 *             SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *             mc.chunk = NULL
 * 
 */
    SDL_UnlockAudio();

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":617
 *             Mix_FreeChunk(mc.chunk)
 *             SDL_UnlockAudio()
 *             mc.chunk = NULL             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound(self, sound_instance not None):
 */
    __pyx_v_mc->chunk = NULL;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":613
 * 
 *         cdef MixChunkContainer mc = container
 *         if mc.chunk != NULL:             # <<<<<<<<<<<<<<
 *             SDL_LockAudio()
 *             Mix_FreeChunk(mc.chunk)
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":602
 * 
 *     @staticmethod
 *     def unload_sound_chunk(container):             # <<<<<<<<<<<<<<
 *         """
 *         Unloads the source sample (Mix_Chunk) from the supplied container (used in Sound
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.unload_sound_chunk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":619
 *             mc.chunk = NULL
 * 
 *     def stop_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound immediately on all tracks.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_61stop_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_60stop_sound[] = "AudioInterface.stop_sound(self, sound_instance)\n\n        Stops all instances of the specified sound immediately on all tracks.\n        Args:\n            sound_instance: The SoundInstance to stop\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_61stop_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 619, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_60stop_sound(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_60stop_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_v_track = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("stop_sound", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":625
 *             sound_instance: The SoundInstance to stop
 *         """
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             track.stop_sound(sound_instance)
 * 
 */
  if (unlikely(__pyx_v_self->tracks == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 625, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->tracks; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 625, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_track, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":626
 *         """
 *         for track in self.tracks:
 *             track.stop_sound(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *     def stop_all_sounds(self):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_track, __pyx_n_s_stop_sound); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_sound_instance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_sound_instance);
      __Pyx_GIVEREF(__pyx_v_sound_instance);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_sound_instance);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":625
 *             sound_instance: The SoundInstance to stop
 *         """
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             track.stop_sound(sound_instance)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":619
 *             mc.chunk = NULL
 * 
 *     def stop_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound immediately on all tracks.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.stop_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_track);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":628
 *             track.stop_sound(sound_instance)
 * 
 *     def stop_all_sounds(self):             # <<<<<<<<<<<<<<
 *         """Stops all playing and pending sounds in all tracks"""
 *         for track in self.tracks:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_63stop_all_sounds(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_62stop_all_sounds[] = "AudioInterface.stop_all_sounds(self)\nStops all playing and pending sounds in all tracks";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_63stop_all_sounds(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_all_sounds (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_62stop_all_sounds(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_62stop_all_sounds(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_v_track = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("stop_all_sounds", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":630
 *     def stop_all_sounds(self):
 *         """Stops all playing and pending sounds in all tracks"""
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             track.stop_all_sounds()
 * 
 */
  if (unlikely(__pyx_v_self->tracks == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 630, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->tracks; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 630, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 630, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_track, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":631
 *         """Stops all playing and pending sounds in all tracks"""
 *         for track in self.tracks:
 *             track.stop_all_sounds()             # <<<<<<<<<<<<<<
 * 
 *     def process(self):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_track, __pyx_n_s_stop_all_sounds); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":630
 *     def stop_all_sounds(self):
 *         """Stops all playing and pending sounds in all tracks"""
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             track.stop_all_sounds()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":628
 *             track.stop_sound(sound_instance)
 * 
 *     def stop_all_sounds(self):             # <<<<<<<<<<<<<<
 *         """Stops all playing and pending sounds in all tracks"""
 *         for track in self.tracks:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.stop_all_sounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_track);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":633
 *             track.stop_all_sounds()
 * 
 *     def process(self):             # <<<<<<<<<<<<<<
 *         """Process tick function for the audio interface."""
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_65process(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_64process[] = "AudioInterface.process(self)\nProcess tick function for the audio interface.";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_65process(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("process (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_64process(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_64process(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_v_track = NULL;
  long __pyx_v_message_num;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  long __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("process", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":637
 * 
 *         # Process tracks
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             track.process()
 * 
 */
  if (unlikely(__pyx_v_self->tracks == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 637, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->tracks; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 637, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_track, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":638
 *         # Process tracks
 *         for track in self.tracks:
 *             track.process()             # <<<<<<<<<<<<<<
 * 
 *         # Process any internal notification messages that may cause other messages to be generated
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_track, __pyx_n_s_process); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 638, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 638, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":637
 * 
 *         # Process tracks
 *         for track in self.tracks:             # <<<<<<<<<<<<<<
 *             track.process()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":641
 * 
 *         # Process any internal notification messages that may cause other messages to be generated
 *         SDL_LockMutex(self.audio_callback_data.mutex)             # <<<<<<<<<<<<<<
 *         for message_num in range(MAX_NOTIFICATION_MESSAGES):
 *             if self.audio_callback_data.notification_messages[message_num].message != notification_not_in_use:
 */
  SDL_LockMutex(__pyx_v_self->audio_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":642
 *         # Process any internal notification messages that may cause other messages to be generated
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_NOTIFICATION_MESSAGES):             # <<<<<<<<<<<<<<
 *             if self.audio_callback_data.notification_messages[message_num].message != notification_not_in_use:
 *                 # Dispatch message processing to target track
 */
  for (__pyx_t_6 = 0; __pyx_t_6 < 32; __pyx_t_6+=1) {
    __pyx_v_message_num = __pyx_t_6;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":643
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_NOTIFICATION_MESSAGES):
 *             if self.audio_callback_data.notification_messages[message_num].message != notification_not_in_use:             # <<<<<<<<<<<<<<
 *                 # Dispatch message processing to target track
 *                 track = self.get_track(self.audio_callback_data.notification_messages[message_num].track)
 */
    __pyx_t_7 = (((__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_message_num])->message != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_not_in_use) != 0);
    if (__pyx_t_7) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":645
 *             if self.audio_callback_data.notification_messages[message_num].message != notification_not_in_use:
 *                 # Dispatch message processing to target track
 *                 track = self.get_track(self.audio_callback_data.notification_messages[message_num].track)             # <<<<<<<<<<<<<<
 *                 if track is not None:
 *                     track.process_notification_message(message_num)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_track); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 645, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_message_num])->track); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 645, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 645, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_track, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":646
 *                 # Dispatch message processing to target track
 *                 track = self.get_track(self.audio_callback_data.notification_messages[message_num].track)
 *                 if track is not None:             # <<<<<<<<<<<<<<
 *                     track.process_notification_message(message_num)
 * 
 */
      __pyx_t_7 = (__pyx_v_track != Py_None);
      __pyx_t_9 = (__pyx_t_7 != 0);
      if (__pyx_t_9) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":647
 *                 track = self.get_track(self.audio_callback_data.notification_messages[message_num].track)
 *                 if track is not None:
 *                     track.process_notification_message(message_num)             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_track, __pyx_n_s_process_notification_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_message_num); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 647, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_4 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (!__pyx_t_4) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_8);
          __pyx_t_8 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":646
 *                 # Dispatch message processing to target track
 *                 track = self.get_track(self.audio_callback_data.notification_messages[message_num].track)
 *                 if track is not None:             # <<<<<<<<<<<<<<
 *                     track.process_notification_message(message_num)
 * 
 */
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":643
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_NOTIFICATION_MESSAGES):
 *             if self.audio_callback_data.notification_messages[message_num].message != notification_not_in_use:             # <<<<<<<<<<<<<<
 *                 # Dispatch message processing to target track
 *                 track = self.get_track(self.audio_callback_data.notification_messages[message_num].track)
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":649
 *                     track.process_notification_message(message_num)
 * 
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def get_in_use_request_message_count(self):
 */
  SDL_UnlockMutex(__pyx_v_self->audio_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":633
 *             track.stop_all_sounds()
 * 
 *     def process(self):             # <<<<<<<<<<<<<<
 *         """Process tick function for the audio interface."""
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.process", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_track);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":651
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 * 
 *     def get_in_use_request_message_count(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the number of request messages currently in use.  Used for debugging and testing.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_67get_in_use_request_message_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_66get_in_use_request_message_count[] = "AudioInterface.get_in_use_request_message_count(self)\n\n        Returns the number of request messages currently in use.  Used for debugging and testing.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_67get_in_use_request_message_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_in_use_request_message_count (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_66get_in_use_request_message_count(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_66get_in_use_request_message_count(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_v_in_use_message_count = NULL;
  long __pyx_v_message_num;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_in_use_request_message_count", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":655
 *         Returns the number of request messages currently in use.  Used for debugging and testing.
 *         """
 *         in_use_message_count = 0             # <<<<<<<<<<<<<<
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_REQUEST_MESSAGES):
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_in_use_message_count = __pyx_int_0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":656
 *         """
 *         in_use_message_count = 0
 *         SDL_LockMutex(self.audio_callback_data.mutex)             # <<<<<<<<<<<<<<
 *         for message_num in range(MAX_REQUEST_MESSAGES):
 *             if self.audio_callback_data.request_messages[message_num].message != request_not_in_use:
 */
  SDL_LockMutex(__pyx_v_self->audio_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":657
 *         in_use_message_count = 0
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_REQUEST_MESSAGES):             # <<<<<<<<<<<<<<
 *             if self.audio_callback_data.request_messages[message_num].message != request_not_in_use:
 *                 in_use_message_count += 1
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 32; __pyx_t_1+=1) {
    __pyx_v_message_num = __pyx_t_1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":658
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_REQUEST_MESSAGES):
 *             if self.audio_callback_data.request_messages[message_num].message != request_not_in_use:             # <<<<<<<<<<<<<<
 *                 in_use_message_count += 1
 * 
 */
    __pyx_t_2 = (((__pyx_v_self->audio_callback_data->request_messages[__pyx_v_message_num])->message != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_not_in_use) != 0);
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":659
 *         for message_num in range(MAX_REQUEST_MESSAGES):
 *             if self.audio_callback_data.request_messages[message_num].message != request_not_in_use:
 *                 in_use_message_count += 1             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 */
      __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_in_use_message_count, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_in_use_message_count, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":658
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_REQUEST_MESSAGES):
 *             if self.audio_callback_data.request_messages[message_num].message != request_not_in_use:             # <<<<<<<<<<<<<<
 *                 in_use_message_count += 1
 * 
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":661
 *                 in_use_message_count += 1
 * 
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)             # <<<<<<<<<<<<<<
 *         return in_use_message_count
 * 
 */
  SDL_UnlockMutex(__pyx_v_self->audio_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":662
 * 
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 *         return in_use_message_count             # <<<<<<<<<<<<<<
 * 
 *     def get_in_use_notification_message_count(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_in_use_message_count);
  __pyx_r = __pyx_v_in_use_message_count;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":651
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 * 
 *     def get_in_use_request_message_count(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the number of request messages currently in use.  Used for debugging and testing.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_in_use_request_message_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_in_use_message_count);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":664
 *         return in_use_message_count
 * 
 *     def get_in_use_notification_message_count(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the number of notification messages currently in use.  Used for debugging and testing.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_69get_in_use_notification_message_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_68get_in_use_notification_message_count[] = "AudioInterface.get_in_use_notification_message_count(self)\n\n        Returns the number of notification messages currently in use.  Used for debugging and testing.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_69get_in_use_notification_message_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_in_use_notification_message_count (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_68get_in_use_notification_message_count(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_68get_in_use_notification_message_count(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_v_in_use_message_count = NULL;
  long __pyx_v_message_num;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_in_use_notification_message_count", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":668
 *         Returns the number of notification messages currently in use.  Used for debugging and testing.
 *         """
 *         in_use_message_count = 0             # <<<<<<<<<<<<<<
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_NOTIFICATION_MESSAGES):
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_in_use_message_count = __pyx_int_0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":669
 *         """
 *         in_use_message_count = 0
 *         SDL_LockMutex(self.audio_callback_data.mutex)             # <<<<<<<<<<<<<<
 *         for message_num in range(MAX_NOTIFICATION_MESSAGES):
 *             if self.audio_callback_data.notification_messages[message_num].message != notification_not_in_use:
 */
  SDL_LockMutex(__pyx_v_self->audio_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":670
 *         in_use_message_count = 0
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_NOTIFICATION_MESSAGES):             # <<<<<<<<<<<<<<
 *             if self.audio_callback_data.notification_messages[message_num].message != notification_not_in_use:
 *                 in_use_message_count += 1
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 32; __pyx_t_1+=1) {
    __pyx_v_message_num = __pyx_t_1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":671
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_NOTIFICATION_MESSAGES):
 *             if self.audio_callback_data.notification_messages[message_num].message != notification_not_in_use:             # <<<<<<<<<<<<<<
 *                 in_use_message_count += 1
 * 
 */
    __pyx_t_2 = (((__pyx_v_self->audio_callback_data->notification_messages[__pyx_v_message_num])->message != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_not_in_use) != 0);
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":672
 *         for message_num in range(MAX_NOTIFICATION_MESSAGES):
 *             if self.audio_callback_data.notification_messages[message_num].message != notification_not_in_use:
 *                 in_use_message_count += 1             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 */
      __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_in_use_message_count, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 672, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_in_use_message_count, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":671
 *         SDL_LockMutex(self.audio_callback_data.mutex)
 *         for message_num in range(MAX_NOTIFICATION_MESSAGES):
 *             if self.audio_callback_data.notification_messages[message_num].message != notification_not_in_use:             # <<<<<<<<<<<<<<
 *                 in_use_message_count += 1
 * 
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":674
 *                 in_use_message_count += 1
 * 
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)             # <<<<<<<<<<<<<<
 *         return in_use_message_count
 * 
 */
  SDL_UnlockMutex(__pyx_v_self->audio_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":675
 * 
 *         SDL_UnlockMutex(self.audio_callback_data.mutex)
 *         return in_use_message_count             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_in_use_message_count);
  __pyx_r = __pyx_v_in_use_message_count;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":664
 *         return in_use_message_count
 * 
 *     def get_in_use_notification_message_count(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the number of notification messages currently in use.  Used for debugging and testing.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.get_in_use_notification_message_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_in_use_message_count);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":678
 * 
 *     @staticmethod
 *     cdef void audio_callback(void* data, Uint8 *output_buffer, int length) nogil:             # <<<<<<<<<<<<<<
 *         """
 *         Main audio callback function (called from SDL_Mixer).
 */

static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_audio_callback(void *__pyx_v_data, Uint8 *__pyx_v_output_buffer, int __pyx_v_length) {
  Uint32 __pyx_v_buffer_length;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *__pyx_v_callback_data;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *__pyx_v_track;
  int __pyx_v_track_num;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":693
 *             track buffers are maintained in each Track object and are processed during this callback.
 *         """
 *         cdef Uint32 buffer_length = <Uint32> length             # <<<<<<<<<<<<<<
 *         cdef AudioCallbackData *callback_data = <AudioCallbackData*> data
 *         cdef TrackState *track
 */
  __pyx_v_buffer_length = ((Uint32)__pyx_v_length);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":694
 *         """
 *         cdef Uint32 buffer_length = <Uint32> length
 *         cdef AudioCallbackData *callback_data = <AudioCallbackData*> data             # <<<<<<<<<<<<<<
 *         cdef TrackState *track
 * 
 */
  __pyx_v_callback_data = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *)__pyx_v_data);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":697
 *         cdef TrackState *track
 * 
 *         if callback_data == NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = ((__pyx_v_callback_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":698
 * 
 *         if callback_data == NULL:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         # Initialize master output buffer (silence)
 */
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":697
 *         cdef TrackState *track
 * 
 *         if callback_data == NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":701
 * 
 *         # Initialize master output buffer (silence)
 *         memset(output_buffer, 0, buffer_length)             # <<<<<<<<<<<<<<
 * 
 *         # Lock the mutex to ensure no audio data is changed during the playback processing
 */
  memset(__pyx_v_output_buffer, 0, __pyx_v_buffer_length);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":705
 *         # Lock the mutex to ensure no audio data is changed during the playback processing
 *         # (multi-threaded protection)
 *         SDL_LockMutex(callback_data.mutex)             # <<<<<<<<<<<<<<
 * 
 *         # Note: There are three separate loops over the tracks that must remain separate due
 */
  SDL_LockMutex(__pyx_v_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":712
 * 
 *         # Loop over tracks, initializing the track buffer and status.
 *         for track_num in range(callback_data.track_count):             # <<<<<<<<<<<<<<
 *             callback_data.tracks[track_num].active = False
 *             callback_data.tracks[track_num].ducking_is_active = False
 */
  __pyx_t_2 = __pyx_v_callback_data->track_count;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_track_num = __pyx_t_3;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":713
 *         # Loop over tracks, initializing the track buffer and status.
 *         for track_num in range(callback_data.track_count):
 *             callback_data.tracks[track_num].active = False             # <<<<<<<<<<<<<<
 *             callback_data.tracks[track_num].ducking_is_active = False
 *             memset(callback_data.tracks[track_num].buffer, 0, buffer_length)
 */
    (__pyx_v_callback_data->tracks[__pyx_v_track_num])->active = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":714
 *         for track_num in range(callback_data.track_count):
 *             callback_data.tracks[track_num].active = False
 *             callback_data.tracks[track_num].ducking_is_active = False             # <<<<<<<<<<<<<<
 *             memset(callback_data.tracks[track_num].buffer, 0, buffer_length)
 * 
 */
    (__pyx_v_callback_data->tracks[__pyx_v_track_num])->ducking_is_active = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":715
 *             callback_data.tracks[track_num].active = False
 *             callback_data.tracks[track_num].ducking_is_active = False
 *             memset(callback_data.tracks[track_num].buffer, 0, buffer_length)             # <<<<<<<<<<<<<<
 * 
 *         # Process any internal sound messages that may affect sound playback (play and stop messages)
 */
    memset((__pyx_v_callback_data->tracks[__pyx_v_track_num])->buffer, 0, __pyx_v_buffer_length);
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":718
 * 
 *         # Process any internal sound messages that may affect sound playback (play and stop messages)
 *         process_request_messages(callback_data)             # <<<<<<<<<<<<<<
 * 
 *         # Loop over tracks, mixing the playing sounds into the track's audio buffer
 */
  __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_process_request_messages(__pyx_v_callback_data);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":721
 * 
 *         # Loop over tracks, mixing the playing sounds into the track's audio buffer
 *         for track_num in range(callback_data.track_count):             # <<<<<<<<<<<<<<
 *             track = callback_data.tracks[track_num]
 * 
 */
  __pyx_t_2 = __pyx_v_callback_data->track_count;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_track_num = __pyx_t_3;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":722
 *         # Loop over tracks, mixing the playing sounds into the track's audio buffer
 *         for track_num in range(callback_data.track_count):
 *             track = callback_data.tracks[track_num]             # <<<<<<<<<<<<<<
 * 
 *             # Call the track's mix function (based on track type)
 */
    __pyx_v_track = (__pyx_v_callback_data->tracks[__pyx_v_track_num]);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":725
 * 
 *             # Call the track's mix function (based on track type)
 *             if track.type == track_type_standard:             # <<<<<<<<<<<<<<
 *                 standard_track_mix_playing_sounds(track, buffer_length, callback_data)
 *             elif track.type == track_type_playlist:
 */
    switch (__pyx_v_track->type) {
      case __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_standard:

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":726
 *             # Call the track's mix function (based on track type)
 *             if track.type == track_type_standard:
 *                 standard_track_mix_playing_sounds(track, buffer_length, callback_data)             # <<<<<<<<<<<<<<
 *             elif track.type == track_type_playlist:
 *                 # TODO: Implement track mix function call
 */
      __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_standard_track_mix_playing_sounds(__pyx_v_track, __pyx_v_buffer_length, __pyx_v_callback_data);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":725
 * 
 *             # Call the track's mix function (based on track type)
 *             if track.type == track_type_standard:             # <<<<<<<<<<<<<<
 *                 standard_track_mix_playing_sounds(track, buffer_length, callback_data)
 *             elif track.type == track_type_playlist:
 */
      break;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":727
 *             if track.type == track_type_standard:
 *                 standard_track_mix_playing_sounds(track, buffer_length, callback_data)
 *             elif track.type == track_type_playlist:             # <<<<<<<<<<<<<<
 *                 # TODO: Implement track mix function call
 *                 pass
 */
      case __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_playlist:
      break;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":730
 *                 # TODO: Implement track mix function call
 *                 pass
 *             elif track.type == track_type_live_loop:             # <<<<<<<<<<<<<<
 *                 # TODO: Implement track mix function call
 *                 pass
 */
      case __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_live_loop:
      break;
      default: break;
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":735
 * 
 *         # Loop over tracks again, applying ducking and mixing down tracks to the master output buffer
 *         for track_num in range(callback_data.track_count):             # <<<<<<<<<<<<<<
 * 
 *             # Only mix the track to the master output if it is active
 */
  __pyx_t_2 = __pyx_v_callback_data->track_count;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_track_num = __pyx_t_3;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":738
 * 
 *             # Only mix the track to the master output if it is active
 *             if callback_data.tracks[track_num].active:             # <<<<<<<<<<<<<<
 * 
 *                 # Apply ducking to track audio buffer (when applicable)
 */
    __pyx_t_1 = ((__pyx_v_callback_data->tracks[__pyx_v_track_num])->active != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":741
 * 
 *                 # Apply ducking to track audio buffer (when applicable)
 *                 apply_track_ducking(callback_data.tracks[track_num], buffer_length, callback_data)             # <<<<<<<<<<<<<<
 * 
 *                 # Apply track volume and mix to output buffer
 */
      __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_track_ducking((__pyx_v_callback_data->tracks[__pyx_v_track_num]), __pyx_v_buffer_length, __pyx_v_callback_data);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":744
 * 
 *                 # Apply track volume and mix to output buffer
 *                 mix_track_to_output(<Uint8*> callback_data.tracks[track_num].buffer,             # <<<<<<<<<<<<<<
 *                                     callback_data.tracks[track_num].volume,
 *                                     output_buffer,
 */
      __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_mix_track_to_output(((Uint8 *)(__pyx_v_callback_data->tracks[__pyx_v_track_num])->buffer), (__pyx_v_callback_data->tracks[__pyx_v_track_num])->volume, __pyx_v_output_buffer, __pyx_v_buffer_length);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":738
 * 
 *             # Only mix the track to the master output if it is active
 *             if callback_data.tracks[track_num].active:             # <<<<<<<<<<<<<<
 * 
 *                 # Apply ducking to track audio buffer (when applicable)
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":750
 * 
 *         # Apply master volume to output buffer
 *         apply_volume_to_buffer(output_buffer, buffer_length, callback_data.master_volume)             # <<<<<<<<<<<<<<
 * 
 *         # Unlock the mutex since we are done accessing the audio data
 */
  __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer(__pyx_v_output_buffer, __pyx_v_buffer_length, __pyx_v_callback_data->master_volume);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":753
 * 
 *         # Unlock the mutex since we are done accessing the audio data
 *         SDL_UnlockMutex(callback_data.mutex)             # <<<<<<<<<<<<<<
 * 
 * # ---------------------------------------------------------------------------
 */
  SDL_UnlockMutex(__pyx_v_callback_data->mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":678
 * 
 *     @staticmethod
 *     cdef void audio_callback(void* data, Uint8 *output_buffer, int length) nogil:             # <<<<<<<<<<<<<<
 *         """
 *         Main audio callback function (called from SDL_Mixer).
 */

  /* function exit code */
  __pyx_L0:;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":64
 *     libraries.
 *     """
 *     cdef public int sample_rate             # <<<<<<<<<<<<<<
 *     cdef int audio_channels
 *     cdef int buffer_samples
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->sample_rate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.sample_rate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate_2__set__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate_2__set__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L1_error)
  __pyx_v_self->sample_rate = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.sample_rate.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":765
 * # ---------------------------------------------------------------------------
 * 
 * cdef void process_request_messages(AudioCallbackData *callback_data) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Processes any new sound messages that should be processed prior to the main
 */

static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_process_request_messages(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *__pyx_v_callback_data) {
  int __pyx_v_i;
  int __pyx_v_track_num;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *__pyx_v_track;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":776
 * 
 *     # Loop over messages
 *     for i in range(MAX_REQUEST_MESSAGES):             # <<<<<<<<<<<<<<
 * 
 *         # Dispatch messages to recipient track's request message processing function
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 32; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":779
 * 
 *         # Dispatch messages to recipient track's request message processing function
 *         if callback_data.request_messages[i].message != request_not_in_use:             # <<<<<<<<<<<<<<
 *             track_num = callback_data.request_messages[i].track
 *             track = callback_data.tracks[track_num]
 */
    __pyx_t_2 = (((__pyx_v_callback_data->request_messages[__pyx_v_i])->message != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_not_in_use) != 0);
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":780
 *         # Dispatch messages to recipient track's request message processing function
 *         if callback_data.request_messages[i].message != request_not_in_use:
 *             track_num = callback_data.request_messages[i].track             # <<<<<<<<<<<<<<
 *             track = callback_data.tracks[track_num]
 *             if track.type == track_type_standard:
 */
      __pyx_t_3 = (__pyx_v_callback_data->request_messages[__pyx_v_i])->track;
      __pyx_v_track_num = __pyx_t_3;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":781
 *         if callback_data.request_messages[i].message != request_not_in_use:
 *             track_num = callback_data.request_messages[i].track
 *             track = callback_data.tracks[track_num]             # <<<<<<<<<<<<<<
 *             if track.type == track_type_standard:
 *                 process_standard_track_request_message(callback_data.request_messages[i], track)
 */
      __pyx_v_track = (__pyx_v_callback_data->tracks[__pyx_v_track_num]);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":782
 *             track_num = callback_data.request_messages[i].track
 *             track = callback_data.tracks[track_num]
 *             if track.type == track_type_standard:             # <<<<<<<<<<<<<<
 *                 process_standard_track_request_message(callback_data.request_messages[i], track)
 *             elif track.type == track_type_playlist:
 */
      switch (__pyx_v_track->type) {
        case __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_standard:

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":783
 *             track = callback_data.tracks[track_num]
 *             if track.type == track_type_standard:
 *                 process_standard_track_request_message(callback_data.request_messages[i], track)             # <<<<<<<<<<<<<<
 *             elif track.type == track_type_playlist:
 *                 # TODO: Implement track request message function call
 */
        __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_process_standard_track_request_message((__pyx_v_callback_data->request_messages[__pyx_v_i]), __pyx_v_track);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":782
 *             track_num = callback_data.request_messages[i].track
 *             track = callback_data.tracks[track_num]
 *             if track.type == track_type_standard:             # <<<<<<<<<<<<<<
 *                 process_standard_track_request_message(callback_data.request_messages[i], track)
 *             elif track.type == track_type_playlist:
 */
        break;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":784
 *             if track.type == track_type_standard:
 *                 process_standard_track_request_message(callback_data.request_messages[i], track)
 *             elif track.type == track_type_playlist:             # <<<<<<<<<<<<<<
 *                 # TODO: Implement track request message function call
 *                 pass
 */
        case __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_playlist:
        break;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":787
 *                 # TODO: Implement track request message function call
 *                 pass
 *             elif track.type == track_type_live_loop:             # <<<<<<<<<<<<<<
 *                 # process_live_loop_request_message(callback_data.request_messages[i], track)
 *                 # TODO: Implement track request message function call
 */
        case __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_live_loop:
        break;
        default: break;
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":779
 * 
 *         # Dispatch messages to recipient track's request message processing function
 *         if callback_data.request_messages[i].message != request_not_in_use:             # <<<<<<<<<<<<<<
 *             track_num = callback_data.request_messages[i].track
 *             track = callback_data.tracks[track_num]
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":765
 * # ---------------------------------------------------------------------------
 * 
 * cdef void process_request_messages(AudioCallbackData *callback_data) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Processes any new sound messages that should be processed prior to the main
 */

  /* function exit code */
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":792
 *                 pass
 * 
 * cdef void process_standard_track_request_message(RequestMessageContainer *request_message,             # <<<<<<<<<<<<<<
 *                                                  TrackState *track) nogil:
 *     """
 */

static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_process_standard_track_request_message(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *__pyx_v_request_message, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *__pyx_v_track) {
  int __pyx_v_player;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState *__pyx_v_standard_track;
  int __pyx_v_index;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Uint32 __pyx_t_4;
  long __pyx_t_5;
  struct Mix_Chunk *__pyx_t_6;
  Uint8 __pyx_t_7;
  int __pyx_t_8;
  Sint32 __pyx_t_9;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":801
 *         track: The TrackState struct for this track
 *     """
 *     cdef int player = request_message.player             # <<<<<<<<<<<<<<
 *     cdef TrackStandardState *standard_track
 * 
 */
  __pyx_t_1 = __pyx_v_request_message->player;
  __pyx_v_player = __pyx_t_1;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":804
 *     cdef TrackStandardState *standard_track
 * 
 *     if track.type != track_type_standard or track.type_state == NULL:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_3 = ((__pyx_v_track->type != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_standard) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_track->type_state == NULL) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":805
 * 
 *     if track.type != track_type_standard or track.type_state == NULL:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     standard_track = <TrackStandardState*>track.type_state
 */
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":804
 *     cdef TrackStandardState *standard_track
 * 
 *     if track.type != track_type_standard or track.type_state == NULL:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":807
 *         return
 * 
 *     standard_track = <TrackStandardState*>track.type_state             # <<<<<<<<<<<<<<
 * 
 *     if request_message.message == request_sound_play:
 */
  __pyx_v_standard_track = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState *)__pyx_v_track->type_state);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":809
 *     standard_track = <TrackStandardState*>track.type_state
 * 
 *     if request_message.message == request_sound_play:             # <<<<<<<<<<<<<<
 *         # Update player to start playing new sound
 *         standard_track.sound_players[player].status = player_pending
 */
  switch (__pyx_v_request_message->message) {
    case __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_play:

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":811
 *     if request_message.message == request_sound_play:
 *         # Update player to start playing new sound
 *         standard_track.sound_players[player].status = player_pending             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].current.sample_pos = request_message.data.play.start_at_position
 *         standard_track.sound_players[player].current.current_loop = 0
 */
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_pending;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":812
 *         # Update player to start playing new sound
 *         standard_track.sound_players[player].status = player_pending
 *         standard_track.sound_players[player].current.sample_pos = request_message.data.play.start_at_position             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].current.current_loop = 0
 *         standard_track.sound_players[player].current.sound_id = request_message.sound_id
 */
    __pyx_t_4 = __pyx_v_request_message->data.play.start_at_position;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos = __pyx_t_4;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":813
 *         standard_track.sound_players[player].status = player_pending
 *         standard_track.sound_players[player].current.sample_pos = request_message.data.play.start_at_position
 *         standard_track.sound_players[player].current.current_loop = 0             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].current.sound_id = request_message.sound_id
 *         standard_track.sound_players[player].current.sound_instance_id = request_message.sound_instance_id
 */
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.current_loop = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":814
 *         standard_track.sound_players[player].current.sample_pos = request_message.data.play.start_at_position
 *         standard_track.sound_players[player].current.current_loop = 0
 *         standard_track.sound_players[player].current.sound_id = request_message.sound_id             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].current.sound_instance_id = request_message.sound_instance_id
 *         standard_track.sound_players[player].current.chunk = request_message.data.play.chunk
 */
    __pyx_t_5 = __pyx_v_request_message->sound_id;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_id = __pyx_t_5;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":815
 *         standard_track.sound_players[player].current.current_loop = 0
 *         standard_track.sound_players[player].current.sound_id = request_message.sound_id
 *         standard_track.sound_players[player].current.sound_instance_id = request_message.sound_instance_id             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].current.chunk = request_message.data.play.chunk
 *         standard_track.sound_players[player].current.volume = request_message.data.play.volume
 */
    __pyx_t_5 = __pyx_v_request_message->sound_instance_id;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_instance_id = __pyx_t_5;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":816
 *         standard_track.sound_players[player].current.sound_id = request_message.sound_id
 *         standard_track.sound_players[player].current.sound_instance_id = request_message.sound_instance_id
 *         standard_track.sound_players[player].current.chunk = request_message.data.play.chunk             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].current.volume = request_message.data.play.volume
 *         standard_track.sound_players[player].current.loops_remaining = request_message.data.play.loops
 */
    __pyx_t_6 = __pyx_v_request_message->data.play.chunk;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk = __pyx_t_6;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":817
 *         standard_track.sound_players[player].current.sound_instance_id = request_message.sound_instance_id
 *         standard_track.sound_players[player].current.chunk = request_message.data.play.chunk
 *         standard_track.sound_players[player].current.volume = request_message.data.play.volume             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].current.loops_remaining = request_message.data.play.loops
 *         standard_track.sound_players[player].current.sound_priority = request_message.data.play.priority
 */
    __pyx_t_7 = __pyx_v_request_message->data.play.volume;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume = __pyx_t_7;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":818
 *         standard_track.sound_players[player].current.chunk = request_message.data.play.chunk
 *         standard_track.sound_players[player].current.volume = request_message.data.play.volume
 *         standard_track.sound_players[player].current.loops_remaining = request_message.data.play.loops             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].current.sound_priority = request_message.data.play.priority
 * 
 */
    __pyx_t_1 = __pyx_v_request_message->data.play.loops;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.loops_remaining = __pyx_t_1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":819
 *         standard_track.sound_players[player].current.volume = request_message.data.play.volume
 *         standard_track.sound_players[player].current.loops_remaining = request_message.data.play.loops
 *         standard_track.sound_players[player].current.sound_priority = request_message.data.play.priority             # <<<<<<<<<<<<<<
 * 
 *         # Fading (done at control rate; need to calculate the number of steps over which to fade in/out)
 */
    __pyx_t_1 = __pyx_v_request_message->data.play.priority;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_priority = __pyx_t_1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":822
 * 
 *         # Fading (done at control rate; need to calculate the number of steps over which to fade in/out)
 *         standard_track.sound_players[player].current.fade_in_steps = request_message.data.play.fade_in_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].current.fade_out_steps = request_message.data.play.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].current.fade_steps_remaining = standard_track.sound_players[player].current.fade_in_steps
 */
    __pyx_t_5 = __Pyx_div_long(__pyx_v_track->buffer_size, 8);
    if (unlikely(__pyx_t_5 == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 822, __pyx_L1_error)
    }
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_in_steps = (__pyx_v_request_message->data.play.fade_in_duration / __pyx_t_5);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":823
 *         # Fading (done at control rate; need to calculate the number of steps over which to fade in/out)
 *         standard_track.sound_players[player].current.fade_in_steps = request_message.data.play.fade_in_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].current.fade_out_steps = request_message.data.play.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].current.fade_steps_remaining = standard_track.sound_players[player].current.fade_in_steps
 *         if standard_track.sound_players[player].current.fade_steps_remaining > 0:
 */
    __pyx_t_5 = __Pyx_div_long(__pyx_v_track->buffer_size, 8);
    if (unlikely(__pyx_t_5 == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 823, __pyx_L1_error)
    }
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_out_steps = (__pyx_v_request_message->data.play.fade_out_duration / __pyx_t_5);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":824
 *         standard_track.sound_players[player].current.fade_in_steps = request_message.data.play.fade_in_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].current.fade_out_steps = request_message.data.play.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].current.fade_steps_remaining = standard_track.sound_players[player].current.fade_in_steps             # <<<<<<<<<<<<<<
 *         if standard_track.sound_players[player].current.fade_steps_remaining > 0:
 *             standard_track.sound_players[player].current.fading_status = fading_status_fading_in
 */
    __pyx_t_4 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_in_steps;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_steps_remaining = __pyx_t_4;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":825
 *         standard_track.sound_players[player].current.fade_out_steps = request_message.data.play.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].current.fade_steps_remaining = standard_track.sound_players[player].current.fade_in_steps
 *         if standard_track.sound_players[player].current.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.fading_status = fading_status_fading_in
 *         else:
 */
    __pyx_t_2 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_steps_remaining > 0) != 0);
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":826
 *         standard_track.sound_players[player].current.fade_steps_remaining = standard_track.sound_players[player].current.fade_in_steps
 *         if standard_track.sound_players[player].current.fade_steps_remaining > 0:
 *             standard_track.sound_players[player].current.fading_status = fading_status_fading_in             # <<<<<<<<<<<<<<
 *         else:
 *             standard_track.sound_players[player].current.fading_status = fading_status_not_fading
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fading_status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_fading_in;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":825
 *         standard_track.sound_players[player].current.fade_out_steps = request_message.data.play.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].current.fade_steps_remaining = standard_track.sound_players[player].current.fade_in_steps
 *         if standard_track.sound_players[player].current.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.fading_status = fading_status_fading_in
 *         else:
 */
      goto __pyx_L6;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":828
 *             standard_track.sound_players[player].current.fading_status = fading_status_fading_in
 *         else:
 *             standard_track.sound_players[player].current.fading_status = fading_status_not_fading             # <<<<<<<<<<<<<<
 * 
 *         # Markers
 */
    /*else*/ {
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fading_status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_not_fading;
    }
    __pyx_L6:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":831
 * 
 *         # Markers
 *         standard_track.sound_players[player].current.marker_count = request_message.data.play.marker_count             # <<<<<<<<<<<<<<
 * 
 *         for index in range(request_message.data.play.marker_count):
 */
    __pyx_t_1 = __pyx_v_request_message->data.play.marker_count;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.marker_count = __pyx_t_1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":833
 *         standard_track.sound_players[player].current.marker_count = request_message.data.play.marker_count
 * 
 *         for index in range(request_message.data.play.marker_count):             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.markers[index] = request_message.data.play.markers[index]
 * 
 */
    __pyx_t_1 = __pyx_v_request_message->data.play.marker_count;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) {
      __pyx_v_index = __pyx_t_8;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":834
 * 
 *         for index in range(request_message.data.play.marker_count):
 *             standard_track.sound_players[player].current.markers[index] = request_message.data.play.markers[index]             # <<<<<<<<<<<<<<
 * 
 *         if request_message.data.play.sound_has_ducking:
 */
      ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.markers[__pyx_v_index]) = (__pyx_v_request_message->data.play.markers[__pyx_v_index]);
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":836
 *             standard_track.sound_players[player].current.markers[index] = request_message.data.play.markers[index]
 * 
 *         if request_message.data.play.sound_has_ducking:             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.sound_has_ducking = True
 *             standard_track.sound_players[player].current.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask
 */
    __pyx_t_2 = (__pyx_v_request_message->data.play.sound_has_ducking != 0);
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":837
 * 
 *         if request_message.data.play.sound_has_ducking:
 *             standard_track.sound_players[player].current.sound_has_ducking = True             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask
 *             standard_track.sound_players[player].current.ducking_settings.attack_start_pos = request_message.data.play.ducking_settings.attack_start_pos
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_has_ducking = 1;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":838
 *         if request_message.data.play.sound_has_ducking:
 *             standard_track.sound_players[player].current.sound_has_ducking = True
 *             standard_track.sound_players[player].current.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.ducking_settings.attack_start_pos = request_message.data.play.ducking_settings.attack_start_pos
 *             standard_track.sound_players[player].current.ducking_settings.attack_duration = request_message.data.play.ducking_settings.attack_duration
 */
      __pyx_t_1 = __pyx_v_request_message->data.play.ducking_settings.track_bit_mask;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.track_bit_mask = __pyx_t_1;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":839
 *             standard_track.sound_players[player].current.sound_has_ducking = True
 *             standard_track.sound_players[player].current.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask
 *             standard_track.sound_players[player].current.ducking_settings.attack_start_pos = request_message.data.play.ducking_settings.attack_start_pos             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.ducking_settings.attack_duration = request_message.data.play.ducking_settings.attack_duration
 *             standard_track.sound_players[player].current.ducking_settings.attenuation_volume = request_message.data.play.ducking_settings.attenuation_volume
 */
      __pyx_t_9 = __pyx_v_request_message->data.play.ducking_settings.attack_start_pos;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attack_start_pos = __pyx_t_9;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":840
 *             standard_track.sound_players[player].current.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask
 *             standard_track.sound_players[player].current.ducking_settings.attack_start_pos = request_message.data.play.ducking_settings.attack_start_pos
 *             standard_track.sound_players[player].current.ducking_settings.attack_duration = request_message.data.play.ducking_settings.attack_duration             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.ducking_settings.attenuation_volume = request_message.data.play.ducking_settings.attenuation_volume
 *             standard_track.sound_players[player].current.ducking_settings.release_start_pos = request_message.data.play.ducking_settings.release_start_pos
 */
      __pyx_t_9 = __pyx_v_request_message->data.play.ducking_settings.attack_duration;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attack_duration = __pyx_t_9;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":841
 *             standard_track.sound_players[player].current.ducking_settings.attack_start_pos = request_message.data.play.ducking_settings.attack_start_pos
 *             standard_track.sound_players[player].current.ducking_settings.attack_duration = request_message.data.play.ducking_settings.attack_duration
 *             standard_track.sound_players[player].current.ducking_settings.attenuation_volume = request_message.data.play.ducking_settings.attenuation_volume             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.ducking_settings.release_start_pos = request_message.data.play.ducking_settings.release_start_pos
 *             standard_track.sound_players[player].current.ducking_settings.release_duration = request_message.data.play.ducking_settings.release_duration
 */
      __pyx_t_7 = __pyx_v_request_message->data.play.ducking_settings.attenuation_volume;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attenuation_volume = __pyx_t_7;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":842
 *             standard_track.sound_players[player].current.ducking_settings.attack_duration = request_message.data.play.ducking_settings.attack_duration
 *             standard_track.sound_players[player].current.ducking_settings.attenuation_volume = request_message.data.play.ducking_settings.attenuation_volume
 *             standard_track.sound_players[player].current.ducking_settings.release_start_pos = request_message.data.play.ducking_settings.release_start_pos             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.ducking_settings.release_duration = request_message.data.play.ducking_settings.release_duration
 *             standard_track.sound_players[player].current.ducking_stage = ducking_stage_delay
 */
      __pyx_t_9 = __pyx_v_request_message->data.play.ducking_settings.release_start_pos;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.release_start_pos = __pyx_t_9;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":843
 *             standard_track.sound_players[player].current.ducking_settings.attenuation_volume = request_message.data.play.ducking_settings.attenuation_volume
 *             standard_track.sound_players[player].current.ducking_settings.release_start_pos = request_message.data.play.ducking_settings.release_start_pos
 *             standard_track.sound_players[player].current.ducking_settings.release_duration = request_message.data.play.ducking_settings.release_duration             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.ducking_stage = ducking_stage_delay
 * 
 */
      __pyx_t_9 = __pyx_v_request_message->data.play.ducking_settings.release_duration;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.release_duration = __pyx_t_9;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":844
 *             standard_track.sound_players[player].current.ducking_settings.release_start_pos = request_message.data.play.ducking_settings.release_start_pos
 *             standard_track.sound_players[player].current.ducking_settings.release_duration = request_message.data.play.ducking_settings.release_duration
 *             standard_track.sound_players[player].current.ducking_stage = ducking_stage_delay             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_stage = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_ducking_stage_delay;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":836
 *             standard_track.sound_players[player].current.markers[index] = request_message.data.play.markers[index]
 * 
 *         if request_message.data.play.sound_has_ducking:             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.sound_has_ducking = True
 *             standard_track.sound_players[player].current.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask
 */
      goto __pyx_L9;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":847
 * 
 *         else:
 *             standard_track.sound_players[player].current.sound_has_ducking = False             # <<<<<<<<<<<<<<
 * 
 *         # Clear request message since it has been processed
 */
    /*else*/ {
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_has_ducking = 0;
    }
    __pyx_L9:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":850
 * 
 *         # Clear request message since it has been processed
 *         request_message.message = request_not_in_use             # <<<<<<<<<<<<<<
 * 
 *     elif request_message.message == request_sound_stop:
 */
    __pyx_v_request_message->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_not_in_use;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":809
 *     standard_track = <TrackStandardState*>track.type_state
 * 
 *     if request_message.message == request_sound_play:             # <<<<<<<<<<<<<<
 *         # Update player to start playing new sound
 *         standard_track.sound_players[player].status = player_pending
 */
    break;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":852
 *         request_message.message = request_not_in_use
 * 
 *     elif request_message.message == request_sound_stop:             # <<<<<<<<<<<<<<
 *         # Update player to stop playing sound
 *         standard_track.sound_players[player].status = player_stopping
 */
    case __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_stop:

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":854
 *     elif request_message.message == request_sound_stop:
 *         # Update player to stop playing sound
 *         standard_track.sound_players[player].status = player_stopping             # <<<<<<<<<<<<<<
 * 
 *         # Calculate fade out (if necessary)
 */
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_stopping;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":857
 * 
 *         # Calculate fade out (if necessary)
 *         standard_track.sound_players[player].current.fade_steps_remaining = request_message.data.stop.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)             # <<<<<<<<<<<<<<
 *         if standard_track.sound_players[player].current.fade_steps_remaining > 0:
 *             standard_track.sound_players[player].current.fade_out_steps = standard_track.sound_players[player].current.fade_steps_remaining
 */
    __pyx_t_5 = __Pyx_div_long(__pyx_v_track->buffer_size, 8);
    if (unlikely(__pyx_t_5 == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 857, __pyx_L1_error)
    }
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_steps_remaining = (__pyx_v_request_message->data.stop.fade_out_duration / __pyx_t_5);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":858
 *         # Calculate fade out (if necessary)
 *         standard_track.sound_players[player].current.fade_steps_remaining = request_message.data.stop.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         if standard_track.sound_players[player].current.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.fade_out_steps = standard_track.sound_players[player].current.fade_steps_remaining
 *             standard_track.sound_players[player].current.fading_status = fading_status_fading_out
 */
    __pyx_t_2 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_steps_remaining > 0) != 0);
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":859
 *         standard_track.sound_players[player].current.fade_steps_remaining = request_message.data.stop.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         if standard_track.sound_players[player].current.fade_steps_remaining > 0:
 *             standard_track.sound_players[player].current.fade_out_steps = standard_track.sound_players[player].current.fade_steps_remaining             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.fading_status = fading_status_fading_out
 *         else:
 */
      __pyx_t_4 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_steps_remaining;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_out_steps = __pyx_t_4;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":860
 *         if standard_track.sound_players[player].current.fade_steps_remaining > 0:
 *             standard_track.sound_players[player].current.fade_out_steps = standard_track.sound_players[player].current.fade_steps_remaining
 *             standard_track.sound_players[player].current.fading_status = fading_status_fading_out             # <<<<<<<<<<<<<<
 *         else:
 *             standard_track.sound_players[player].current.fading_status = fading_status_not_fading
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fading_status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_fading_out;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":858
 *         # Calculate fade out (if necessary)
 *         standard_track.sound_players[player].current.fade_steps_remaining = request_message.data.stop.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         if standard_track.sound_players[player].current.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.fade_out_steps = standard_track.sound_players[player].current.fade_steps_remaining
 *             standard_track.sound_players[player].current.fading_status = fading_status_fading_out
 */
      goto __pyx_L10;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":862
 *             standard_track.sound_players[player].current.fading_status = fading_status_fading_out
 *         else:
 *             standard_track.sound_players[player].current.fading_status = fading_status_not_fading             # <<<<<<<<<<<<<<
 * 
 *         # Adjust ducking release (if necessary)
 */
    /*else*/ {
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fading_status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_not_fading;
    }
    __pyx_L10:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":865
 * 
 *         # Adjust ducking release (if necessary)
 *         if standard_track.sound_players[player].current.sound_has_ducking:             # <<<<<<<<<<<<<<
 *             # standard_track.sound_players[player].current.ducking_settings.release_duration = request_message.data.stop.ducking_release_duration
 *             # standard_track.sound_players[player].current.ducking_settings.release_start_pos = standard_track.sound_players[player].current.sample_pos
 */
    __pyx_t_2 = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_has_ducking != 0);
    if (__pyx_t_2) {
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":874
 * 
 *         # Clear request message since it has been processed
 *         request_message.message = request_not_in_use             # <<<<<<<<<<<<<<
 * 
 *     elif request_message.message == request_sound_replace:
 */
    __pyx_v_request_message->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_not_in_use;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":852
 *         request_message.message = request_not_in_use
 * 
 *     elif request_message.message == request_sound_stop:             # <<<<<<<<<<<<<<
 *         # Update player to stop playing sound
 *         standard_track.sound_players[player].status = player_stopping
 */
    break;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":876
 *         request_message.message = request_not_in_use
 * 
 *     elif request_message.message == request_sound_replace:             # <<<<<<<<<<<<<<
 *         # Update player to stop playing current sound and start playing new sound
 *         standard_track.sound_players[player].status = player_replacing
 */
    case __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_replace:

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":878
 *     elif request_message.message == request_sound_replace:
 *         # Update player to stop playing current sound and start playing new sound
 *         standard_track.sound_players[player].status = player_replacing             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].next.sample_pos = request_message.data.play.start_at_position
 *         standard_track.sound_players[player].next.current_loop = 0
 */
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_replacing;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":879
 *         # Update player to stop playing current sound and start playing new sound
 *         standard_track.sound_players[player].status = player_replacing
 *         standard_track.sound_players[player].next.sample_pos = request_message.data.play.start_at_position             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].next.current_loop = 0
 *         standard_track.sound_players[player].next.sound_id = request_message.sound_id
 */
    __pyx_t_4 = __pyx_v_request_message->data.play.start_at_position;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.sample_pos = __pyx_t_4;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":880
 *         standard_track.sound_players[player].status = player_replacing
 *         standard_track.sound_players[player].next.sample_pos = request_message.data.play.start_at_position
 *         standard_track.sound_players[player].next.current_loop = 0             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].next.sound_id = request_message.sound_id
 *         standard_track.sound_players[player].next.sound_instance_id = request_message.sound_instance_id
 */
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.current_loop = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":881
 *         standard_track.sound_players[player].next.sample_pos = request_message.data.play.start_at_position
 *         standard_track.sound_players[player].next.current_loop = 0
 *         standard_track.sound_players[player].next.sound_id = request_message.sound_id             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].next.sound_instance_id = request_message.sound_instance_id
 *         standard_track.sound_players[player].next.chunk = request_message.data.play.chunk
 */
    __pyx_t_5 = __pyx_v_request_message->sound_id;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.sound_id = __pyx_t_5;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":882
 *         standard_track.sound_players[player].next.current_loop = 0
 *         standard_track.sound_players[player].next.sound_id = request_message.sound_id
 *         standard_track.sound_players[player].next.sound_instance_id = request_message.sound_instance_id             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].next.chunk = request_message.data.play.chunk
 *         standard_track.sound_players[player].next.volume = request_message.data.play.volume
 */
    __pyx_t_5 = __pyx_v_request_message->sound_instance_id;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.sound_instance_id = __pyx_t_5;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":883
 *         standard_track.sound_players[player].next.sound_id = request_message.sound_id
 *         standard_track.sound_players[player].next.sound_instance_id = request_message.sound_instance_id
 *         standard_track.sound_players[player].next.chunk = request_message.data.play.chunk             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].next.volume = request_message.data.play.volume
 *         standard_track.sound_players[player].next.loops_remaining = request_message.data.play.loops
 */
    __pyx_t_6 = __pyx_v_request_message->data.play.chunk;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.chunk = __pyx_t_6;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":884
 *         standard_track.sound_players[player].next.sound_instance_id = request_message.sound_instance_id
 *         standard_track.sound_players[player].next.chunk = request_message.data.play.chunk
 *         standard_track.sound_players[player].next.volume = request_message.data.play.volume             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].next.loops_remaining = request_message.data.play.loops
 *         standard_track.sound_players[player].next.sound_priority = request_message.data.play.priority
 */
    __pyx_t_7 = __pyx_v_request_message->data.play.volume;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.volume = __pyx_t_7;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":885
 *         standard_track.sound_players[player].next.chunk = request_message.data.play.chunk
 *         standard_track.sound_players[player].next.volume = request_message.data.play.volume
 *         standard_track.sound_players[player].next.loops_remaining = request_message.data.play.loops             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].next.sound_priority = request_message.data.play.priority
 * 
 */
    __pyx_t_1 = __pyx_v_request_message->data.play.loops;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.loops_remaining = __pyx_t_1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":886
 *         standard_track.sound_players[player].next.volume = request_message.data.play.volume
 *         standard_track.sound_players[player].next.loops_remaining = request_message.data.play.loops
 *         standard_track.sound_players[player].next.sound_priority = request_message.data.play.priority             # <<<<<<<<<<<<<<
 * 
 *         # Fading (done at control rate; need to calculate the number of steps over which to fade in/out)
 */
    __pyx_t_1 = __pyx_v_request_message->data.play.priority;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.sound_priority = __pyx_t_1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":889
 * 
 *         # Fading (done at control rate; need to calculate the number of steps over which to fade in/out)
 *         standard_track.sound_players[player].next.fade_in_steps = request_message.data.play.fade_in_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].next.fade_out_steps = request_message.data.play.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].next.fade_steps_remaining = standard_track.sound_players[player].next.fade_in_steps
 */
    __pyx_t_5 = __Pyx_div_long(__pyx_v_track->buffer_size, 8);
    if (unlikely(__pyx_t_5 == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 889, __pyx_L1_error)
    }
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.fade_in_steps = (__pyx_v_request_message->data.play.fade_in_duration / __pyx_t_5);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":890
 *         # Fading (done at control rate; need to calculate the number of steps over which to fade in/out)
 *         standard_track.sound_players[player].next.fade_in_steps = request_message.data.play.fade_in_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].next.fade_out_steps = request_message.data.play.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)             # <<<<<<<<<<<<<<
 *         standard_track.sound_players[player].next.fade_steps_remaining = standard_track.sound_players[player].next.fade_in_steps
 *         if standard_track.sound_players[player].next.fade_steps_remaining > 0:
 */
    __pyx_t_5 = __Pyx_div_long(__pyx_v_track->buffer_size, 8);
    if (unlikely(__pyx_t_5 == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 890, __pyx_L1_error)
    }
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.fade_out_steps = (__pyx_v_request_message->data.play.fade_out_duration / __pyx_t_5);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":891
 *         standard_track.sound_players[player].next.fade_in_steps = request_message.data.play.fade_in_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].next.fade_out_steps = request_message.data.play.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].next.fade_steps_remaining = standard_track.sound_players[player].next.fade_in_steps             # <<<<<<<<<<<<<<
 *         if standard_track.sound_players[player].next.fade_steps_remaining > 0:
 *             standard_track.sound_players[player].next.fading_status = fading_status_fading_in
 */
    __pyx_t_4 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.fade_in_steps;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.fade_steps_remaining = __pyx_t_4;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":892
 *         standard_track.sound_players[player].next.fade_out_steps = request_message.data.play.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].next.fade_steps_remaining = standard_track.sound_players[player].next.fade_in_steps
 *         if standard_track.sound_players[player].next.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.fading_status = fading_status_fading_in
 *         else:
 */
    __pyx_t_2 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).next.fade_steps_remaining > 0) != 0);
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":893
 *         standard_track.sound_players[player].next.fade_steps_remaining = standard_track.sound_players[player].next.fade_in_steps
 *         if standard_track.sound_players[player].next.fade_steps_remaining > 0:
 *             standard_track.sound_players[player].next.fading_status = fading_status_fading_in             # <<<<<<<<<<<<<<
 *         else:
 *             standard_track.sound_players[player].next.fading_status = fading_status_not_fading
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.fading_status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_fading_in;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":892
 *         standard_track.sound_players[player].next.fade_out_steps = request_message.data.play.fade_out_duration // (track.buffer_size // CONTROL_POINTS_PER_BUFFER)
 *         standard_track.sound_players[player].next.fade_steps_remaining = standard_track.sound_players[player].next.fade_in_steps
 *         if standard_track.sound_players[player].next.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.fading_status = fading_status_fading_in
 *         else:
 */
      goto __pyx_L12;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":895
 *             standard_track.sound_players[player].next.fading_status = fading_status_fading_in
 *         else:
 *             standard_track.sound_players[player].next.fading_status = fading_status_not_fading             # <<<<<<<<<<<<<<
 * 
 *         # Markers
 */
    /*else*/ {
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.fading_status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_not_fading;
    }
    __pyx_L12:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":898
 * 
 *         # Markers
 *         standard_track.sound_players[player].next.marker_count = request_message.data.play.marker_count             # <<<<<<<<<<<<<<
 * 
 *         for index in range(request_message.data.play.marker_count):
 */
    __pyx_t_1 = __pyx_v_request_message->data.play.marker_count;
    (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.marker_count = __pyx_t_1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":900
 *         standard_track.sound_players[player].next.marker_count = request_message.data.play.marker_count
 * 
 *         for index in range(request_message.data.play.marker_count):             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.markers[index] = request_message.data.play.markers[index]
 * 
 */
    __pyx_t_1 = __pyx_v_request_message->data.play.marker_count;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) {
      __pyx_v_index = __pyx_t_8;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":901
 * 
 *         for index in range(request_message.data.play.marker_count):
 *             standard_track.sound_players[player].next.markers[index] = request_message.data.play.markers[index]             # <<<<<<<<<<<<<<
 * 
 *         if request_message.data.play.sound_has_ducking:
 */
      ((__pyx_v_standard_track->sound_players[__pyx_v_player]).next.markers[__pyx_v_index]) = (__pyx_v_request_message->data.play.markers[__pyx_v_index]);
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":903
 *             standard_track.sound_players[player].next.markers[index] = request_message.data.play.markers[index]
 * 
 *         if request_message.data.play.sound_has_ducking:             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.sound_has_ducking = True
 *             standard_track.sound_players[player].next.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask
 */
    __pyx_t_2 = (__pyx_v_request_message->data.play.sound_has_ducking != 0);
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":904
 * 
 *         if request_message.data.play.sound_has_ducking:
 *             standard_track.sound_players[player].next.sound_has_ducking = True             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask
 *             standard_track.sound_players[player].next.ducking_settings.attack_start_pos = request_message.data.play.ducking_settings.attack_start_pos
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.sound_has_ducking = 1;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":905
 *         if request_message.data.play.sound_has_ducking:
 *             standard_track.sound_players[player].next.sound_has_ducking = True
 *             standard_track.sound_players[player].next.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.ducking_settings.attack_start_pos = request_message.data.play.ducking_settings.attack_start_pos
 *             standard_track.sound_players[player].next.ducking_settings.attack_duration = request_message.data.play.ducking_settings.attack_duration
 */
      __pyx_t_1 = __pyx_v_request_message->data.play.ducking_settings.track_bit_mask;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.track_bit_mask = __pyx_t_1;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":906
 *             standard_track.sound_players[player].next.sound_has_ducking = True
 *             standard_track.sound_players[player].next.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask
 *             standard_track.sound_players[player].next.ducking_settings.attack_start_pos = request_message.data.play.ducking_settings.attack_start_pos             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.ducking_settings.attack_duration = request_message.data.play.ducking_settings.attack_duration
 *             standard_track.sound_players[player].next.ducking_settings.attenuation_volume = request_message.data.play.ducking_settings.attenuation_volume
 */
      __pyx_t_9 = __pyx_v_request_message->data.play.ducking_settings.attack_start_pos;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.attack_start_pos = __pyx_t_9;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":907
 *             standard_track.sound_players[player].next.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask
 *             standard_track.sound_players[player].next.ducking_settings.attack_start_pos = request_message.data.play.ducking_settings.attack_start_pos
 *             standard_track.sound_players[player].next.ducking_settings.attack_duration = request_message.data.play.ducking_settings.attack_duration             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.ducking_settings.attenuation_volume = request_message.data.play.ducking_settings.attenuation_volume
 *             standard_track.sound_players[player].next.ducking_settings.release_start_pos = request_message.data.play.ducking_settings.release_start_pos
 */
      __pyx_t_9 = __pyx_v_request_message->data.play.ducking_settings.attack_duration;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.attack_duration = __pyx_t_9;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":908
 *             standard_track.sound_players[player].next.ducking_settings.attack_start_pos = request_message.data.play.ducking_settings.attack_start_pos
 *             standard_track.sound_players[player].next.ducking_settings.attack_duration = request_message.data.play.ducking_settings.attack_duration
 *             standard_track.sound_players[player].next.ducking_settings.attenuation_volume = request_message.data.play.ducking_settings.attenuation_volume             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.ducking_settings.release_start_pos = request_message.data.play.ducking_settings.release_start_pos
 *             standard_track.sound_players[player].next.ducking_settings.release_duration = request_message.data.play.ducking_settings.release_duration
 */
      __pyx_t_7 = __pyx_v_request_message->data.play.ducking_settings.attenuation_volume;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.attenuation_volume = __pyx_t_7;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":909
 *             standard_track.sound_players[player].next.ducking_settings.attack_duration = request_message.data.play.ducking_settings.attack_duration
 *             standard_track.sound_players[player].next.ducking_settings.attenuation_volume = request_message.data.play.ducking_settings.attenuation_volume
 *             standard_track.sound_players[player].next.ducking_settings.release_start_pos = request_message.data.play.ducking_settings.release_start_pos             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.ducking_settings.release_duration = request_message.data.play.ducking_settings.release_duration
 *             standard_track.sound_players[player].next.ducking_stage = ducking_stage_delay
 */
      __pyx_t_9 = __pyx_v_request_message->data.play.ducking_settings.release_start_pos;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.release_start_pos = __pyx_t_9;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":910
 *             standard_track.sound_players[player].next.ducking_settings.attenuation_volume = request_message.data.play.ducking_settings.attenuation_volume
 *             standard_track.sound_players[player].next.ducking_settings.release_start_pos = request_message.data.play.ducking_settings.release_start_pos
 *             standard_track.sound_players[player].next.ducking_settings.release_duration = request_message.data.play.ducking_settings.release_duration             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.ducking_stage = ducking_stage_delay
 * 
 */
      __pyx_t_9 = __pyx_v_request_message->data.play.ducking_settings.release_duration;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.release_duration = __pyx_t_9;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":911
 *             standard_track.sound_players[player].next.ducking_settings.release_start_pos = request_message.data.play.ducking_settings.release_start_pos
 *             standard_track.sound_players[player].next.ducking_settings.release_duration = request_message.data.play.ducking_settings.release_duration
 *             standard_track.sound_players[player].next.ducking_stage = ducking_stage_delay             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_stage = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_ducking_stage_delay;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":903
 *             standard_track.sound_players[player].next.markers[index] = request_message.data.play.markers[index]
 * 
 *         if request_message.data.play.sound_has_ducking:             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].next.sound_has_ducking = True
 *             standard_track.sound_players[player].next.ducking_settings.track_bit_mask = request_message.data.play.ducking_settings.track_bit_mask
 */
      goto __pyx_L15;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":914
 * 
 *         else:
 *             standard_track.sound_players[player].next.sound_has_ducking = False             # <<<<<<<<<<<<<<
 * 
 *         # TODO: Figure out how to handle ducking when replacing an existing sound
 */
    /*else*/ {
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.sound_has_ducking = 0;
    }
    __pyx_L15:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":919
 * 
 *         # Clear request message since it has been processed
 *         request_message.message = request_not_in_use             # <<<<<<<<<<<<<<
 * 
 * cdef void standard_track_mix_playing_sounds(TrackState *track, Uint32 buffer_length, AudioCallbackData *callback_data) nogil:
 */
    __pyx_v_request_message->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_not_in_use;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":876
 *         request_message.message = request_not_in_use
 * 
 *     elif request_message.message == request_sound_replace:             # <<<<<<<<<<<<<<
 *         # Update player to stop playing current sound and start playing new sound
 *         standard_track.sound_players[player].status = player_replacing
 */
    break;
    default: break;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":792
 *                 pass
 * 
 * cdef void process_standard_track_request_message(RequestMessageContainer *request_message,             # <<<<<<<<<<<<<<
 *                                                  TrackState *track) nogil:
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.process_standard_track_request_message", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":921
 *         request_message.message = request_not_in_use
 * 
 * cdef void standard_track_mix_playing_sounds(TrackState *track, Uint32 buffer_length, AudioCallbackData *callback_data) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Mixes any sounds that are playing on the specified standard track into the specified audio buffer.
 */

static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_standard_track_mix_playing_sounds(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *__pyx_v_track, Uint32 __pyx_v_buffer_length, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *__pyx_v_callback_data) {
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState *__pyx_v_standard_track;
  Uint32 __pyx_v_sdl_ticks;
  Uint8 *__pyx_v_sound_buffer;
  Uint8 *__pyx_v_output_buffer;
  Uint32 __pyx_v_buffer_pos;
  Uint32 __pyx_v_fade_out_duration;
  Uint32 __pyx_v_sound_samples_remaining;
  Uint8 __pyx_v_volume;
  Uint32 __pyx_v_samples_per_control_point;
  Uint32 __pyx_v_control_point_pos;
  int __pyx_v_ducking_is_active;
  float __pyx_v_progress;
  int __pyx_v_track_num;
  int __pyx_v_marker_id;
  int __pyx_v_player;
  long __pyx_v_control_point;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Uint8 __pyx_t_5;
  int __pyx_t_6;
  Uint32 __pyx_t_7;
  Uint32 __pyx_t_8;
  Uint32 __pyx_t_9;
  Uint32 __pyx_t_10;
  long __pyx_t_11;
  struct Mix_Chunk *__pyx_t_12;
  Sint32 __pyx_t_13;
  int __pyx_t_14;
  Uint8 __pyx_t_15;
  Uint8 __pyx_t_16;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":933
 *     cdef TrackStandardState *standard_track
 * 
 *     if track == NULL or track.type != track_type_standard:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_2 = ((__pyx_v_track == NULL) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_track->type != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_standard) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":934
 * 
 *     if track == NULL or track.type != track_type_standard:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     # Get the current clock from SDL (it is used for the audio timing master)
 */
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":933
 *     cdef TrackStandardState *standard_track
 * 
 *     if track == NULL or track.type != track_type_standard:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":937
 * 
 *     # Get the current clock from SDL (it is used for the audio timing master)
 *     cdef Uint32 sdl_ticks = SDL_GetTicks()             # <<<<<<<<<<<<<<
 * 
 *     # Setup source (sound) and destination (track) buffer pointers/values
 */
  __pyx_v_sdl_ticks = SDL_GetTicks();

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":941
 *     # Setup source (sound) and destination (track) buffer pointers/values
 *     cdef Uint8 *sound_buffer
 *     cdef Uint8 *output_buffer = <Uint8*> track.buffer             # <<<<<<<<<<<<<<
 * 
 *     cdef int message_index
 */
  __pyx_v_output_buffer = ((Uint8 *)__pyx_v_track->buffer);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":956
 *     cdef int marker_id
 * 
 *     standard_track = <TrackStandardState*>track.type_state             # <<<<<<<<<<<<<<
 *     samples_per_control_point = buffer_length // CONTROL_POINTS_PER_BUFFER
 * 
 */
  __pyx_v_standard_track = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState *)__pyx_v_track->type_state);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":957
 * 
 *     standard_track = <TrackStandardState*>track.type_state
 *     samples_per_control_point = buffer_length // CONTROL_POINTS_PER_BUFFER             # <<<<<<<<<<<<<<
 * 
 *     # Loop over track sound players
 */
  __pyx_v_samples_per_control_point = (__pyx_v_buffer_length / 8);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":960
 * 
 *     # Loop over track sound players
 *     for player in range(standard_track.sound_player_count):             # <<<<<<<<<<<<<<
 * 
 *         # If the player is idle, there is nothing to do so move on to the next player
 */
  __pyx_t_3 = __pyx_v_standard_track->sound_player_count;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_player = __pyx_t_4;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":963
 * 
 *         # If the player is idle, there is nothing to do so move on to the next player
 *         if standard_track.sound_players[player].status is player_idle \             # <<<<<<<<<<<<<<
 *                 or standard_track.sound_players[player].current.chunk == NULL:
 *             continue
 */
    __pyx_t_2 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L9_bool_binop_done;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":964
 *         # If the player is idle, there is nothing to do so move on to the next player
 *         if standard_track.sound_players[player].status is player_idle \
 *                 or standard_track.sound_players[player].current.chunk == NULL:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_2 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk == NULL) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L9_bool_binop_done:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":963
 * 
 *         # If the player is idle, there is nothing to do so move on to the next player
 *         if standard_track.sound_players[player].status is player_idle \             # <<<<<<<<<<<<<<
 *                 or standard_track.sound_players[player].current.chunk == NULL:
 *             continue
 */
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":965
 *         if standard_track.sound_players[player].status is player_idle \
 *                 or standard_track.sound_players[player].current.chunk == NULL:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         buffer_pos = 0
 */
      goto __pyx_L6_continue;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":963
 * 
 *         # If the player is idle, there is nothing to do so move on to the next player
 *         if standard_track.sound_players[player].status is player_idle \             # <<<<<<<<<<<<<<
 *                 or standard_track.sound_players[player].current.chunk == NULL:
 *             continue
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":967
 *             continue
 * 
 *         buffer_pos = 0             # <<<<<<<<<<<<<<
 *         track.active = True
 * 
 */
    __pyx_v_buffer_pos = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":968
 * 
 *         buffer_pos = 0
 *         track.active = True             # <<<<<<<<<<<<<<
 * 
 *         # Get source sound buffer (read one byte at a time, bytes will be combined into a
 */
    __pyx_v_track->active = 1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":972
 *         # Get source sound buffer (read one byte at a time, bytes will be combined into a
 *         # 16-bit sample value before being mixed)
 *         sound_buffer = <Uint8*> standard_track.sound_players[player].current.chunk.abuf             # <<<<<<<<<<<<<<
 * 
 *         # Check if player has been requested to stop a sound
 */
    __pyx_v_sound_buffer = ((Uint8 *)(__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk->abuf);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":975
 * 
 *         # Check if player has been requested to stop a sound
 *         if standard_track.sound_players[player].status is player_stopping:             # <<<<<<<<<<<<<<
 * 
 *             if standard_track.sound_players[player].current.sound_has_ducking:
 */
    __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_stopping) != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":977
 *         if standard_track.sound_players[player].status is player_stopping:
 * 
 *             if standard_track.sound_players[player].current.sound_has_ducking:             # <<<<<<<<<<<<<<
 *                 # Initiate a fast ducking release (10 ms)
 *                 # TODO: implement ducking release here
 */
      __pyx_t_1 = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_has_ducking != 0);
      if (__pyx_t_1) {
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":982
 *                 pass
 * 
 *             volume = standard_track.sound_players[player].current.volume             # <<<<<<<<<<<<<<
 * 
 *             # Loop over destination buffer, mixing in the source sample
 */
      __pyx_t_5 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume;
      __pyx_v_volume = __pyx_t_5;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":985
 * 
 *             # Loop over destination buffer, mixing in the source sample
 *             while buffer_pos < buffer_length:             # <<<<<<<<<<<<<<
 * 
 *                 # Calculate volume at the control rate (handle fading)
 */
      while (1) {
        __pyx_t_1 = ((__pyx_v_buffer_pos < __pyx_v_buffer_length) != 0);
        if (!__pyx_t_1) break;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":988
 * 
 *                 # Calculate volume at the control rate (handle fading)
 *                 if (buffer_pos % samples_per_control_point) == 0:             # <<<<<<<<<<<<<<
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_out:
 *                         volume = <Uint8> (in_out_quad(standard_track.sound_players[player].current.fade_steps_remaining /
 */
        if (unlikely(__pyx_v_samples_per_control_point == 0)) {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          #ifdef WITH_THREAD
          PyGILState_Release(__pyx_gilstate_save);
          #endif
          __PYX_ERR(0, 988, __pyx_L1_error)
        }
        __pyx_t_1 = (((__pyx_v_buffer_pos % __pyx_v_samples_per_control_point) == 0) != 0);
        if (__pyx_t_1) {

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":989
 *                 # Calculate volume at the control rate (handle fading)
 *                 if (buffer_pos % samples_per_control_point) == 0:
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_out:             # <<<<<<<<<<<<<<
 *                         volume = <Uint8> (in_out_quad(standard_track.sound_players[player].current.fade_steps_remaining /
 *                             standard_track.sound_players[player].current.fade_out_steps) * standard_track.sound_players[
 */
          __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fading_status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_fading_out) != 0);
          if (__pyx_t_1) {

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":990
 *                 if (buffer_pos % samples_per_control_point) == 0:
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_out:
 *                         volume = <Uint8> (in_out_quad(standard_track.sound_players[player].current.fade_steps_remaining /             # <<<<<<<<<<<<<<
 *                             standard_track.sound_players[player].current.fade_out_steps) * standard_track.sound_players[
 *                                               player].current.volume)
 */
            if (unlikely((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_out_steps == 0)) {
              #ifdef WITH_THREAD
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
              #endif
              PyErr_SetString(PyExc_ZeroDivisionError, "float division");
              #ifdef WITH_THREAD
              PyGILState_Release(__pyx_gilstate_save);
              #endif
              __PYX_ERR(0, 990, __pyx_L1_error)
            }

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":991
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_out:
 *                         volume = <Uint8> (in_out_quad(standard_track.sound_players[player].current.fade_steps_remaining /
 *                             standard_track.sound_players[player].current.fade_out_steps) * standard_track.sound_players[             # <<<<<<<<<<<<<<
 *                                               player].current.volume)
 *                         standard_track.sound_players[player].current.fade_steps_remaining -= 1
 */
            __pyx_v_volume = ((Uint8)(__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_in_out_quad((((double)(__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_steps_remaining) / ((double)(__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_out_steps))) * (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume));

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":993
 *                             standard_track.sound_players[player].current.fade_out_steps) * standard_track.sound_players[
 *                                               player].current.volume)
 *                         standard_track.sound_players[player].current.fade_steps_remaining -= 1             # <<<<<<<<<<<<<<
 *                         if standard_track.sound_players[player].current.fade_steps_remaining == 0:
 *                             standard_track.sound_players[player].current.fading_status = fading_status_not_fading
 */
            __pyx_t_6 = __pyx_v_player;
            (__pyx_v_standard_track->sound_players[__pyx_t_6]).current.fade_steps_remaining = ((__pyx_v_standard_track->sound_players[__pyx_t_6]).current.fade_steps_remaining - 1);

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":994
 *                                               player].current.volume)
 *                         standard_track.sound_players[player].current.fade_steps_remaining -= 1
 *                         if standard_track.sound_players[player].current.fade_steps_remaining == 0:             # <<<<<<<<<<<<<<
 *                             standard_track.sound_players[player].current.fading_status = fading_status_not_fading
 *                             standard_track.sound_players[player].status = player_finished
 */
            __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_steps_remaining == 0) != 0);
            if (__pyx_t_1) {

              /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":995
 *                         standard_track.sound_players[player].current.fade_steps_remaining -= 1
 *                         if standard_track.sound_players[player].current.fade_steps_remaining == 0:
 *                             standard_track.sound_players[player].current.fading_status = fading_status_not_fading             # <<<<<<<<<<<<<<
 *                             standard_track.sound_players[player].status = player_finished
 *                     else:
 */
              (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fading_status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_not_fading;

              /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":996
 *                         if standard_track.sound_players[player].current.fade_steps_remaining == 0:
 *                             standard_track.sound_players[player].current.fading_status = fading_status_not_fading
 *                             standard_track.sound_players[player].status = player_finished             # <<<<<<<<<<<<<<
 *                     else:
 *                         volume = standard_track.sound_players[player].current.volume
 */
              (__pyx_v_standard_track->sound_players[__pyx_v_player]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_finished;

              /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":994
 *                                               player].current.volume)
 *                         standard_track.sound_players[player].current.fade_steps_remaining -= 1
 *                         if standard_track.sound_players[player].current.fade_steps_remaining == 0:             # <<<<<<<<<<<<<<
 *                             standard_track.sound_players[player].current.fading_status = fading_status_not_fading
 *                             standard_track.sound_players[player].status = player_finished
 */
            }

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":989
 *                 # Calculate volume at the control rate (handle fading)
 *                 if (buffer_pos % samples_per_control_point) == 0:
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_out:             # <<<<<<<<<<<<<<
 *                         volume = <Uint8> (in_out_quad(standard_track.sound_players[player].current.fade_steps_remaining /
 *                             standard_track.sound_players[player].current.fade_out_steps) * standard_track.sound_players[
 */
            goto __pyx_L16;
          }

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":998
 *                             standard_track.sound_players[player].status = player_finished
 *                     else:
 *                         volume = standard_track.sound_players[player].current.volume             # <<<<<<<<<<<<<<
 *                         standard_track.sound_players[player].status = player_finished
 * 
 */
          /*else*/ {
            __pyx_t_5 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume;
            __pyx_v_volume = __pyx_t_5;

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":999
 *                     else:
 *                         volume = standard_track.sound_players[player].current.volume
 *                         standard_track.sound_players[player].status = player_finished             # <<<<<<<<<<<<<<
 * 
 *                 mix_sound_sample_to_buffer(sound_buffer,
 */
            (__pyx_v_standard_track->sound_players[__pyx_v_player]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_finished;
          }
          __pyx_L16:;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":988
 * 
 *                 # Calculate volume at the control rate (handle fading)
 *                 if (buffer_pos % samples_per_control_point) == 0:             # <<<<<<<<<<<<<<
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_out:
 *                         volume = <Uint8> (in_out_quad(standard_track.sound_players[player].current.fade_steps_remaining /
 */
        }

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1001
 *                         standard_track.sound_players[player].status = player_finished
 * 
 *                 mix_sound_sample_to_buffer(sound_buffer,             # <<<<<<<<<<<<<<
 *                                            standard_track.sound_players[player].current.sample_pos,
 *                                            volume,
 */
        __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_mix_sound_sample_to_buffer(__pyx_v_sound_buffer, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos, __pyx_v_volume, __pyx_v_output_buffer, __pyx_v_buffer_pos);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1008
 * 
 *                 # Advance the source sample pointer to the next sample
 *                 standard_track.sound_players[player].current.sample_pos += BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 *                 # Advance the output buffer pointer to the next sample
 */
        __pyx_t_6 = __pyx_v_player;
        (__pyx_v_standard_track->sound_players[__pyx_t_6]).current.sample_pos = ((__pyx_v_standard_track->sound_players[__pyx_t_6]).current.sample_pos + 2);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1011
 * 
 *                 # Advance the output buffer pointer to the next sample
 *                 buffer_pos += BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 *                 # Check if we are at the end of the source sample buffer
 */
        __pyx_v_buffer_pos = (__pyx_v_buffer_pos + 2);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1014
 * 
 *                 # Check if we are at the end of the source sample buffer
 *                 if standard_track.sound_players[player].current.sample_pos >= standard_track.sound_players[player].current.chunk.alen:             # <<<<<<<<<<<<<<
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),
 *                                             callback_data.notification_messages, sdl_ticks)
 */
        __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos >= (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk->alen) != 0);
        if (__pyx_t_1) {

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1015
 *                 # Check if we are at the end of the source sample buffer
 *                 if standard_track.sound_players[player].current.sample_pos >= standard_track.sound_players[player].current.chunk.alen:
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),             # <<<<<<<<<<<<<<
 *                                             callback_data.notification_messages, sdl_ticks)
 * 
 */
          __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_end_of_sound_processing((&(__pyx_v_standard_track->sound_players[__pyx_v_player])), __pyx_v_callback_data->notification_messages, __pyx_v_sdl_ticks);

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1014
 * 
 *                 # Check if we are at the end of the source sample buffer
 *                 if standard_track.sound_players[player].current.sample_pos >= standard_track.sound_players[player].current.chunk.alen:             # <<<<<<<<<<<<<<
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),
 *                                             callback_data.notification_messages, sdl_ticks)
 */
        }

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1018
 *                                             callback_data.notification_messages, sdl_ticks)
 * 
 *                 if standard_track.sound_players[player].status is player_finished:             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
        __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_finished) != 0);
        if (__pyx_t_1) {

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1019
 * 
 *                 if standard_track.sound_players[player].status is player_finished:
 *                     break             # <<<<<<<<<<<<<<
 * 
 *         # Check if player has been requested to stop a sound and immediately replace it with another sound
 */
          goto __pyx_L14_break;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1018
 *                                             callback_data.notification_messages, sdl_ticks)
 * 
 *                 if standard_track.sound_players[player].status is player_finished:             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
        }
      }
      __pyx_L14_break:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":975
 * 
 *         # Check if player has been requested to stop a sound
 *         if standard_track.sound_players[player].status is player_stopping:             # <<<<<<<<<<<<<<
 * 
 *             if standard_track.sound_players[player].current.sound_has_ducking:
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1022
 * 
 *         # Check if player has been requested to stop a sound and immediately replace it with another sound
 *         if standard_track.sound_players[player].status is player_replacing:             # <<<<<<<<<<<<<<
 * 
 *             sound_samples_remaining = standard_track.sound_players[player].current.chunk.alen - standard_track.sound_players[
 */
    __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_replacing) != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1024
 *         if standard_track.sound_players[player].status is player_replacing:
 * 
 *             sound_samples_remaining = standard_track.sound_players[player].current.chunk.alen - standard_track.sound_players[             # <<<<<<<<<<<<<<
 *                 player].current.sample_pos
 *             fade_out_duration = min(buffer_length,
 */
      __pyx_v_sound_samples_remaining = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk->alen - (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1027
 *                 player].current.sample_pos
 *             fade_out_duration = min(buffer_length,
 *                                     <Uint32>(callback_data.sample_rate * callback_data.audio_channels *             # <<<<<<<<<<<<<<
 *                                           QUICK_FADE_DURATION_SECS),
 *                                     sound_samples_remaining)
 */
      __pyx_t_7 = ((Uint32)((__pyx_v_callback_data->sample_rate * __pyx_v_callback_data->audio_channels) * 0.05));

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1029
 *                                     <Uint32>(callback_data.sample_rate * callback_data.audio_channels *
 *                                           QUICK_FADE_DURATION_SECS),
 *                                     sound_samples_remaining)             # <<<<<<<<<<<<<<
 *             volume = standard_track.sound_players[player].current.volume
 * 
 */
      __pyx_t_8 = __pyx_v_sound_samples_remaining;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1026
 *             sound_samples_remaining = standard_track.sound_players[player].current.chunk.alen - standard_track.sound_players[
 *                 player].current.sample_pos
 *             fade_out_duration = min(buffer_length,             # <<<<<<<<<<<<<<
 *                                     <Uint32>(callback_data.sample_rate * callback_data.audio_channels *
 *                                           QUICK_FADE_DURATION_SECS),
 */
      __pyx_t_9 = __pyx_v_buffer_length;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1027
 *                 player].current.sample_pos
 *             fade_out_duration = min(buffer_length,
 *                                     <Uint32>(callback_data.sample_rate * callback_data.audio_channels *             # <<<<<<<<<<<<<<
 *                                           QUICK_FADE_DURATION_SECS),
 *                                     sound_samples_remaining)
 */
      if (((__pyx_t_7 < __pyx_t_9) != 0)) {
        __pyx_t_10 = __pyx_t_7;
      } else {
        __pyx_t_10 = __pyx_t_9;
      }
      __pyx_t_9 = __pyx_t_10;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1029
 *                                     <Uint32>(callback_data.sample_rate * callback_data.audio_channels *
 *                                           QUICK_FADE_DURATION_SECS),
 *                                     sound_samples_remaining)             # <<<<<<<<<<<<<<
 *             volume = standard_track.sound_players[player].current.volume
 * 
 */
      if (((__pyx_t_8 < __pyx_t_9) != 0)) {
        __pyx_t_10 = __pyx_t_8;
      } else {
        __pyx_t_10 = __pyx_t_9;
      }
      __pyx_v_fade_out_duration = __pyx_t_10;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1030
 *                                           QUICK_FADE_DURATION_SECS),
 *                                     sound_samples_remaining)
 *             volume = standard_track.sound_players[player].current.volume             # <<<<<<<<<<<<<<
 * 
 *             if standard_track.sound_players[player].current.sound_has_ducking:
 */
      __pyx_t_5 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume;
      __pyx_v_volume = __pyx_t_5;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1032
 *             volume = standard_track.sound_players[player].current.volume
 * 
 *             if standard_track.sound_players[player].current.sound_has_ducking:             # <<<<<<<<<<<<<<
 *                 # Initiate a fast ducking release (10 ms)
 *                 # TODO: implement ducking release here
 */
      __pyx_t_1 = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_has_ducking != 0);
      if (__pyx_t_1) {
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1038
 * 
 *             # Loop over destination buffer, mixing in the source sample
 *             while buffer_pos < fade_out_duration:             # <<<<<<<<<<<<<<
 *                 mix_sound_sample_to_buffer(sound_buffer,
 *                                            standard_track.sound_players[player].current.sample_pos,
 */
      while (1) {
        __pyx_t_1 = ((__pyx_v_buffer_pos < __pyx_v_fade_out_duration) != 0);
        if (!__pyx_t_1) break;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1039
 *             # Loop over destination buffer, mixing in the source sample
 *             while buffer_pos < fade_out_duration:
 *                 mix_sound_sample_to_buffer(sound_buffer,             # <<<<<<<<<<<<<<
 *                                            standard_track.sound_players[player].current.sample_pos,
 *                                            volume,
 */
        __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_mix_sound_sample_to_buffer(__pyx_v_sound_buffer, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos, __pyx_v_volume, __pyx_v_output_buffer, __pyx_v_buffer_pos);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1046
 * 
 *                 # Advance the source sample pointer to the next sample (2 bytes)
 *                 standard_track.sound_players[player].current.sample_pos += BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 *                 # Advance the output buffer pointer to the next sample (2 bytes)
 */
        __pyx_t_6 = __pyx_v_player;
        (__pyx_v_standard_track->sound_players[__pyx_t_6]).current.sample_pos = ((__pyx_v_standard_track->sound_players[__pyx_t_6]).current.sample_pos + 2);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1049
 * 
 *                 # Advance the output buffer pointer to the next sample (2 bytes)
 *                 buffer_pos += BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 *                 # Check if we are at the end of the source sample buffer (loop if applicable)
 */
        __pyx_v_buffer_pos = (__pyx_v_buffer_pos + 2);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1052
 * 
 *                 # Check if we are at the end of the source sample buffer (loop if applicable)
 *                 if standard_track.sound_players[player].current.sample_pos >= standard_track.sound_players[player].current.chunk.alen:             # <<<<<<<<<<<<<<
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),
 *                                             callback_data.notification_messages, sdl_ticks)
 */
        __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos >= (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk->alen) != 0);
        if (__pyx_t_1) {

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1053
 *                 # Check if we are at the end of the source sample buffer (loop if applicable)
 *                 if standard_track.sound_players[player].current.sample_pos >= standard_track.sound_players[player].current.chunk.alen:
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),             # <<<<<<<<<<<<<<
 *                                             callback_data.notification_messages, sdl_ticks)
 *                     if standard_track.sound_players[player].status is player_finished:
 */
          __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_end_of_sound_processing((&(__pyx_v_standard_track->sound_players[__pyx_v_player])), __pyx_v_callback_data->notification_messages, __pyx_v_sdl_ticks);

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1055
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),
 *                                             callback_data.notification_messages, sdl_ticks)
 *                     if standard_track.sound_players[player].status is player_finished:             # <<<<<<<<<<<<<<
 *                         break
 * 
 */
          __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_finished) != 0);
          if (__pyx_t_1) {

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1056
 *                                             callback_data.notification_messages, sdl_ticks)
 *                     if standard_track.sound_players[player].status is player_finished:
 *                         break             # <<<<<<<<<<<<<<
 * 
 *                 # Set volume for next loop
 */
            goto __pyx_L23_break;

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1055
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),
 *                                             callback_data.notification_messages, sdl_ticks)
 *                     if standard_track.sound_players[player].status is player_finished:             # <<<<<<<<<<<<<<
 *                         break
 * 
 */
          }

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1052
 * 
 *                 # Check if we are at the end of the source sample buffer (loop if applicable)
 *                 if standard_track.sound_players[player].current.sample_pos >= standard_track.sound_players[player].current.chunk.alen:             # <<<<<<<<<<<<<<
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),
 *                                             callback_data.notification_messages, sdl_ticks)
 */
        }

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1060
 *                 # Set volume for next loop
 *                 volume = <int> (
 *                     (1.0 - in_out_quad(buffer_pos / fade_out_duration)) * standard_track.sound_players[player].current.volume)             # <<<<<<<<<<<<<<
 * 
 *             # Send audio event that the sound has stopped
 */
        if (unlikely(__pyx_v_fade_out_duration == 0)) {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
          #ifdef WITH_THREAD
          PyGILState_Release(__pyx_gilstate_save);
          #endif
          __PYX_ERR(0, 1060, __pyx_L1_error)
        }

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1059
 * 
 *                 # Set volume for next loop
 *                 volume = <int> (             # <<<<<<<<<<<<<<
 *                     (1.0 - in_out_quad(buffer_pos / fade_out_duration)) * standard_track.sound_players[player].current.volume)
 * 
 */
        __pyx_v_volume = ((int)((1.0 - __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_in_out_quad((((double)__pyx_v_buffer_pos) / ((double)__pyx_v_fade_out_duration)))) * (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume));
      }
      __pyx_L23_break:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1063
 * 
 *             # Send audio event that the sound has stopped
 *             send_sound_stopped_notification(track.number, player,             # <<<<<<<<<<<<<<
 *                                      standard_track.sound_players[player].current.sound_id,
 *                                      standard_track.sound_players[player].current.sound_instance_id,
 */
      __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_stopped_notification(__pyx_v_track->number, __pyx_v_player, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_id, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_instance_id, __pyx_v_callback_data->notification_messages, __pyx_v_sdl_ticks);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1070
 * 
 *             # Update sound player status to finished
 *             standard_track.sound_players[player].status = player_pending             # <<<<<<<<<<<<<<
 * 
 *             # Copy sound player settings from next sound to current
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_pending;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1073
 * 
 *             # Copy sound player settings from next sound to current
 *             standard_track.sound_players[player].status = player_pending             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.sample_pos = standard_track.sound_players[player].next.sample_pos
 *             standard_track.sound_players[player].current.current_loop = standard_track.sound_players[player].next.current_loop
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_pending;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1074
 *             # Copy sound player settings from next sound to current
 *             standard_track.sound_players[player].status = player_pending
 *             standard_track.sound_players[player].current.sample_pos = standard_track.sound_players[player].next.sample_pos             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.current_loop = standard_track.sound_players[player].next.current_loop
 *             standard_track.sound_players[player].current.sound_id = standard_track.sound_players[player].next.sound_id
 */
      __pyx_t_10 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.sample_pos;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos = __pyx_t_10;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1075
 *             standard_track.sound_players[player].status = player_pending
 *             standard_track.sound_players[player].current.sample_pos = standard_track.sound_players[player].next.sample_pos
 *             standard_track.sound_players[player].current.current_loop = standard_track.sound_players[player].next.current_loop             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.sound_id = standard_track.sound_players[player].next.sound_id
 *             standard_track.sound_players[player].current.sound_instance_id = standard_track.sound_players[player].next.sound_instance_id
 */
      __pyx_t_6 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.current_loop;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.current_loop = __pyx_t_6;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1076
 *             standard_track.sound_players[player].current.sample_pos = standard_track.sound_players[player].next.sample_pos
 *             standard_track.sound_players[player].current.current_loop = standard_track.sound_players[player].next.current_loop
 *             standard_track.sound_players[player].current.sound_id = standard_track.sound_players[player].next.sound_id             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.sound_instance_id = standard_track.sound_players[player].next.sound_instance_id
 *             standard_track.sound_players[player].current.chunk = standard_track.sound_players[player].next.chunk
 */
      __pyx_t_11 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.sound_id;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_id = __pyx_t_11;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1077
 *             standard_track.sound_players[player].current.current_loop = standard_track.sound_players[player].next.current_loop
 *             standard_track.sound_players[player].current.sound_id = standard_track.sound_players[player].next.sound_id
 *             standard_track.sound_players[player].current.sound_instance_id = standard_track.sound_players[player].next.sound_instance_id             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.chunk = standard_track.sound_players[player].next.chunk
 *             standard_track.sound_players[player].current.volume = standard_track.sound_players[player].next.volume
 */
      __pyx_t_11 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.sound_instance_id;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_instance_id = __pyx_t_11;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1078
 *             standard_track.sound_players[player].current.sound_id = standard_track.sound_players[player].next.sound_id
 *             standard_track.sound_players[player].current.sound_instance_id = standard_track.sound_players[player].next.sound_instance_id
 *             standard_track.sound_players[player].current.chunk = standard_track.sound_players[player].next.chunk             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.volume = standard_track.sound_players[player].next.volume
 *             standard_track.sound_players[player].current.loops_remaining = standard_track.sound_players[player].next.loops_remaining
 */
      __pyx_t_12 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.chunk;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk = __pyx_t_12;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1079
 *             standard_track.sound_players[player].current.sound_instance_id = standard_track.sound_players[player].next.sound_instance_id
 *             standard_track.sound_players[player].current.chunk = standard_track.sound_players[player].next.chunk
 *             standard_track.sound_players[player].current.volume = standard_track.sound_players[player].next.volume             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.loops_remaining = standard_track.sound_players[player].next.loops_remaining
 *             standard_track.sound_players[player].current.sound_priority = standard_track.sound_players[player].next.sound_priority
 */
      __pyx_t_5 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.volume;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume = __pyx_t_5;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1080
 *             standard_track.sound_players[player].current.chunk = standard_track.sound_players[player].next.chunk
 *             standard_track.sound_players[player].current.volume = standard_track.sound_players[player].next.volume
 *             standard_track.sound_players[player].current.loops_remaining = standard_track.sound_players[player].next.loops_remaining             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.sound_priority = standard_track.sound_players[player].next.sound_priority
 *             standard_track.sound_players[player].current.marker_count = standard_track.sound_players[player].next.marker_count
 */
      __pyx_t_6 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.loops_remaining;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.loops_remaining = __pyx_t_6;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1081
 *             standard_track.sound_players[player].current.volume = standard_track.sound_players[player].next.volume
 *             standard_track.sound_players[player].current.loops_remaining = standard_track.sound_players[player].next.loops_remaining
 *             standard_track.sound_players[player].current.sound_priority = standard_track.sound_players[player].next.sound_priority             # <<<<<<<<<<<<<<
 *             standard_track.sound_players[player].current.marker_count = standard_track.sound_players[player].next.marker_count
 * 
 */
      __pyx_t_6 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.sound_priority;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_priority = __pyx_t_6;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1082
 *             standard_track.sound_players[player].current.loops_remaining = standard_track.sound_players[player].next.loops_remaining
 *             standard_track.sound_players[player].current.sound_priority = standard_track.sound_players[player].next.sound_priority
 *             standard_track.sound_players[player].current.marker_count = standard_track.sound_players[player].next.marker_count             # <<<<<<<<<<<<<<
 * 
 *             for buffer_pos in range(standard_track.sound_players[player].current.marker_count):
 */
      __pyx_t_6 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.marker_count;
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.marker_count = __pyx_t_6;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1084
 *             standard_track.sound_players[player].current.marker_count = standard_track.sound_players[player].next.marker_count
 * 
 *             for buffer_pos in range(standard_track.sound_players[player].current.marker_count):             # <<<<<<<<<<<<<<
 *                 standard_track.sound_players[player].current.markers[buffer_pos] = standard_track.sound_players[player].next.markers[buffer_pos]
 * 
 */
      __pyx_t_6 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.marker_count;
      for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_6; __pyx_t_10+=1) {
        __pyx_v_buffer_pos = __pyx_t_10;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1085
 * 
 *             for buffer_pos in range(standard_track.sound_players[player].current.marker_count):
 *                 standard_track.sound_players[player].current.markers[buffer_pos] = standard_track.sound_players[player].next.markers[buffer_pos]             # <<<<<<<<<<<<<<
 * 
 *             if standard_track.sound_players[player].current.sound_has_ducking:
 */
        ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.markers[__pyx_v_buffer_pos]) = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).next.markers[__pyx_v_buffer_pos]);
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1087
 *                 standard_track.sound_players[player].current.markers[buffer_pos] = standard_track.sound_players[player].next.markers[buffer_pos]
 * 
 *             if standard_track.sound_players[player].current.sound_has_ducking:             # <<<<<<<<<<<<<<
 *                 standard_track.sound_players[player].current.sound_has_ducking = True
 *                 standard_track.sound_players[player].current.ducking_settings.track_bit_mask = standard_track.sound_players[player].next.ducking_settings.track_bit_mask
 */
      __pyx_t_1 = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_has_ducking != 0);
      if (__pyx_t_1) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1088
 * 
 *             if standard_track.sound_players[player].current.sound_has_ducking:
 *                 standard_track.sound_players[player].current.sound_has_ducking = True             # <<<<<<<<<<<<<<
 *                 standard_track.sound_players[player].current.ducking_settings.track_bit_mask = standard_track.sound_players[player].next.ducking_settings.track_bit_mask
 *                 standard_track.sound_players[player].current.ducking_settings.attack_start_pos = standard_track.sound_players[player].next.ducking_settings.attack_start_pos
 */
        (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_has_ducking = 1;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1089
 *             if standard_track.sound_players[player].current.sound_has_ducking:
 *                 standard_track.sound_players[player].current.sound_has_ducking = True
 *                 standard_track.sound_players[player].current.ducking_settings.track_bit_mask = standard_track.sound_players[player].next.ducking_settings.track_bit_mask             # <<<<<<<<<<<<<<
 *                 standard_track.sound_players[player].current.ducking_settings.attack_start_pos = standard_track.sound_players[player].next.ducking_settings.attack_start_pos
 *                 standard_track.sound_players[player].current.ducking_settings.attack_duration = standard_track.sound_players[player].next.ducking_settings.attack_duration
 */
        __pyx_t_6 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.track_bit_mask;
        (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.track_bit_mask = __pyx_t_6;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1090
 *                 standard_track.sound_players[player].current.sound_has_ducking = True
 *                 standard_track.sound_players[player].current.ducking_settings.track_bit_mask = standard_track.sound_players[player].next.ducking_settings.track_bit_mask
 *                 standard_track.sound_players[player].current.ducking_settings.attack_start_pos = standard_track.sound_players[player].next.ducking_settings.attack_start_pos             # <<<<<<<<<<<<<<
 *                 standard_track.sound_players[player].current.ducking_settings.attack_duration = standard_track.sound_players[player].next.ducking_settings.attack_duration
 *                 standard_track.sound_players[player].current.ducking_settings.attenuation_volume = standard_track.sound_players[player].next.ducking_settings.attenuation_volume
 */
        __pyx_t_13 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.attack_start_pos;
        (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attack_start_pos = __pyx_t_13;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1091
 *                 standard_track.sound_players[player].current.ducking_settings.track_bit_mask = standard_track.sound_players[player].next.ducking_settings.track_bit_mask
 *                 standard_track.sound_players[player].current.ducking_settings.attack_start_pos = standard_track.sound_players[player].next.ducking_settings.attack_start_pos
 *                 standard_track.sound_players[player].current.ducking_settings.attack_duration = standard_track.sound_players[player].next.ducking_settings.attack_duration             # <<<<<<<<<<<<<<
 *                 standard_track.sound_players[player].current.ducking_settings.attenuation_volume = standard_track.sound_players[player].next.ducking_settings.attenuation_volume
 *                 standard_track.sound_players[player].current.ducking_settings.release_start_pos = standard_track.sound_players[player].next.ducking_settings.release_start_pos
 */
        __pyx_t_13 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.attack_duration;
        (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attack_duration = __pyx_t_13;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1092
 *                 standard_track.sound_players[player].current.ducking_settings.attack_start_pos = standard_track.sound_players[player].next.ducking_settings.attack_start_pos
 *                 standard_track.sound_players[player].current.ducking_settings.attack_duration = standard_track.sound_players[player].next.ducking_settings.attack_duration
 *                 standard_track.sound_players[player].current.ducking_settings.attenuation_volume = standard_track.sound_players[player].next.ducking_settings.attenuation_volume             # <<<<<<<<<<<<<<
 *                 standard_track.sound_players[player].current.ducking_settings.release_start_pos = standard_track.sound_players[player].next.ducking_settings.release_start_pos
 *                 standard_track.sound_players[player].current.ducking_settings.release_duration = standard_track.sound_players[player].next.ducking_settings.release_duration
 */
        __pyx_t_5 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.attenuation_volume;
        (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attenuation_volume = __pyx_t_5;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1093
 *                 standard_track.sound_players[player].current.ducking_settings.attack_duration = standard_track.sound_players[player].next.ducking_settings.attack_duration
 *                 standard_track.sound_players[player].current.ducking_settings.attenuation_volume = standard_track.sound_players[player].next.ducking_settings.attenuation_volume
 *                 standard_track.sound_players[player].current.ducking_settings.release_start_pos = standard_track.sound_players[player].next.ducking_settings.release_start_pos             # <<<<<<<<<<<<<<
 *                 standard_track.sound_players[player].current.ducking_settings.release_duration = standard_track.sound_players[player].next.ducking_settings.release_duration
 *             else:
 */
        __pyx_t_13 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.release_start_pos;
        (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.release_start_pos = __pyx_t_13;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1094
 *                 standard_track.sound_players[player].current.ducking_settings.attenuation_volume = standard_track.sound_players[player].next.ducking_settings.attenuation_volume
 *                 standard_track.sound_players[player].current.ducking_settings.release_start_pos = standard_track.sound_players[player].next.ducking_settings.release_start_pos
 *                 standard_track.sound_players[player].current.ducking_settings.release_duration = standard_track.sound_players[player].next.ducking_settings.release_duration             # <<<<<<<<<<<<<<
 *             else:
 *                 standard_track.sound_players[player].current.sound_has_ducking = False
 */
        __pyx_t_13 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).next.ducking_settings.release_duration;
        (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.release_duration = __pyx_t_13;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1087
 *                 standard_track.sound_players[player].current.markers[buffer_pos] = standard_track.sound_players[player].next.markers[buffer_pos]
 * 
 *             if standard_track.sound_players[player].current.sound_has_ducking:             # <<<<<<<<<<<<<<
 *                 standard_track.sound_players[player].current.sound_has_ducking = True
 *                 standard_track.sound_players[player].current.ducking_settings.track_bit_mask = standard_track.sound_players[player].next.ducking_settings.track_bit_mask
 */
        goto __pyx_L28;
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1096
 *                 standard_track.sound_players[player].current.ducking_settings.release_duration = standard_track.sound_players[player].next.ducking_settings.release_duration
 *             else:
 *                 standard_track.sound_players[player].current.sound_has_ducking = False             # <<<<<<<<<<<<<<
 * 
 *             # Update the current input sound buffer to point to the new sound
 */
      /*else*/ {
        (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_has_ducking = 0;
      }
      __pyx_L28:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1099
 * 
 *             # Update the current input sound buffer to point to the new sound
 *             sound_buffer = <Uint8*> standard_track.sound_players[player].current.chunk.abuf             # <<<<<<<<<<<<<<
 * 
 *         # Check if player has a sound pending playback (ready to start)
 */
      __pyx_v_sound_buffer = ((Uint8 *)(__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk->abuf);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1022
 * 
 *         # Check if player has been requested to stop a sound and immediately replace it with another sound
 *         if standard_track.sound_players[player].status is player_replacing:             # <<<<<<<<<<<<<<
 * 
 *             sound_samples_remaining = standard_track.sound_players[player].current.chunk.alen - standard_track.sound_players[
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1102
 * 
 *         # Check if player has a sound pending playback (ready to start)
 *         if standard_track.sound_players[player].status is player_pending:             # <<<<<<<<<<<<<<
 *             # Sound ready to start playback, send event notification and set status to playing
 *             send_sound_started_notification(track.number, player,
 */
    __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_pending) != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1104
 *         if standard_track.sound_players[player].status is player_pending:
 *             # Sound ready to start playback, send event notification and set status to playing
 *             send_sound_started_notification(track.number, player,             # <<<<<<<<<<<<<<
 *                                             standard_track.sound_players[player].current.sound_id,
 *                                             standard_track.sound_players[player].current.sound_instance_id,
 */
      __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_started_notification(__pyx_v_track->number, __pyx_v_player, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_id, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_instance_id, __pyx_v_callback_data->notification_messages, __pyx_v_sdl_ticks);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1110
 *                                             sdl_ticks)
 * 
 *             standard_track.sound_players[player].status = player_playing             # <<<<<<<<<<<<<<
 * 
 *         # Process markers (do any markers fall in the current processing window?)
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_playing;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1102
 * 
 *         # Check if player has a sound pending playback (ready to start)
 *         if standard_track.sound_players[player].status is player_pending:             # <<<<<<<<<<<<<<
 *             # Sound ready to start playback, send event notification and set status to playing
 *             send_sound_started_notification(track.number, player,
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1113
 * 
 *         # Process markers (do any markers fall in the current processing window?)
 *         for marker_id in range(standard_track.sound_players[player].current.marker_count):             # <<<<<<<<<<<<<<
 *             if standard_track.sound_players[player].current.sample_pos <= standard_track.sound_players[player].current.markers[
 *                 marker_id] < standard_track.sound_players[player].current.sample_pos + buffer_length:
 */
    __pyx_t_6 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.marker_count;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_6; __pyx_t_14+=1) {
      __pyx_v_marker_id = __pyx_t_14;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1114
 *         # Process markers (do any markers fall in the current processing window?)
 *         for marker_id in range(standard_track.sound_players[player].current.marker_count):
 *             if standard_track.sound_players[player].current.sample_pos <= standard_track.sound_players[player].current.markers[             # <<<<<<<<<<<<<<
 *                 marker_id] < standard_track.sound_players[player].current.sample_pos + buffer_length:
 * 
 */
      __pyx_t_1 = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos <= ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.markers[__pyx_v_marker_id]));
      if (__pyx_t_1) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1115
 *         for marker_id in range(standard_track.sound_players[player].current.marker_count):
 *             if standard_track.sound_players[player].current.sample_pos <= standard_track.sound_players[player].current.markers[
 *                 marker_id] < standard_track.sound_players[player].current.sample_pos + buffer_length:             # <<<<<<<<<<<<<<
 * 
 *                 # Marker is in window, send notification
 */
        __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.markers[__pyx_v_marker_id]) < ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos + __pyx_v_buffer_length));
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1114
 *         # Process markers (do any markers fall in the current processing window?)
 *         for marker_id in range(standard_track.sound_players[player].current.marker_count):
 *             if standard_track.sound_players[player].current.sample_pos <= standard_track.sound_players[player].current.markers[             # <<<<<<<<<<<<<<
 *                 marker_id] < standard_track.sound_players[player].current.sample_pos + buffer_length:
 * 
 */
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1118
 * 
 *                 # Marker is in window, send notification
 *                 send_sound_marker_notification(track.number, player,             # <<<<<<<<<<<<<<
 *                                                standard_track.sound_players[player].current.sound_id,
 *                                                standard_track.sound_players[player].current.sound_instance_id,
 */
        __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_marker_notification(__pyx_v_track->number, __pyx_v_player, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_id, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_instance_id, __pyx_v_callback_data->notification_messages, __pyx_v_sdl_ticks, __pyx_v_marker_id);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1114
 *         # Process markers (do any markers fall in the current processing window?)
 *         for marker_id in range(standard_track.sound_players[player].current.marker_count):
 *             if standard_track.sound_players[player].current.sample_pos <= standard_track.sound_players[player].current.markers[             # <<<<<<<<<<<<<<
 *                 marker_id] < standard_track.sound_players[player].current.sample_pos + buffer_length:
 * 
 */
      }
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1126
 * 
 *         # If audio playback object is playing, add it's samples to the output buffer (scaled by sample volume)
 *         if standard_track.sound_players[player].status is player_playing and \             # <<<<<<<<<<<<<<
 *                         standard_track.sound_players[player].current.volume > 0 and \
 *                         standard_track.sound_players[player].current.chunk != NULL:
 */
    __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_playing) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L34_bool_binop_done;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1127
 *         # If audio playback object is playing, add it's samples to the output buffer (scaled by sample volume)
 *         if standard_track.sound_players[player].status is player_playing and \
 *                         standard_track.sound_players[player].current.volume > 0 and \             # <<<<<<<<<<<<<<
 *                         standard_track.sound_players[player].current.chunk != NULL:
 * 
 */
    __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume > 0) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L34_bool_binop_done;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1128
 *         if standard_track.sound_players[player].status is player_playing and \
 *                         standard_track.sound_players[player].current.volume > 0 and \
 *                         standard_track.sound_players[player].current.chunk != NULL:             # <<<<<<<<<<<<<<
 * 
 *             # Process sound ducking (if applicable)
 */
    __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk != NULL) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L34_bool_binop_done:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1126
 * 
 *         # If audio playback object is playing, add it's samples to the output buffer (scaled by sample volume)
 *         if standard_track.sound_players[player].status is player_playing and \             # <<<<<<<<<<<<<<
 *                         standard_track.sound_players[player].current.volume > 0 and \
 *                         standard_track.sound_players[player].current.chunk != NULL:
 */
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1131
 * 
 *             # Process sound ducking (if applicable)
 *             if standard_track.sound_players[player].current.sound_has_ducking:             # <<<<<<<<<<<<<<
 * 
 *                 ducking_is_active = False
 */
      __pyx_t_2 = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_has_ducking != 0);
      if (__pyx_t_2) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1133
 *             if standard_track.sound_players[player].current.sound_has_ducking:
 * 
 *                 ducking_is_active = False             # <<<<<<<<<<<<<<
 *                 control_point_pos = standard_track.sound_players[player].current.sample_pos
 * 
 */
        __pyx_v_ducking_is_active = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1134
 * 
 *                 ducking_is_active = False
 *                 control_point_pos = standard_track.sound_players[player].current.sample_pos             # <<<<<<<<<<<<<<
 * 
 *                 # Loop over control points in sound
 */
        __pyx_t_10 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos;
        __pyx_v_control_point_pos = __pyx_t_10;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1137
 * 
 *                 # Loop over control points in sound
 *                 for control_point in range(CONTROL_POINTS_PER_BUFFER):             # <<<<<<<<<<<<<<
 * 
 *                     # Determine control point ducking stage and calculate control point
 */
        for (__pyx_t_11 = 0; __pyx_t_11 < 8; __pyx_t_11+=1) {
          __pyx_v_control_point = __pyx_t_11;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1140
 * 
 *                     # Determine control point ducking stage and calculate control point
 *                     if control_point_pos >= standard_track.sound_players[player].current.ducking_settings.release_start_pos + standard_track.sound_players[player].current.ducking_settings.release_duration:             # <<<<<<<<<<<<<<
 *                         # Ducking finished
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = MIX_MAX_VOLUME
 */
          __pyx_t_2 = ((__pyx_v_control_point_pos >= ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.release_start_pos + (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.release_duration)) != 0);
          if (__pyx_t_2) {

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1142
 *                     if control_point_pos >= standard_track.sound_players[player].current.ducking_settings.release_start_pos + standard_track.sound_players[player].current.ducking_settings.release_duration:
 *                         # Ducking finished
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = MIX_MAX_VOLUME             # <<<<<<<<<<<<<<
 * 
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.release_start_pos:
 */
            ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_control_points[__pyx_v_control_point]) = MIX_MAX_VOLUME;

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1140
 * 
 *                     # Determine control point ducking stage and calculate control point
 *                     if control_point_pos >= standard_track.sound_players[player].current.ducking_settings.release_start_pos + standard_track.sound_players[player].current.ducking_settings.release_duration:             # <<<<<<<<<<<<<<
 *                         # Ducking finished
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = MIX_MAX_VOLUME
 */
            goto __pyx_L40;
          }

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1144
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = MIX_MAX_VOLUME
 * 
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.release_start_pos:             # <<<<<<<<<<<<<<
 *                         # Ducking release stage
 *                         ducking_is_active = True
 */
          __pyx_t_2 = ((__pyx_v_control_point_pos >= (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.release_start_pos) != 0);
          if (__pyx_t_2) {

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1146
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.release_start_pos:
 *                         # Ducking release stage
 *                         ducking_is_active = True             # <<<<<<<<<<<<<<
 *                         progress = (control_point_pos - standard_track.sound_players[player].current.ducking_settings.release_start_pos) / standard_track.sound_players[player].current.ducking_settings.release_duration
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = \
 */
            __pyx_v_ducking_is_active = 1;

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1147
 *                         # Ducking release stage
 *                         ducking_is_active = True
 *                         progress = (control_point_pos - standard_track.sound_players[player].current.ducking_settings.release_start_pos) / standard_track.sound_players[player].current.ducking_settings.release_duration             # <<<<<<<<<<<<<<
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = \
 *                             lerpU8(in_out_quad(progress), standard_track.sound_players[player].current.ducking_settings.attenuation_volume, MIX_MAX_VOLUME)
 */
            __pyx_t_10 = (__pyx_v_control_point_pos - (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.release_start_pos);
            if (unlikely((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.release_duration == 0)) {
              #ifdef WITH_THREAD
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
              #endif
              PyErr_SetString(PyExc_ZeroDivisionError, "float division");
              #ifdef WITH_THREAD
              PyGILState_Release(__pyx_gilstate_save);
              #endif
              __PYX_ERR(0, 1147, __pyx_L1_error)
            }
            __pyx_v_progress = (((double)__pyx_t_10) / ((double)(__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.release_duration));

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1148
 *                         ducking_is_active = True
 *                         progress = (control_point_pos - standard_track.sound_players[player].current.ducking_settings.release_start_pos) / standard_track.sound_players[player].current.ducking_settings.release_duration
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = \             # <<<<<<<<<<<<<<
 *                             lerpU8(in_out_quad(progress), standard_track.sound_players[player].current.ducking_settings.attenuation_volume, MIX_MAX_VOLUME)
 * 
 */
            ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_control_points[__pyx_v_control_point]) = __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_lerpU8(__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_in_out_quad(__pyx_v_progress), (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attenuation_volume, MIX_MAX_VOLUME);

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1144
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = MIX_MAX_VOLUME
 * 
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.release_start_pos:             # <<<<<<<<<<<<<<
 *                         # Ducking release stage
 *                         ducking_is_active = True
 */
            goto __pyx_L40;
          }

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1151
 *                             lerpU8(in_out_quad(progress), standard_track.sound_players[player].current.ducking_settings.attenuation_volume, MIX_MAX_VOLUME)
 * 
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.attack_start_pos + standard_track.sound_players[player].current.ducking_settings.attack_duration:             # <<<<<<<<<<<<<<
 *                         # Ducking hold state
 *                         ducking_is_active = True
 */
          __pyx_t_2 = ((__pyx_v_control_point_pos >= ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attack_start_pos + (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attack_duration)) != 0);
          if (__pyx_t_2) {

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1153
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.attack_start_pos + standard_track.sound_players[player].current.ducking_settings.attack_duration:
 *                         # Ducking hold state
 *                         ducking_is_active = True             # <<<<<<<<<<<<<<
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = standard_track.sound_players[player].current.ducking_settings.attenuation_volume
 * 
 */
            __pyx_v_ducking_is_active = 1;

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1154
 *                         # Ducking hold state
 *                         ducking_is_active = True
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = standard_track.sound_players[player].current.ducking_settings.attenuation_volume             # <<<<<<<<<<<<<<
 * 
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.attack_start_pos:
 */
            __pyx_t_5 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attenuation_volume;
            ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_control_points[__pyx_v_control_point]) = __pyx_t_5;

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1151
 *                             lerpU8(in_out_quad(progress), standard_track.sound_players[player].current.ducking_settings.attenuation_volume, MIX_MAX_VOLUME)
 * 
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.attack_start_pos + standard_track.sound_players[player].current.ducking_settings.attack_duration:             # <<<<<<<<<<<<<<
 *                         # Ducking hold state
 *                         ducking_is_active = True
 */
            goto __pyx_L40;
          }

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1156
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = standard_track.sound_players[player].current.ducking_settings.attenuation_volume
 * 
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.attack_start_pos:             # <<<<<<<<<<<<<<
 *                         # Ducking attack stage
 *                         ducking_is_active = True
 */
          __pyx_t_2 = ((__pyx_v_control_point_pos >= (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attack_start_pos) != 0);
          if (__pyx_t_2) {

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1158
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.attack_start_pos:
 *                         # Ducking attack stage
 *                         ducking_is_active = True             # <<<<<<<<<<<<<<
 *                         progress = (control_point_pos - standard_track.sound_players[player].current.ducking_settings.attack_start_pos) / standard_track.sound_players[player].current.ducking_settings.attack_duration
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = \
 */
            __pyx_v_ducking_is_active = 1;

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1159
 *                         # Ducking attack stage
 *                         ducking_is_active = True
 *                         progress = (control_point_pos - standard_track.sound_players[player].current.ducking_settings.attack_start_pos) / standard_track.sound_players[player].current.ducking_settings.attack_duration             # <<<<<<<<<<<<<<
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = \
 *                             lerpU8(in_out_quad(progress), MIX_MAX_VOLUME, standard_track.sound_players[player].current.ducking_settings.attenuation_volume)
 */
            __pyx_t_10 = (__pyx_v_control_point_pos - (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attack_start_pos);
            if (unlikely((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attack_duration == 0)) {
              #ifdef WITH_THREAD
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
              #endif
              PyErr_SetString(PyExc_ZeroDivisionError, "float division");
              #ifdef WITH_THREAD
              PyGILState_Release(__pyx_gilstate_save);
              #endif
              __PYX_ERR(0, 1159, __pyx_L1_error)
            }
            __pyx_v_progress = (((double)__pyx_t_10) / ((double)(__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attack_duration));

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1160
 *                         ducking_is_active = True
 *                         progress = (control_point_pos - standard_track.sound_players[player].current.ducking_settings.attack_start_pos) / standard_track.sound_players[player].current.ducking_settings.attack_duration
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = \             # <<<<<<<<<<<<<<
 *                             lerpU8(in_out_quad(progress), MIX_MAX_VOLUME, standard_track.sound_players[player].current.ducking_settings.attenuation_volume)
 * 
 */
            ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_control_points[__pyx_v_control_point]) = __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_lerpU8(__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_in_out_quad(__pyx_v_progress), MIX_MAX_VOLUME, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.attenuation_volume);

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1156
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = standard_track.sound_players[player].current.ducking_settings.attenuation_volume
 * 
 *                     elif control_point_pos >= standard_track.sound_players[player].current.ducking_settings.attack_start_pos:             # <<<<<<<<<<<<<<
 *                         # Ducking attack stage
 *                         ducking_is_active = True
 */
            goto __pyx_L40;
          }

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1165
 *                     else:
 *                         # Ducking delay stage
 *                         standard_track.sound_players[player].current.ducking_control_points[control_point] = MIX_MAX_VOLUME             # <<<<<<<<<<<<<<
 * 
 *                     # Move to next control point
 */
          /*else*/ {
            ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_control_points[__pyx_v_control_point]) = MIX_MAX_VOLUME;
          }
          __pyx_L40:;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1168
 * 
 *                     # Move to next control point
 *                     control_point_pos += samples_per_control_point             # <<<<<<<<<<<<<<
 * 
 *                     # Loop back to beginning of sound (if looping)
 */
          __pyx_v_control_point_pos = (__pyx_v_control_point_pos + __pyx_v_samples_per_control_point);

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1171
 * 
 *                     # Loop back to beginning of sound (if looping)
 *                     if control_point_pos >= standard_track.sound_players[player].current.chunk.alen and standard_track.sound_players[player].current.loops_remaining != 0:             # <<<<<<<<<<<<<<
 *                         control_point_pos -= standard_track.sound_players[player].current.chunk.alen
 * 
 */
          __pyx_t_1 = ((__pyx_v_control_point_pos >= (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk->alen) != 0);
          if (__pyx_t_1) {
          } else {
            __pyx_t_2 = __pyx_t_1;
            goto __pyx_L42_bool_binop_done;
          }
          __pyx_t_1 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.loops_remaining != 0) != 0);
          __pyx_t_2 = __pyx_t_1;
          __pyx_L42_bool_binop_done:;
          if (__pyx_t_2) {

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1172
 *                     # Loop back to beginning of sound (if looping)
 *                     if control_point_pos >= standard_track.sound_players[player].current.chunk.alen and standard_track.sound_players[player].current.loops_remaining != 0:
 *                         control_point_pos -= standard_track.sound_players[player].current.chunk.alen             # <<<<<<<<<<<<<<
 * 
 *                 # Apply ducking to target track(s) (when applicable)
 */
            __pyx_v_control_point_pos = (__pyx_v_control_point_pos - (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk->alen);

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1171
 * 
 *                     # Loop back to beginning of sound (if looping)
 *                     if control_point_pos >= standard_track.sound_players[player].current.chunk.alen and standard_track.sound_players[player].current.loops_remaining != 0:             # <<<<<<<<<<<<<<
 *                         control_point_pos -= standard_track.sound_players[player].current.chunk.alen
 * 
 */
          }
        }

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1175
 * 
 *                 # Apply ducking to target track(s) (when applicable)
 *                 if ducking_is_active:             # <<<<<<<<<<<<<<
 *                     for track_num in range(callback_data.track_count):
 *                         if (1 << track_num) & standard_track.sound_players[player].current.ducking_settings.track_bit_mask:
 */
        __pyx_t_2 = (__pyx_v_ducking_is_active != 0);
        if (__pyx_t_2) {

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1176
 *                 # Apply ducking to target track(s) (when applicable)
 *                 if ducking_is_active:
 *                     for track_num in range(callback_data.track_count):             # <<<<<<<<<<<<<<
 *                         if (1 << track_num) & standard_track.sound_players[player].current.ducking_settings.track_bit_mask:
 *                             if callback_data.tracks[track_num].ducking_is_active:
 */
          __pyx_t_6 = __pyx_v_callback_data->track_count;
          for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_6; __pyx_t_14+=1) {
            __pyx_v_track_num = __pyx_t_14;

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1177
 *                 if ducking_is_active:
 *                     for track_num in range(callback_data.track_count):
 *                         if (1 << track_num) & standard_track.sound_players[player].current.ducking_settings.track_bit_mask:             # <<<<<<<<<<<<<<
 *                             if callback_data.tracks[track_num].ducking_is_active:
 *                                 # Ducking is already active on the track; take the minimum value at each control point
 */
            __pyx_t_2 = (((1 << __pyx_v_track_num) & (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_settings.track_bit_mask) != 0);
            if (__pyx_t_2) {

              /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1178
 *                     for track_num in range(callback_data.track_count):
 *                         if (1 << track_num) & standard_track.sound_players[player].current.ducking_settings.track_bit_mask:
 *                             if callback_data.tracks[track_num].ducking_is_active:             # <<<<<<<<<<<<<<
 *                                 # Ducking is already active on the track; take the minimum value at each control point
 *                                 for control_point in range(CONTROL_POINTS_PER_BUFFER):
 */
              __pyx_t_2 = ((__pyx_v_callback_data->tracks[__pyx_v_track_num])->ducking_is_active != 0);
              if (__pyx_t_2) {

                /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1180
 *                             if callback_data.tracks[track_num].ducking_is_active:
 *                                 # Ducking is already active on the track; take the minimum value at each control point
 *                                 for control_point in range(CONTROL_POINTS_PER_BUFFER):             # <<<<<<<<<<<<<<
 *                                     callback_data.tracks[track_num].ducking_control_points[control_point] = min(
 *                                         callback_data.tracks[track_num].ducking_control_points[control_point],
 */
                for (__pyx_t_11 = 0; __pyx_t_11 < 8; __pyx_t_11+=1) {
                  __pyx_v_control_point = __pyx_t_11;

                  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1183
 *                                     callback_data.tracks[track_num].ducking_control_points[control_point] = min(
 *                                         callback_data.tracks[track_num].ducking_control_points[control_point],
 *                                         standard_track.sound_players[player].current.ducking_control_points[control_point])             # <<<<<<<<<<<<<<
 *                             else:
 *                                 # Ducking not active on track; set it to active and assign control points
 */
                  __pyx_t_5 = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_control_points[__pyx_v_control_point]);

                  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1182
 *                                 for control_point in range(CONTROL_POINTS_PER_BUFFER):
 *                                     callback_data.tracks[track_num].ducking_control_points[control_point] = min(
 *                                         callback_data.tracks[track_num].ducking_control_points[control_point],             # <<<<<<<<<<<<<<
 *                                         standard_track.sound_players[player].current.ducking_control_points[control_point])
 *                             else:
 */
                  __pyx_t_15 = ((__pyx_v_callback_data->tracks[__pyx_v_track_num])->ducking_control_points[__pyx_v_control_point]);

                  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1183
 *                                     callback_data.tracks[track_num].ducking_control_points[control_point] = min(
 *                                         callback_data.tracks[track_num].ducking_control_points[control_point],
 *                                         standard_track.sound_players[player].current.ducking_control_points[control_point])             # <<<<<<<<<<<<<<
 *                             else:
 *                                 # Ducking not active on track; set it to active and assign control points
 */
                  if (((__pyx_t_5 < __pyx_t_15) != 0)) {
                    __pyx_t_16 = __pyx_t_5;
                  } else {
                    __pyx_t_16 = __pyx_t_15;
                  }

                  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1181
 *                                 # Ducking is already active on the track; take the minimum value at each control point
 *                                 for control_point in range(CONTROL_POINTS_PER_BUFFER):
 *                                     callback_data.tracks[track_num].ducking_control_points[control_point] = min(             # <<<<<<<<<<<<<<
 *                                         callback_data.tracks[track_num].ducking_control_points[control_point],
 *                                         standard_track.sound_players[player].current.ducking_control_points[control_point])
 */
                  ((__pyx_v_callback_data->tracks[__pyx_v_track_num])->ducking_control_points[__pyx_v_control_point]) = __pyx_t_16;
                }

                /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1178
 *                     for track_num in range(callback_data.track_count):
 *                         if (1 << track_num) & standard_track.sound_players[player].current.ducking_settings.track_bit_mask:
 *                             if callback_data.tracks[track_num].ducking_is_active:             # <<<<<<<<<<<<<<
 *                                 # Ducking is already active on the track; take the minimum value at each control point
 *                                 for control_point in range(CONTROL_POINTS_PER_BUFFER):
 */
                goto __pyx_L48;
              }

              /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1186
 *                             else:
 *                                 # Ducking not active on track; set it to active and assign control points
 *                                 callback_data.tracks[track_num].ducking_is_active = True             # <<<<<<<<<<<<<<
 *                                 for control_point in range(CONTROL_POINTS_PER_BUFFER):
 *                                     callback_data.tracks[track_num].ducking_control_points[control_point] = standard_track.sound_players[player].current.ducking_control_points[control_point]
 */
              /*else*/ {
                (__pyx_v_callback_data->tracks[__pyx_v_track_num])->ducking_is_active = 1;

                /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1187
 *                                 # Ducking not active on track; set it to active and assign control points
 *                                 callback_data.tracks[track_num].ducking_is_active = True
 *                                 for control_point in range(CONTROL_POINTS_PER_BUFFER):             # <<<<<<<<<<<<<<
 *                                     callback_data.tracks[track_num].ducking_control_points[control_point] = standard_track.sound_players[player].current.ducking_control_points[control_point]
 * 
 */
                for (__pyx_t_11 = 0; __pyx_t_11 < 8; __pyx_t_11+=1) {
                  __pyx_v_control_point = __pyx_t_11;

                  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1188
 *                                 callback_data.tracks[track_num].ducking_is_active = True
 *                                 for control_point in range(CONTROL_POINTS_PER_BUFFER):
 *                                     callback_data.tracks[track_num].ducking_control_points[control_point] = standard_track.sound_players[player].current.ducking_control_points[control_point]             # <<<<<<<<<<<<<<
 * 
 *             # Loop over destination buffer, mixing in the source sample
 */
                  ((__pyx_v_callback_data->tracks[__pyx_v_track_num])->ducking_control_points[__pyx_v_control_point]) = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.ducking_control_points[__pyx_v_control_point]);
                }
              }
              __pyx_L48:;

              /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1177
 *                 if ducking_is_active:
 *                     for track_num in range(callback_data.track_count):
 *                         if (1 << track_num) & standard_track.sound_players[player].current.ducking_settings.track_bit_mask:             # <<<<<<<<<<<<<<
 *                             if callback_data.tracks[track_num].ducking_is_active:
 *                                 # Ducking is already active on the track; take the minimum value at each control point
 */
            }
          }

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1175
 * 
 *                 # Apply ducking to target track(s) (when applicable)
 *                 if ducking_is_active:             # <<<<<<<<<<<<<<
 *                     for track_num in range(callback_data.track_count):
 *                         if (1 << track_num) & standard_track.sound_players[player].current.ducking_settings.track_bit_mask:
 */
        }

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1131
 * 
 *             # Process sound ducking (if applicable)
 *             if standard_track.sound_players[player].current.sound_has_ducking:             # <<<<<<<<<<<<<<
 * 
 *                 ducking_is_active = False
 */
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1191
 * 
 *             # Loop over destination buffer, mixing in the source sample
 *             volume = standard_track.sound_players[player].current.volume             # <<<<<<<<<<<<<<
 *             while buffer_pos < buffer_length:
 * 
 */
      __pyx_t_16 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume;
      __pyx_v_volume = __pyx_t_16;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1192
 *             # Loop over destination buffer, mixing in the source sample
 *             volume = standard_track.sound_players[player].current.volume
 *             while buffer_pos < buffer_length:             # <<<<<<<<<<<<<<
 * 
 *                 # Calculate volume at the control rate (handle fading)
 */
      while (1) {
        __pyx_t_2 = ((__pyx_v_buffer_pos < __pyx_v_buffer_length) != 0);
        if (!__pyx_t_2) break;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1195
 * 
 *                 # Calculate volume at the control rate (handle fading)
 *                 if (buffer_pos % samples_per_control_point) == 0:             # <<<<<<<<<<<<<<
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_in:
 *                         volume = <Uint8> (in_out_quad(
 */
        if (unlikely(__pyx_v_samples_per_control_point == 0)) {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          #ifdef WITH_THREAD
          PyGILState_Release(__pyx_gilstate_save);
          #endif
          __PYX_ERR(0, 1195, __pyx_L1_error)
        }
        __pyx_t_2 = (((__pyx_v_buffer_pos % __pyx_v_samples_per_control_point) == 0) != 0);
        if (__pyx_t_2) {

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1196
 *                 # Calculate volume at the control rate (handle fading)
 *                 if (buffer_pos % samples_per_control_point) == 0:
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_in:             # <<<<<<<<<<<<<<
 *                         volume = <Uint8> (in_out_quad(
 *                             (standard_track.sound_players[player].current.fade_in_steps - standard_track.sound_players[player].current.fade_steps_remaining) /
 */
          __pyx_t_2 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fading_status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_fading_in) != 0);
          if (__pyx_t_2) {

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1198
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_in:
 *                         volume = <Uint8> (in_out_quad(
 *                             (standard_track.sound_players[player].current.fade_in_steps - standard_track.sound_players[player].current.fade_steps_remaining) /             # <<<<<<<<<<<<<<
 *                             standard_track.sound_players[player].current.fade_in_steps) * standard_track.sound_players[
 *                                               player].current.volume)
 */
            __pyx_t_10 = ((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_in_steps - (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_steps_remaining);

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1199
 *                         volume = <Uint8> (in_out_quad(
 *                             (standard_track.sound_players[player].current.fade_in_steps - standard_track.sound_players[player].current.fade_steps_remaining) /
 *                             standard_track.sound_players[player].current.fade_in_steps) * standard_track.sound_players[             # <<<<<<<<<<<<<<
 *                                               player].current.volume)
 *                         standard_track.sound_players[player].current.fade_steps_remaining -= 1
 */
            if (unlikely((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_in_steps == 0)) {
              #ifdef WITH_THREAD
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
              #endif
              PyErr_SetString(PyExc_ZeroDivisionError, "float division");
              #ifdef WITH_THREAD
              PyGILState_Release(__pyx_gilstate_save);
              #endif
              __PYX_ERR(0, 1198, __pyx_L1_error)
            }

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1197
 *                 if (buffer_pos % samples_per_control_point) == 0:
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_in:
 *                         volume = <Uint8> (in_out_quad(             # <<<<<<<<<<<<<<
 *                             (standard_track.sound_players[player].current.fade_in_steps - standard_track.sound_players[player].current.fade_steps_remaining) /
 *                             standard_track.sound_players[player].current.fade_in_steps) * standard_track.sound_players[
 */
            __pyx_v_volume = ((Uint8)(__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_in_out_quad((((double)__pyx_t_10) / ((double)(__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_in_steps))) * (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume));

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1201
 *                             standard_track.sound_players[player].current.fade_in_steps) * standard_track.sound_players[
 *                                               player].current.volume)
 *                         standard_track.sound_players[player].current.fade_steps_remaining -= 1             # <<<<<<<<<<<<<<
 *                         if standard_track.sound_players[player].current.fade_steps_remaining == 0:
 *                             standard_track.sound_players[player].current.fading_status = fading_status_not_fading
 */
            __pyx_t_6 = __pyx_v_player;
            (__pyx_v_standard_track->sound_players[__pyx_t_6]).current.fade_steps_remaining = ((__pyx_v_standard_track->sound_players[__pyx_t_6]).current.fade_steps_remaining - 1);

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1202
 *                                               player].current.volume)
 *                         standard_track.sound_players[player].current.fade_steps_remaining -= 1
 *                         if standard_track.sound_players[player].current.fade_steps_remaining == 0:             # <<<<<<<<<<<<<<
 *                             standard_track.sound_players[player].current.fading_status = fading_status_not_fading
 * 
 */
            __pyx_t_2 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fade_steps_remaining == 0) != 0);
            if (__pyx_t_2) {

              /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1203
 *                         standard_track.sound_players[player].current.fade_steps_remaining -= 1
 *                         if standard_track.sound_players[player].current.fade_steps_remaining == 0:
 *                             standard_track.sound_players[player].current.fading_status = fading_status_not_fading             # <<<<<<<<<<<<<<
 * 
 *                     # Note: fading out only happens while the sound is stopping and therefore is not
 */
              (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.fading_status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_not_fading;

              /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1202
 *                                               player].current.volume)
 *                         standard_track.sound_players[player].current.fade_steps_remaining -= 1
 *                         if standard_track.sound_players[player].current.fade_steps_remaining == 0:             # <<<<<<<<<<<<<<
 *                             standard_track.sound_players[player].current.fading_status = fading_status_not_fading
 * 
 */
            }

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1196
 *                 # Calculate volume at the control rate (handle fading)
 *                 if (buffer_pos % samples_per_control_point) == 0:
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_in:             # <<<<<<<<<<<<<<
 *                         volume = <Uint8> (in_out_quad(
 *                             (standard_track.sound_players[player].current.fade_in_steps - standard_track.sound_players[player].current.fade_steps_remaining) /
 */
            goto __pyx_L56;
          }

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1209
 * 
 *                     else:
 *                         volume = standard_track.sound_players[player].current.volume             # <<<<<<<<<<<<<<
 * 
 *                 mix_sound_sample_to_buffer(sound_buffer,
 */
          /*else*/ {
            __pyx_t_16 = (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.volume;
            __pyx_v_volume = __pyx_t_16;
          }
          __pyx_L56:;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1195
 * 
 *                 # Calculate volume at the control rate (handle fading)
 *                 if (buffer_pos % samples_per_control_point) == 0:             # <<<<<<<<<<<<<<
 *                     if standard_track.sound_players[player].current.fading_status == fading_status_fading_in:
 *                         volume = <Uint8> (in_out_quad(
 */
        }

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1211
 *                         volume = standard_track.sound_players[player].current.volume
 * 
 *                 mix_sound_sample_to_buffer(sound_buffer,             # <<<<<<<<<<<<<<
 *                                            standard_track.sound_players[player].current.sample_pos,
 *                                            volume,
 */
        __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_mix_sound_sample_to_buffer(__pyx_v_sound_buffer, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos, __pyx_v_volume, __pyx_v_output_buffer, __pyx_v_buffer_pos);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1218
 * 
 *                 # Advance the source sample pointer to the next sample (2 bytes)
 *                 standard_track.sound_players[player].current.sample_pos += BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 *                 # Advance the output buffer pointer to the next sample (2 bytes)
 */
        __pyx_t_6 = __pyx_v_player;
        (__pyx_v_standard_track->sound_players[__pyx_t_6]).current.sample_pos = ((__pyx_v_standard_track->sound_players[__pyx_t_6]).current.sample_pos + 2);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1221
 * 
 *                 # Advance the output buffer pointer to the next sample (2 bytes)
 *                 buffer_pos += BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 *                 # Check if we are at the end of the source sample buffer (loop if applicable)
 */
        __pyx_v_buffer_pos = (__pyx_v_buffer_pos + 2);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1224
 * 
 *                 # Check if we are at the end of the source sample buffer (loop if applicable)
 *                 if standard_track.sound_players[player].current.sample_pos >= standard_track.sound_players[player].current.chunk.alen:             # <<<<<<<<<<<<<<
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),
 *                                             callback_data.notification_messages, sdl_ticks)
 */
        __pyx_t_2 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sample_pos >= (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.chunk->alen) != 0);
        if (__pyx_t_2) {

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1225
 *                 # Check if we are at the end of the source sample buffer (loop if applicable)
 *                 if standard_track.sound_players[player].current.sample_pos >= standard_track.sound_players[player].current.chunk.alen:
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),             # <<<<<<<<<<<<<<
 *                                             callback_data.notification_messages, sdl_ticks)
 *                     if standard_track.sound_players[player].status is player_finished:
 */
          __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_end_of_sound_processing((&(__pyx_v_standard_track->sound_players[__pyx_v_player])), __pyx_v_callback_data->notification_messages, __pyx_v_sdl_ticks);

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1227
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),
 *                                             callback_data.notification_messages, sdl_ticks)
 *                     if standard_track.sound_players[player].status is player_finished:             # <<<<<<<<<<<<<<
 *                         break
 * 
 */
          __pyx_t_2 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_finished) != 0);
          if (__pyx_t_2) {

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1228
 *                                             callback_data.notification_messages, sdl_ticks)
 *                     if standard_track.sound_players[player].status is player_finished:
 *                         break             # <<<<<<<<<<<<<<
 * 
 *                 # TODO: Hold sound processing until ducking has finished
 */
            goto __pyx_L54_break;

            /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1227
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),
 *                                             callback_data.notification_messages, sdl_ticks)
 *                     if standard_track.sound_players[player].status is player_finished:             # <<<<<<<<<<<<<<
 *                         break
 * 
 */
          }

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1224
 * 
 *                 # Check if we are at the end of the source sample buffer (loop if applicable)
 *                 if standard_track.sound_players[player].current.sample_pos >= standard_track.sound_players[player].current.chunk.alen:             # <<<<<<<<<<<<<<
 *                     end_of_sound_processing(cython.address(standard_track.sound_players[player]),
 *                                             callback_data.notification_messages, sdl_ticks)
 */
        }
      }
      __pyx_L54_break:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1126
 * 
 *         # If audio playback object is playing, add it's samples to the output buffer (scaled by sample volume)
 *         if standard_track.sound_players[player].status is player_playing and \             # <<<<<<<<<<<<<<
 *                         standard_track.sound_players[player].current.volume > 0 and \
 *                         standard_track.sound_players[player].current.chunk != NULL:
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1235
 * 
 *         # Check if the sound has finished
 *         if standard_track.sound_players[player].status is player_finished:             # <<<<<<<<<<<<<<
 *             send_sound_stopped_notification(track.number, player,
 *                                      standard_track.sound_players[player].current.sound_id,
 */
    __pyx_t_2 = (((__pyx_v_standard_track->sound_players[__pyx_v_player]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_finished) != 0);
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1236
 *         # Check if the sound has finished
 *         if standard_track.sound_players[player].status is player_finished:
 *             send_sound_stopped_notification(track.number, player,             # <<<<<<<<<<<<<<
 *                                      standard_track.sound_players[player].current.sound_id,
 *                                      standard_track.sound_players[player].current.sound_instance_id,
 */
      __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_stopped_notification(__pyx_v_track->number, __pyx_v_player, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_id, (__pyx_v_standard_track->sound_players[__pyx_v_player]).current.sound_instance_id, __pyx_v_callback_data->notification_messages, __pyx_v_sdl_ticks);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1241
 *                                      callback_data.notification_messages,
 *                                      sdl_ticks)
 *             standard_track.sound_players[player].status = player_idle             # <<<<<<<<<<<<<<
 * 
 * cdef inline void end_of_sound_processing(SoundPlayer* player,
 */
      (__pyx_v_standard_track->sound_players[__pyx_v_player]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1235
 * 
 *         # Check if the sound has finished
 *         if standard_track.sound_players[player].status is player_finished:             # <<<<<<<<<<<<<<
 *             send_sound_stopped_notification(track.number, player,
 *                                      standard_track.sound_players[player].current.sound_id,
 */
    }
    __pyx_L6_continue:;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":921
 *         request_message.message = request_not_in_use
 * 
 * cdef void standard_track_mix_playing_sounds(TrackState *track, Uint32 buffer_length, AudioCallbackData *callback_data) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Mixes any sounds that are playing on the specified standard track into the specified audio buffer.
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.standard_track_mix_playing_sounds", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1243
 *             standard_track.sound_players[player].status = player_idle
 * 
 * cdef inline void end_of_sound_processing(SoundPlayer* player,             # <<<<<<<<<<<<<<
 *                                          NotificationMessageContainer **notification_messages,
 *                                          Uint32 sdl_ticks) nogil:
 */

static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_end_of_sound_processing(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer *__pyx_v_player, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **__pyx_v_notification_messages, Uint32 __pyx_v_sdl_ticks) {
  int __pyx_t_1;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1256
 *     """
 *     # Check if we are at the end of the source sample buffer (loop if applicable)
 *     if player.current.loops_remaining > 0:             # <<<<<<<<<<<<<<
 *         # At the end and still loops remaining, loop back to the beginning
 *         player.current.loops_remaining -= 1
 */
  __pyx_t_1 = ((__pyx_v_player->current.loops_remaining > 0) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1258
 *     if player.current.loops_remaining > 0:
 *         # At the end and still loops remaining, loop back to the beginning
 *         player.current.loops_remaining -= 1             # <<<<<<<<<<<<<<
 *         player.current.sample_pos = 0
 *         player.current.current_loop += 1
 */
    __pyx_v_player->current.loops_remaining = (__pyx_v_player->current.loops_remaining - 1);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1259
 *         # At the end and still loops remaining, loop back to the beginning
 *         player.current.loops_remaining -= 1
 *         player.current.sample_pos = 0             # <<<<<<<<<<<<<<
 *         player.current.current_loop += 1
 *         send_sound_looping_notification(player.track_num, player.player,
 */
    __pyx_v_player->current.sample_pos = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1260
 *         player.current.loops_remaining -= 1
 *         player.current.sample_pos = 0
 *         player.current.current_loop += 1             # <<<<<<<<<<<<<<
 *         send_sound_looping_notification(player.track_num, player.player,
 *                                  player.current.sound_id, player.current.sound_instance_id,
 */
    __pyx_v_player->current.current_loop = (__pyx_v_player->current.current_loop + 1);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1261
 *         player.current.sample_pos = 0
 *         player.current.current_loop += 1
 *         send_sound_looping_notification(player.track_num, player.player,             # <<<<<<<<<<<<<<
 *                                  player.current.sound_id, player.current.sound_instance_id,
 *                                  notification_messages, sdl_ticks)
 */
    __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_looping_notification(__pyx_v_player->track_num, __pyx_v_player->player, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_notification_messages, __pyx_v_sdl_ticks);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1256
 *     """
 *     # Check if we are at the end of the source sample buffer (loop if applicable)
 *     if player.current.loops_remaining > 0:             # <<<<<<<<<<<<<<
 *         # At the end and still loops remaining, loop back to the beginning
 *         player.current.loops_remaining -= 1
 */
    goto __pyx_L3;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1265
 *                                  notification_messages, sdl_ticks)
 * 
 *     elif player.current.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *         # At the end and not looping, the sample has finished playing
 *         player.status = player_finished
 */
  __pyx_t_1 = ((__pyx_v_player->current.loops_remaining == 0) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1267
 *     elif player.current.loops_remaining == 0:
 *         # At the end and not looping, the sample has finished playing
 *         player.status = player_finished             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __pyx_v_player->status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_finished;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1265
 *                                  notification_messages, sdl_ticks)
 * 
 *     elif player.current.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *         # At the end and not looping, the sample has finished playing
 *         player.status = player_finished
 */
    goto __pyx_L3;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1271
 *     else:
 *         # Looping infinitely, loop back to the beginning
 *         player.current.sample_pos = 0             # <<<<<<<<<<<<<<
 *         player.current.current_loop += 1
 *         send_sound_looping_notification(player.track_num, player.player,
 */
  /*else*/ {
    __pyx_v_player->current.sample_pos = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1272
 *         # Looping infinitely, loop back to the beginning
 *         player.current.sample_pos = 0
 *         player.current.current_loop += 1             # <<<<<<<<<<<<<<
 *         send_sound_looping_notification(player.track_num, player.player,
 *                                  player.current.sound_id, player.current.sound_instance_id,
 */
    __pyx_v_player->current.current_loop = (__pyx_v_player->current.current_loop + 1);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1273
 *         player.current.sample_pos = 0
 *         player.current.current_loop += 1
 *         send_sound_looping_notification(player.track_num, player.player,             # <<<<<<<<<<<<<<
 *                                  player.current.sound_id, player.current.sound_instance_id,
 *                                  notification_messages, sdl_ticks)
 */
    __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_looping_notification(__pyx_v_player->track_num, __pyx_v_player->player, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_notification_messages, __pyx_v_sdl_ticks);
  }
  __pyx_L3:;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1243
 *             standard_track.sound_players[player].status = player_idle
 * 
 * cdef inline void end_of_sound_processing(SoundPlayer* player,             # <<<<<<<<<<<<<<
 *                                          NotificationMessageContainer **notification_messages,
 *                                          Uint32 sdl_ticks) nogil:
 */

  /* function exit code */
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1277
 *                                  notification_messages, sdl_ticks)
 * 
 * cdef inline void send_sound_started_notification(int track_num, int player,             # <<<<<<<<<<<<<<
 *                                                  long sound_id, long sound_instance_id,
 *                                                  NotificationMessageContainer **notification_messages,
 */

static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_started_notification(int __pyx_v_track_num, int __pyx_v_player, long __pyx_v_sound_id, long __pyx_v_sound_instance_id, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **__pyx_v_notification_messages, Uint32 __pyx_v_sdl_ticks) {
  int __pyx_v_message_index;
  int __pyx_t_1;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1291
 *         sdl_ticks: The current SDL tick time
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)             # <<<<<<<<<<<<<<
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_started
 */
  __pyx_v_message_index = __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_get_available_notification_message(__pyx_v_notification_messages);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1292
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].message = notification_sound_started
 *         notification_messages[message_index].track = track_num
 */
  __pyx_t_1 = ((__pyx_v_message_index != -1L) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1293
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_started             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_started;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1294
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_started
 *         notification_messages[message_index].track = track_num             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->track = __pyx_v_track_num;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1295
 *         notification_messages[message_index].message = notification_sound_started
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->player = __pyx_v_player;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1296
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 *         notification_messages[message_index].time = sdl_ticks
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->sound_id = __pyx_v_sound_id;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1297
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].time = sdl_ticks
 * 
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->sound_instance_id = __pyx_v_sound_instance_id;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1298
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 *         notification_messages[message_index].time = sdl_ticks             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_stopped_notification(int track_num, int player,
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->time = __pyx_v_sdl_ticks;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1292
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].message = notification_sound_started
 *         notification_messages[message_index].track = track_num
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1277
 *                                  notification_messages, sdl_ticks)
 * 
 * cdef inline void send_sound_started_notification(int track_num, int player,             # <<<<<<<<<<<<<<
 *                                                  long sound_id, long sound_instance_id,
 *                                                  NotificationMessageContainer **notification_messages,
 */

  /* function exit code */
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1300
 *         notification_messages[message_index].time = sdl_ticks
 * 
 * cdef inline void send_sound_stopped_notification(int track_num, int player,             # <<<<<<<<<<<<<<
 *                                                  long sound_id, long sound_instance_id,
 *                                                  NotificationMessageContainer **notification_messages,
 */

static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_stopped_notification(int __pyx_v_track_num, int __pyx_v_player, long __pyx_v_sound_id, long __pyx_v_sound_instance_id, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **__pyx_v_notification_messages, Uint32 __pyx_v_sdl_ticks) {
  int __pyx_v_message_index;
  int __pyx_t_1;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1314
 *         sdl_ticks: The current SDL tick time
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)             # <<<<<<<<<<<<<<
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_stopped
 */
  __pyx_v_message_index = __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_get_available_notification_message(__pyx_v_notification_messages);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1315
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].message = notification_sound_stopped
 *         notification_messages[message_index].track = track_num
 */
  __pyx_t_1 = ((__pyx_v_message_index != -1L) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1316
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_stopped             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_stopped;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1317
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_stopped
 *         notification_messages[message_index].track = track_num             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->track = __pyx_v_track_num;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1318
 *         notification_messages[message_index].message = notification_sound_stopped
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->player = __pyx_v_player;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1319
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 *         notification_messages[message_index].time = sdl_ticks
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->sound_id = __pyx_v_sound_id;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1320
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].time = sdl_ticks
 * 
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->sound_instance_id = __pyx_v_sound_instance_id;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1321
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 *         notification_messages[message_index].time = sdl_ticks             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_looping_notification(int track_num, int player,
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->time = __pyx_v_sdl_ticks;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1315
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].message = notification_sound_stopped
 *         notification_messages[message_index].track = track_num
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1300
 *         notification_messages[message_index].time = sdl_ticks
 * 
 * cdef inline void send_sound_stopped_notification(int track_num, int player,             # <<<<<<<<<<<<<<
 *                                                  long sound_id, long sound_instance_id,
 *                                                  NotificationMessageContainer **notification_messages,
 */

  /* function exit code */
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1323
 *         notification_messages[message_index].time = sdl_ticks
 * 
 * cdef inline void send_sound_looping_notification(int track_num, int player,             # <<<<<<<<<<<<<<
 *                                                  long sound_id, long sound_instance_id,
 *                                                  NotificationMessageContainer **notification_messages,
 */

static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_looping_notification(int __pyx_v_track_num, int __pyx_v_player, long __pyx_v_sound_id, long __pyx_v_sound_instance_id, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **__pyx_v_notification_messages, Uint32 __pyx_v_sdl_ticks) {
  int __pyx_v_message_index;
  int __pyx_t_1;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1337
 *         sdl_ticks: The current SDL tick time
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)             # <<<<<<<<<<<<<<
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_looping
 */
  __pyx_v_message_index = __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_get_available_notification_message(__pyx_v_notification_messages);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1338
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].message = notification_sound_looping
 *         notification_messages[message_index].track = track_num
 */
  __pyx_t_1 = ((__pyx_v_message_index != -1L) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1339
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_looping             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_looping;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1340
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_looping
 *         notification_messages[message_index].track = track_num             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->track = __pyx_v_track_num;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1341
 *         notification_messages[message_index].message = notification_sound_looping
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->player = __pyx_v_player;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1342
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 *         notification_messages[message_index].time = sdl_ticks
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->sound_id = __pyx_v_sound_id;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1343
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].time = sdl_ticks
 * 
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->sound_instance_id = __pyx_v_sound_instance_id;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1344
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 *         notification_messages[message_index].time = sdl_ticks             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_marker_notification(int track_num, int player,
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->time = __pyx_v_sdl_ticks;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1338
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].message = notification_sound_looping
 *         notification_messages[message_index].track = track_num
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1323
 *         notification_messages[message_index].time = sdl_ticks
 * 
 * cdef inline void send_sound_looping_notification(int track_num, int player,             # <<<<<<<<<<<<<<
 *                                                  long sound_id, long sound_instance_id,
 *                                                  NotificationMessageContainer **notification_messages,
 */

  /* function exit code */
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1346
 *         notification_messages[message_index].time = sdl_ticks
 * 
 * cdef inline void send_sound_marker_notification(int track_num, int player,             # <<<<<<<<<<<<<<
 *                                                 long sound_id, long sound_instance_id,
 *                                                 NotificationMessageContainer **notification_messages,
 */

static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_send_sound_marker_notification(int __pyx_v_track_num, int __pyx_v_player, long __pyx_v_sound_id, long __pyx_v_sound_instance_id, __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **__pyx_v_notification_messages, Uint32 __pyx_v_sdl_ticks, int __pyx_v_marker_id) {
  int __pyx_v_message_index;
  int __pyx_t_1;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1362
 *         marker_id: The id of the marker being sent for the specified sound
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)             # <<<<<<<<<<<<<<
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_marker
 */
  __pyx_v_message_index = __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_get_available_notification_message(__pyx_v_notification_messages);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1363
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].message = notification_sound_marker
 *         notification_messages[message_index].track = track_num
 */
  __pyx_t_1 = ((__pyx_v_message_index != -1L) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1364
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_marker             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_marker;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1365
 *     if message_index != -1:
 *         notification_messages[message_index].message = notification_sound_marker
 *         notification_messages[message_index].track = track_num             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->track = __pyx_v_track_num;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1366
 *         notification_messages[message_index].message = notification_sound_marker
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->player = __pyx_v_player;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1367
 *         notification_messages[message_index].track = track_num
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 *         notification_messages[message_index].time = sdl_ticks
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->sound_id = __pyx_v_sound_id;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1368
 *         notification_messages[message_index].player = player
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].time = sdl_ticks
 *         notification_messages[message_index].data.marker.id = marker_id
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->sound_instance_id = __pyx_v_sound_instance_id;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1369
 *         notification_messages[message_index].sound_id = sound_id
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 *         notification_messages[message_index].time = sdl_ticks             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].data.marker.id = marker_id
 * 
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->time = __pyx_v_sdl_ticks;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1370
 *         notification_messages[message_index].sound_instance_id = sound_instance_id
 *         notification_messages[message_index].time = sdl_ticks
 *         notification_messages[message_index].data.marker.id = marker_id             # <<<<<<<<<<<<<<
 * 
 * cdef void apply_track_ducking(TrackState* track, Uint32 buffer_size, AudioCallbackData* callback_data) nogil:
 */
    (__pyx_v_notification_messages[__pyx_v_message_index])->data.marker.id = __pyx_v_marker_id;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1363
 *     """
 *     cdef int message_index = get_available_notification_message(notification_messages)
 *     if message_index != -1:             # <<<<<<<<<<<<<<
 *         notification_messages[message_index].message = notification_sound_marker
 *         notification_messages[message_index].track = track_num
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1346
 *         notification_messages[message_index].time = sdl_ticks
 * 
 * cdef inline void send_sound_marker_notification(int track_num, int player,             # <<<<<<<<<<<<<<
 *                                                 long sound_id, long sound_instance_id,
 *                                                 NotificationMessageContainer **notification_messages,
 */

  /* function exit code */
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1372
 *         notification_messages[message_index].data.marker.id = marker_id
 * 
 * cdef void apply_track_ducking(TrackState* track, Uint32 buffer_size, AudioCallbackData* callback_data) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Applies ducking to the specified track (if applicable).
 */

static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_track_ducking(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *__pyx_v_track, Uint32 __pyx_v_buffer_size, CYTHON_UNUSED __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *__pyx_v_callback_data) {
  Uint32 __pyx_v_buffer_pos;
  Uint32 __pyx_v_samples_per_control_point;
  Uint8 __pyx_v_ducking_volume;
  int __pyx_v_control_point;
  int __pyx_t_1;
  int __pyx_t_2;
  struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer_range __pyx_t_3;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1380
 *         callback_data: The AudioCallbackData struct
 *     """
 *     cdef Uint32 buffer_pos = 0             # <<<<<<<<<<<<<<
 *     cdef Uint32 samples_per_control_point = buffer_size // CONTROL_POINTS_PER_BUFFER
 *     cdef Uint8 ducking_volume
 */
  __pyx_v_buffer_pos = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1381
 *     """
 *     cdef Uint32 buffer_pos = 0
 *     cdef Uint32 samples_per_control_point = buffer_size // CONTROL_POINTS_PER_BUFFER             # <<<<<<<<<<<<<<
 *     cdef Uint8 ducking_volume
 *     cdef int control_point
 */
  __pyx_v_samples_per_control_point = (__pyx_v_buffer_size / 8);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1385
 *     cdef int control_point
 * 
 *     if track == NULL:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_1 = ((__pyx_v_track == NULL) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1386
 * 
 *     if track == NULL:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     # Only need to process when ducking is active
 */
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1385
 *     cdef int control_point
 * 
 *     if track == NULL:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1389
 * 
 *     # Only need to process when ducking is active
 *     if track.ducking_is_active:             # <<<<<<<<<<<<<<
 *         # Loop over track buffer
 *         for control_point in range(CONTROL_POINTS_PER_BUFFER):
 */
  __pyx_t_1 = (__pyx_v_track->ducking_is_active != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1391
 *     if track.ducking_is_active:
 *         # Loop over track buffer
 *         for control_point in range(CONTROL_POINTS_PER_BUFFER):             # <<<<<<<<<<<<<<
 *             ducking_volume = track.ducking_control_points[control_point]
 *             if ducking_volume < MIX_MAX_VOLUME:
 */
    for (__pyx_t_2 = 0; __pyx_t_2 < 8; __pyx_t_2+=1) {
      __pyx_v_control_point = __pyx_t_2;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1392
 *         # Loop over track buffer
 *         for control_point in range(CONTROL_POINTS_PER_BUFFER):
 *             ducking_volume = track.ducking_control_points[control_point]             # <<<<<<<<<<<<<<
 *             if ducking_volume < MIX_MAX_VOLUME:
 *                 apply_volume_to_buffer_range(<Uint8*> track.buffer, buffer_pos, ducking_volume,
 */
      __pyx_v_ducking_volume = (__pyx_v_track->ducking_control_points[__pyx_v_control_point]);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1393
 *         for control_point in range(CONTROL_POINTS_PER_BUFFER):
 *             ducking_volume = track.ducking_control_points[control_point]
 *             if ducking_volume < MIX_MAX_VOLUME:             # <<<<<<<<<<<<<<
 *                 apply_volume_to_buffer_range(<Uint8*> track.buffer, buffer_pos, ducking_volume,
 *                                              samples_per_control_point)
 */
      __pyx_t_1 = ((__pyx_v_ducking_volume < MIX_MAX_VOLUME) != 0);
      if (__pyx_t_1) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1394
 *             ducking_volume = track.ducking_control_points[control_point]
 *             if ducking_volume < MIX_MAX_VOLUME:
 *                 apply_volume_to_buffer_range(<Uint8*> track.buffer, buffer_pos, ducking_volume,             # <<<<<<<<<<<<<<
 *                                              samples_per_control_point)
 * 
 */
        __pyx_t_3.__pyx_n = 1;
        __pyx_t_3.length = __pyx_v_samples_per_control_point;
        __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer_range(((Uint8 *)__pyx_v_track->buffer), __pyx_v_buffer_pos, __pyx_v_ducking_volume, &__pyx_t_3); 

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1393
 *         for control_point in range(CONTROL_POINTS_PER_BUFFER):
 *             ducking_volume = track.ducking_control_points[control_point]
 *             if ducking_volume < MIX_MAX_VOLUME:             # <<<<<<<<<<<<<<
 *                 apply_volume_to_buffer_range(<Uint8*> track.buffer, buffer_pos, ducking_volume,
 *                                              samples_per_control_point)
 */
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1397
 *                                              samples_per_control_point)
 * 
 *             buffer_pos += samples_per_control_point             # <<<<<<<<<<<<<<
 * 
 * cdef inline void apply_volume_to_buffer_range(Uint8 *buffer, Uint32 start_pos, Uint8 volume, Uint32 length=2) nogil:
 */
      __pyx_v_buffer_pos = (__pyx_v_buffer_pos + __pyx_v_samples_per_control_point);
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1389
 * 
 *     # Only need to process when ducking is active
 *     if track.ducking_is_active:             # <<<<<<<<<<<<<<
 *         # Loop over track buffer
 *         for control_point in range(CONTROL_POINTS_PER_BUFFER):
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1372
 *         notification_messages[message_index].data.marker.id = marker_id
 * 
 * cdef void apply_track_ducking(TrackState* track, Uint32 buffer_size, AudioCallbackData* callback_data) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Applies ducking to the specified track (if applicable).
 */

  /* function exit code */
  __pyx_L0:;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1399
 *             buffer_pos += samples_per_control_point
 * 
 * cdef inline void apply_volume_to_buffer_range(Uint8 *buffer, Uint32 start_pos, Uint8 volume, Uint32 length=2) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Applies the specified volume to a range of samples in an audio buffer at the specified
 */

static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer_range(Uint8 *__pyx_v_buffer, Uint32 __pyx_v_start_pos, Uint8 __pyx_v_volume, struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer_range *__pyx_optional_args) {
  Uint32 __pyx_v_length = ((Uint32)2);
  union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bit __pyx_v_buffer_sample;
  Uint32 __pyx_v_buffer_pos;
  int __pyx_t_1;
  int __pyx_t_2;
  Uint8 __pyx_t_3;
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_length = __pyx_optional_args->length;
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1410
 *     """
 *     cdef Sample16Bit buffer_sample
 *     cdef Uint32 buffer_pos = start_pos             # <<<<<<<<<<<<<<
 * 
 *     while buffer_pos < start_pos + length:
 */
  __pyx_v_buffer_pos = __pyx_v_start_pos;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1412
 *     cdef Uint32 buffer_pos = start_pos
 * 
 *     while buffer_pos < start_pos + length:             # <<<<<<<<<<<<<<
 *         buffer_sample.bytes.byte0 = buffer[buffer_pos]
 *         buffer_sample.bytes.byte1 = buffer[buffer_pos + 1]
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_buffer_pos < (__pyx_v_start_pos + __pyx_v_length)) != 0);
    if (!__pyx_t_1) break;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1413
 * 
 *     while buffer_pos < start_pos + length:
 *         buffer_sample.bytes.byte0 = buffer[buffer_pos]             # <<<<<<<<<<<<<<
 *         buffer_sample.bytes.byte1 = buffer[buffer_pos + 1]
 *         buffer_sample.value = (buffer_sample.value * volume) // MIX_MAX_VOLUME
 */
    __pyx_v_buffer_sample.bytes.byte0 = (__pyx_v_buffer[__pyx_v_buffer_pos]);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1414
 *     while buffer_pos < start_pos + length:
 *         buffer_sample.bytes.byte0 = buffer[buffer_pos]
 *         buffer_sample.bytes.byte1 = buffer[buffer_pos + 1]             # <<<<<<<<<<<<<<
 *         buffer_sample.value = (buffer_sample.value * volume) // MIX_MAX_VOLUME
 *         buffer[buffer_pos] = buffer_sample.bytes.byte0
 */
    __pyx_v_buffer_sample.bytes.byte1 = (__pyx_v_buffer[(__pyx_v_buffer_pos + 1)]);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1415
 *         buffer_sample.bytes.byte0 = buffer[buffer_pos]
 *         buffer_sample.bytes.byte1 = buffer[buffer_pos + 1]
 *         buffer_sample.value = (buffer_sample.value * volume) // MIX_MAX_VOLUME             # <<<<<<<<<<<<<<
 *         buffer[buffer_pos] = buffer_sample.bytes.byte0
 *         buffer[buffer_pos + 1] = buffer_sample.bytes.byte1
 */
    __pyx_t_2 = (__pyx_v_buffer_sample.value * __pyx_v_volume);
    if (unlikely(MIX_MAX_VOLUME == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 1415, __pyx_L1_error)
    }
    else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(MIX_MAX_VOLUME == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 1415, __pyx_L1_error)
    }
    __pyx_v_buffer_sample.value = __Pyx_div_int(__pyx_t_2, MIX_MAX_VOLUME);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1416
 *         buffer_sample.bytes.byte1 = buffer[buffer_pos + 1]
 *         buffer_sample.value = (buffer_sample.value * volume) // MIX_MAX_VOLUME
 *         buffer[buffer_pos] = buffer_sample.bytes.byte0             # <<<<<<<<<<<<<<
 *         buffer[buffer_pos + 1] = buffer_sample.bytes.byte1
 *         buffer_pos += BYTES_PER_SAMPLE
 */
    __pyx_t_3 = __pyx_v_buffer_sample.bytes.byte0;
    (__pyx_v_buffer[__pyx_v_buffer_pos]) = __pyx_t_3;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1417
 *         buffer_sample.value = (buffer_sample.value * volume) // MIX_MAX_VOLUME
 *         buffer[buffer_pos] = buffer_sample.bytes.byte0
 *         buffer[buffer_pos + 1] = buffer_sample.bytes.byte1             # <<<<<<<<<<<<<<
 *         buffer_pos += BYTES_PER_SAMPLE
 * 
 */
    __pyx_t_3 = __pyx_v_buffer_sample.bytes.byte1;
    (__pyx_v_buffer[(__pyx_v_buffer_pos + 1)]) = __pyx_t_3;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1418
 *         buffer[buffer_pos] = buffer_sample.bytes.byte0
 *         buffer[buffer_pos + 1] = buffer_sample.bytes.byte1
 *         buffer_pos += BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 * cdef void apply_volume_to_buffer(Uint8 *buffer, int buffer_length, Uint8 volume) nogil:
 */
    __pyx_v_buffer_pos = (__pyx_v_buffer_pos + 2);
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1399
 *             buffer_pos += samples_per_control_point
 * 
 * cdef inline void apply_volume_to_buffer_range(Uint8 *buffer, Uint32 start_pos, Uint8 volume, Uint32 length=2) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Applies the specified volume to a range of samples in an audio buffer at the specified
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.apply_volume_to_buffer_range", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1420
 *         buffer_pos += BYTES_PER_SAMPLE
 * 
 * cdef void apply_volume_to_buffer(Uint8 *buffer, int buffer_length, Uint8 volume) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Applies the specified volume to an entire audio buffer.
 */

static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_apply_volume_to_buffer(Uint8 *__pyx_v_buffer, int __pyx_v_buffer_length, Uint8 __pyx_v_volume) {
  int __pyx_v_temp_sample;
  union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bit __pyx_v_sample;
  int __pyx_v_buffer_pos;
  int __pyx_t_1;
  int __pyx_t_2;
  Uint8 __pyx_t_3;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1430
 *     cdef int temp_sample
 *     cdef Sample16Bit sample
 *     cdef int buffer_pos = 0             # <<<<<<<<<<<<<<
 * 
 *     while buffer_pos < buffer_length:
 */
  __pyx_v_buffer_pos = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1432
 *     cdef int buffer_pos = 0
 * 
 *     while buffer_pos < buffer_length:             # <<<<<<<<<<<<<<
 * 
 *         # Get sound sample (2 bytes), combine into a 16-bit value and apply sound volume
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_buffer_pos < __pyx_v_buffer_length) != 0);
    if (!__pyx_t_1) break;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1435
 * 
 *         # Get sound sample (2 bytes), combine into a 16-bit value and apply sound volume
 *         sample.bytes.byte0 = buffer[buffer_pos]             # <<<<<<<<<<<<<<
 *         sample.bytes.byte1 = buffer[buffer_pos + 1]
 *         temp_sample = (sample.value * volume) // MIX_MAX_VOLUME
 */
    __pyx_v_sample.bytes.byte0 = (__pyx_v_buffer[__pyx_v_buffer_pos]);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1436
 *         # Get sound sample (2 bytes), combine into a 16-bit value and apply sound volume
 *         sample.bytes.byte0 = buffer[buffer_pos]
 *         sample.bytes.byte1 = buffer[buffer_pos + 1]             # <<<<<<<<<<<<<<
 *         temp_sample = (sample.value * volume) // MIX_MAX_VOLUME
 * 
 */
    __pyx_v_sample.bytes.byte1 = (__pyx_v_buffer[(__pyx_v_buffer_pos + 1)]);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1437
 *         sample.bytes.byte0 = buffer[buffer_pos]
 *         sample.bytes.byte1 = buffer[buffer_pos + 1]
 *         temp_sample = (sample.value * volume) // MIX_MAX_VOLUME             # <<<<<<<<<<<<<<
 * 
 *         # Put the new sample back into the output buffer (from a 32-bit value
 */
    __pyx_t_2 = (__pyx_v_sample.value * __pyx_v_volume);
    if (unlikely(MIX_MAX_VOLUME == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 1437, __pyx_L1_error)
    }
    else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(MIX_MAX_VOLUME == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 1437, __pyx_L1_error)
    }
    __pyx_v_temp_sample = __Pyx_div_int(__pyx_t_2, MIX_MAX_VOLUME);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1441
 *         # Put the new sample back into the output buffer (from a 32-bit value
 *         # back to a 16-bit value that we know is in 16-bit value range)
 *         sample.value = temp_sample             # <<<<<<<<<<<<<<
 *         buffer[buffer_pos] = sample.bytes.byte0
 *         buffer[buffer_pos + 1] = sample.bytes.byte1
 */
    __pyx_v_sample.value = __pyx_v_temp_sample;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1442
 *         # back to a 16-bit value that we know is in 16-bit value range)
 *         sample.value = temp_sample
 *         buffer[buffer_pos] = sample.bytes.byte0             # <<<<<<<<<<<<<<
 *         buffer[buffer_pos + 1] = sample.bytes.byte1
 * 
 */
    __pyx_t_3 = __pyx_v_sample.bytes.byte0;
    (__pyx_v_buffer[__pyx_v_buffer_pos]) = __pyx_t_3;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1443
 *         sample.value = temp_sample
 *         buffer[buffer_pos] = sample.bytes.byte0
 *         buffer[buffer_pos + 1] = sample.bytes.byte1             # <<<<<<<<<<<<<<
 * 
 *         buffer_pos += BYTES_PER_SAMPLE
 */
    __pyx_t_3 = __pyx_v_sample.bytes.byte1;
    (__pyx_v_buffer[(__pyx_v_buffer_pos + 1)]) = __pyx_t_3;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1445
 *         buffer[buffer_pos + 1] = sample.bytes.byte1
 * 
 *         buffer_pos += BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 * cdef inline void mix_sound_sample_to_buffer(Uint8 *sound_buffer, Uint32 sample_pos, Uint8 sound_volume,
 */
    __pyx_v_buffer_pos = (__pyx_v_buffer_pos + 2);
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1420
 *         buffer_pos += BYTES_PER_SAMPLE
 * 
 * cdef void apply_volume_to_buffer(Uint8 *buffer, int buffer_length, Uint8 volume) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Applies the specified volume to an entire audio buffer.
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.apply_volume_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1447
 *         buffer_pos += BYTES_PER_SAMPLE
 * 
 * cdef inline void mix_sound_sample_to_buffer(Uint8 *sound_buffer, Uint32 sample_pos, Uint8 sound_volume,             # <<<<<<<<<<<<<<
 *                                             Uint8 *output_buffer, Uint32 buffer_pos) nogil:
 *     """
 */

static CYTHON_INLINE void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_mix_sound_sample_to_buffer(Uint8 *__pyx_v_sound_buffer, Uint32 __pyx_v_sample_pos, Uint8 __pyx_v_sound_volume, Uint8 *__pyx_v_output_buffer, Uint32 __pyx_v_buffer_pos) {
  int __pyx_v_temp_sample;
  union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bit __pyx_v_sound_sample;
  union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bit __pyx_v_output_sample;
  int __pyx_t_1;
  int __pyx_t_2;
  Uint8 __pyx_t_3;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1463
 * 
 *     # Get sound sample (2 bytes), combine into a 16-bit value and apply sound volume
 *     sound_sample.bytes.byte0 = sound_buffer[sample_pos]             # <<<<<<<<<<<<<<
 *     sound_sample.bytes.byte1 = sound_buffer[sample_pos + 1]
 * 
 */
  __pyx_v_sound_sample.bytes.byte0 = (__pyx_v_sound_buffer[__pyx_v_sample_pos]);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1464
 *     # Get sound sample (2 bytes), combine into a 16-bit value and apply sound volume
 *     sound_sample.bytes.byte0 = sound_buffer[sample_pos]
 *     sound_sample.bytes.byte1 = sound_buffer[sample_pos + 1]             # <<<<<<<<<<<<<<
 * 
 *     # Get sample (2 bytes) already in the output buffer and combine into 16-bit value
 */
  __pyx_v_sound_sample.bytes.byte1 = (__pyx_v_sound_buffer[(__pyx_v_sample_pos + 1)]);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1467
 * 
 *     # Get sample (2 bytes) already in the output buffer and combine into 16-bit value
 *     output_sample.bytes.byte0 = output_buffer[buffer_pos]             # <<<<<<<<<<<<<<
 *     output_sample.bytes.byte1 = output_buffer[buffer_pos + 1]
 * 
 */
  __pyx_v_output_sample.bytes.byte0 = (__pyx_v_output_buffer[__pyx_v_buffer_pos]);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1468
 *     # Get sample (2 bytes) already in the output buffer and combine into 16-bit value
 *     output_sample.bytes.byte0 = output_buffer[buffer_pos]
 *     output_sample.bytes.byte1 = output_buffer[buffer_pos + 1]             # <<<<<<<<<<<<<<
 * 
 *     # Apply volume to sound sample
 */
  __pyx_v_output_sample.bytes.byte1 = (__pyx_v_output_buffer[(__pyx_v_buffer_pos + 1)]);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1471
 * 
 *     # Apply volume to sound sample
 *     sound_sample.value = (sound_sample.value * sound_volume) // MIX_MAX_VOLUME             # <<<<<<<<<<<<<<
 * 
 *     # Calculate the new output sample (mix the existing output sample with
 */
  __pyx_t_1 = (__pyx_v_sound_sample.value * __pyx_v_sound_volume);
  if (unlikely(MIX_MAX_VOLUME == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    __PYX_ERR(0, 1471, __pyx_L1_error)
  }
  else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(MIX_MAX_VOLUME == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_1))) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    __PYX_ERR(0, 1471, __pyx_L1_error)
  }
  __pyx_v_sound_sample.value = __Pyx_div_int(__pyx_t_1, MIX_MAX_VOLUME);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1475
 *     # Calculate the new output sample (mix the existing output sample with
 *     # the new source sound).  The temp sample is a 32-bit value to avoid overflow.
 *     temp_sample = output_sample.value + sound_sample.value             # <<<<<<<<<<<<<<
 * 
 *     # Clip the temp sample back to a 16-bit value (will cause distortion if samples
 */
  __pyx_v_temp_sample = (__pyx_v_output_sample.value + __pyx_v_sound_sample.value);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1479
 *     # Clip the temp sample back to a 16-bit value (will cause distortion if samples
 *     # on channel are too loud)
 *     if temp_sample > MAX_AUDIO_VALUE_S16:             # <<<<<<<<<<<<<<
 *         temp_sample = MAX_AUDIO_VALUE_S16
 *     elif temp_sample < MIN_AUDIO_VALUE_S16:
 */
  __pyx_t_2 = ((__pyx_v_temp_sample > 0x7FFF) != 0);
  if (__pyx_t_2) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1480
 *     # on channel are too loud)
 *     if temp_sample > MAX_AUDIO_VALUE_S16:
 *         temp_sample = MAX_AUDIO_VALUE_S16             # <<<<<<<<<<<<<<
 *     elif temp_sample < MIN_AUDIO_VALUE_S16:
 *         temp_sample = MIN_AUDIO_VALUE_S16
 */
    __pyx_v_temp_sample = 0x7FFF;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1479
 *     # Clip the temp sample back to a 16-bit value (will cause distortion if samples
 *     # on channel are too loud)
 *     if temp_sample > MAX_AUDIO_VALUE_S16:             # <<<<<<<<<<<<<<
 *         temp_sample = MAX_AUDIO_VALUE_S16
 *     elif temp_sample < MIN_AUDIO_VALUE_S16:
 */
    goto __pyx_L3;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1481
 *     if temp_sample > MAX_AUDIO_VALUE_S16:
 *         temp_sample = MAX_AUDIO_VALUE_S16
 *     elif temp_sample < MIN_AUDIO_VALUE_S16:             # <<<<<<<<<<<<<<
 *         temp_sample = MIN_AUDIO_VALUE_S16
 * 
 */
  __pyx_t_2 = ((__pyx_v_temp_sample < -32768L) != 0);
  if (__pyx_t_2) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1482
 *         temp_sample = MAX_AUDIO_VALUE_S16
 *     elif temp_sample < MIN_AUDIO_VALUE_S16:
 *         temp_sample = MIN_AUDIO_VALUE_S16             # <<<<<<<<<<<<<<
 * 
 *     # Put the new mixed output sample back into the output buffer (from a 32-bit value
 */
    __pyx_v_temp_sample = -32768;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1481
 *     if temp_sample > MAX_AUDIO_VALUE_S16:
 *         temp_sample = MAX_AUDIO_VALUE_S16
 *     elif temp_sample < MIN_AUDIO_VALUE_S16:             # <<<<<<<<<<<<<<
 *         temp_sample = MIN_AUDIO_VALUE_S16
 * 
 */
  }
  __pyx_L3:;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1486
 *     # Put the new mixed output sample back into the output buffer (from a 32-bit value
 *     # back to a 16-bit value that we know is in 16-bit value range)
 *     output_sample.value = temp_sample             # <<<<<<<<<<<<<<
 *     output_buffer[buffer_pos] = output_sample.bytes.byte0
 *     output_buffer[buffer_pos + 1] = output_sample.bytes.byte1
 */
  __pyx_v_output_sample.value = __pyx_v_temp_sample;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1487
 *     # back to a 16-bit value that we know is in 16-bit value range)
 *     output_sample.value = temp_sample
 *     output_buffer[buffer_pos] = output_sample.bytes.byte0             # <<<<<<<<<<<<<<
 *     output_buffer[buffer_pos + 1] = output_sample.bytes.byte1
 * 
 */
  __pyx_t_3 = __pyx_v_output_sample.bytes.byte0;
  (__pyx_v_output_buffer[__pyx_v_buffer_pos]) = __pyx_t_3;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1488
 *     output_sample.value = temp_sample
 *     output_buffer[buffer_pos] = output_sample.bytes.byte0
 *     output_buffer[buffer_pos + 1] = output_sample.bytes.byte1             # <<<<<<<<<<<<<<
 * 
 * cdef inline Uint8 lerpU8(float progress, Uint8 a, Uint8 b) nogil:
 */
  __pyx_t_3 = __pyx_v_output_sample.bytes.byte1;
  (__pyx_v_output_buffer[(__pyx_v_buffer_pos + 1)]) = __pyx_t_3;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1447
 *         buffer_pos += BYTES_PER_SAMPLE
 * 
 * cdef inline void mix_sound_sample_to_buffer(Uint8 *sound_buffer, Uint32 sample_pos, Uint8 sound_volume,             # <<<<<<<<<<<<<<
 *                                             Uint8 *output_buffer, Uint32 buffer_pos) nogil:
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.mix_sound_sample_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1490
 *     output_buffer[buffer_pos + 1] = output_sample.bytes.byte1
 * 
 * cdef inline Uint8 lerpU8(float progress, Uint8 a, Uint8 b) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Linearly interpolate between 2 8-bit values.
 */

static CYTHON_INLINE Uint8 __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_lerpU8(float __pyx_v_progress, Uint8 __pyx_v_a, Uint8 __pyx_v_b) {
  Uint8 __pyx_r;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1501
 *         New 8-bit value between the supplied values
 *     """
 *     return <Uint8> ((1.0 - progress) * a + progress * b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline float in_out_quad(float progress) nogil:
 */
  __pyx_r = ((Uint8)(((1.0 - __pyx_v_progress) * __pyx_v_a) + (__pyx_v_progress * __pyx_v_b)));
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1490
 *     output_buffer[buffer_pos + 1] = output_sample.bytes.byte1
 * 
 * cdef inline Uint8 lerpU8(float progress, Uint8 a, Uint8 b) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Linearly interpolate between 2 8-bit values.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1503
 *     return <Uint8> ((1.0 - progress) * a + progress * b)
 * 
 * cdef inline float in_out_quad(float progress) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     A quadratic easing function used for smoother audio fading
 */

static CYTHON_INLINE float __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_in_out_quad(float __pyx_v_progress) {
  float __pyx_v_p;
  float __pyx_r;
  int __pyx_t_1;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1513
 *     """
 *     cdef float p
 *     p = progress * 2             # <<<<<<<<<<<<<<
 *     if p < 1:
 *         return 0.5 * p * p
 */
  __pyx_v_p = (__pyx_v_progress * 2.0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1514
 *     cdef float p
 *     p = progress * 2
 *     if p < 1:             # <<<<<<<<<<<<<<
 *         return 0.5 * p * p
 *     p -= 1.0
 */
  __pyx_t_1 = ((__pyx_v_p < 1.0) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1515
 *     p = progress * 2
 *     if p < 1:
 *         return 0.5 * p * p             # <<<<<<<<<<<<<<
 *     p -= 1.0
 *     return -0.5 * (p * (p - 2.0) - 1.0)
 */
    __pyx_r = ((0.5 * __pyx_v_p) * __pyx_v_p);
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1514
 *     cdef float p
 *     p = progress * 2
 *     if p < 1:             # <<<<<<<<<<<<<<
 *         return 0.5 * p * p
 *     p -= 1.0
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1516
 *     if p < 1:
 *         return 0.5 * p * p
 *     p -= 1.0             # <<<<<<<<<<<<<<
 *     return -0.5 * (p * (p - 2.0) - 1.0)
 * 
 */
  __pyx_v_p = (__pyx_v_p - 1.0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1517
 *         return 0.5 * p * p
 *     p -= 1.0
 *     return -0.5 * (p * (p - 2.0) - 1.0)             # <<<<<<<<<<<<<<
 * 
 * cdef void mix_track_to_output(Uint8 *track_buffer, Uint8 track_volume, Uint8 *output_buffer, Uint32 buffer_size) nogil:
 */
  __pyx_r = (-0.5 * ((__pyx_v_p * (__pyx_v_p - 2.0)) - 1.0));
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1503
 *     return <Uint8> ((1.0 - progress) * a + progress * b)
 * 
 * cdef inline float in_out_quad(float progress) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     A quadratic easing function used for smoother audio fading
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1519
 *     return -0.5 * (p * (p - 2.0) - 1.0)
 * 
 * cdef void mix_track_to_output(Uint8 *track_buffer, Uint8 track_volume, Uint8 *output_buffer, Uint32 buffer_size) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Mixes a track buffer into the master audio output buffer.
 */

static void __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_mix_track_to_output(Uint8 *__pyx_v_track_buffer, Uint8 __pyx_v_track_volume, Uint8 *__pyx_v_output_buffer, Uint32 __pyx_v_buffer_size) {
  union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bit __pyx_v_track_sample;
  union __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Sample16Bit __pyx_v_output_sample;
  int __pyx_v_temp_sample;
  Uint32 __pyx_v_index;
  int __pyx_t_1;
  int __pyx_t_2;
  Uint8 __pyx_t_3;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1536
 *     cdef Uint32 index
 * 
 *     index = 0             # <<<<<<<<<<<<<<
 *     while index < buffer_size:
 * 
 */
  __pyx_v_index = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1537
 * 
 *     index = 0
 *     while index < buffer_size:             # <<<<<<<<<<<<<<
 * 
 *         # Get sound sample (2 bytes), combine into a 16-bit value and apply sound volume
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_index < __pyx_v_buffer_size) != 0);
    if (!__pyx_t_1) break;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1540
 * 
 *         # Get sound sample (2 bytes), combine into a 16-bit value and apply sound volume
 *         track_sample.bytes.byte0 = track_buffer[index]             # <<<<<<<<<<<<<<
 *         track_sample.bytes.byte1 = track_buffer[index + 1]
 *         track_sample.value = track_sample.value * track_volume // MIX_MAX_VOLUME
 */
    __pyx_v_track_sample.bytes.byte0 = (__pyx_v_track_buffer[__pyx_v_index]);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1541
 *         # Get sound sample (2 bytes), combine into a 16-bit value and apply sound volume
 *         track_sample.bytes.byte0 = track_buffer[index]
 *         track_sample.bytes.byte1 = track_buffer[index + 1]             # <<<<<<<<<<<<<<
 *         track_sample.value = track_sample.value * track_volume // MIX_MAX_VOLUME
 * 
 */
    __pyx_v_track_sample.bytes.byte1 = (__pyx_v_track_buffer[(__pyx_v_index + 1)]);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1542
 *         track_sample.bytes.byte0 = track_buffer[index]
 *         track_sample.bytes.byte1 = track_buffer[index + 1]
 *         track_sample.value = track_sample.value * track_volume // MIX_MAX_VOLUME             # <<<<<<<<<<<<<<
 * 
 *         # Get sample (2 bytes) already in the output buffer and combine into 16-bit value
 */
    __pyx_t_2 = (__pyx_v_track_sample.value * __pyx_v_track_volume);
    if (unlikely(MIX_MAX_VOLUME == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 1542, __pyx_L1_error)
    }
    else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(MIX_MAX_VOLUME == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 1542, __pyx_L1_error)
    }
    __pyx_v_track_sample.value = __Pyx_div_int(__pyx_t_2, MIX_MAX_VOLUME);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1545
 * 
 *         # Get sample (2 bytes) already in the output buffer and combine into 16-bit value
 *         output_sample.bytes.byte0 = output_buffer[index]             # <<<<<<<<<<<<<<
 *         output_sample.bytes.byte1 = output_buffer[index + 1]
 * 
 */
    __pyx_v_output_sample.bytes.byte0 = (__pyx_v_output_buffer[__pyx_v_index]);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1546
 *         # Get sample (2 bytes) already in the output buffer and combine into 16-bit value
 *         output_sample.bytes.byte0 = output_buffer[index]
 *         output_sample.bytes.byte1 = output_buffer[index + 1]             # <<<<<<<<<<<<<<
 * 
 *         # Calculate the new output sample (mix the existing output sample with
 */
    __pyx_v_output_sample.bytes.byte1 = (__pyx_v_output_buffer[(__pyx_v_index + 1)]);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1550
 *         # Calculate the new output sample (mix the existing output sample with
 *         # the track sample).  The temp sample is a 32-bit value to avoid overflow.
 *         temp_sample = output_sample.value + track_sample.value             # <<<<<<<<<<<<<<
 * 
 *         # Clip the temp sample back to a 16-bit value (will cause distortion if samples
 */
    __pyx_v_temp_sample = (__pyx_v_output_sample.value + __pyx_v_track_sample.value);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1554
 *         # Clip the temp sample back to a 16-bit value (will cause distortion if samples
 *         # on channel are too loud)
 *         if temp_sample > MAX_AUDIO_VALUE_S16:             # <<<<<<<<<<<<<<
 *             temp_sample = MAX_AUDIO_VALUE_S16
 *         elif temp_sample < MIN_AUDIO_VALUE_S16:
 */
    __pyx_t_1 = ((__pyx_v_temp_sample > 0x7FFF) != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1555
 *         # on channel are too loud)
 *         if temp_sample > MAX_AUDIO_VALUE_S16:
 *             temp_sample = MAX_AUDIO_VALUE_S16             # <<<<<<<<<<<<<<
 *         elif temp_sample < MIN_AUDIO_VALUE_S16:
 *             temp_sample = MIN_AUDIO_VALUE_S16
 */
      __pyx_v_temp_sample = 0x7FFF;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1554
 *         # Clip the temp sample back to a 16-bit value (will cause distortion if samples
 *         # on channel are too loud)
 *         if temp_sample > MAX_AUDIO_VALUE_S16:             # <<<<<<<<<<<<<<
 *             temp_sample = MAX_AUDIO_VALUE_S16
 *         elif temp_sample < MIN_AUDIO_VALUE_S16:
 */
      goto __pyx_L5;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1556
 *         if temp_sample > MAX_AUDIO_VALUE_S16:
 *             temp_sample = MAX_AUDIO_VALUE_S16
 *         elif temp_sample < MIN_AUDIO_VALUE_S16:             # <<<<<<<<<<<<<<
 *             temp_sample = MIN_AUDIO_VALUE_S16
 * 
 */
    __pyx_t_1 = ((__pyx_v_temp_sample < -32768L) != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1557
 *             temp_sample = MAX_AUDIO_VALUE_S16
 *         elif temp_sample < MIN_AUDIO_VALUE_S16:
 *             temp_sample = MIN_AUDIO_VALUE_S16             # <<<<<<<<<<<<<<
 * 
 *         # Write the new output sample back to the output buffer (from
 */
      __pyx_v_temp_sample = -32768;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1556
 *         if temp_sample > MAX_AUDIO_VALUE_S16:
 *             temp_sample = MAX_AUDIO_VALUE_S16
 *         elif temp_sample < MIN_AUDIO_VALUE_S16:             # <<<<<<<<<<<<<<
 *             temp_sample = MIN_AUDIO_VALUE_S16
 * 
 */
    }
    __pyx_L5:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1561
 *         # Write the new output sample back to the output buffer (from
 *         # a 32-bit value back to a 16-bit value that we know is in 16-bit value range)
 *         output_sample.value = temp_sample             # <<<<<<<<<<<<<<
 *         output_buffer[index] = output_sample.bytes.byte0
 *         output_buffer[index + 1] = output_sample.bytes.byte1
 */
    __pyx_v_output_sample.value = __pyx_v_temp_sample;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1562
 *         # a 32-bit value back to a 16-bit value that we know is in 16-bit value range)
 *         output_sample.value = temp_sample
 *         output_buffer[index] = output_sample.bytes.byte0             # <<<<<<<<<<<<<<
 *         output_buffer[index + 1] = output_sample.bytes.byte1
 * 
 */
    __pyx_t_3 = __pyx_v_output_sample.bytes.byte0;
    (__pyx_v_output_buffer[__pyx_v_index]) = __pyx_t_3;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1563
 *         output_sample.value = temp_sample
 *         output_buffer[index] = output_sample.bytes.byte0
 *         output_buffer[index + 1] = output_sample.bytes.byte1             # <<<<<<<<<<<<<<
 * 
 *         index += BYTES_PER_SAMPLE
 */
    __pyx_t_3 = __pyx_v_output_sample.bytes.byte1;
    (__pyx_v_output_buffer[(__pyx_v_index + 1)]) = __pyx_t_3;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1565
 *         output_buffer[index + 1] = output_sample.bytes.byte1
 * 
 *         index += BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 * cdef int get_available_notification_message(NotificationMessageContainer **notification_messages) nogil:
 */
    __pyx_v_index = (__pyx_v_index + 2);
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1519
 *     return -0.5 * (p * (p - 2.0) - 1.0)
 * 
 * cdef void mix_track_to_output(Uint8 *track_buffer, Uint8 track_volume, Uint8 *output_buffer, Uint32 buffer_size) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Mixes a track buffer into the master audio output buffer.
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.mix_track_to_output", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1567
 *         index += BYTES_PER_SAMPLE
 * 
 * cdef int get_available_notification_message(NotificationMessageContainer **notification_messages) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Returns the index of the first available notification message. If all notification messages
 */

static int __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_get_available_notification_message(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer **__pyx_v_notification_messages) {
  long __pyx_v_i;
  int __pyx_r;
  int __pyx_t_1;
  long __pyx_t_2;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1574
 *     :return: The index of the first available notification message.  -1 if all are in use.
 *     """
 *     if notification_messages == NULL:             # <<<<<<<<<<<<<<
 *         return -1
 * 
 */
  __pyx_t_1 = ((__pyx_v_notification_messages == NULL) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1575
 *     """
 *     if notification_messages == NULL:
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     for i in range(MAX_NOTIFICATION_MESSAGES):
 */
    __pyx_r = -1;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1574
 *     :return: The index of the first available notification message.  -1 if all are in use.
 *     """
 *     if notification_messages == NULL:             # <<<<<<<<<<<<<<
 *         return -1
 * 
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1577
 *         return -1
 * 
 *     for i in range(MAX_NOTIFICATION_MESSAGES):             # <<<<<<<<<<<<<<
 *         if notification_messages[i].message == notification_not_in_use:
 *             return i
 */
  for (__pyx_t_2 = 0; __pyx_t_2 < 32; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1578
 * 
 *     for i in range(MAX_NOTIFICATION_MESSAGES):
 *         if notification_messages[i].message == notification_not_in_use:             # <<<<<<<<<<<<<<
 *             return i
 * 
 */
    __pyx_t_1 = (((__pyx_v_notification_messages[__pyx_v_i])->message == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_not_in_use) != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1579
 *     for i in range(MAX_NOTIFICATION_MESSAGES):
 *         if notification_messages[i].message == notification_not_in_use:
 *             return i             # <<<<<<<<<<<<<<
 * 
 *     return -1
 */
      __pyx_r = __pyx_v_i;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1578
 * 
 *     for i in range(MAX_NOTIFICATION_MESSAGES):
 *         if notification_messages[i].message == notification_not_in_use:             # <<<<<<<<<<<<<<
 *             return i
 * 
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1581
 *             return i
 * 
 *     return -1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1567
 *         index += BYTES_PER_SAMPLE
 * 
 * cdef int get_available_notification_message(NotificationMessageContainer **notification_messages) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Returns the index of the first available notification message. If all notification messages
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1603
 *     cdef TrackState *state
 * 
 *     def __cinit__(self, *args, **kw):             # <<<<<<<<<<<<<<
 *         """C constructor"""
 *         self.state = NULL
 */

/* Python wrapper */
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kw = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track___cinit__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self), __pyx_v_args, __pyx_v_kw);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kw);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track___cinit__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kw) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1605
 *     def __cinit__(self, *args, **kw):
 *         """C constructor"""
 *         self.state = NULL             # <<<<<<<<<<<<<<
 *         self._audio_callback_data = NULL
 *         self.mutex = NULL
 */
  __pyx_v_self->state = NULL;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1606
 *         """C constructor"""
 *         self.state = NULL
 *         self._audio_callback_data = NULL             # <<<<<<<<<<<<<<
 *         self.mutex = NULL
 * 
 */
  __pyx_v_self->_audio_callback_data = NULL;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1607
 *         self.state = NULL
 *         self._audio_callback_data = NULL
 *         self.mutex = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, dict sound_instances_by_id, object audio_callback_data, str name, int track_num, int buffer_size, float volume=1.0):
 */
  __pyx_v_self->mutex = NULL;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1603
 *     cdef TrackState *state
 * 
 *     def __cinit__(self, *args, **kw):             # <<<<<<<<<<<<<<
 *         """C constructor"""
 *         self.state = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1609
 *         self.mutex = NULL
 * 
 *     def __init__(self, dict sound_instances_by_id, object audio_callback_data, str name, int track_num, int buffer_size, float volume=1.0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_2__init__[] = "\n        Constructor\n        Args:\n            sound_instances_by_id: A dictionary of all active sound instance objects keyed by id\n            audio_callback_data: The AudioCallbackData pointer wrapped in a PyCapsule object\n            name: The track name\n            track_num: The track number (corresponds to the SDL_Mixer channel number)\n            buffer_size: The length of the track audio buffer in bytes\n            volume: The track volume (0.0 to 1.0)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_2__init__;
#endif
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sound_instances_by_id = 0;
  PyObject *__pyx_v_audio_callback_data = 0;
  PyObject *__pyx_v_name = 0;
  int __pyx_v_track_num;
  int __pyx_v_buffer_size;
  float __pyx_v_volume;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sound_instances_by_id,&__pyx_n_s_audio_callback_data,&__pyx_n_s_name,&__pyx_n_s_track_num,&__pyx_n_s_buffer_size,&__pyx_n_s_volume,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sound_instances_by_id)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_audio_callback_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 1); __PYX_ERR(0, 1609, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 2); __PYX_ERR(0, 1609, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_track_num)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 3); __PYX_ERR(0, 1609, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buffer_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 4); __PYX_ERR(0, 1609, __pyx_L3_error)
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_volume);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1609, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sound_instances_by_id = ((PyObject*)values[0]);
    __pyx_v_audio_callback_data = values[1];
    __pyx_v_name = ((PyObject*)values[2]);
    __pyx_v_track_num = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_track_num == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error)
    __pyx_v_buffer_size = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_buffer_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error)
    if (values[5]) {
      __pyx_v_volume = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_volume == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error)
    } else {
      __pyx_v_volume = ((float)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1609, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sound_instances_by_id), (&PyDict_Type), 1, "sound_instances_by_id", 1))) __PYX_ERR(0, 1609, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 1609, __pyx_L1_error)
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_2__init__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self), __pyx_v_sound_instances_by_id, __pyx_v_audio_callback_data, __pyx_v_name, __pyx_v_track_num, __pyx_v_buffer_size, __pyx_v_volume);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_2__init__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, PyObject *__pyx_v_sound_instances_by_id, PyObject *__pyx_v_audio_callback_data, PyObject *__pyx_v_name, int __pyx_v_track_num, int __pyx_v_buffer_size, float __pyx_v_volume) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  void *__pyx_t_3;
  struct SDL_mutex *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1620
 *             volume: The track volume (0.0 to 1.0)
 *         """
 *         self.log = logging.getLogger("Track")             # <<<<<<<<<<<<<<
 *         self._sound_instances_by_id = sound_instances_by_id
 *         self._name = name
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->log);
  __Pyx_DECREF(__pyx_v_self->log);
  __pyx_v_self->log = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1621
 *         """
 *         self.log = logging.getLogger("Track")
 *         self._sound_instances_by_id = sound_instances_by_id             # <<<<<<<<<<<<<<
 *         self._name = name
 *         self._number = track_num
 */
  __Pyx_INCREF(__pyx_v_sound_instances_by_id);
  __Pyx_GIVEREF(__pyx_v_sound_instances_by_id);
  __Pyx_GOTREF(__pyx_v_self->_sound_instances_by_id);
  __Pyx_DECREF(__pyx_v_self->_sound_instances_by_id);
  __pyx_v_self->_sound_instances_by_id = __pyx_v_sound_instances_by_id;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1622
 *         self.log = logging.getLogger("Track")
 *         self._sound_instances_by_id = sound_instances_by_id
 *         self._name = name             # <<<<<<<<<<<<<<
 *         self._number = track_num
 * 
 */
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->_name);
  __Pyx_DECREF(__pyx_v_self->_name);
  __pyx_v_self->_name = __pyx_v_name;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1623
 *         self._sound_instances_by_id = sound_instances_by_id
 *         self._name = name
 *         self._number = track_num             # <<<<<<<<<<<<<<
 * 
 *         # The easiest way to pass a C pointer in a constructor is to wrap it in a PyCapsule
 */
  __pyx_v_self->_number = __pyx_v_track_num;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1628
 *         # (see https://docs.python.org/3.4/c-api/capsule.html).  This basically wraps the
 *         # pointer in a Python object. It can be extracted using PyCapsule_GetPointer.
 *         self._audio_callback_data = <AudioCallbackData*>pycapsule.PyCapsule_GetPointer(audio_callback_data, NULL)             # <<<<<<<<<<<<<<
 *         self.mutex = self._audio_callback_data.mutex
 * 
 */
  __pyx_t_3 = PyCapsule_GetPointer(__pyx_v_audio_callback_data, NULL); if (unlikely(__pyx_t_3 == NULL && PyErr_Occurred())) __PYX_ERR(0, 1628, __pyx_L1_error)
  __pyx_v_self->_audio_callback_data = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioCallbackData *)__pyx_t_3);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1629
 *         # pointer in a Python object. It can be extracted using PyCapsule_GetPointer.
 *         self._audio_callback_data = <AudioCallbackData*>pycapsule.PyCapsule_GetPointer(audio_callback_data, NULL)
 *         self.mutex = self._audio_callback_data.mutex             # <<<<<<<<<<<<<<
 * 
 *         # Allocate memory for the track state (common among all track types)
 */
  __pyx_t_4 = __pyx_v_self->_audio_callback_data->mutex;
  __pyx_v_self->mutex = __pyx_t_4;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1632
 * 
 *         # Allocate memory for the track state (common among all track types)
 *         self.state = <TrackState*> PyMem_Malloc(sizeof(TrackState))             # <<<<<<<<<<<<<<
 *         self.state.type = track_type_none
 *         self.state.type_state = NULL
 */
  __pyx_v_self->state = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *)PyMem_Malloc((sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState))));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1633
 *         # Allocate memory for the track state (common among all track types)
 *         self.state = <TrackState*> PyMem_Malloc(sizeof(TrackState))
 *         self.state.type = track_type_none             # <<<<<<<<<<<<<<
 *         self.state.type_state = NULL
 *         self.state.number = track_num
 */
  __pyx_v_self->state->type = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_none;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1634
 *         self.state = <TrackState*> PyMem_Malloc(sizeof(TrackState))
 *         self.state.type = track_type_none
 *         self.state.type_state = NULL             # <<<<<<<<<<<<<<
 *         self.state.number = track_num
 *         self.state.buffer = <void *>PyMem_Malloc(buffer_size)
 */
  __pyx_v_self->state->type_state = NULL;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1635
 *         self.state.type = track_type_none
 *         self.state.type_state = NULL
 *         self.state.number = track_num             # <<<<<<<<<<<<<<
 *         self.state.buffer = <void *>PyMem_Malloc(buffer_size)
 *         self.state.buffer_size = buffer_size
 */
  __pyx_v_self->state->number = __pyx_v_track_num;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1636
 *         self.state.type_state = NULL
 *         self.state.number = track_num
 *         self.state.buffer = <void *>PyMem_Malloc(buffer_size)             # <<<<<<<<<<<<<<
 *         self.state.buffer_size = buffer_size
 *         self.log.debug("Allocated track audio buffer (%d bytes)", buffer_size)
 */
  __pyx_v_self->state->buffer = ((void *)PyMem_Malloc(__pyx_v_buffer_size));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1637
 *         self.state.number = track_num
 *         self.state.buffer = <void *>PyMem_Malloc(buffer_size)
 *         self.state.buffer_size = buffer_size             # <<<<<<<<<<<<<<
 *         self.log.debug("Allocated track audio buffer (%d bytes)", buffer_size)
 *         self.volume = volume
 */
  __pyx_v_self->state->buffer_size = __pyx_v_buffer_size;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1638
 *         self.state.buffer = <void *>PyMem_Malloc(buffer_size)
 *         self.state.buffer_size = buffer_size
 *         self.log.debug("Allocated track audio buffer (%d bytes)", buffer_size)             # <<<<<<<<<<<<<<
 *         self.volume = volume
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_buffer_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_Allocated_track_audio_buffer_d_b);
  __Pyx_GIVEREF(__pyx_kp_u_Allocated_track_audio_buffer_d_b);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_Allocated_track_audio_buffer_d_b);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1639
 *         self.state.buffer_size = buffer_size
 *         self.log.debug("Allocated track audio buffer (%d bytes)", buffer_size)
 *         self.volume = volume             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_volume, __pyx_t_1) < 0) __PYX_ERR(0, 1639, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1609
 *         self.mutex = NULL
 * 
 *     def __init__(self, dict sound_instances_by_id, object audio_callback_data, str name, int track_num, int buffer_size, float volume=1.0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1641
 *         self.volume = volume
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Track.{}.{}>'.format(self.number, self.name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_4__repr__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_4__repr__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1642
 * 
 *     def __repr__(self):
 *         return '<Track.{}.{}>'.format(self.number, self.name)             # <<<<<<<<<<<<<<
 * 
 *     cdef TrackState *get_state(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Track_2, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_number); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1641
 *         self.volume = volume
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Track.{}.{}>'.format(self.number, self.name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1644
 *         return '<Track.{}.{}>'.format(self.number, self.name)
 * 
 *     cdef TrackState *get_state(self):             # <<<<<<<<<<<<<<
 *         return self.state
 * 
 */

static __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_get_state(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self) {
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_state", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1645
 * 
 *     cdef TrackState *get_state(self):
 *         return self.state             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __pyx_r = __pyx_v_self->state;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1644
 *         return '<Track.{}.{}>'.format(self.number, self.name)
 * 
 *     cdef TrackState *get_state(self):             # <<<<<<<<<<<<<<
 *         return self.state
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1648
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_4name___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_4name___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1649
 *     property name:
 *         def __get__(self):
 *             return self._name             # <<<<<<<<<<<<<<
 * 
 *     property volume:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_name);
  __pyx_r = __pyx_v_self->_name;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1648
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._name
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1652
 * 
 *     property volume:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return round(self.state.volume / MIX_MAX_VOLUME, 2)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1653
 *     property volume:
 *         def __get__(self):
 *             return round(self.state.volume / MIX_MAX_VOLUME, 2)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, float volume):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(MIX_MAX_VOLUME == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1653, __pyx_L1_error)
  }
  __pyx_t_1 = PyFloat_FromDouble((((double)__pyx_v_self->state->volume) / ((double)MIX_MAX_VOLUME))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_2);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1652
 * 
 *     property volume:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return round(self.state.volume / MIX_MAX_VOLUME, 2)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.volume.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1655
 *             return round(self.state.volume / MIX_MAX_VOLUME, 2)
 * 
 *         def __set__(self, float volume):             # <<<<<<<<<<<<<<
 *             if self.state != NULL:
 *                 # Volume used in SDL_Mixer is an integer between 0 and MIX_MAX_VOLUME (0 to 128)
 */

/* Python wrapper */
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_volume); /*proto*/
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_volume) {
  float __pyx_v_volume;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_volume); {
    __pyx_v_volume = __pyx_PyFloat_AsFloat(__pyx_arg_volume); if (unlikely((__pyx_v_volume == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1655, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.volume.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume_2__set__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self), ((float)__pyx_v_volume));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume_2__set__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, float __pyx_v_volume) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  float __pyx_t_4;
  float __pyx_t_5;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1656
 * 
 *         def __set__(self, float volume):
 *             if self.state != NULL:             # <<<<<<<<<<<<<<
 *                 # Volume used in SDL_Mixer is an integer between 0 and MIX_MAX_VOLUME (0 to 128)
 *                 SDL_LockMutex(self.mutex)
 */
  __pyx_t_1 = ((__pyx_v_self->state != NULL) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1658
 *             if self.state != NULL:
 *                 # Volume used in SDL_Mixer is an integer between 0 and MIX_MAX_VOLUME (0 to 128)
 *                 SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *                 self.state.volume = <Uint8>min(max(volume * MIX_MAX_VOLUME, 0), MIX_MAX_VOLUME)
 *                 SDL_UnlockMutex(self.mutex)
 */
    SDL_LockMutex(__pyx_v_self->mutex);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1659
 *                 # Volume used in SDL_Mixer is an integer between 0 and MIX_MAX_VOLUME (0 to 128)
 *                 SDL_LockMutex(self.mutex)
 *                 self.state.volume = <Uint8>min(max(volume * MIX_MAX_VOLUME, 0), MIX_MAX_VOLUME)             # <<<<<<<<<<<<<<
 *                 SDL_UnlockMutex(self.mutex)
 * 
 */
    __pyx_t_2 = MIX_MAX_VOLUME;
    __pyx_t_3 = 0;
    __pyx_t_4 = (__pyx_v_volume * MIX_MAX_VOLUME);
    if (((__pyx_t_3 > __pyx_t_4) != 0)) {
      __pyx_t_5 = __pyx_t_3;
    } else {
      __pyx_t_5 = __pyx_t_4;
    }
    __pyx_t_4 = __pyx_t_5;
    if (((__pyx_t_2 < __pyx_t_4) != 0)) {
      __pyx_t_5 = __pyx_t_2;
    } else {
      __pyx_t_5 = __pyx_t_4;
    }
    __pyx_v_self->state->volume = ((Uint8)__pyx_t_5);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1660
 *                 SDL_LockMutex(self.mutex)
 *                 self.state.volume = <Uint8>min(max(volume * MIX_MAX_VOLUME, 0), MIX_MAX_VOLUME)
 *                 SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    SDL_UnlockMutex(__pyx_v_self->mutex);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1656
 * 
 *         def __set__(self, float volume):
 *             if self.state != NULL:             # <<<<<<<<<<<<<<
 *                 # Volume used in SDL_Mixer is an integer between 0 and MIX_MAX_VOLUME (0 to 128)
 *                 SDL_LockMutex(self.mutex)
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1655
 *             return round(self.state.volume / MIX_MAX_VOLUME, 2)
 * 
 *         def __set__(self, float volume):             # <<<<<<<<<<<<<<
 *             if self.state != NULL:
 *                 # Volume used in SDL_Mixer is an integer between 0 and MIX_MAX_VOLUME (0 to 128)
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1663
 * 
 *     @property
 *     def number(self):             # <<<<<<<<<<<<<<
 *         """Return the track number"""
 *         cdef int number = -1
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6number_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6number_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6number___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6number___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self) {
  int __pyx_v_number;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1665
 *     def number(self):
 *         """Return the track number"""
 *         cdef int number = -1             # <<<<<<<<<<<<<<
 *         if self.state != NULL:
 *             SDL_LockMutex(self.mutex)
 */
  __pyx_v_number = -1;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1666
 *         """Return the track number"""
 *         cdef int number = -1
 *         if self.state != NULL:             # <<<<<<<<<<<<<<
 *             SDL_LockMutex(self.mutex)
 *             number = self.state.number
 */
  __pyx_t_1 = ((__pyx_v_self->state != NULL) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1667
 *         cdef int number = -1
 *         if self.state != NULL:
 *             SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *             number = self.state.number
 *             SDL_UnlockMutex(self.mutex)
 */
    SDL_LockMutex(__pyx_v_self->mutex);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1668
 *         if self.state != NULL:
 *             SDL_LockMutex(self.mutex)
 *             number = self.state.number             # <<<<<<<<<<<<<<
 *             SDL_UnlockMutex(self.mutex)
 *         return number
 */
    __pyx_t_2 = __pyx_v_self->state->number;
    __pyx_v_number = __pyx_t_2;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1669
 *             SDL_LockMutex(self.mutex)
 *             number = self.state.number
 *             SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *         return number
 * 
 */
    SDL_UnlockMutex(__pyx_v_self->mutex);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1666
 *         """Return the track number"""
 *         cdef int number = -1
 *         if self.state != NULL:             # <<<<<<<<<<<<<<
 *             SDL_LockMutex(self.mutex)
 *             number = self.state.number
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1670
 *             number = self.state.number
 *             SDL_UnlockMutex(self.mutex)
 *         return number             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_number); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1663
 * 
 *     @property
 *     def number(self):             # <<<<<<<<<<<<<<
 *         """Return the track number"""
 *         cdef int number = -1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.number.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1673
 * 
 *     @property
 *     def supports_in_memory_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track supports in-memory sounds"""
 *         raise NotImplementedError('Must be overridden in derived class')
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_in_memory_sounds_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_in_memory_sounds_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_in_memory_sounds___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_in_memory_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1675
 *     def supports_in_memory_sounds(self):
 *         """Return whether or not track supports in-memory sounds"""
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 1675, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1673
 * 
 *     @property
 *     def supports_in_memory_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track supports in-memory sounds"""
 *         raise NotImplementedError('Must be overridden in derived class')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.supports_in_memory_sounds.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1678
 * 
 *     @property
 *     def supports_streaming_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track supports streaming sounds"""
 *         raise NotImplementedError('Must be overridden in derived class')
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_streaming_sounds_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_streaming_sounds_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_streaming_sounds___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_streaming_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1680
 *     def supports_streaming_sounds(self):
 *         """Return whether or not track supports streaming sounds"""
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     def play_sound(self, sound_instance not None):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 1680, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1678
 * 
 *     @property
 *     def supports_streaming_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track supports streaming sounds"""
 *         raise NotImplementedError('Must be overridden in derived class')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.supports_streaming_sounds.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1682
 *         raise NotImplementedError('Must be overridden in derived class')
 * 
 *     def play_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound on the current track.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_7play_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6play_sound[] = "Track.play_sound(self, sound_instance)\n\n        Plays a sound on the current track.\n        Args:\n            sound_instance: The SoundInstance object to play\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_7play_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("play_sound (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 1682, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6play_sound(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6play_sound(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("play_sound", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1688
 *             sound_instance: The SoundInstance object to play
 *         """
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound(self, sound_instance not None):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 1688, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1682
 *         raise NotImplementedError('Must be overridden in derived class')
 * 
 *     def play_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound on the current track.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.play_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1690
 *         raise NotImplementedError('Must be overridden in derived class')
 * 
 *     def stop_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound immediately on the track.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_9stop_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_8stop_sound[] = "Track.stop_sound(self, sound_instance)\n\n        Stops all instances of the specified sound immediately on the track.\n        Args:\n            sound_instance: The SoundInstance to stop\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_9stop_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 1690, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_8stop_sound(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_8stop_sound(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("stop_sound", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1696
 *             sound_instance: The SoundInstance to stop
 *         """
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound_looping(self, sound_instance not None):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 1696, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1690
 *         raise NotImplementedError('Must be overridden in derived class')
 * 
 *     def stop_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound immediately on the track.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.stop_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1698
 *         raise NotImplementedError('Must be overridden in derived class')
 * 
 *     def stop_sound_looping(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound on the track after they finish the current loop.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_11stop_sound_looping(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_10stop_sound_looping[] = "Track.stop_sound_looping(self, sound_instance)\n\n        Stops all instances of the specified sound on the track after they finish the current loop.\n        Any queued instances of the sound will be removed.\n        Args:\n            sound_instance: The Sound to stop\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_11stop_sound_looping(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound_looping (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 1698, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_10stop_sound_looping(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_10stop_sound_looping(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("stop_sound_looping", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1705
 *             sound_instance: The Sound to stop
 *         """
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     def stop_all_sounds(self):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 1705, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1698
 *         raise NotImplementedError('Must be overridden in derived class')
 * 
 *     def stop_sound_looping(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound on the track after they finish the current loop.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.stop_sound_looping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1707
 *         raise NotImplementedError('Must be overridden in derived class')
 * 
 *     def stop_all_sounds(self):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all playing sounds immediately on the track.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_13stop_all_sounds(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_12stop_all_sounds[] = "Track.stop_all_sounds(self)\n\n        Stops all playing sounds immediately on the track.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_13stop_all_sounds(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_all_sounds (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_12stop_all_sounds(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_12stop_all_sounds(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("stop_all_sounds", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1711
 *         Stops all playing sounds immediately on the track.
 *         """
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     def process(self):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 1711, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1707
 *         raise NotImplementedError('Must be overridden in derived class')
 * 
 *     def stop_all_sounds(self):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all playing sounds immediately on the track.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.stop_all_sounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1713
 *         raise NotImplementedError('Must be overridden in derived class')
 * 
 *     def process(self):             # <<<<<<<<<<<<<<
 *         """Processes the track queue each tick."""
 *         raise NotImplementedError('Must be overridden in derived class')
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_15process(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_14process[] = "Track.process(self)\nProcesses the track queue each tick.";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_15process(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("process (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_14process(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_14process(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("process", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1715
 *     def process(self):
 *         """Processes the track queue each tick."""
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 1715, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1713
 *         raise NotImplementedError('Must be overridden in derived class')
 * 
 *     def process(self):             # <<<<<<<<<<<<<<
 *         """Processes the track queue each tick."""
 *         raise NotImplementedError('Must be overridden in derived class')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track.process", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1737
 *     cdef TrackStandardState *type_state
 * 
 *     def __init__(self, dict sound_instances_by_id, object audio_callback_data, str name, int track_num, int buffer_size,             # <<<<<<<<<<<<<<
 *                  int max_simultaneous_sounds=MAX_SIMULTANEOUS_SOUNDS_DEFAULT,
 *                  float volume=1.0):
 */

/* Python wrapper */
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard___init__[] = "\n        Constructor\n        Args:\n            sound_instances_by_id: A dictionary of all active sound instance objects keyed by id\n            audio_callback_data: The AudioCallbackData struct wrapped in a PyCapsule\n            name: The track name\n            track_num: The track number\n            buffer_size: The length of the track audio buffer in bytes\n            max_simultaneous_sounds: The maximum number of sounds that can be played simultaneously\n                on the track\n            volume: The track volume (0.0 to 1.0)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard___init__;
#endif
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sound_instances_by_id = 0;
  PyObject *__pyx_v_audio_callback_data = 0;
  PyObject *__pyx_v_name = 0;
  int __pyx_v_track_num;
  int __pyx_v_buffer_size;
  int __pyx_v_max_simultaneous_sounds;
  float __pyx_v_volume;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sound_instances_by_id,&__pyx_n_s_audio_callback_data,&__pyx_n_s_name,&__pyx_n_s_track_num,&__pyx_n_s_buffer_size,&__pyx_n_s_max_simultaneous_sounds,&__pyx_n_s_volume,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sound_instances_by_id)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_audio_callback_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 1); __PYX_ERR(0, 1737, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 2); __PYX_ERR(0, 1737, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_track_num)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 3); __PYX_ERR(0, 1737, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buffer_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 4); __PYX_ERR(0, 1737, __pyx_L3_error)
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_simultaneous_sounds);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_volume);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1737, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sound_instances_by_id = ((PyObject*)values[0]);
    __pyx_v_audio_callback_data = values[1];
    __pyx_v_name = ((PyObject*)values[2]);
    __pyx_v_track_num = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_track_num == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1737, __pyx_L3_error)
    __pyx_v_buffer_size = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_buffer_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1737, __pyx_L3_error)
    if (values[5]) {
      __pyx_v_max_simultaneous_sounds = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_max_simultaneous_sounds == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1738, __pyx_L3_error)
    } else {
      __pyx_v_max_simultaneous_sounds = ((int)8);
    }
    if (values[6]) {
      __pyx_v_volume = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_volume == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1739, __pyx_L3_error)
    } else {
      __pyx_v_volume = ((float)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1737, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sound_instances_by_id), (&PyDict_Type), 1, "sound_instances_by_id", 1))) __PYX_ERR(0, 1737, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 1737, __pyx_L1_error)
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard___init__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), __pyx_v_sound_instances_by_id, __pyx_v_audio_callback_data, __pyx_v_name, __pyx_v_track_num, __pyx_v_buffer_size, __pyx_v_max_simultaneous_sounds, __pyx_v_volume);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard___init__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instances_by_id, PyObject *__pyx_v_audio_callback_data, PyObject *__pyx_v_name, int __pyx_v_track_num, int __pyx_v_buffer_size, int __pyx_v_max_simultaneous_sounds, float __pyx_v_volume) {
  int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1753
 *         """
 *         # IMPORTANT: Call super class init function to allocate track state memory!
 *         super().__init__(sound_instances_by_id, audio_callback_data, name, track_num, buffer_size, volume)             # <<<<<<<<<<<<<<
 * 
 *         self.log = logging.getLogger("Track." + str(track_num) + ".TrackStandard." + name)
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_track_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_buffer_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_volume); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_v_sound_instances_by_id);
  __Pyx_GIVEREF(__pyx_v_sound_instances_by_id);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_sound_instances_by_id);
  __Pyx_INCREF(__pyx_v_audio_callback_data);
  __Pyx_GIVEREF(__pyx_v_audio_callback_data);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_audio_callback_data);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, __pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1755
 *         super().__init__(sound_instances_by_id, audio_callback_data, name, track_num, buffer_size, volume)
 * 
 *         self.log = logging.getLogger("Track." + str(track_num) + ".TrackStandard." + name)             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockMutex(self.mutex)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_track_num); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Track_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_t_5, __pyx_kp_u_TrackStandard); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyUnicode_ConcatSafe(__pyx_t_2, __pyx_v_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.log);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.log);
  __pyx_v_self->__pyx_base.log = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1757
 *         self.log = logging.getLogger("Track." + str(track_num) + ".TrackStandard." + name)
 * 
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         self._sound_queue = PriorityQueue()
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1759
 *         SDL_LockMutex(self.mutex)
 * 
 *         self._sound_queue = PriorityQueue()             # <<<<<<<<<<<<<<
 *         self._sound_queue_items = dict()
 *         self._queue_entry_id = 0
 */
  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_PriorityQueue); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1759, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1759, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_sound_queue);
  __Pyx_DECREF(__pyx_v_self->_sound_queue);
  __pyx_v_self->_sound_queue = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1760
 * 
 *         self._sound_queue = PriorityQueue()
 *         self._sound_queue_items = dict()             # <<<<<<<<<<<<<<
 *         self._queue_entry_id = 0
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_sound_queue_items);
  __Pyx_DECREF(__pyx_v_self->_sound_queue_items);
  __pyx_v_self->_sound_queue_items = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1761
 *         self._sound_queue = PriorityQueue()
 *         self._sound_queue_items = dict()
 *         self._queue_entry_id = 0             # <<<<<<<<<<<<<<
 * 
 *         # Set track type specific settings
 */
  __pyx_v_self->_queue_entry_id = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1764
 * 
 *         # Set track type specific settings
 *         self.state.type = track_type_standard             # <<<<<<<<<<<<<<
 * 
 *         # Allocate memory for the specific track type state struct (TrackStandardState)
 */
  __pyx_v_self->__pyx_base.state->type = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_standard;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1767
 * 
 *         # Allocate memory for the specific track type state struct (TrackStandardState)
 *         self.type_state = <TrackStandardState*> PyMem_Malloc(sizeof(TrackStandardState))             # <<<<<<<<<<<<<<
 *         self.state.type_state = <void*>self.type_state
 * 
 */
  __pyx_v_self->type_state = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState *)PyMem_Malloc((sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandardState))));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1768
 *         # Allocate memory for the specific track type state struct (TrackStandardState)
 *         self.type_state = <TrackStandardState*> PyMem_Malloc(sizeof(TrackStandardState))
 *         self.state.type_state = <void*>self.type_state             # <<<<<<<<<<<<<<
 * 
 *         # Make sure the number of simultaneous sounds is within the allowable range
 */
  __pyx_v_self->__pyx_base.state->type_state = ((void *)__pyx_v_self->type_state);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1771
 * 
 *         # Make sure the number of simultaneous sounds is within the allowable range
 *         if max_simultaneous_sounds > MAX_SIMULTANEOUS_SOUNDS_LIMIT:             # <<<<<<<<<<<<<<
 *             self.log.warning("The maximum number of simultaneous sounds per track is %d",
 *                              MAX_SIMULTANEOUS_SOUNDS_LIMIT)
 */
  __pyx_t_9 = ((__pyx_v_max_simultaneous_sounds > 32) != 0);
  if (__pyx_t_9) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1772
 *         # Make sure the number of simultaneous sounds is within the allowable range
 *         if max_simultaneous_sounds > MAX_SIMULTANEOUS_SOUNDS_LIMIT:
 *             self.log.warning("The maximum number of simultaneous sounds per track is %d",             # <<<<<<<<<<<<<<
 *                              MAX_SIMULTANEOUS_SOUNDS_LIMIT)
 *             max_simultaneous_sounds = MAX_SIMULTANEOUS_SOUNDS_LIMIT
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_warning); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1774
 *             self.log.warning("The maximum number of simultaneous sounds per track is %d",
 *                              MAX_SIMULTANEOUS_SOUNDS_LIMIT)
 *             max_simultaneous_sounds = MAX_SIMULTANEOUS_SOUNDS_LIMIT             # <<<<<<<<<<<<<<
 *         elif max_simultaneous_sounds < 1:
 *             self.log.warning("The minimum number of simultaneous sounds per track is 1")
 */
    __pyx_v_max_simultaneous_sounds = 32;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1771
 * 
 *         # Make sure the number of simultaneous sounds is within the allowable range
 *         if max_simultaneous_sounds > MAX_SIMULTANEOUS_SOUNDS_LIMIT:             # <<<<<<<<<<<<<<
 *             self.log.warning("The maximum number of simultaneous sounds per track is %d",
 *                              MAX_SIMULTANEOUS_SOUNDS_LIMIT)
 */
    goto __pyx_L3;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1775
 *                              MAX_SIMULTANEOUS_SOUNDS_LIMIT)
 *             max_simultaneous_sounds = MAX_SIMULTANEOUS_SOUNDS_LIMIT
 *         elif max_simultaneous_sounds < 1:             # <<<<<<<<<<<<<<
 *             self.log.warning("The minimum number of simultaneous sounds per track is 1")
 *             max_simultaneous_sounds = 1
 */
  __pyx_t_9 = ((__pyx_v_max_simultaneous_sounds < 1) != 0);
  if (__pyx_t_9) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1776
 *             max_simultaneous_sounds = MAX_SIMULTANEOUS_SOUNDS_LIMIT
 *         elif max_simultaneous_sounds < 1:
 *             self.log.warning("The minimum number of simultaneous sounds per track is 1")             # <<<<<<<<<<<<<<
 *             max_simultaneous_sounds = 1
 *         self._max_simultaneous_sounds = max_simultaneous_sounds
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_warning); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1777
 *         elif max_simultaneous_sounds < 1:
 *             self.log.warning("The minimum number of simultaneous sounds per track is 1")
 *             max_simultaneous_sounds = 1             # <<<<<<<<<<<<<<
 *         self._max_simultaneous_sounds = max_simultaneous_sounds
 *         self.type_state.sound_player_count = max_simultaneous_sounds
 */
    __pyx_v_max_simultaneous_sounds = 1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1775
 *                              MAX_SIMULTANEOUS_SOUNDS_LIMIT)
 *             max_simultaneous_sounds = MAX_SIMULTANEOUS_SOUNDS_LIMIT
 *         elif max_simultaneous_sounds < 1:             # <<<<<<<<<<<<<<
 *             self.log.warning("The minimum number of simultaneous sounds per track is 1")
 *             max_simultaneous_sounds = 1
 */
  }
  __pyx_L3:;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1778
 *             self.log.warning("The minimum number of simultaneous sounds per track is 1")
 *             max_simultaneous_sounds = 1
 *         self._max_simultaneous_sounds = max_simultaneous_sounds             # <<<<<<<<<<<<<<
 *         self.type_state.sound_player_count = max_simultaneous_sounds
 * 
 */
  __pyx_v_self->_max_simultaneous_sounds = __pyx_v_max_simultaneous_sounds;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1779
 *             max_simultaneous_sounds = 1
 *         self._max_simultaneous_sounds = max_simultaneous_sounds
 *         self.type_state.sound_player_count = max_simultaneous_sounds             # <<<<<<<<<<<<<<
 * 
 *         # Allocate memory for the sound player structs needed for the desired number of
 */
  __pyx_v_self->type_state->sound_player_count = __pyx_v_max_simultaneous_sounds;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1783
 *         # Allocate memory for the sound player structs needed for the desired number of
 *         # simultaneous sounds that can be played on the track.
 *         self.type_state.sound_players = <SoundPlayer*> PyMem_Malloc(self.type_state.sound_player_count * sizeof(SoundPlayer))             # <<<<<<<<<<<<<<
 * 
 *         # Initialize sound player attributes
 */
  __pyx_v_self->type_state->sound_players = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer *)PyMem_Malloc((__pyx_v_self->type_state->sound_player_count * (sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer)))));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1786
 * 
 *         # Initialize sound player attributes
 *         for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].status = player_idle
 *             self.type_state.sound_players[i].track_num = self.number
 */
  __pyx_t_10 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1787
 *         # Initialize sound player attributes
 *         for i in range(self.type_state.sound_player_count):
 *             self.type_state.sound_players[i].status = player_idle             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].track_num = self.number
 *             self.type_state.sound_players[i].player = i
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1788
 *         for i in range(self.type_state.sound_player_count):
 *             self.type_state.sound_players[i].status = player_idle
 *             self.type_state.sound_players[i].track_num = self.number             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].player = i
 *             self.type_state.sound_players[i].current.chunk = NULL
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1788, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).track_num = __pyx_t_12;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1789
 *             self.type_state.sound_players[i].status = player_idle
 *             self.type_state.sound_players[i].track_num = self.number
 *             self.type_state.sound_players[i].player = i             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.chunk = NULL
 *             self.type_state.sound_players[i].current.loops_remaining = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).player = __pyx_v_i;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1790
 *             self.type_state.sound_players[i].track_num = self.number
 *             self.type_state.sound_players[i].player = i
 *             self.type_state.sound_players[i].current.chunk = NULL             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.loops_remaining = 0
 *             self.type_state.sound_players[i].current.current_loop = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.chunk = NULL;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1791
 *             self.type_state.sound_players[i].player = i
 *             self.type_state.sound_players[i].current.chunk = NULL
 *             self.type_state.sound_players[i].current.loops_remaining = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.current_loop = 0
 *             self.type_state.sound_players[i].current.volume = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.loops_remaining = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1792
 *             self.type_state.sound_players[i].current.chunk = NULL
 *             self.type_state.sound_players[i].current.loops_remaining = 0
 *             self.type_state.sound_players[i].current.current_loop = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.volume = 0
 *             self.type_state.sound_players[i].current.sample_pos = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.current_loop = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1793
 *             self.type_state.sound_players[i].current.loops_remaining = 0
 *             self.type_state.sound_players[i].current.current_loop = 0
 *             self.type_state.sound_players[i].current.volume = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.sample_pos = 0
 *             self.type_state.sound_players[i].current.sound_id = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.volume = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1794
 *             self.type_state.sound_players[i].current.current_loop = 0
 *             self.type_state.sound_players[i].current.volume = 0
 *             self.type_state.sound_players[i].current.sample_pos = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.sound_id = 0
 *             self.type_state.sound_players[i].current.sound_instance_id = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sample_pos = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1795
 *             self.type_state.sound_players[i].current.volume = 0
 *             self.type_state.sound_players[i].current.sample_pos = 0
 *             self.type_state.sound_players[i].current.sound_id = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.sound_instance_id = 0
 *             self.type_state.sound_players[i].current.sound_priority = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_id = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1796
 *             self.type_state.sound_players[i].current.sample_pos = 0
 *             self.type_state.sound_players[i].current.sound_id = 0
 *             self.type_state.sound_players[i].current.sound_instance_id = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.sound_priority = 0
 *             self.type_state.sound_players[i].current.sound_has_ducking = False
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1797
 *             self.type_state.sound_players[i].current.sound_id = 0
 *             self.type_state.sound_players[i].current.sound_instance_id = 0
 *             self.type_state.sound_players[i].current.sound_priority = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.sound_has_ducking = False
 *             self.type_state.sound_players[i].current.ducking_stage = ducking_stage_idle
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_priority = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1798
 *             self.type_state.sound_players[i].current.sound_instance_id = 0
 *             self.type_state.sound_players[i].current.sound_priority = 0
 *             self.type_state.sound_players[i].current.sound_has_ducking = False             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.ducking_stage = ducking_stage_idle
 *             self.type_state.sound_players[i].next.chunk = NULL
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_has_ducking = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1799
 *             self.type_state.sound_players[i].current.sound_priority = 0
 *             self.type_state.sound_players[i].current.sound_has_ducking = False
 *             self.type_state.sound_players[i].current.ducking_stage = ducking_stage_idle             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.chunk = NULL
 *             self.type_state.sound_players[i].next.loops_remaining = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.ducking_stage = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_ducking_stage_idle;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1800
 *             self.type_state.sound_players[i].current.sound_has_ducking = False
 *             self.type_state.sound_players[i].current.ducking_stage = ducking_stage_idle
 *             self.type_state.sound_players[i].next.chunk = NULL             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.loops_remaining = 0
 *             self.type_state.sound_players[i].next.current_loop = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.chunk = NULL;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1801
 *             self.type_state.sound_players[i].current.ducking_stage = ducking_stage_idle
 *             self.type_state.sound_players[i].next.chunk = NULL
 *             self.type_state.sound_players[i].next.loops_remaining = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.current_loop = 0
 *             self.type_state.sound_players[i].next.volume = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.loops_remaining = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1802
 *             self.type_state.sound_players[i].next.chunk = NULL
 *             self.type_state.sound_players[i].next.loops_remaining = 0
 *             self.type_state.sound_players[i].next.current_loop = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.volume = 0
 *             self.type_state.sound_players[i].next.sample_pos = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.current_loop = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1803
 *             self.type_state.sound_players[i].next.loops_remaining = 0
 *             self.type_state.sound_players[i].next.current_loop = 0
 *             self.type_state.sound_players[i].next.volume = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.sample_pos = 0
 *             self.type_state.sound_players[i].next.sound_id = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.volume = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1804
 *             self.type_state.sound_players[i].next.current_loop = 0
 *             self.type_state.sound_players[i].next.volume = 0
 *             self.type_state.sound_players[i].next.sample_pos = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.sound_id = 0
 *             self.type_state.sound_players[i].next.sound_instance_id = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.sample_pos = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1805
 *             self.type_state.sound_players[i].next.volume = 0
 *             self.type_state.sound_players[i].next.sample_pos = 0
 *             self.type_state.sound_players[i].next.sound_id = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.sound_instance_id = 0
 *             self.type_state.sound_players[i].next.sound_priority = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.sound_id = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1806
 *             self.type_state.sound_players[i].next.sample_pos = 0
 *             self.type_state.sound_players[i].next.sound_id = 0
 *             self.type_state.sound_players[i].next.sound_instance_id = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.sound_priority = 0
 *             self.type_state.sound_players[i].next.sound_has_ducking = False
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.sound_instance_id = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1807
 *             self.type_state.sound_players[i].next.sound_id = 0
 *             self.type_state.sound_players[i].next.sound_instance_id = 0
 *             self.type_state.sound_players[i].next.sound_priority = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.sound_has_ducking = False
 *             self.type_state.sound_players[i].next.ducking_stage = ducking_stage_idle
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.sound_priority = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1808
 *             self.type_state.sound_players[i].next.sound_instance_id = 0
 *             self.type_state.sound_players[i].next.sound_priority = 0
 *             self.type_state.sound_players[i].next.sound_has_ducking = False             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.ducking_stage = ducking_stage_idle
 * 
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.sound_has_ducking = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1809
 *             self.type_state.sound_players[i].next.sound_priority = 0
 *             self.type_state.sound_players[i].next.sound_has_ducking = False
 *             self.type_state.sound_players[i].next.ducking_stage = ducking_stage_idle             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.ducking_stage = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_ducking_stage_idle;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1811
 *             self.type_state.sound_players[i].next.ducking_stage = ducking_stage_idle
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1737
 *     cdef TrackStandardState *type_state
 * 
 *     def __init__(self, dict sound_instances_by_id, object audio_callback_data, str name, int track_num, int buffer_size,             # <<<<<<<<<<<<<<
 *                  int max_simultaneous_sounds=MAX_SIMULTANEOUS_SOUNDS_DEFAULT,
 *                  float volume=1.0):
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1813
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Destructor"""
 * 
 */

/* Python wrapper */
static void __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_2__dealloc__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_2__dealloc__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1816
 *         """Destructor"""
 * 
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         # Free the specific track type state and other allocated memory
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1819
 * 
 *         # Free the specific track type state and other allocated memory
 *         if self.state != NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.type_state.sound_players)
 *             PyMem_Free(self.type_state)
 */
  __pyx_t_1 = ((__pyx_v_self->__pyx_base.state != NULL) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1820
 *         # Free the specific track type state and other allocated memory
 *         if self.state != NULL:
 *             PyMem_Free(self.type_state.sound_players)             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.type_state)
 *             self.state = NULL
 */
    PyMem_Free(__pyx_v_self->type_state->sound_players);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1821
 *         if self.state != NULL:
 *             PyMem_Free(self.type_state.sound_players)
 *             PyMem_Free(self.type_state)             # <<<<<<<<<<<<<<
 *             self.state = NULL
 * 
 */
    PyMem_Free(__pyx_v_self->type_state);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1822
 *             PyMem_Free(self.type_state.sound_players)
 *             PyMem_Free(self.type_state)
 *             self.state = NULL             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
    __pyx_v_self->__pyx_base.state = NULL;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1819
 * 
 *         # Free the specific track type state and other allocated memory
 *         if self.state != NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.type_state.sound_players)
 *             PyMem_Free(self.type_state)
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1824
 *             self.state = NULL
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1813
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Destructor"""
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1826
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Track.{}.Standard.{}>'.format(self.number, self.name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_4__repr__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_4__repr__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1827
 * 
 *     def __repr__(self):
 *         return '<Track.{}.Standard.{}>'.format(self.number, self.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Track_Standard, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_number); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1826
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Track.{}.Standard.{}>'.format(self.number, self.name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1830
 * 
 *     @property
 *     def supports_in_memory_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track accepts in-memory sounds"""
 *         return True
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_in_memory_sounds_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_in_memory_sounds_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_in_memory_sounds___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_in_memory_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1832
 *     def supports_in_memory_sounds(self):
 *         """Return whether or not track accepts in-memory sounds"""
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1830
 * 
 *     @property
 *     def supports_in_memory_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track accepts in-memory sounds"""
 *         return True
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1835
 * 
 *     @property
 *     def supports_streaming_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track accepts streaming sounds"""
 *         return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_streaming_sounds_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_streaming_sounds_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_streaming_sounds___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_streaming_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1837
 *     def supports_streaming_sounds(self):
 *         """Return whether or not track accepts streaming sounds"""
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1835
 * 
 *     @property
 *     def supports_streaming_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track accepts streaming sounds"""
 *         return False
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1840
 * 
 *     @property
 *     def max_simultaneous_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return the number of sounds that can be played simultaneously on this track"""
 *         return self._max_simultaneous_sounds
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_23max_simultaneous_sounds_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_23max_simultaneous_sounds_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_23max_simultaneous_sounds___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_23max_simultaneous_sounds___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1842
 *     def max_simultaneous_sounds(self):
 *         """Return the number of sounds that can be played simultaneously on this track"""
 *         return self._max_simultaneous_sounds             # <<<<<<<<<<<<<<
 * 
 *     cdef int _get_idle_sound_player(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_max_simultaneous_sounds); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1840
 * 
 *     @property
 *     def max_simultaneous_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return the number of sounds that can be played simultaneously on this track"""
 *         return self._max_simultaneous_sounds
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.max_simultaneous_sounds.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1844
 *         return self._max_simultaneous_sounds
 * 
 *     cdef int _get_idle_sound_player(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the index of the first idle sound player on the track.  If all
 */

static int __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_idle_sound_player(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  int __pyx_v_index;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_get_idle_sound_player", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1851
 *         # NOTE: The SDL Mutex must be held while calling this function
 * 
 *         for index in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[index].status == player_idle:
 *                 SDL_UnlockMutex(self.mutex)
 */
  __pyx_t_1 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_index = __pyx_t_2;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1852
 * 
 *         for index in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[index].status == player_idle:             # <<<<<<<<<<<<<<
 *                 SDL_UnlockMutex(self.mutex)
 *                 return index
 */
    __pyx_t_3 = (((__pyx_v_self->type_state->sound_players[__pyx_v_index]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (__pyx_t_3) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1853
 *         for index in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[index].status == player_idle:
 *                 SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *                 return index
 * 
 */
      SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1854
 *             if self.type_state.sound_players[index].status == player_idle:
 *                 SDL_UnlockMutex(self.mutex)
 *                 return index             # <<<<<<<<<<<<<<
 * 
 *         return -1
 */
      __pyx_r = __pyx_v_index;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1852
 * 
 *         for index in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[index].status == player_idle:             # <<<<<<<<<<<<<<
 *                 SDL_UnlockMutex(self.mutex)
 *                 return index
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1856
 *                 return index
 * 
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     def process(self):
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1844
 *         return self._max_simultaneous_sounds
 * 
 *     cdef int _get_idle_sound_player(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the index of the first idle sound player on the track.  If all
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1858
 *         return -1
 * 
 *     def process(self):             # <<<<<<<<<<<<<<
 *         """Processes the track queue each tick."""
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_7process(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_6process[] = "TrackStandard.process(self)\nProcesses the track queue each tick.";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_7process(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("process (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_6process(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_6process(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  int __pyx_v_keep_checking;
  int __pyx_v_idle_sound_player;
  PyObject *__pyx_v_sound_instance = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("process", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1861
 *         """Processes the track queue each tick."""
 * 
 *         cdef bint keep_checking = True             # <<<<<<<<<<<<<<
 *         cdef int idle_sound_player
 * 
 */
  __pyx_v_keep_checking = 1;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1866
 *         # Lock the mutex to ensure no audio data is changed during the playback processing
 *         # (multi-threaded protection)
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         while keep_checking:
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1868
 *         SDL_LockMutex(self.mutex)
 * 
 *         while keep_checking:             # <<<<<<<<<<<<<<
 *             # See if there are now any idle sound players
 *             idle_sound_player = self._get_idle_sound_player()
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_keep_checking != 0);
    if (!__pyx_t_1) break;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1870
 *         while keep_checking:
 *             # See if there are now any idle sound players
 *             idle_sound_player = self._get_idle_sound_player()             # <<<<<<<<<<<<<<
 *             if idle_sound_player >= 0:
 *                 # Found an idle player, check if there are any sounds queued for playback
 */
    __pyx_v_idle_sound_player = ((struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_idle_sound_player(__pyx_v_self);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1871
 *             # See if there are now any idle sound players
 *             idle_sound_player = self._get_idle_sound_player()
 *             if idle_sound_player >= 0:             # <<<<<<<<<<<<<<
 *                 # Found an idle player, check if there are any sounds queued for playback
 *                 sound_instance = self._get_next_sound()
 */
    __pyx_t_1 = ((__pyx_v_idle_sound_player >= 0) != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1873
 *             if idle_sound_player >= 0:
 *                 # Found an idle player, check if there are any sounds queued for playback
 *                 sound_instance = self._get_next_sound()             # <<<<<<<<<<<<<<
 * 
 *                 if sound_instance is not None:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_next_sound); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1873, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1873, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1873, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1875
 *                 sound_instance = self._get_next_sound()
 * 
 *                 if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                     self.log.debug("Getting sound from queue %s", sound_instance)
 *                     self._play_sound_on_sound_player(sound_instance=sound_instance, player=idle_sound_player)
 */
      __pyx_t_1 = (__pyx_v_sound_instance != Py_None);
      __pyx_t_5 = (__pyx_t_1 != 0);
      if (__pyx_t_5) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1876
 * 
 *                 if sound_instance is not None:
 *                     self.log.debug("Getting sound from queue %s", sound_instance)             # <<<<<<<<<<<<<<
 *                     self._play_sound_on_sound_player(sound_instance=sound_instance, player=idle_sound_player)
 *                 else:
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1876, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_6 = 1;
          }
        }
        __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1876, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_Getting_sound_from_queue_s);
        __Pyx_GIVEREF(__pyx_kp_u_Getting_sound_from_queue_s);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_u_Getting_sound_from_queue_s);
        __Pyx_INCREF(__pyx_v_sound_instance);
        __Pyx_GIVEREF(__pyx_v_sound_instance);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_sound_instance);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1876, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1877
 *                 if sound_instance is not None:
 *                     self.log.debug("Getting sound from queue %s", sound_instance)
 *                     self._play_sound_on_sound_player(sound_instance=sound_instance, player=idle_sound_player)             # <<<<<<<<<<<<<<
 *                 else:
 *                     keep_checking = False
 */
        ((struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_play_sound_on_sound_player(__pyx_v_self, __pyx_v_sound_instance, __pyx_v_idle_sound_player, NULL);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1875
 *                 sound_instance = self._get_next_sound()
 * 
 *                 if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                     self.log.debug("Getting sound from queue %s", sound_instance)
 *                     self._play_sound_on_sound_player(sound_instance=sound_instance, player=idle_sound_player)
 */
        goto __pyx_L6;
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1879
 *                     self._play_sound_on_sound_player(sound_instance=sound_instance, player=idle_sound_player)
 *                 else:
 *                     keep_checking = False             # <<<<<<<<<<<<<<
 *             else:
 *                 keep_checking = False
 */
      /*else*/ {
        __pyx_v_keep_checking = 0;
      }
      __pyx_L6:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1871
 *             # See if there are now any idle sound players
 *             idle_sound_player = self._get_idle_sound_player()
 *             if idle_sound_player >= 0:             # <<<<<<<<<<<<<<
 *                 # Found an idle player, check if there are any sounds queued for playback
 *                 sound_instance = self._get_next_sound()
 */
      goto __pyx_L5;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1881
 *                     keep_checking = False
 *             else:
 *                 keep_checking = False             # <<<<<<<<<<<<<<
 * 
 *         # Unlock the mutex since we are done accessing the audio data
 */
    /*else*/ {
      __pyx_v_keep_checking = 0;
    }
    __pyx_L5:;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1884
 * 
 *         # Unlock the mutex since we are done accessing the audio data
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     cdef RequestMessageContainer* _get_available_request_message(self):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1858
 *         return -1
 * 
 *     def process(self):             # <<<<<<<<<<<<<<
 *         """Processes the track queue each tick."""
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.process", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1886
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     cdef RequestMessageContainer* _get_available_request_message(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a pointer to the first available request message.
 */

static __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_available_request_message(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *__pyx_v_request_message;
  long __pyx_v_i;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *__pyx_r;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_get_available_request_message", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1896
 * 
 *         cdef RequestMessageContainer *request_message
 *         for i in range(MAX_REQUEST_MESSAGES):             # <<<<<<<<<<<<<<
 *             if self._audio_callback_data.request_messages[i].message == request_not_in_use:
 *                 request_message = <RequestMessageContainer*> self._audio_callback_data.request_messages[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 32; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1897
 *         cdef RequestMessageContainer *request_message
 *         for i in range(MAX_REQUEST_MESSAGES):
 *             if self._audio_callback_data.request_messages[i].message == request_not_in_use:             # <<<<<<<<<<<<<<
 *                 request_message = <RequestMessageContainer*> self._audio_callback_data.request_messages[i]
 *                 SDL_UnlockMutex(self.mutex)
 */
    __pyx_t_2 = (((__pyx_v_self->__pyx_base._audio_callback_data->request_messages[__pyx_v_i])->message == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_not_in_use) != 0);
    if (__pyx_t_2) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1898
 *         for i in range(MAX_REQUEST_MESSAGES):
 *             if self._audio_callback_data.request_messages[i].message == request_not_in_use:
 *                 request_message = <RequestMessageContainer*> self._audio_callback_data.request_messages[i]             # <<<<<<<<<<<<<<
 *                 SDL_UnlockMutex(self.mutex)
 *                 return request_message
 */
      __pyx_v_request_message = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *)(__pyx_v_self->__pyx_base._audio_callback_data->request_messages[__pyx_v_i]));

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1899
 *             if self._audio_callback_data.request_messages[i].message == request_not_in_use:
 *                 request_message = <RequestMessageContainer*> self._audio_callback_data.request_messages[i]
 *                 SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *                 return request_message
 * 
 */
      SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1900
 *                 request_message = <RequestMessageContainer*> self._audio_callback_data.request_messages[i]
 *                 SDL_UnlockMutex(self.mutex)
 *                 return request_message             # <<<<<<<<<<<<<<
 * 
 *         return NULL
 */
      __pyx_r = __pyx_v_request_message;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1897
 *         cdef RequestMessageContainer *request_message
 *         for i in range(MAX_REQUEST_MESSAGES):
 *             if self._audio_callback_data.request_messages[i].message == request_not_in_use:             # <<<<<<<<<<<<<<
 *                 request_message = <RequestMessageContainer*> self._audio_callback_data.request_messages[i]
 *                 SDL_UnlockMutex(self.mutex)
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1902
 *                 return request_message
 * 
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     def process_notification_message(self, int message_num):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1886
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     cdef RequestMessageContainer* _get_available_request_message(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a pointer to the first available request message.
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1904
 *         return NULL
 * 
 *     def process_notification_message(self, int message_num):             # <<<<<<<<<<<<<<
 *         """Process a notification message to this track"""
 *         cdef NotificationMessageContainer *notification_message = self._audio_callback_data.notification_messages[message_num]
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_9process_notification_message(PyObject *__pyx_v_self, PyObject *__pyx_arg_message_num); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_8process_notification_message[] = "TrackStandard.process_notification_message(self, int message_num)\nProcess a notification message to this track";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_9process_notification_message(PyObject *__pyx_v_self, PyObject *__pyx_arg_message_num) {
  int __pyx_v_message_num;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("process_notification_message (wrapper)", 0);
  assert(__pyx_arg_message_num); {
    __pyx_v_message_num = __Pyx_PyInt_As_int(__pyx_arg_message_num); if (unlikely((__pyx_v_message_num == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1904, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.process_notification_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_8process_notification_message(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), ((int)__pyx_v_message_num));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_8process_notification_message(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, int __pyx_v_message_num) {
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessageContainer *__pyx_v_notification_message;
  PyObject *__pyx_v_sound_instance = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("process_notification_message", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1906
 *     def process_notification_message(self, int message_num):
 *         """Process a notification message to this track"""
 *         cdef NotificationMessageContainer *notification_message = self._audio_callback_data.notification_messages[message_num]             # <<<<<<<<<<<<<<
 * 
 *         if notification_message == NULL:
 */
  __pyx_v_notification_message = (__pyx_v_self->__pyx_base._audio_callback_data->notification_messages[__pyx_v_message_num]);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1908
 *         cdef NotificationMessageContainer *notification_message = self._audio_callback_data.notification_messages[message_num]
 * 
 *         if notification_message == NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = ((__pyx_v_notification_message == NULL) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1909
 * 
 *         if notification_message == NULL:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("Processing notification message %d for sound instance (id: %d)",
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1908
 *         cdef NotificationMessageContainer *notification_message = self._audio_callback_data.notification_messages[message_num]
 * 
 *         if notification_message == NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1911
 *             return
 * 
 *         self.log.debug("Processing notification message %d for sound instance (id: %d)",             # <<<<<<<<<<<<<<
 *                        notification_message.message, notification_message.sound_instance_id)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1912
 * 
 *         self.log.debug("Processing notification message %d for sound instance (id: %d)",
 *                        notification_message.message, notification_message.sound_instance_id)             # <<<<<<<<<<<<<<
 * 
 *         if notification_message.sound_instance_id not in self._sound_instances_by_id:
 */
  __pyx_t_4 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage(__pyx_v_notification_message->message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_Processing_notification_message);
  __Pyx_GIVEREF(__pyx_kp_u_Processing_notification_message);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_Processing_notification_message);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1914
 *                        notification_message.message, notification_message.sound_instance_id)
 * 
 *         if notification_message.sound_instance_id not in self._sound_instances_by_id:             # <<<<<<<<<<<<<<
 *             self.log.warning("Received a notification message for a sound instance (id: %d) "
 *                              "that is no longer managed in the audio library. "
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__pyx_v_self->__pyx_base._sound_instances_by_id == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1914, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_t_2, __pyx_v_self->__pyx_base._sound_instances_by_id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = (__pyx_t_1 != 0);
  if (__pyx_t_9) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1915
 * 
 *         if notification_message.sound_instance_id not in self._sound_instances_by_id:
 *             self.log.warning("Received a notification message for a sound instance (id: %d) "             # <<<<<<<<<<<<<<
 *                              "that is no longer managed in the audio library. "
 *                              "Notification will be discarded.",
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1918
 *                              "that is no longer managed in the audio library. "
 *                              "Notification will be discarded.",
 *                              notification_message.sound_instance_id)             # <<<<<<<<<<<<<<
 * 
 *         elif notification_message.message == notification_sound_started:
 */
    __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Received_a_notification_message);
    __Pyx_GIVEREF(__pyx_kp_u_Received_a_notification_message);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_kp_u_Received_a_notification_message);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1914
 *                        notification_message.message, notification_message.sound_instance_id)
 * 
 *         if notification_message.sound_instance_id not in self._sound_instances_by_id:             # <<<<<<<<<<<<<<
 *             self.log.warning("Received a notification message for a sound instance (id: %d) "
 *                              "that is no longer managed in the audio library. "
 */
    goto __pyx_L4;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1920
 *                              notification_message.sound_instance_id)
 * 
 *         elif notification_message.message == notification_sound_started:             # <<<<<<<<<<<<<<
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
  __pyx_t_9 = ((__pyx_v_notification_message->message == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_started) != 0);
  if (__pyx_t_9) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1921
 * 
 *         elif notification_message.message == notification_sound_started:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]             # <<<<<<<<<<<<<<
 *             if sound_instance is not None:
 *                 sound_instance.set_playing()
 */
    if (unlikely(__pyx_v_self->__pyx_base._sound_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1921, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_self->__pyx_base._sound_instances_by_id, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_sound_instance = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1922
 *         elif notification_message.message == notification_sound_started:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_playing()
 * 
 */
    __pyx_t_9 = (__pyx_v_sound_instance != Py_None);
    __pyx_t_1 = (__pyx_t_9 != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1923
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 *                 sound_instance.set_playing()             # <<<<<<<<<<<<<<
 * 
 *         elif notification_message.message == notification_sound_stopped:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_playing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1923, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1923, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1922
 *         elif notification_message.message == notification_sound_started:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_playing()
 * 
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1920
 *                              notification_message.sound_instance_id)
 * 
 *         elif notification_message.message == notification_sound_started:             # <<<<<<<<<<<<<<
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
    goto __pyx_L4;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1925
 *                 sound_instance.set_playing()
 * 
 *         elif notification_message.message == notification_sound_stopped:             # <<<<<<<<<<<<<<
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
  __pyx_t_1 = ((__pyx_v_notification_message->message == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_stopped) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1926
 * 
 *         elif notification_message.message == notification_sound_stopped:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]             # <<<<<<<<<<<<<<
 *             if sound_instance is not None:
 *                 sound_instance.set_stopped()
 */
    if (unlikely(__pyx_v_self->__pyx_base._sound_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1926, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1926, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->__pyx_base._sound_instances_by_id, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1926, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_sound_instance = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1927
 *         elif notification_message.message == notification_sound_stopped:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_stopped()
 *                 self.log.debug("Removing sound instance %s from active sound dictionary", str(sound_instance))
 */
    __pyx_t_1 = (__pyx_v_sound_instance != Py_None);
    __pyx_t_9 = (__pyx_t_1 != 0);
    if (__pyx_t_9) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1928
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 *                 sound_instance.set_stopped()             # <<<<<<<<<<<<<<
 *                 self.log.debug("Removing sound instance %s from active sound dictionary", str(sound_instance))
 *                 del self._sound_instances_by_id[sound_instance.id]
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_stopped); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1928, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1928, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1928, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1929
 *             if sound_instance is not None:
 *                 sound_instance.set_stopped()
 *                 self.log.debug("Removing sound instance %s from active sound dictionary", str(sound_instance))             # <<<<<<<<<<<<<<
 *                 del self._sound_instances_by_id[sound_instance.id]
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_sound_instance);
      __Pyx_GIVEREF(__pyx_v_sound_instance);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_sound_instance);
      __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_Removing_sound_instance_s_from_a);
      __Pyx_GIVEREF(__pyx_kp_u_Removing_sound_instance_s_from_a);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_kp_u_Removing_sound_instance_s_from_a);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1930
 *                 sound_instance.set_stopped()
 *                 self.log.debug("Removing sound instance %s from active sound dictionary", str(sound_instance))
 *                 del self._sound_instances_by_id[sound_instance.id]             # <<<<<<<<<<<<<<
 * 
 *         elif notification_message.message == notification_sound_looping:
 */
      if (unlikely(__pyx_v_self->__pyx_base._sound_instances_by_id == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1930, __pyx_L1_error)
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(PyDict_DelItem(__pyx_v_self->__pyx_base._sound_instances_by_id, __pyx_t_2) < 0)) __PYX_ERR(0, 1930, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1927
 *         elif notification_message.message == notification_sound_stopped:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_stopped()
 *                 self.log.debug("Removing sound instance %s from active sound dictionary", str(sound_instance))
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1925
 *                 sound_instance.set_playing()
 * 
 *         elif notification_message.message == notification_sound_stopped:             # <<<<<<<<<<<<<<
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
    goto __pyx_L4;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1932
 *                 del self._sound_instances_by_id[sound_instance.id]
 * 
 *         elif notification_message.message == notification_sound_looping:             # <<<<<<<<<<<<<<
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
  __pyx_t_9 = ((__pyx_v_notification_message->message == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_looping) != 0);
  if (__pyx_t_9) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1933
 * 
 *         elif notification_message.message == notification_sound_looping:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]             # <<<<<<<<<<<<<<
 *             if sound_instance is not None:
 *                 sound_instance.set_looping()
 */
    if (unlikely(__pyx_v_self->__pyx_base._sound_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1933, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_self->__pyx_base._sound_instances_by_id, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_sound_instance = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1934
 *         elif notification_message.message == notification_sound_looping:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_looping()
 * 
 */
    __pyx_t_9 = (__pyx_v_sound_instance != Py_None);
    __pyx_t_1 = (__pyx_t_9 != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1935
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 *                 sound_instance.set_looping()             # <<<<<<<<<<<<<<
 * 
 *         elif notification_message.message == notification_sound_marker:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_looping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1935, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_5) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1935, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1935, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1934
 *         elif notification_message.message == notification_sound_looping:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_looping()
 * 
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1932
 *                 del self._sound_instances_by_id[sound_instance.id]
 * 
 *         elif notification_message.message == notification_sound_looping:             # <<<<<<<<<<<<<<
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
    goto __pyx_L4;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1937
 *                 sound_instance.set_looping()
 * 
 *         elif notification_message.message == notification_sound_marker:             # <<<<<<<<<<<<<<
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
  __pyx_t_1 = ((__pyx_v_notification_message->message == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_sound_marker) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1938
 * 
 *         elif notification_message.message == notification_sound_marker:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]             # <<<<<<<<<<<<<<
 *             if sound_instance is not None:
 *                 sound_instance.set_marker(notification_message.data.marker.id)
 */
    if (unlikely(__pyx_v_self->__pyx_base._sound_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1938, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->__pyx_base._sound_instances_by_id, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_sound_instance = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1939
 *         elif notification_message.message == notification_sound_marker:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_marker(notification_message.data.marker.id)
 * 
 */
    __pyx_t_1 = (__pyx_v_sound_instance != Py_None);
    __pyx_t_9 = (__pyx_t_1 != 0);
    if (__pyx_t_9) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1940
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 *                 sound_instance.set_marker(notification_message.data.marker.id)             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_marker); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_notification_message->data.marker.id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_8) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1940, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1940, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1940, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1939
 *         elif notification_message.message == notification_sound_marker:
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_marker(notification_message.data.marker.id)
 * 
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1937
 *                 sound_instance.set_looping()
 * 
 *         elif notification_message.message == notification_sound_marker:             # <<<<<<<<<<<<<<
 *             sound_instance = self._sound_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
    goto __pyx_L4;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1943
 * 
 *         else:
 *             raise AudioException("Unknown notification message received on %s track", self.name)             # <<<<<<<<<<<<<<
 * 
 *         # Event has been processed, reset it so it may be used again
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_AudioException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Unknown_notification_message_rec);
    __Pyx_GIVEREF(__pyx_kp_u_Unknown_notification_message_rec);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_Unknown_notification_message_rec);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1943, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1946
 * 
 *         # Event has been processed, reset it so it may be used again
 *         notification_message.message = notification_not_in_use             # <<<<<<<<<<<<<<
 *         notification_message.sound_id = 0
 *         notification_message.sound_instance_id = 0
 */
  __pyx_v_notification_message->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_notification_not_in_use;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1947
 *         # Event has been processed, reset it so it may be used again
 *         notification_message.message = notification_not_in_use
 *         notification_message.sound_id = 0             # <<<<<<<<<<<<<<
 *         notification_message.sound_instance_id = 0
 * 
 */
  __pyx_v_notification_message->sound_id = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1948
 *         notification_message.message = notification_not_in_use
 *         notification_message.sound_id = 0
 *         notification_message.sound_instance_id = 0             # <<<<<<<<<<<<<<
 * 
 *     def _get_next_sound(self):
 */
  __pyx_v_notification_message->sound_instance_id = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1904
 *         return NULL
 * 
 *     def process_notification_message(self, int message_num):             # <<<<<<<<<<<<<<
 *         """Process a notification message to this track"""
 *         cdef NotificationMessageContainer *notification_message = self._audio_callback_data.notification_messages[message_num]
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.process_notification_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1950
 *         notification_message.sound_instance_id = 0
 * 
 *     def _get_next_sound(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the next sound in the priority queue ready for playback.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_11_get_next_sound(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_10_get_next_sound[] = "TrackStandard._get_next_sound(self)\n\n        Returns the next sound in the priority queue ready for playback.\n\n        Returns: A SoundInstance object. If the queue is empty, None is returned.\n\n        This method ensures that the sound that is returned has not expired.\n        If the next sound in the queue has expired, it is discarded and the\n        next sound that has not expired is returned.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_11_get_next_sound(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_next_sound (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_10_get_next_sound(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_10_get_next_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_v_queue_entry_ids_retrieved = 0;
  PyObject *__pyx_v_queue_entry = NULL;
  PyObject *__pyx_v_sound_instance = NULL;
  PyObject *__pyx_v_exp_time = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  __Pyx_RefNannySetupContext("_get_next_sound", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1964
 *         # retrieving from the queue and exit when we have gone through
 *         # all items once.
 *         cdef list queue_entry_ids_retrieved = list()             # <<<<<<<<<<<<<<
 *         while True:
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_queue_entry_ids_retrieved = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1965
 *         # all items once.
 *         cdef list queue_entry_ids_retrieved = list()
 *         while True:             # <<<<<<<<<<<<<<
 * 
 *             # Each item in the queue is a list containing the following items:
 */
  while (1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1974
 *             #    3 (sound): The Sound object ready for playback
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 # Get the next item in the queue (sorted by priority and expiration time)
 *                 queue_entry = self._sound_queue.get_nowait()
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1976
 *             try:
 *                 # Get the next item in the queue (sorted by priority and expiration time)
 *                 queue_entry = self._sound_queue.get_nowait()             # <<<<<<<<<<<<<<
 * 
 *                 # Check if we've already processed the entry during this call
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_get_nowait); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1976, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (__pyx_t_6) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1976, __pyx_L5_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1976, __pyx_L5_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF_SET(__pyx_v_queue_entry, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1979
 * 
 *                 # Check if we've already processed the entry during this call
 *                 if queue_entry[2] in queue_entry_ids_retrieved:             # <<<<<<<<<<<<<<
 *                     # Already processed, put it back in the queue and return None
 *                     self._sound_queue.put(queue_entry)
 */
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_queue_entry, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1979, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_v_queue_entry_ids_retrieved, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1979, __pyx_L5_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_8 = (__pyx_t_7 != 0);
        if (__pyx_t_8) {

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1981
 *                 if queue_entry[2] in queue_entry_ids_retrieved:
 *                     # Already processed, put it back in the queue and return None
 *                     self._sound_queue.put(queue_entry)             # <<<<<<<<<<<<<<
 *                     return None
 * 
 */
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_put); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1981, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_6 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
            if (likely(__pyx_t_6)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_6);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_5, function);
            }
          }
          if (!__pyx_t_6) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_queue_entry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1981, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_1);
          } else {
            __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1981, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
            __Pyx_INCREF(__pyx_v_queue_entry);
            __Pyx_GIVEREF(__pyx_v_queue_entry);
            PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_queue_entry);
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1981, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1982
 *                     # Already processed, put it back in the queue and return None
 *                     self._sound_queue.put(queue_entry)
 *                     return None             # <<<<<<<<<<<<<<
 * 
 *                 # Keep track of entries we've processed during this call
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(Py_None);
          __pyx_r = Py_None;
          goto __pyx_L9_try_return;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1979
 * 
 *                 # Check if we've already processed the entry during this call
 *                 if queue_entry[2] in queue_entry_ids_retrieved:             # <<<<<<<<<<<<<<
 *                     # Already processed, put it back in the queue and return None
 *                     self._sound_queue.put(queue_entry)
 */
        }

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1985
 * 
 *                 # Keep track of entries we've processed during this call
 *                 queue_entry_ids_retrieved.append(queue_entry[2])             # <<<<<<<<<<<<<<
 * 
 *                 # Check if entry has already been marked as removed (sound is None)
 */
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_queue_entry, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1985, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_queue_entry_ids_retrieved, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 1985, __pyx_L5_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1988
 * 
 *                 # Check if entry has already been marked as removed (sound is None)
 *                 if queue_entry[3] is None:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_queue_entry, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1988, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = (__pyx_t_1 == Py_None);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_7 = (__pyx_t_8 != 0);
        if (__pyx_t_7) {

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1989
 *                 # Check if entry has already been marked as removed (sound is None)
 *                 if queue_entry[3] is None:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *             except Empty:
 */
          goto __pyx_L11_try_continue;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1988
 * 
 *                 # Check if entry has already been marked as removed (sound is None)
 *                 if queue_entry[3] is None:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        }

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1974
 *             #    3 (sound): The Sound object ready for playback
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 # Get the next item in the queue (sorted by priority and expiration time)
 *                 queue_entry = self._sound_queue.get_nowait()
 */
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L12_try_end;
      __pyx_L5_error:;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1991
 *                     continue
 * 
 *             except Empty:             # <<<<<<<<<<<<<<
 *                 # Queue is empty
 *                 return None
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1991, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_11) {
        __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard._get_next_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9) < 0) __PYX_ERR(0, 1991, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_9);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1993
 *             except Empty:
 *                 # Queue is empty
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             # If the sound is still loading and not expired, put it back in the queue
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_None);
        __pyx_r = Py_None;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L8_except_return;
      }
      goto __pyx_L7_except_error;
      __pyx_L7_except_error:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1974
 *             #    3 (sound): The Sound object ready for playback
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 # Get the next item in the queue (sorted by priority and expiration time)
 *                 queue_entry = self._sound_queue.get_nowait()
 */
      __Pyx_PyThreadState_assign
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L1_error;
      __pyx_L11_try_continue:;
      __Pyx_PyThreadState_assign
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L3_continue;
      __pyx_L9_try_return:;
      __Pyx_PyThreadState_assign
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L0;
      __pyx_L8_except_return:;
      __Pyx_PyThreadState_assign
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L0;
      __pyx_L12_try_end:;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1996
 * 
 *             # If the sound is still loading and not expired, put it back in the queue
 *             sound_instance = queue_entry[3]             # <<<<<<<<<<<<<<
 *             exp_time = queue_entry[1]
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \
 */
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_queue_entry, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1997
 *             # If the sound is still loading and not expired, put it back in the queue
 *             sound_instance = queue_entry[3]
 *             exp_time = queue_entry[1]             # <<<<<<<<<<<<<<
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \
 *                     (exp_time is None or exp_time > time.time()):
 */
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_queue_entry, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_XDECREF_SET(__pyx_v_exp_time, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1998
 *             sound_instance = queue_entry[3]
 *             exp_time = queue_entry[1]
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \             # <<<<<<<<<<<<<<
 *                     (exp_time is None or exp_time > time.time()):
 *                 self._sound_queue.put(queue_entry)
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_loaded); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_12 = ((!__pyx_t_8) != 0);
    if (__pyx_t_12) {
    } else {
      __pyx_t_7 = __pyx_t_12;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_loading); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_12) {
    } else {
      __pyx_t_7 = __pyx_t_12;
      goto __pyx_L18_bool_binop_done;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1999
 *             exp_time = queue_entry[1]
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \
 *                     (exp_time is None or exp_time > time.time()):             # <<<<<<<<<<<<<<
 *                 self._sound_queue.put(queue_entry)
 *                 self.log.debug("Next pending sound in queue is still loading, "
 */
    __pyx_t_12 = (__pyx_v_exp_time == Py_None);
    __pyx_t_8 = (__pyx_t_12 != 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1999, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1999, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_exp_time, __pyx_t_9, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1999, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = __pyx_t_8;
    __pyx_L18_bool_binop_done:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1998
 *             sound_instance = queue_entry[3]
 *             exp_time = queue_entry[1]
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \             # <<<<<<<<<<<<<<
 *                     (exp_time is None or exp_time > time.time()):
 *                 self._sound_queue.put(queue_entry)
 */
    if (__pyx_t_7) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2000
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \
 *                     (exp_time is None or exp_time > time.time()):
 *                 self._sound_queue.put(queue_entry)             # <<<<<<<<<<<<<<
 *                 self.log.debug("Next pending sound in queue is still loading, "
 *                                "re-queueing sound %s",
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_put); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2000, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_queue_entry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2000, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2000, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_queue_entry);
        __Pyx_GIVEREF(__pyx_v_queue_entry);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_queue_entry);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2000, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2001
 *                     (exp_time is None or exp_time > time.time()):
 *                 self._sound_queue.put(queue_entry)
 *                 self.log.debug("Next pending sound in queue is still loading, "             # <<<<<<<<<<<<<<
 *                                "re-queueing sound %s",
 *                                queue_entry)
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2001, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2003
 *                 self.log.debug("Next pending sound in queue is still loading, "
 *                                "re-queueing sound %s",
 *                                queue_entry)             # <<<<<<<<<<<<<<
 *             else:
 *                 # Remove the queue entry from the list of sounds in the queue
 */
      __pyx_t_6 = NULL;
      __pyx_t_13 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_13 = 1;
        }
      }
      __pyx_t_5 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2001, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_Next_pending_sound_in_queue_is_s);
      __Pyx_GIVEREF(__pyx_kp_u_Next_pending_sound_in_queue_is_s);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_13, __pyx_kp_u_Next_pending_sound_in_queue_is_s);
      __Pyx_INCREF(__pyx_v_queue_entry);
      __Pyx_GIVEREF(__pyx_v_queue_entry);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_13, __pyx_v_queue_entry);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2001, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1998
 *             sound_instance = queue_entry[3]
 *             exp_time = queue_entry[1]
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \             # <<<<<<<<<<<<<<
 *                     (exp_time is None or exp_time > time.time()):
 *                 self._sound_queue.put(queue_entry)
 */
      goto __pyx_L17;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2006
 *             else:
 *                 # Remove the queue entry from the list of sounds in the queue
 *                 if sound_instance in self._sound_queue_items:             # <<<<<<<<<<<<<<
 *                     del self._sound_queue_items[sound_instance]
 * 
 */
    /*else*/ {
      if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 2006, __pyx_L1_error)
      }
      __pyx_t_7 = (__Pyx_PyDict_ContainsTF(__pyx_v_sound_instance, __pyx_v_self->_sound_queue_items, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2006, __pyx_L1_error)
      __pyx_t_8 = (__pyx_t_7 != 0);
      if (__pyx_t_8) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2007
 *                 # Remove the queue entry from the list of sounds in the queue
 *                 if sound_instance in self._sound_queue_items:
 *                     del self._sound_queue_items[sound_instance]             # <<<<<<<<<<<<<<
 * 
 *                 # Return the next sound from the priority queue if it has not expired
 */
        if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 2007, __pyx_L1_error)
        }
        if (unlikely(PyDict_DelItem(__pyx_v_self->_sound_queue_items, __pyx_v_sound_instance) < 0)) __PYX_ERR(0, 2007, __pyx_L1_error)

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2006
 *             else:
 *                 # Remove the queue entry from the list of sounds in the queue
 *                 if sound_instance in self._sound_queue_items:             # <<<<<<<<<<<<<<
 *                     del self._sound_queue_items[sound_instance]
 * 
 */
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2010
 * 
 *                 # Return the next sound from the priority queue if it has not expired
 *                 if exp_time is None or exp_time > time.time():             # <<<<<<<<<<<<<<
 *                     self.log.debug("Retrieving next pending sound from queue %s", queue_entry)
 *                     sound_instance.set_pending()  # Notify sound instance it is no longer queued
 */
      __pyx_t_7 = (__pyx_v_exp_time == Py_None);
      __pyx_t_12 = (__pyx_t_7 != 0);
      if (!__pyx_t_12) {
      } else {
        __pyx_t_8 = __pyx_t_12;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_9) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2010, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2010, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_exp_time, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2010, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __pyx_t_12;
      __pyx_L24_bool_binop_done:;
      if (__pyx_t_8) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2011
 *                 # Return the next sound from the priority queue if it has not expired
 *                 if exp_time is None or exp_time > time.time():
 *                     self.log.debug("Retrieving next pending sound from queue %s", queue_entry)             # <<<<<<<<<<<<<<
 *                     sound_instance.set_pending()  # Notify sound instance it is no longer queued
 *                     return sound_instance
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2011, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = NULL;
        __pyx_t_13 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_13 = 1;
          }
        }
        __pyx_t_6 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2011, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_Retrieving_next_pending_sound_fr);
        __Pyx_GIVEREF(__pyx_kp_u_Retrieving_next_pending_sound_fr);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_13, __pyx_kp_u_Retrieving_next_pending_sound_fr);
        __Pyx_INCREF(__pyx_v_queue_entry);
        __Pyx_GIVEREF(__pyx_v_queue_entry);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_13, __pyx_v_queue_entry);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2011, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2012
 *                 if exp_time is None or exp_time > time.time():
 *                     self.log.debug("Retrieving next pending sound from queue %s", queue_entry)
 *                     sound_instance.set_pending()  # Notify sound instance it is no longer queued             # <<<<<<<<<<<<<<
 *                     return sound_instance
 *                 else:
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_pending); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2012, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (__pyx_t_6) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2012, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else {
          __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2012, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2013
 *                     self.log.debug("Retrieving next pending sound from queue %s", queue_entry)
 *                     sound_instance.set_pending()  # Notify sound instance it is no longer queued
 *                     return sound_instance             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.log.debug("Discarding expired sound from queue %s", queue_entry)
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_sound_instance);
        __pyx_r = __pyx_v_sound_instance;
        goto __pyx_L0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2010
 * 
 *                 # Return the next sound from the priority queue if it has not expired
 *                 if exp_time is None or exp_time > time.time():             # <<<<<<<<<<<<<<
 *                     self.log.debug("Retrieving next pending sound from queue %s", queue_entry)
 *                     sound_instance.set_pending()  # Notify sound instance it is no longer queued
 */
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2015
 *                     return sound_instance
 *                 else:
 *                     self.log.debug("Discarding expired sound from queue %s", queue_entry)             # <<<<<<<<<<<<<<
 *                     sound_instance.set_expired()  # Notify sound instance it has expired
 * 
 */
      /*else*/ {
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2015, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = NULL;
        __pyx_t_13 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_13 = 1;
          }
        }
        __pyx_t_9 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2015, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_Discarding_expired_sound_from_qu);
        __Pyx_GIVEREF(__pyx_kp_u_Discarding_expired_sound_from_qu);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_13, __pyx_kp_u_Discarding_expired_sound_from_qu);
        __Pyx_INCREF(__pyx_v_queue_entry);
        __Pyx_GIVEREF(__pyx_v_queue_entry);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_13, __pyx_v_queue_entry);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2015, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2016
 *                 else:
 *                     self.log.debug("Discarding expired sound from queue %s", queue_entry)
 *                     sound_instance.set_expired()  # Notify sound instance it has expired             # <<<<<<<<<<<<<<
 * 
 *         return None
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_expired); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2016, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (__pyx_t_9) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2016, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else {
          __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2016, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __pyx_L17:;
    __pyx_L3_continue:;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2018
 *                     sound_instance.set_expired()  # Notify sound instance it has expired
 * 
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def _remove_sound_from_queue(self, sound_instance not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1950
 *         notification_message.sound_instance_id = 0
 * 
 *     def _get_next_sound(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the next sound in the priority queue ready for playback.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard._get_next_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_queue_entry_ids_retrieved);
  __Pyx_XDECREF(__pyx_v_queue_entry);
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XDECREF(__pyx_v_exp_time);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2020
 *         return None
 * 
 *     def _remove_sound_from_queue(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Removes a sound from the priority sound queue.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_13_remove_sound_from_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_12_remove_sound_from_queue[] = "TrackStandard._remove_sound_from_queue(self, sound_instance)\n\n        Removes a sound from the priority sound queue.\n        Args:\n            sound_instance: The sound object to remove\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_13_remove_sound_from_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_remove_sound_from_queue (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 2020, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_12_remove_sound_from_queue(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_12_remove_sound_from_queue(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_remove_sound_from_queue", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2031
 *         # will not be played.  After marking queue entry as None, the dictionary keeping
 *         # track of sounds in the queue is updated.
 *         if sound_instance in self._sound_queue_items:             # <<<<<<<<<<<<<<
 *             entry = self._sound_queue_items[sound_instance]
 *             entry[3] = None
 */
  if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 2031, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_sound_instance, __pyx_v_self->_sound_queue_items, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2031, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2032
 *         # track of sounds in the queue is updated.
 *         if sound_instance in self._sound_queue_items:
 *             entry = self._sound_queue_items[sound_instance]             # <<<<<<<<<<<<<<
 *             entry[3] = None
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 */
    if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 2032, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_self->_sound_queue_items, __pyx_v_sound_instance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_entry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2033
 *         if sound_instance in self._sound_queue_items:
 *             entry = self._sound_queue_items[sound_instance]
 *             entry[3] = None             # <<<<<<<<<<<<<<
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()
 */
    if (unlikely(__Pyx_SetItemInt(__pyx_v_entry, 3, Py_None, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 2033, __pyx_L1_error)

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2034
 *             entry = self._sound_queue_items[sound_instance]
 *             entry[3] = None
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)             # <<<<<<<<<<<<<<
 *             sound_instance.set_canceled()
 *             del self._sound_queue_items[sound_instance]
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Removing_pending_sound_from_queu);
    __Pyx_GIVEREF(__pyx_kp_u_Removing_pending_sound_from_queu);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_u_Removing_pending_sound_from_queu);
    __Pyx_INCREF(__pyx_v_sound_instance);
    __Pyx_GIVEREF(__pyx_v_sound_instance);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_sound_instance);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2035
 *             entry[3] = None
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()             # <<<<<<<<<<<<<<
 *             del self._sound_queue_items[sound_instance]
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_canceled); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_7) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2035, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2035, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2036
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()
 *             del self._sound_queue_items[sound_instance]             # <<<<<<<<<<<<<<
 * 
 *     def _remove_all_sounds_from_queue(self):
 */
    if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 2036, __pyx_L1_error)
    }
    if (unlikely(PyDict_DelItem(__pyx_v_self->_sound_queue_items, __pyx_v_sound_instance) < 0)) __PYX_ERR(0, 2036, __pyx_L1_error)

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2031
 *         # will not be played.  After marking queue entry as None, the dictionary keeping
 *         # track of sounds in the queue is updated.
 *         if sound_instance in self._sound_queue_items:             # <<<<<<<<<<<<<<
 *             entry = self._sound_queue_items[sound_instance]
 *             entry[3] = None
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2020
 *         return None
 * 
 *     def _remove_sound_from_queue(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Removes a sound from the priority sound queue.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard._remove_sound_from_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2038
 *             del self._sound_queue_items[sound_instance]
 * 
 *     def _remove_all_sounds_from_queue(self):             # <<<<<<<<<<<<<<
 *         """Removes all sounds from the priority sound queue.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_15_remove_all_sounds_from_queue(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_14_remove_all_sounds_from_queue[] = "TrackStandard._remove_all_sounds_from_queue(self)\nRemoves all sounds from the priority sound queue.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_15_remove_all_sounds_from_queue(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_remove_all_sounds_from_queue (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_14_remove_all_sounds_from_queue(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_14_remove_all_sounds_from_queue(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_v_sound_instance = NULL;
  PyObject *__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("_remove_all_sounds_from_queue", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2046
 *         # will not be played.  After marking queue entry as None, the dictionary keeping
 *         # track of sounds in the queue is updated.
 *         for sound_instance in self._sound_queue_items:             # <<<<<<<<<<<<<<
 *             entry = self._sound_queue_items[sound_instance]
 *             entry[3] = None
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 2046, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_sound_queue_items, 1, ((PyObject *)NULL), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, NULL, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_6 == 0)) break;
    if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 2046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2047
 *         # track of sounds in the queue is updated.
 *         for sound_instance in self._sound_queue_items:
 *             entry = self._sound_queue_items[sound_instance]             # <<<<<<<<<<<<<<
 *             entry[3] = None
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 */
    if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 2047, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_self->_sound_queue_items, __pyx_v_sound_instance); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2048
 *         for sound_instance in self._sound_queue_items:
 *             entry = self._sound_queue_items[sound_instance]
 *             entry[3] = None             # <<<<<<<<<<<<<<
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()
 */
    if (unlikely(__Pyx_SetItemInt(__pyx_v_entry, 3, Py_None, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 2048, __pyx_L1_error)

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2049
 *             entry = self._sound_queue_items[sound_instance]
 *             entry[3] = None
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)             # <<<<<<<<<<<<<<
 *             sound_instance.set_canceled()
 * 
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Removing_pending_sound_from_queu);
    __Pyx_GIVEREF(__pyx_kp_u_Removing_pending_sound_from_queu);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_kp_u_Removing_pending_sound_from_queu);
    __Pyx_INCREF(__pyx_v_sound_instance);
    __Pyx_GIVEREF(__pyx_v_sound_instance);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_sound_instance);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2050
 *             entry[3] = None
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()             # <<<<<<<<<<<<<<
 * 
 *         self._sound_queue_items.clear()
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_canceled); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2050, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (__pyx_t_10) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2050, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2050, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2052
 *             sound_instance.set_canceled()
 * 
 *         self._sound_queue_items.clear()             # <<<<<<<<<<<<<<
 * 
 *     def play_sound(self, sound_instance not None):
 */
  if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear");
    __PYX_ERR(0, 2052, __pyx_L1_error)
  }
  __pyx_t_11 = __Pyx_PyDict_Clear(__pyx_v_self->_sound_queue_items); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 2052, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2038
 *             del self._sound_queue_items[sound_instance]
 * 
 *     def _remove_all_sounds_from_queue(self):             # <<<<<<<<<<<<<<
 *         """Removes all sounds from the priority sound queue.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard._remove_all_sounds_from_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2054
 *         self._sound_queue_items.clear()
 * 
 *     def play_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound on the current track.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_17play_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_16play_sound[] = "TrackStandard.play_sound(self, sound_instance)\n\n        Plays a sound on the current track.\n        Args:\n            sound_instance: The SoundInstance object to play\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_17play_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("play_sound (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 2054, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_16play_sound(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_16play_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_v_exp_time = NULL;
  PyObject *__pyx_v_sound_player = NULL;
  PyObject *__pyx_v_player = NULL;
  PyObject *__pyx_v_lowest_priority = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player __pyx_t_10;
  __Pyx_RefNannySetupContext("play_sound", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2060
 *             sound_instance: The SoundInstance object to play
 *         """
 *         self.log.debug("play_sound - Processing sound '%s' for playback.", sound_instance.name)             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockMutex(self.mutex)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_play_sound_Processing_sound_s_fo);
  __Pyx_GIVEREF(__pyx_kp_u_play_sound_Processing_sound_s_fo);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_u_play_sound_Processing_sound_s_fo);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2062
 *         self.log.debug("play_sound - Processing sound '%s' for playback.", sound_instance.name)
 * 
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         if sound_instance.max_queue_time is None:
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2064
 *         SDL_LockMutex(self.mutex)
 * 
 *         if sound_instance.max_queue_time is None:             # <<<<<<<<<<<<<<
 *             exp_time = None
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_max_queue_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2065
 * 
 *         if sound_instance.max_queue_time is None:
 *             exp_time = None             # <<<<<<<<<<<<<<
 *         else:
 *             exp_time = time.time() + sound_instance.max_queue_time
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_exp_time = Py_None;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2064
 *         SDL_LockMutex(self.mutex)
 * 
 *         if sound_instance.max_queue_time is None:             # <<<<<<<<<<<<<<
 *             exp_time = None
 *         else:
 */
    goto __pyx_L3;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2067
 *             exp_time = None
 *         else:
 *             exp_time = time.time() + sound_instance.max_queue_time             # <<<<<<<<<<<<<<
 * 
 *         # Make sure sound is loaded.  If not, we assume the sound is being loaded and we
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2067, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2067, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2067, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2067, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_max_queue_time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2067, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2067, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_exp_time = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2071
 *         # Make sure sound is loaded.  If not, we assume the sound is being loaded and we
 *         # add it to the queue so it will be picked up on the next loop.
 *         if not sound_instance.sound.loaded:             # <<<<<<<<<<<<<<
 *             # If the sound is not already loading, load it now
 *             if not sound_instance.sound.loading:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_loaded); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2071, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_7 = ((!__pyx_t_8) != 0);
  if (__pyx_t_7) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2073
 *         if not sound_instance.sound.loaded:
 *             # If the sound is not already loading, load it now
 *             if not sound_instance.sound.loading:             # <<<<<<<<<<<<<<
 *                 sound_instance.sound.load()
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_loading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2073, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = ((!__pyx_t_7) != 0);
    if (__pyx_t_8) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2074
 *             # If the sound is not already loading, load it now
 *             if not sound_instance.sound.loading:
 *                 sound_instance.sound.load()             # <<<<<<<<<<<<<<
 * 
 *             if sound_instance.max_queue_time != 0:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2074, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2074, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2073
 *         if not sound_instance.sound.loaded:
 *             # If the sound is not already loading, load it now
 *             if not sound_instance.sound.loading:             # <<<<<<<<<<<<<<
 *                 sound_instance.sound.load()
 * 
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2076
 *                 sound_instance.sound.load()
 * 
 *             if sound_instance.max_queue_time != 0:             # <<<<<<<<<<<<<<
 *                 self._queue_sound(sound_instance=sound_instance, exp_time=exp_time)
 *                 self.log.debug("play_sound - Sound %s was not loaded and therefore has been "
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_max_queue_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2076, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2076, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2077
 * 
 *             if sound_instance.max_queue_time != 0:
 *                 self._queue_sound(sound_instance=sound_instance, exp_time=exp_time)             # <<<<<<<<<<<<<<
 *                 self.log.debug("play_sound - Sound %s was not loaded and therefore has been "
 *                                "queued for playback.", sound_instance.name)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_queue_sound); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2077, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2077, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_sound_instance, __pyx_v_sound_instance) < 0) __PYX_ERR(0, 2077, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_exp_time, __pyx_v_exp_time) < 0) __PYX_ERR(0, 2077, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2077, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2078
 *             if sound_instance.max_queue_time != 0:
 *                 self._queue_sound(sound_instance=sound_instance, exp_time=exp_time)
 *                 self.log.debug("play_sound - Sound %s was not loaded and therefore has been "             # <<<<<<<<<<<<<<
 *                                "queued for playback.", sound_instance.name)
 *             else:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2078, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2079
 *                 self._queue_sound(sound_instance=sound_instance, exp_time=exp_time)
 *                 self.log.debug("play_sound - Sound %s was not loaded and therefore has been "
 *                                "queued for playback.", sound_instance.name)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.log.debug("play_sound - Sound %s was not loaded and max_queue_time = 0, "
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2078, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_play_sound_Sound_s_was_not_loade);
      __Pyx_GIVEREF(__pyx_kp_u_play_sound_Sound_s_was_not_loade);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_s_was_not_loade);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2078, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2076
 *                 sound_instance.sound.load()
 * 
 *             if sound_instance.max_queue_time != 0:             # <<<<<<<<<<<<<<
 *                 self._queue_sound(sound_instance=sound_instance, exp_time=exp_time)
 *                 self.log.debug("play_sound - Sound %s was not loaded and therefore has been "
 */
      goto __pyx_L6;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2081
 *                                "queued for playback.", sound_instance.name)
 *             else:
 *                 self.log.debug("play_sound - Sound %s was not loaded and max_queue_time = 0, "             # <<<<<<<<<<<<<<
 *                                "therefore it has been discarded and will not be played.", sound_instance.name)
 *                 sound_instance.set_expired()
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2082
 *             else:
 *                 self.log.debug("play_sound - Sound %s was not loaded and max_queue_time = 0, "
 *                                "therefore it has been discarded and will not be played.", sound_instance.name)             # <<<<<<<<<<<<<<
 *                 sound_instance.set_expired()
 *         else:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2082, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_play_sound_Sound_s_was_not_loade_2);
      __Pyx_GIVEREF(__pyx_kp_u_play_sound_Sound_s_was_not_loade_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_s_was_not_loade_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2083
 *                 self.log.debug("play_sound - Sound %s was not loaded and max_queue_time = 0, "
 *                                "therefore it has been discarded and will not be played.", sound_instance.name)
 *                 sound_instance.set_expired()             # <<<<<<<<<<<<<<
 *         else:
 *             # If the sound can be played right away (available player) then play it.
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_expired); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2083, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2083, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2083, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L6:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2071
 *         # Make sure sound is loaded.  If not, we assume the sound is being loaded and we
 *         # add it to the queue so it will be picked up on the next loop.
 *         if not sound_instance.sound.loaded:             # <<<<<<<<<<<<<<
 *             # If the sound is not already loading, load it now
 *             if not sound_instance.sound.loading:
 */
    goto __pyx_L4;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2087
 *             # If the sound can be played right away (available player) then play it.
 *             # Is there an available sound player?
 *             sound_player = self._get_sound_player_with_lowest_priority()             # <<<<<<<<<<<<<<
 *             player = sound_player[0]
 *             lowest_priority = sound_player[1]
 */
  /*else*/ {
    __pyx_t_6 = ((struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_sound_player_with_lowest_priority(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_sound_player = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2088
 *             # Is there an available sound player?
 *             sound_player = self._get_sound_player_with_lowest_priority()
 *             player = sound_player[0]             # <<<<<<<<<<<<<<
 *             lowest_priority = sound_player[1]
 * 
 */
    if (unlikely(__pyx_v_sound_player == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 2088, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_sound_player, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_player = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2089
 *             sound_player = self._get_sound_player_with_lowest_priority()
 *             player = sound_player[0]
 *             lowest_priority = sound_player[1]             # <<<<<<<<<<<<<<
 * 
 *             if lowest_priority is None:
 */
    if (unlikely(__pyx_v_sound_player == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 2089, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_sound_player, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_lowest_priority = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2091
 *             lowest_priority = sound_player[1]
 * 
 *             if lowest_priority is None:             # <<<<<<<<<<<<<<
 *                 self.log.debug("play_sound - Sound player %d is available "
 *                                "for playback", player)
 */
    __pyx_t_8 = (__pyx_v_lowest_priority == Py_None);
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (__pyx_t_7) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2092
 * 
 *             if lowest_priority is None:
 *                 self.log.debug("play_sound - Sound player %d is available "             # <<<<<<<<<<<<<<
 *                                "for playback", player)
 *                 # Play the sound using the available player
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2092, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2093
 *             if lowest_priority is None:
 *                 self.log.debug("play_sound - Sound player %d is available "
 *                                "for playback", player)             # <<<<<<<<<<<<<<
 *                 # Play the sound using the available player
 *                 self._play_sound_on_sound_player(sound_instance=sound_instance, player=player)
 */
      __pyx_t_3 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2092, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_play_sound_Sound_player_d_is_ava);
      __Pyx_GIVEREF(__pyx_kp_u_play_sound_Sound_player_d_is_ava);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_player_d_is_ava);
      __Pyx_INCREF(__pyx_v_player);
      __Pyx_GIVEREF(__pyx_v_player);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_player);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2092, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2095
 *                                "for playback", player)
 *                 # Play the sound using the available player
 *                 self._play_sound_on_sound_player(sound_instance=sound_instance, player=player)             # <<<<<<<<<<<<<<
 *             else:
 *                 # All sound players are currently busy:
 */
      __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_player); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2095, __pyx_L1_error)
      ((struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_play_sound_on_sound_player(__pyx_v_self, __pyx_v_sound_instance, __pyx_t_9, NULL);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2091
 *             lowest_priority = sound_player[1]
 * 
 *             if lowest_priority is None:             # <<<<<<<<<<<<<<
 *                 self.log.debug("play_sound - Sound player %d is available "
 *                                "for playback", player)
 */
      goto __pyx_L7;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2098
 *             else:
 *                 # All sound players are currently busy:
 *                 self.log.debug("play_sound - No idle sound player is available.")             # <<<<<<<<<<<<<<
 *                 self.log.debug("play_sound - Sound player %d is currently playing the sound with "
 *                                "the lowest priority (%d).", player, lowest_priority)
 */
    /*else*/ {
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2098, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2098, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2099
 *                 # All sound players are currently busy:
 *                 self.log.debug("play_sound - No idle sound player is available.")
 *                 self.log.debug("play_sound - Sound player %d is currently playing the sound with "             # <<<<<<<<<<<<<<
 *                                "the lowest priority (%d).", player, lowest_priority)
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2099, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2100
 *                 self.log.debug("play_sound - No idle sound player is available.")
 *                 self.log.debug("play_sound - Sound player %d is currently playing the sound with "
 *                                "the lowest priority (%d).", player, lowest_priority)             # <<<<<<<<<<<<<<
 * 
 *                 # If the lowest priority of all the sounds currently playing is lower than
 */
      __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_3 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2099, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_play_sound_Sound_player_d_is_cur);
      __Pyx_GIVEREF(__pyx_kp_u_play_sound_Sound_player_d_is_cur);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_player_d_is_cur);
      __Pyx_INCREF(__pyx_v_player);
      __Pyx_GIVEREF(__pyx_v_player);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_player);
      __Pyx_INCREF(__pyx_v_lowest_priority);
      __Pyx_GIVEREF(__pyx_v_lowest_priority);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_5, __pyx_v_lowest_priority);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2099, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2104
 *                 # If the lowest priority of all the sounds currently playing is lower than
 *                 # the requested sound, kill the lowest priority sound and replace it.
 *                 if sound_instance.priority > lowest_priority:             # <<<<<<<<<<<<<<
 *                     self.log.debug("play_sound - Sound priority (%d) is higher than the "
 *                                    "lowest sound currently playing (%d). Forcing playback "
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_v_lowest_priority, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2104, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2104, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_7) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2105
 *                 # the requested sound, kill the lowest priority sound and replace it.
 *                 if sound_instance.priority > lowest_priority:
 *                     self.log.debug("play_sound - Sound priority (%d) is higher than the "             # <<<<<<<<<<<<<<
 *                                    "lowest sound currently playing (%d). Forcing playback "
 *                                    "on sound player %d.", sound_instance.priority, lowest_priority, player)
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2107
 *                     self.log.debug("play_sound - Sound priority (%d) is higher than the "
 *                                    "lowest sound currently playing (%d). Forcing playback "
 *                                    "on sound player %d.", sound_instance.priority, lowest_priority, player)             # <<<<<<<<<<<<<<
 *                     self._play_sound_on_sound_player(sound_instance=sound_instance,
 *                                                      player=player,
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_5 = 1;
          }
        }
        __pyx_t_1 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_play_sound_Sound_priority_d_is_h);
        __Pyx_GIVEREF(__pyx_kp_u_play_sound_Sound_priority_d_is_h);
        PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_priority_d_is_h);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_5, __pyx_t_3);
        __Pyx_INCREF(__pyx_v_lowest_priority);
        __Pyx_GIVEREF(__pyx_v_lowest_priority);
        PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_5, __pyx_v_lowest_priority);
        __Pyx_INCREF(__pyx_v_player);
        __Pyx_GIVEREF(__pyx_v_player);
        PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_5, __pyx_v_player);
        __pyx_t_3 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2109
 *                                    "on sound player %d.", sound_instance.priority, lowest_priority, player)
 *                     self._play_sound_on_sound_player(sound_instance=sound_instance,
 *                                                      player=player,             # <<<<<<<<<<<<<<
 *                                                      force=True)
 *                 elif sound_instance.max_queue_time == 0:
 */
        __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_player); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2109, __pyx_L1_error)

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2108
 *                                    "lowest sound currently playing (%d). Forcing playback "
 *                                    "on sound player %d.", sound_instance.priority, lowest_priority, player)
 *                     self._play_sound_on_sound_player(sound_instance=sound_instance,             # <<<<<<<<<<<<<<
 *                                                      player=player,
 *                                                      force=True)
 */
        __pyx_t_10.__pyx_n = 1;
        __pyx_t_10.force = 1;
        __pyx_t_7 = ((struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_play_sound_on_sound_player(__pyx_v_self, __pyx_v_sound_instance, __pyx_t_9, &__pyx_t_10); 

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2104
 *                 # If the lowest priority of all the sounds currently playing is lower than
 *                 # the requested sound, kill the lowest priority sound and replace it.
 *                 if sound_instance.priority > lowest_priority:             # <<<<<<<<<<<<<<
 *                     self.log.debug("play_sound - Sound priority (%d) is higher than the "
 *                                    "lowest sound currently playing (%d). Forcing playback "
 */
        goto __pyx_L8;
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2111
 *                                                      player=player,
 *                                                      force=True)
 *                 elif sound_instance.max_queue_time == 0:             # <<<<<<<<<<<<<<
 *                     # The sound could not be played immediately and has now expired (max_queue_time == 0)
 *                     self.log.debug("play_sound - Sound priority (%d) is less than or equal to the "
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_max_queue_time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2111, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_7) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2113
 *                 elif sound_instance.max_queue_time == 0:
 *                     # The sound could not be played immediately and has now expired (max_queue_time == 0)
 *                     self.log.debug("play_sound - Sound priority (%d) is less than or equal to the "             # <<<<<<<<<<<<<<
 *                                    "lowest sound currently playing (%d). Sound could not be played"
 *                                    "immediately and has now expired (max_queue_time = 0) and will "
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2117
 *                                    "immediately and has now expired (max_queue_time = 0) and will "
 *                                    "not be played.",
 *                                    sound_instance.priority, lowest_priority)             # <<<<<<<<<<<<<<
 *                     sound_instance.set_expired()
 *                 else:
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2117, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
            __pyx_t_5 = 1;
          }
        }
        __pyx_t_4 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_play_sound_Sound_priority_d_is_l);
        __Pyx_GIVEREF(__pyx_kp_u_play_sound_Sound_priority_d_is_l);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_priority_d_is_l);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_1);
        __Pyx_INCREF(__pyx_v_lowest_priority);
        __Pyx_GIVEREF(__pyx_v_lowest_priority);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_v_lowest_priority);
        __pyx_t_1 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2118
 *                                    "not be played.",
 *                                    sound_instance.priority, lowest_priority)
 *                     sound_instance.set_expired()             # <<<<<<<<<<<<<<
 *                 else:
 *                     # Add the requested sound to the priority queue
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_expired); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2118, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_4 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        if (__pyx_t_4) {
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2118, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else {
          __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2118, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2111
 *                                                      player=player,
 *                                                      force=True)
 *                 elif sound_instance.max_queue_time == 0:             # <<<<<<<<<<<<<<
 *                     # The sound could not be played immediately and has now expired (max_queue_time == 0)
 *                     self.log.debug("play_sound - Sound priority (%d) is less than or equal to the "
 */
        goto __pyx_L8;
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2121
 *                 else:
 *                     # Add the requested sound to the priority queue
 *                     self.log.debug("play_sound - Sound priority (%d) is less than or equal to the "             # <<<<<<<<<<<<<<
 *                                    "lowest sound currently playing (%d). Sound will be queued "
 *                                    "for playback.", sound_instance.priority, lowest_priority)
 */
      /*else*/ {
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2121, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2123
 *                     self.log.debug("play_sound - Sound priority (%d) is less than or equal to the "
 *                                    "lowest sound currently playing (%d). Sound will be queued "
 *                                    "for playback.", sound_instance.priority, lowest_priority)             # <<<<<<<<<<<<<<
 *                     self._queue_sound(sound_instance=sound_instance, exp_time=exp_time)
 * 
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2123, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
            __pyx_t_5 = 1;
          }
        }
        __pyx_t_3 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2121, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (__pyx_t_1) {
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_play_sound_Sound_priority_d_is_l_2);
        __Pyx_GIVEREF(__pyx_kp_u_play_sound_Sound_priority_d_is_l_2);
        PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_priority_d_is_l_2);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_t_4);
        __Pyx_INCREF(__pyx_v_lowest_priority);
        __Pyx_GIVEREF(__pyx_v_lowest_priority);
        PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_5, __pyx_v_lowest_priority);
        __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2121, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2124
 *                                    "lowest sound currently playing (%d). Sound will be queued "
 *                                    "for playback.", sound_instance.priority, lowest_priority)
 *                     self._queue_sound(sound_instance=sound_instance, exp_time=exp_time)             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_queue_sound); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_sound_instance, __pyx_v_sound_instance) < 0) __PYX_ERR(0, 2124, __pyx_L1_error)
        if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_exp_time, __pyx_v_exp_time) < 0) __PYX_ERR(0, 2124, __pyx_L1_error)
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_L8:;
    }
    __pyx_L7:;
  }
  __pyx_L4:;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2126
 *                     self._queue_sound(sound_instance=sound_instance, exp_time=exp_time)
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def replace_sound(self, old_instance not None, sound_instance not None):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2054
 *         self._sound_queue_items.clear()
 * 
 *     def play_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound on the current track.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.play_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exp_time);
  __Pyx_XDECREF(__pyx_v_sound_player);
  __Pyx_XDECREF(__pyx_v_player);
  __Pyx_XDECREF(__pyx_v_lowest_priority);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2128
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def replace_sound(self, old_instance not None, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Replace a currently playing instance with another sound instance.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_19replace_sound(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_18replace_sound[] = "TrackStandard.replace_sound(self, old_instance, sound_instance)\n\n        Replace a currently playing instance with another sound instance.\n        Args:\n            old_instance: The currently playing sound instance to replace\n            sound_instance: The new sound instance to begin playing immediately\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_19replace_sound(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_old_instance = 0;
  PyObject *__pyx_v_sound_instance = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace_sound (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_old_instance,&__pyx_n_s_sound_instance,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_old_instance)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sound_instance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace_sound", 1, 2, 2, 1); __PYX_ERR(0, 2128, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace_sound") < 0)) __PYX_ERR(0, 2128, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_old_instance = values[0];
    __pyx_v_sound_instance = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace_sound", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2128, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.replace_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(((PyObject *)__pyx_v_old_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "old_instance"); __PYX_ERR(0, 2128, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 2128, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_18replace_sound(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), __pyx_v_old_instance, __pyx_v_sound_instance);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_18replace_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_old_instance, PyObject *__pyx_v_sound_instance) {
  int __pyx_v_player;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("replace_sound", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2136
 *         """
 * 
 *         self.log.debug("replace_sound - Preparing to replace existing sound with a new sound instance")             # <<<<<<<<<<<<<<
 * 
 *         # Find which player is currently playing the specified sound instance to replace
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2139
 * 
 *         # Find which player is currently playing the specified sound instance to replace
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *         player = self._get_player_playing_sound_instance(old_instance)
 * 
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2140
 *         # Find which player is currently playing the specified sound instance to replace
 *         SDL_LockMutex(self.mutex)
 *         player = self._get_player_playing_sound_instance(old_instance)             # <<<<<<<<<<<<<<
 * 
 *         if player >= 0:
 */
  __pyx_v_player = ((struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_player_playing_sound_instance(__pyx_v_self, __pyx_v_old_instance);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2142
 *         player = self._get_player_playing_sound_instance(old_instance)
 * 
 *         if player >= 0:             # <<<<<<<<<<<<<<
 *             self._play_sound_on_sound_player(sound_instance, player, force=True)
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_player >= 0) != 0);
  if (__pyx_t_3) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2143
 * 
 *         if player >= 0:
 *             self._play_sound_on_sound_player(sound_instance, player, force=True)             # <<<<<<<<<<<<<<
 *         else:
 *             self.log.debug("replace_sound - Could not locate specified sound instance to replace")
 */
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.force = 1;
    __pyx_t_3 = ((struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_play_sound_on_sound_player(__pyx_v_self, __pyx_v_sound_instance, __pyx_v_player, &__pyx_t_4); 

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2142
 *         player = self._get_player_playing_sound_instance(old_instance)
 * 
 *         if player >= 0:             # <<<<<<<<<<<<<<
 *             self._play_sound_on_sound_player(sound_instance, player, force=True)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2145
 *             self._play_sound_on_sound_player(sound_instance, player, force=True)
 *         else:
 *             self.log.debug("replace_sound - Could not locate specified sound instance to replace")             # <<<<<<<<<<<<<<
 *             sound_instance.set_canceled()
 * 
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2146
 *         else:
 *             self.log.debug("replace_sound - Could not locate specified sound instance to replace")
 *             sound_instance.set_canceled()             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_canceled); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2146, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2146, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2148
 *             sound_instance.set_canceled()
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def _queue_sound(self, sound_instance, exp_time=None):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2128
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def replace_sound(self, old_instance not None, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Replace a currently playing instance with another sound instance.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.replace_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2150
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def _queue_sound(self, sound_instance, exp_time=None):             # <<<<<<<<<<<<<<
 *         """Adds a sound to the queue to be played when a sound player becomes available.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_21_queue_sound(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_20_queue_sound[] = "TrackStandard._queue_sound(self, sound_instance, exp_time=None)\nAdds a sound to the queue to be played when a sound player becomes available.\n\n        Args:\n            sound_instance: The SoundInstance object to play.\n            exp_time: Real world time of when this sound will expire.  It will not play\n                if the queue is freed up after it expires.  None indicates the sound\n                never expires and will eventually be played.\n\n        Note that this method will insert this sound into a position in the\n        queue based on its priority, so highest-priority sounds are played\n        first.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_21_queue_sound(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sound_instance = 0;
  PyObject *__pyx_v_exp_time = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_queue_sound (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sound_instance,&__pyx_n_s_exp_time,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sound_instance)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exp_time);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_queue_sound") < 0)) __PYX_ERR(0, 2150, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sound_instance = values[0];
    __pyx_v_exp_time = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_queue_sound", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2150, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard._queue_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_20_queue_sound(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), __pyx_v_sound_instance, __pyx_v_exp_time);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_20_queue_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance, PyObject *__pyx_v_exp_time) {
  PyObject *__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  __Pyx_RefNannySetupContext("_queue_sound", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2167
 *         # retrieves the lowest values first, and MPF uses higher values for
 *         # higher priorities.
 *         entry = [-sound_instance.priority, exp_time, self._queue_entry_id, sound_instance]             # <<<<<<<<<<<<<<
 *         self._sound_queue.put(entry)
 *         self._queue_entry_id += 1
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_queue_entry_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_exp_time);
  __Pyx_GIVEREF(__pyx_v_exp_time);
  PyList_SET_ITEM(__pyx_t_3, 1, __pyx_v_exp_time);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_sound_instance);
  __Pyx_GIVEREF(__pyx_v_sound_instance);
  PyList_SET_ITEM(__pyx_t_3, 3, __pyx_v_sound_instance);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_v_entry = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2168
 *         # higher priorities.
 *         entry = [-sound_instance.priority, exp_time, self._queue_entry_id, sound_instance]
 *         self._sound_queue.put(entry)             # <<<<<<<<<<<<<<
 *         self._queue_entry_id += 1
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_entry); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_entry);
    __Pyx_GIVEREF(__pyx_v_entry);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_entry);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2169
 *         entry = [-sound_instance.priority, exp_time, self._queue_entry_id, sound_instance]
 *         self._sound_queue.put(entry)
 *         self._queue_entry_id += 1             # <<<<<<<<<<<<<<
 * 
 *         # Notify sound instance it has been queued
 */
  __pyx_v_self->_queue_entry_id = (__pyx_v_self->_queue_entry_id + 1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2172
 * 
 *         # Notify sound instance it has been queued
 *         sound_instance.set_queued()             # <<<<<<<<<<<<<<
 * 
 *         # Save the new entry in a dictionary of entries keyed by sound.  This
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_queued); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2172, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2172, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2176
 *         # Save the new entry in a dictionary of entries keyed by sound.  This
 *         # dictionary is used to remove pending sounds from the priority queue.
 *         self._sound_queue_items[sound_instance] = entry             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("Queueing sound %s", entry)
 */
  if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 2176, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_v_self->_sound_queue_items, __pyx_v_sound_instance, __pyx_v_entry) < 0)) __PYX_ERR(0, 2176, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2178
 *         self._sound_queue_items[sound_instance] = entry
 * 
 *         self.log.debug("Queueing sound %s", entry)             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound(self, sound_instance not None):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_2 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_Queueing_sound_s);
  __Pyx_GIVEREF(__pyx_kp_u_Queueing_sound_s);
  PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_5, __pyx_kp_u_Queueing_sound_s);
  __Pyx_INCREF(__pyx_v_entry);
  __Pyx_GIVEREF(__pyx_v_entry);
  PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_5, __pyx_v_entry);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2150
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def _queue_sound(self, sound_instance, exp_time=None):             # <<<<<<<<<<<<<<
 *         """Adds a sound to the queue to be played when a sound player becomes available.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard._queue_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2180
 *         self.log.debug("Queueing sound %s", entry)
 * 
 *     def stop_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound immediately on the track. Any queued instances
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_23stop_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_22stop_sound[] = "TrackStandard.stop_sound(self, sound_instance)\n\n        Stops all instances of the specified sound immediately on the track. Any queued instances\n        will be removed from the queue.\n        Args:\n            sound_instance: The SoundInstance to stop\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_23stop_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 2180, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_22stop_sound(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_22stop_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  int __pyx_v_i;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *__pyx_v_request_message;
  PyObject *__pyx_v_seconds_to_bytes_factor = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  long __pyx_t_11;
  int __pyx_t_12;
  Uint32 __pyx_t_13;
  __Pyx_RefNannySetupContext("stop_sound", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2188
 *         """
 * 
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("Stopping sound %s and removing any pending instances from queue", sound_instance.name)
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2190
 *         SDL_LockMutex(self.mutex)
 * 
 *         self.log.debug("Stopping sound %s and removing any pending instances from queue", sound_instance.name)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.type_state.sound_player_count):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_Stopping_sound_s_and_removing_an);
  __Pyx_GIVEREF(__pyx_kp_u_Stopping_sound_s_and_removing_an);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_u_Stopping_sound_s_and_removing_an);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2192
 *         self.log.debug("Stopping sound %s and removing any pending instances from queue", sound_instance.name)
 * 
 *         for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[i].status != player_idle and self.type_state.sound_players[
 *                 i].current.sound_instance_id == sound_instance.id:
 */
  __pyx_t_7 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2193
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and self.type_state.sound_players[             # <<<<<<<<<<<<<<
 *                 i].current.sound_instance_id == sound_instance.id:
 *                 # Set stop sound event
 */
    __pyx_t_10 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (__pyx_t_10) {
    } else {
      __pyx_t_9 = __pyx_t_10;
      goto __pyx_L6_bool_binop_done;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2194
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and self.type_state.sound_players[
 *                 i].current.sound_instance_id == sound_instance.id:             # <<<<<<<<<<<<<<
 *                 # Set stop sound event
 *                 request_message = self._get_available_request_message()
 */
    __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2194, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2194, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2194, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2194, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9 = __pyx_t_10;
    __pyx_L6_bool_binop_done:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2193
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and self.type_state.sound_players[             # <<<<<<<<<<<<<<
 *                 i].current.sound_instance_id == sound_instance.id:
 *                 # Set stop sound event
 */
    if (__pyx_t_9) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2196
 *                 i].current.sound_instance_id == sound_instance.id:
 *                 # Set stop sound event
 *                 request_message = self._get_available_request_message()             # <<<<<<<<<<<<<<
 *                 if request_message != NULL:
 *                     request_message.message = request_sound_stop
 */
      __pyx_v_request_message = ((struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_available_request_message(__pyx_v_self);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2197
 *                 # Set stop sound event
 *                 request_message = self._get_available_request_message()
 *                 if request_message != NULL:             # <<<<<<<<<<<<<<
 *                     request_message.message = request_sound_stop
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id
 */
      __pyx_t_9 = ((__pyx_v_request_message != NULL) != 0);
      if (__pyx_t_9) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2198
 *                 request_message = self._get_available_request_message()
 *                 if request_message != NULL:
 *                     request_message.message = request_sound_stop             # <<<<<<<<<<<<<<
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id
 *                     request_message.sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 */
        __pyx_v_request_message->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_stop;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2199
 *                 if request_message != NULL:
 *                     request_message.message = request_sound_stop
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id             # <<<<<<<<<<<<<<
 *                     request_message.sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 *                     request_message.track = self.number
 */
        __pyx_t_11 = (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_id;
        __pyx_v_request_message->sound_id = __pyx_t_11;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2200
 *                     request_message.message = request_sound_stop
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id
 *                     request_message.sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id             # <<<<<<<<<<<<<<
 *                     request_message.track = self.number
 *                     request_message.player = i
 */
        __pyx_t_11 = (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id;
        __pyx_v_request_message->sound_instance_id = __pyx_t_11;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2201
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id
 *                     request_message.sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 *                     request_message.track = self.number             # <<<<<<<<<<<<<<
 *                     request_message.player = i
 *                     request_message.time = SDL_GetTicks()
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_number); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2201, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2201, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_request_message->track = __pyx_t_12;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2202
 *                     request_message.sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 *                     request_message.track = self.number
 *                     request_message.player = i             # <<<<<<<<<<<<<<
 *                     request_message.time = SDL_GetTicks()
 * 
 */
        __pyx_v_request_message->player = __pyx_v_i;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2203
 *                     request_message.track = self.number
 *                     request_message.player = i
 *                     request_message.time = SDL_GetTicks()             # <<<<<<<<<<<<<<
 * 
 *                     # Fade out
 */
        __pyx_v_request_message->time = SDL_GetTicks();

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2206
 * 
 *                     # Fade out
 *                     seconds_to_bytes_factor = self._audio_callback_data.sample_rate * self._audio_callback_data.audio_channels * BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 *                     request_message.data.stop.fade_out_duration = sound_instance.fade_out * seconds_to_bytes_factor
 * 
 */
        __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_self->__pyx_base._audio_callback_data->sample_rate * __pyx_v_self->__pyx_base._audio_callback_data->audio_channels) * 2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2206, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_XDECREF_SET(__pyx_v_seconds_to_bytes_factor, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2207
 *                     # Fade out
 *                     seconds_to_bytes_factor = self._audio_callback_data.sample_rate * self._audio_callback_data.audio_channels * BYTES_PER_SAMPLE
 *                     request_message.data.stop.fade_out_duration = sound_instance.fade_out * seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 * 
 *                     # Adjust ducking (if necessary)
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_fade_out); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2207, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_2 = PyNumber_Multiply(__pyx_t_6, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2207, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_13 = __Pyx_PyInt_As_Uint32(__pyx_t_2); if (unlikely((__pyx_t_13 == (Uint32)-1) && PyErr_Occurred())) __PYX_ERR(0, 2207, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_request_message->data.stop.fade_out_duration = __pyx_t_13;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2210
 * 
 *                     # Adjust ducking (if necessary)
 *                     if sound_instance.ducking is not None:             # <<<<<<<<<<<<<<
 *                         request_message.data.stop.ducking_release_duration = min(
 *                             sound_instance.ducking.release * seconds_to_bytes_factor,
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_9 = (__pyx_t_2 != Py_None);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_10 = (__pyx_t_9 != 0);
        if (__pyx_t_10) {

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2213
 *                         request_message.data.stop.ducking_release_duration = min(
 *                             sound_instance.ducking.release * seconds_to_bytes_factor,
 *                             request_message.data.stop.fade_out_duration)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.log.error(
 */
          __pyx_t_13 = __pyx_v_request_message->data.stop.fade_out_duration;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2212
 *                     if sound_instance.ducking is not None:
 *                         request_message.data.stop.ducking_release_duration = min(
 *                             sound_instance.ducking.release * seconds_to_bytes_factor,             # <<<<<<<<<<<<<<
 *                             request_message.data.stop.fade_out_duration)
 *                 else:
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2212, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2212, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyNumber_Multiply(__pyx_t_6, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2212, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2213
 *                         request_message.data.stop.ducking_release_duration = min(
 *                             sound_instance.ducking.release * seconds_to_bytes_factor,
 *                             request_message.data.stop.fade_out_duration)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.log.error(
 */
          __pyx_t_1 = __Pyx_PyInt_From_Uint32(__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2213, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2213, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2213, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (__pyx_t_10) {
            __pyx_t_3 = __Pyx_PyInt_From_Uint32(__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2213, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_6 = __pyx_t_3;
            __pyx_t_3 = 0;
          } else {
            __Pyx_INCREF(__pyx_t_2);
            __pyx_t_6 = __pyx_t_2;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __pyx_t_6;
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2211
 *                     # Adjust ducking (if necessary)
 *                     if sound_instance.ducking is not None:
 *                         request_message.data.stop.ducking_release_duration = min(             # <<<<<<<<<<<<<<
 *                             sound_instance.ducking.release * seconds_to_bytes_factor,
 *                             request_message.data.stop.fade_out_duration)
 */
          __pyx_t_6 = __pyx_convert__to_py___pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataStopSound(__pyx_v_request_message->data.stop); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2211, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__Pyx_PyObject_SetAttrStr(__pyx_t_6, __pyx_n_s_ducking_release_duration, __pyx_t_2) < 0) __PYX_ERR(0, 2211, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2210
 * 
 *                     # Adjust ducking (if necessary)
 *                     if sound_instance.ducking is not None:             # <<<<<<<<<<<<<<
 *                         request_message.data.stop.ducking_release_duration = min(
 *                             sound_instance.ducking.release * seconds_to_bytes_factor,
 */
        }

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2197
 *                 # Set stop sound event
 *                 request_message = self._get_available_request_message()
 *                 if request_message != NULL:             # <<<<<<<<<<<<<<
 *                     request_message.message = request_sound_stop
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id
 */
        goto __pyx_L8;
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2215
 *                             request_message.data.stop.fade_out_duration)
 *                 else:
 *                     self.log.error(             # <<<<<<<<<<<<<<
 *                         "All internal audio messages are currently "
 *                         "in use, could not stop sound %s", sound_instance.name)
 */
      /*else*/ {
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2215, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2217
 *                     self.log.error(
 *                         "All internal audio messages are currently "
 *                         "in use, could not stop sound %s", sound_instance.name)             # <<<<<<<<<<<<<<
 * 
 *         # Remove any instances of the specified sound that are pending in the sound queue.
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2217, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_5 = 1;
          }
        }
        __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2215, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_1) {
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_All_internal_audio_messages_are);
        __Pyx_GIVEREF(__pyx_kp_u_All_internal_audio_messages_are);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_kp_u_All_internal_audio_messages_are);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2215, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __pyx_L8:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2193
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and self.type_state.sound_players[             # <<<<<<<<<<<<<<
 *                 i].current.sound_instance_id == sound_instance.id:
 *                 # Set stop sound event
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2220
 * 
 *         # Remove any instances of the specified sound that are pending in the sound queue.
 *         self._remove_sound_from_queue(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_sound_from_queue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sound_instance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_sound_instance);
    __Pyx_GIVEREF(__pyx_v_sound_instance);
    PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_sound_instance);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2222
 *         self._remove_sound_from_queue(sound_instance)
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound_looping(self, sound_instance not None):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2180
 *         self.log.debug("Queueing sound %s", entry)
 * 
 *     def stop_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound immediately on the track. Any queued instances
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.stop_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_seconds_to_bytes_factor);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2224
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def stop_sound_looping(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound on the track after they finish the current loop.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25stop_sound_looping(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_24stop_sound_looping[] = "TrackStandard.stop_sound_looping(self, sound_instance)\n\n        Stops all instances of the specified sound on the track after they finish the current loop.\n        Any queued instances of the sound will be removed.\n        Args:\n            sound_instance: The Sound to stop\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25stop_sound_looping(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound_looping (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 2224, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_24stop_sound_looping(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_24stop_sound_looping(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("stop_sound_looping", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2232
 *         """
 * 
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.type_state.sound_player_count):
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2234
 *         SDL_LockMutex(self.mutex)
 * 
 *         for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[i].status != player_idle and self.type_state.sound_players[
 *                 i].current.sound_instance_id == sound_instance.id:
 */
  __pyx_t_1 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2235
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and self.type_state.sound_players[             # <<<<<<<<<<<<<<
 *                 i].current.sound_instance_id == sound_instance.id:
 *                 # Set sound's loops_remaining variable to zero
 */
    __pyx_t_4 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2236
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and self.type_state.sound_players[
 *                 i].current.sound_instance_id == sound_instance.id:             # <<<<<<<<<<<<<<
 *                 # Set sound's loops_remaining variable to zero
 *                 self.type_state.sound_players[i].current.loops_remaining = 0
 */
    __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2236, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2236, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2235
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and self.type_state.sound_players[             # <<<<<<<<<<<<<<
 *                 i].current.sound_instance_id == sound_instance.id:
 *                 # Set sound's loops_remaining variable to zero
 */
    if (__pyx_t_3) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2238
 *                 i].current.sound_instance_id == sound_instance.id:
 *                 # Set sound's loops_remaining variable to zero
 *                 self.type_state.sound_players[i].current.loops_remaining = 0             # <<<<<<<<<<<<<<
 * 
 *         # Remove any instances of the specified sound that are pending in the sound queue.
 */
      (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.loops_remaining = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2235
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and self.type_state.sound_players[             # <<<<<<<<<<<<<<
 *                 i].current.sound_instance_id == sound_instance.id:
 *                 # Set sound's loops_remaining variable to zero
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2241
 * 
 *         # Remove any instances of the specified sound that are pending in the sound queue.
 *         self._remove_sound_from_queue(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_sound_from_queue); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_sound_instance); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  } else {
    __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_sound_instance);
    __Pyx_GIVEREF(__pyx_v_sound_instance);
    PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_sound_instance);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2243
 *         self._remove_sound_from_queue(sound_instance)
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def stop_all_sounds(self, float fade_out_seconds = 0.0):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2224
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def stop_sound_looping(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound on the track after they finish the current loop.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.stop_sound_looping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2245
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def stop_all_sounds(self, float fade_out_seconds = 0.0):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all playing sounds immediately on the track.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_27stop_all_sounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_26stop_all_sounds[] = "TrackStandard.stop_all_sounds(self, float fade_out_seconds=0.0)\n\n        Stops all playing sounds immediately on the track.\n        Args:\n            fade_out_seconds: The number of seconds to fade out the sounds before stopping\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_27stop_all_sounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_fade_out_seconds;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_all_sounds (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fade_out_seconds,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fade_out_seconds);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stop_all_sounds") < 0)) __PYX_ERR(0, 2245, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_fade_out_seconds = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_fade_out_seconds == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 2245, __pyx_L3_error)
    } else {
      __pyx_v_fade_out_seconds = ((float)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("stop_all_sounds", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2245, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.stop_all_sounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_26stop_all_sounds(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), __pyx_v_fade_out_seconds);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_26stop_all_sounds(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, float __pyx_v_fade_out_seconds) {
  int __pyx_v_i;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *__pyx_v_request_message;
  PyObject *__pyx_v_seconds_to_bytes_factor = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  long __pyx_t_6;
  int __pyx_t_7;
  Uint32 __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("stop_all_sounds", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2251
 *             fade_out_seconds: The number of seconds to fade out the sounds before stopping
 *         """
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("Stopping all sounds and removing any pending sounds from queue")
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2253
 *         SDL_LockMutex(self.mutex)
 * 
 *         self.log.debug("Stopping all sounds and removing any pending sounds from queue")             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.type_state.sound_player_count):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2255
 *         self.log.debug("Stopping all sounds and removing any pending sounds from queue")
 * 
 *         for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[i].status != player_idle:
 *                 # Set stop sound event
 */
  __pyx_t_3 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2256
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:             # <<<<<<<<<<<<<<
 *                 # Set stop sound event
 *                 request_message = self._get_available_request_message()
 */
    __pyx_t_5 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (__pyx_t_5) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2258
 *             if self.type_state.sound_players[i].status != player_idle:
 *                 # Set stop sound event
 *                 request_message = self._get_available_request_message()             # <<<<<<<<<<<<<<
 *                 if request_message != NULL:
 *                     request_message.message = request_sound_stop
 */
      __pyx_v_request_message = ((struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_available_request_message(__pyx_v_self);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2259
 *                 # Set stop sound event
 *                 request_message = self._get_available_request_message()
 *                 if request_message != NULL:             # <<<<<<<<<<<<<<
 *                     request_message.message = request_sound_stop
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id
 */
      __pyx_t_5 = ((__pyx_v_request_message != NULL) != 0);
      if (__pyx_t_5) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2260
 *                 request_message = self._get_available_request_message()
 *                 if request_message != NULL:
 *                     request_message.message = request_sound_stop             # <<<<<<<<<<<<<<
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id
 *                     request_message.sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 */
        __pyx_v_request_message->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_stop;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2261
 *                 if request_message != NULL:
 *                     request_message.message = request_sound_stop
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id             # <<<<<<<<<<<<<<
 *                     request_message.sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 *                     request_message.track = self.number
 */
        __pyx_t_6 = (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_id;
        __pyx_v_request_message->sound_id = __pyx_t_6;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2262
 *                     request_message.message = request_sound_stop
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id
 *                     request_message.sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id             # <<<<<<<<<<<<<<
 *                     request_message.track = self.number
 *                     request_message.player = i
 */
        __pyx_t_6 = (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id;
        __pyx_v_request_message->sound_instance_id = __pyx_t_6;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2263
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id
 *                     request_message.sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 *                     request_message.track = self.number             # <<<<<<<<<<<<<<
 *                     request_message.player = i
 *                     request_message.time = SDL_GetTicks()
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_number); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2263, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2263, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_request_message->track = __pyx_t_7;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2264
 *                     request_message.sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 *                     request_message.track = self.number
 *                     request_message.player = i             # <<<<<<<<<<<<<<
 *                     request_message.time = SDL_GetTicks()
 * 
 */
        __pyx_v_request_message->player = __pyx_v_i;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2265
 *                     request_message.track = self.number
 *                     request_message.player = i
 *                     request_message.time = SDL_GetTicks()             # <<<<<<<<<<<<<<
 * 
 *                     # Fade out
 */
        __pyx_v_request_message->time = SDL_GetTicks();

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2268
 * 
 *                     # Fade out
 *                     seconds_to_bytes_factor = self._audio_callback_data.sample_rate * self._audio_callback_data.audio_channels * BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 *                     request_message.data.stop.fade_out_duration = fade_out_seconds * seconds_to_bytes_factor
 * 
 */
        __pyx_t_2 = __Pyx_PyInt_From_long(((__pyx_v_self->__pyx_base._audio_callback_data->sample_rate * __pyx_v_self->__pyx_base._audio_callback_data->audio_channels) * 2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2268, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_XDECREF_SET(__pyx_v_seconds_to_bytes_factor, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2269
 *                     # Fade out
 *                     seconds_to_bytes_factor = self._audio_callback_data.sample_rate * self._audio_callback_data.audio_channels * BYTES_PER_SAMPLE
 *                     request_message.data.stop.fade_out_duration = fade_out_seconds * seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 * 
 *                     # Adjust ducking (if necessary)
 */
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_fade_out_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2269, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2269, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_8 = __Pyx_PyInt_As_Uint32(__pyx_t_1); if (unlikely((__pyx_t_8 == (Uint32)-1) && PyErr_Occurred())) __PYX_ERR(0, 2269, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_request_message->data.stop.fade_out_duration = __pyx_t_8;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2259
 *                 # Set stop sound event
 *                 request_message = self._get_available_request_message()
 *                 if request_message != NULL:             # <<<<<<<<<<<<<<
 *                     request_message.message = request_sound_stop
 *                     request_message.sound_id = self.type_state.sound_players[i].current.sound_id
 */
        goto __pyx_L6;
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2275
 *                     pass
 *                 else:
 *                     self.log.error("All internal audio messages are currently in use, could not stop all sounds")             # <<<<<<<<<<<<<<
 * 
 *         # Remove all sounds that are pending in the sound queue.
 */
      /*else*/ {
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2275, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2275, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_L6:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2256
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:             # <<<<<<<<<<<<<<
 *                 # Set stop sound event
 *                 request_message = self._get_available_request_message()
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2278
 * 
 *         # Remove all sounds that are pending in the sound queue.
 *         self._remove_all_sounds_from_queue()             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_all_sounds_from_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_9) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2278, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2278, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2280
 *         self._remove_all_sounds_from_queue()
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     cdef tuple _get_sound_player_with_lowest_priority(self):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2245
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def stop_all_sounds(self, float fade_out_seconds = 0.0):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all playing sounds immediately on the track.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.stop_all_sounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_seconds_to_bytes_factor);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2282
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     cdef tuple _get_sound_player_with_lowest_priority(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieves the sound player currently with the lowest priority.
 */

static PyObject *__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_sound_player_with_lowest_priority(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  int __pyx_v_lowest_priority;
  int __pyx_v_sound_player;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_get_sound_player_with_lowest_priority", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2293
 *         # NOTE: The SDL Mutex must be held while calling this function
 * 
 *         cdef int lowest_priority = 2147483647             # <<<<<<<<<<<<<<
 *         cdef int sound_player = -1
 *         cdef int i
 */
  __pyx_v_lowest_priority = 0x7FFFFFFF;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2294
 * 
 *         cdef int lowest_priority = 2147483647
 *         cdef int sound_player = -1             # <<<<<<<<<<<<<<
 *         cdef int i
 * 
 */
  __pyx_v_sound_player = -1;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2297
 *         cdef int i
 * 
 *         for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[i].status == player_idle:
 *                 SDL_UnlockMutex(self.mutex)
 */
  __pyx_t_1 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2298
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status == player_idle:             # <<<<<<<<<<<<<<
 *                 SDL_UnlockMutex(self.mutex)
 *                 return i, None
 */
    __pyx_t_3 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status == __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (__pyx_t_3) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2299
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status == player_idle:
 *                 SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *                 return i, None
 *             elif self.type_state.sound_players[i].current.sound_priority < lowest_priority:
 */
      SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2300
 *             if self.type_state.sound_players[i].status == player_idle:
 *                 SDL_UnlockMutex(self.mutex)
 *                 return i, None             # <<<<<<<<<<<<<<
 *             elif self.type_state.sound_players[i].current.sound_priority < lowest_priority:
 *                 lowest_priority = self.type_state.sound_players[i].current.sound_priority
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_5, 1, Py_None);
      __pyx_t_4 = 0;
      __pyx_r = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2298
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status == player_idle:             # <<<<<<<<<<<<<<
 *                 SDL_UnlockMutex(self.mutex)
 *                 return i, None
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2301
 *                 SDL_UnlockMutex(self.mutex)
 *                 return i, None
 *             elif self.type_state.sound_players[i].current.sound_priority < lowest_priority:             # <<<<<<<<<<<<<<
 *                 lowest_priority = self.type_state.sound_players[i].current.sound_priority
 *                 sound_player = i
 */
    __pyx_t_3 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_priority < __pyx_v_lowest_priority) != 0);
    if (__pyx_t_3) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2302
 *                 return i, None
 *             elif self.type_state.sound_players[i].current.sound_priority < lowest_priority:
 *                 lowest_priority = self.type_state.sound_players[i].current.sound_priority             # <<<<<<<<<<<<<<
 *                 sound_player = i
 * 
 */
      __pyx_t_6 = (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_priority;
      __pyx_v_lowest_priority = __pyx_t_6;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2303
 *             elif self.type_state.sound_players[i].current.sound_priority < lowest_priority:
 *                 lowest_priority = self.type_state.sound_players[i].current.sound_priority
 *                 sound_player = i             # <<<<<<<<<<<<<<
 * 
 *         return sound_player, lowest_priority
 */
      __pyx_v_sound_player = __pyx_v_i;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2301
 *                 SDL_UnlockMutex(self.mutex)
 *                 return i, None
 *             elif self.type_state.sound_players[i].current.sound_priority < lowest_priority:             # <<<<<<<<<<<<<<
 *                 lowest_priority = self.type_state.sound_players[i].current.sound_priority
 *                 sound_player = i
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2305
 *                 sound_player = i
 * 
 *         return sound_player, lowest_priority             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _play_sound_on_sound_player(self, sound_instance, int player, bint force=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_sound_player); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_lowest_priority); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __pyx_t_5 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2282
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     cdef tuple _get_sound_player_with_lowest_priority(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieves the sound player currently with the lowest priority.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard._get_sound_player_with_lowest_priority", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2307
 *         return sound_player, lowest_priority
 * 
 *     cdef bint _play_sound_on_sound_player(self, sound_instance, int player, bint force=False):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound using the specified sound player
 */

static int __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance, int __pyx_v_player, struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player *__pyx_optional_args) {
  int __pyx_v_force = ((int)0);
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_chunk_container = 0;
  __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *__pyx_v_request_message;
  PyObject *__pyx_v_seconds_to_bytes_factor = NULL;
  PyObject *__pyx_v_index = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  long __pyx_t_11;
  int __pyx_t_12;
  struct Mix_Chunk *__pyx_t_13;
  Uint32 __pyx_t_14;
  Uint8 __pyx_t_15;
  PyObject *(*__pyx_t_16)(PyObject *);
  Py_ssize_t __pyx_t_17;
  int __pyx_t_18;
  Sint32 __pyx_t_19;
  __Pyx_RefNannySetupContext("_play_sound_on_sound_player", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_force = __pyx_optional_args->force;
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2321
 *         """
 *         # NOTE: The SDL Mutex must be held while calling this function
 *         self.log.debug("_play_sound_on_sound_player: %s, %s, %s", str(sound_instance), str(player), str(force))             # <<<<<<<<<<<<<<
 * 
 *         # Get the sound sample buffer container
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_sound_instance);
  __Pyx_GIVEREF(__pyx_v_sound_instance);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_sound_instance);
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_player); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_force); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_play_sound_on_sound_player_s_s);
  __Pyx_GIVEREF(__pyx_kp_u_play_sound_on_sound_player_s_s);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_play_sound_on_sound_player_s_s);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2324
 * 
 *         # Get the sound sample buffer container
 *         cdef MixChunkContainer chunk_container = sound_instance.container             # <<<<<<<<<<<<<<
 *         cdef RequestMessageContainer *request_message
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_container); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer))))) __PYX_ERR(0, 2324, __pyx_L1_error)
  __pyx_v_chunk_container = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2327
 *         cdef RequestMessageContainer *request_message
 * 
 *         if not sound_instance.sound.loaded:             # <<<<<<<<<<<<<<
 *             self.log.debug("Specified sound is not loaded, could not "
 *                            "play sound %s", sound_instance.name)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_loaded); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2327, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = ((!__pyx_t_9) != 0);
  if (__pyx_t_10) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2328
 * 
 *         if not sound_instance.sound.loaded:
 *             self.log.debug("Specified sound is not loaded, could not "             # <<<<<<<<<<<<<<
 *                            "play sound %s", sound_instance.name)
 *             return False
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2329
 *         if not sound_instance.sound.loaded:
 *             self.log.debug("Specified sound is not loaded, could not "
 *                            "play sound %s", sound_instance.name)             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_3 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Specified_sound_is_not_loaded_co);
    __Pyx_GIVEREF(__pyx_kp_u_Specified_sound_is_not_loaded_co);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_kp_u_Specified_sound_is_not_loaded_co);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2330
 *             self.log.debug("Specified sound is not loaded, could not "
 *                            "play sound %s", sound_instance.name)
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         # Make sure the player in range
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2327
 *         cdef RequestMessageContainer *request_message
 * 
 *         if not sound_instance.sound.loaded:             # <<<<<<<<<<<<<<
 *             self.log.debug("Specified sound is not loaded, could not "
 *                            "play sound %s", sound_instance.name)
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2333
 * 
 *         # Make sure the player in range
 *         if player in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 * 
 *             # If the specified sound player is not idle do not play the sound if force is not set
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_player); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->type_state->sound_player_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2333, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = (__pyx_t_10 != 0);
  if (__pyx_t_9) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2336
 * 
 *             # If the specified sound player is not idle do not play the sound if force is not set
 *             if self.type_state.sound_players[player].status != player_idle and not force:             # <<<<<<<<<<<<<<
 *                 self.log.debug("All sound players are currently in use, "
 *                                "could not play sound %s", sound_instance.name)
 */
    __pyx_t_10 = (((__pyx_v_self->type_state->sound_players[__pyx_v_player]).status != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (__pyx_t_10) {
    } else {
      __pyx_t_9 = __pyx_t_10;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_10 = ((!(__pyx_v_force != 0)) != 0);
    __pyx_t_9 = __pyx_t_10;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_9) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2337
 *             # If the specified sound player is not idle do not play the sound if force is not set
 *             if self.type_state.sound_players[player].status != player_idle and not force:
 *                 self.log.debug("All sound players are currently in use, "             # <<<<<<<<<<<<<<
 *                                "could not play sound %s", sound_instance.name)
 *                 return False
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2338
 *             if self.type_state.sound_players[player].status != player_idle and not force:
 *                 self.log.debug("All sound players are currently in use, "
 *                                "could not play sound %s", sound_instance.name)             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_All_sound_players_are_currently);
      __Pyx_GIVEREF(__pyx_kp_u_All_sound_players_are_currently);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_kp_u_All_sound_players_are_currently);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2339
 *                 self.log.debug("All sound players are currently in use, "
 *                                "could not play sound %s", sound_instance.name)
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *             # Set play sound event
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2336
 * 
 *             # If the specified sound player is not idle do not play the sound if force is not set
 *             if self.type_state.sound_players[player].status != player_idle and not force:             # <<<<<<<<<<<<<<
 *                 self.log.debug("All sound players are currently in use, "
 *                                "could not play sound %s", sound_instance.name)
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2342
 * 
 *             # Set play sound event
 *             request_message = self._get_available_request_message()             # <<<<<<<<<<<<<<
 *             if request_message != NULL:
 * 
 */
    __pyx_v_request_message = ((struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_available_request_message(__pyx_v_self);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2343
 *             # Set play sound event
 *             request_message = self._get_available_request_message()
 *             if request_message != NULL:             # <<<<<<<<<<<<<<
 * 
 *                 # Add sound to the dictionary of active sound instances
 */
    __pyx_t_9 = ((__pyx_v_request_message != NULL) != 0);
    if (__pyx_t_9) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2346
 * 
 *                 # Add sound to the dictionary of active sound instances
 *                 self.log.debug("Adding sound instance %s to active sound dictionary", str(sound_instance))             # <<<<<<<<<<<<<<
 *                 self._sound_instances_by_id[sound_instance.id] = sound_instance
 * 
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_sound_instance);
      __Pyx_GIVEREF(__pyx_v_sound_instance);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_sound_instance);
      __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_Adding_sound_instance_s_to_activ);
      __Pyx_GIVEREF(__pyx_kp_u_Adding_sound_instance_s_to_activ);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_Adding_sound_instance_s_to_activ);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2347
 *                 # Add sound to the dictionary of active sound instances
 *                 self.log.debug("Adding sound instance %s to active sound dictionary", str(sound_instance))
 *                 self._sound_instances_by_id[sound_instance.id] = sound_instance             # <<<<<<<<<<<<<<
 * 
 *                 if self.type_state.sound_players[player].status != player_idle:
 */
      if (unlikely(__pyx_v_self->__pyx_base._sound_instances_by_id == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 2347, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(PyDict_SetItem(__pyx_v_self->__pyx_base._sound_instances_by_id, __pyx_t_1, __pyx_v_sound_instance) < 0)) __PYX_ERR(0, 2347, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2349
 *                 self._sound_instances_by_id[sound_instance.id] = sound_instance
 * 
 *                 if self.type_state.sound_players[player].status != player_idle:             # <<<<<<<<<<<<<<
 *                     request_message.message = request_sound_replace
 *                 else:
 */
      __pyx_t_9 = (((__pyx_v_self->type_state->sound_players[__pyx_v_player]).status != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
      if (__pyx_t_9) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2350
 * 
 *                 if self.type_state.sound_players[player].status != player_idle:
 *                     request_message.message = request_sound_replace             # <<<<<<<<<<<<<<
 *                 else:
 *                     # Reserve the sound player for this sound (it is no longer idle)
 */
        __pyx_v_request_message->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_replace;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2349
 *                 self._sound_instances_by_id[sound_instance.id] = sound_instance
 * 
 *                 if self.type_state.sound_players[player].status != player_idle:             # <<<<<<<<<<<<<<
 *                     request_message.message = request_sound_replace
 *                 else:
 */
        goto __pyx_L9;
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2353
 *                 else:
 *                     # Reserve the sound player for this sound (it is no longer idle)
 *                     self.type_state.sound_players[player].status = player_pending             # <<<<<<<<<<<<<<
 *                     request_message.message = request_sound_play
 * 
 */
      /*else*/ {
        (__pyx_v_self->type_state->sound_players[__pyx_v_player]).status = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_pending;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2354
 *                     # Reserve the sound player for this sound (it is no longer idle)
 *                     self.type_state.sound_players[player].status = player_pending
 *                     request_message.message = request_sound_play             # <<<<<<<<<<<<<<
 * 
 *                 request_message.sound_id = sound_instance.sound.id
 */
        __pyx_v_request_message->message = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_request_sound_play;
      }
      __pyx_L9:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2356
 *                     request_message.message = request_sound_play
 * 
 *                 request_message.sound_id = sound_instance.sound.id             # <<<<<<<<<<<<<<
 *                 request_message.sound_instance_id = sound_instance.id
 *                 request_message.track = self.number
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 2356, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_request_message->sound_id = __pyx_t_11;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2357
 * 
 *                 request_message.sound_id = sound_instance.sound.id
 *                 request_message.sound_instance_id = sound_instance.id             # <<<<<<<<<<<<<<
 *                 request_message.track = self.number
 *                 request_message.player = player
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 2357, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_request_message->sound_instance_id = __pyx_t_11;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2358
 *                 request_message.sound_id = sound_instance.sound.id
 *                 request_message.sound_instance_id = sound_instance.id
 *                 request_message.track = self.number             # <<<<<<<<<<<<<<
 *                 request_message.player = player
 *                 request_message.time = SDL_GetTicks()
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_number); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2358, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2358, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_request_message->track = __pyx_t_12;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2359
 *                 request_message.sound_instance_id = sound_instance.id
 *                 request_message.track = self.number
 *                 request_message.player = player             # <<<<<<<<<<<<<<
 *                 request_message.time = SDL_GetTicks()
 *                 request_message.data.play.loops = sound_instance.loops
 */
      __pyx_v_request_message->player = __pyx_v_player;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2360
 *                 request_message.track = self.number
 *                 request_message.player = player
 *                 request_message.time = SDL_GetTicks()             # <<<<<<<<<<<<<<
 *                 request_message.data.play.loops = sound_instance.loops
 *                 request_message.data.play.priority = sound_instance.priority
 */
      __pyx_v_request_message->time = SDL_GetTicks();

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2361
 *                 request_message.player = player
 *                 request_message.time = SDL_GetTicks()
 *                 request_message.data.play.loops = sound_instance.loops             # <<<<<<<<<<<<<<
 *                 request_message.data.play.priority = sound_instance.priority
 *                 request_message.data.play.chunk = chunk_container.chunk
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_loops); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2361, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2361, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_request_message->data.play.loops = __pyx_t_12;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2362
 *                 request_message.time = SDL_GetTicks()
 *                 request_message.data.play.loops = sound_instance.loops
 *                 request_message.data.play.priority = sound_instance.priority             # <<<<<<<<<<<<<<
 *                 request_message.data.play.chunk = chunk_container.chunk
 * 
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2362, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2362, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_request_message->data.play.priority = __pyx_t_12;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2363
 *                 request_message.data.play.loops = sound_instance.loops
 *                 request_message.data.play.priority = sound_instance.priority
 *                 request_message.data.play.chunk = chunk_container.chunk             # <<<<<<<<<<<<<<
 * 
 *                 # Conversion factor (seconds to bytes/buffer position)
 */
      __pyx_t_13 = __pyx_v_chunk_container->chunk;
      __pyx_v_request_message->data.play.chunk = __pyx_t_13;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2366
 * 
 *                 # Conversion factor (seconds to bytes/buffer position)
 *                 seconds_to_bytes_factor = self._audio_callback_data.sample_rate * self._audio_callback_data.audio_channels * BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 *                 request_message.data.play.start_at_position = <Uint32>(sound_instance.start_at * seconds_to_bytes_factor)
 */
      __pyx_t_2 = __Pyx_PyInt_From_long(((__pyx_v_self->__pyx_base._audio_callback_data->sample_rate * __pyx_v_self->__pyx_base._audio_callback_data->audio_channels) * 2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_seconds_to_bytes_factor = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2368
 *                 seconds_to_bytes_factor = self._audio_callback_data.sample_rate * self._audio_callback_data.audio_channels * BYTES_PER_SAMPLE
 * 
 *                 request_message.data.play.start_at_position = <Uint32>(sound_instance.start_at * seconds_to_bytes_factor)             # <<<<<<<<<<<<<<
 *                 request_message.data.play.fade_in_duration = <Uint32>(sound_instance.fade_in * seconds_to_bytes_factor)
 *                 request_message.data.play.fade_out_duration = <Uint32>(sound_instance.fade_out * seconds_to_bytes_factor)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_start_at); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2368, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2368, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_14 = __Pyx_PyInt_As_Uint32(__pyx_t_1); if (unlikely((__pyx_t_14 == (Uint32)-1) && PyErr_Occurred())) __PYX_ERR(0, 2368, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_request_message->data.play.start_at_position = ((Uint32)__pyx_t_14);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2369
 * 
 *                 request_message.data.play.start_at_position = <Uint32>(sound_instance.start_at * seconds_to_bytes_factor)
 *                 request_message.data.play.fade_in_duration = <Uint32>(sound_instance.fade_in * seconds_to_bytes_factor)             # <<<<<<<<<<<<<<
 *                 request_message.data.play.fade_out_duration = <Uint32>(sound_instance.fade_out * seconds_to_bytes_factor)
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_fade_in); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_14 = __Pyx_PyInt_As_Uint32(__pyx_t_2); if (unlikely((__pyx_t_14 == (Uint32)-1) && PyErr_Occurred())) __PYX_ERR(0, 2369, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_request_message->data.play.fade_in_duration = ((Uint32)__pyx_t_14);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2370
 *                 request_message.data.play.start_at_position = <Uint32>(sound_instance.start_at * seconds_to_bytes_factor)
 *                 request_message.data.play.fade_in_duration = <Uint32>(sound_instance.fade_in * seconds_to_bytes_factor)
 *                 request_message.data.play.fade_out_duration = <Uint32>(sound_instance.fade_out * seconds_to_bytes_factor)             # <<<<<<<<<<<<<<
 * 
 *                 # Volume must be converted from a float (0.0 to 1.0) to an 8-bit integer (0..MIX_MAX_VOLUME)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_fade_out); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_14 = __Pyx_PyInt_As_Uint32(__pyx_t_1); if (unlikely((__pyx_t_14 == (Uint32)-1) && PyErr_Occurred())) __PYX_ERR(0, 2370, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_request_message->data.play.fade_out_duration = ((Uint32)__pyx_t_14);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2373
 * 
 *                 # Volume must be converted from a float (0.0 to 1.0) to an 8-bit integer (0..MIX_MAX_VOLUME)
 *                 request_message.data.play.volume = <Uint8>(sound_instance.volume * MIX_MAX_VOLUME)             # <<<<<<<<<<<<<<
 * 
 *                 # If the sound has any markers, set them
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2373, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_From_int(MIX_MAX_VOLUME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2373, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2373, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_15 = __Pyx_PyInt_As_Uint8(__pyx_t_8); if (unlikely((__pyx_t_15 == (Uint8)-1) && PyErr_Occurred())) __PYX_ERR(0, 2373, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_request_message->data.play.volume = ((Uint8)__pyx_t_15);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2376
 * 
 *                 # If the sound has any markers, set them
 *                 request_message.data.play.marker_count = sound_instance.marker_count             # <<<<<<<<<<<<<<
 *                 if sound_instance.marker_count > 0:
 *                     for index in range(sound_instance.marker_count):
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_marker_count); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2376, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_request_message->data.play.marker_count = __pyx_t_12;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2377
 *                 # If the sound has any markers, set them
 *                 request_message.data.play.marker_count = sound_instance.marker_count
 *                 if sound_instance.marker_count > 0:             # <<<<<<<<<<<<<<
 *                     for index in range(sound_instance.marker_count):
 *                         request_message.data.play.markers[index] = <long>(sound_instance.markers[index]['time'] * seconds_to_bytes_factor)
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_marker_count); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2377, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_8, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2377, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2377, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_9) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2378
 *                 request_message.data.play.marker_count = sound_instance.marker_count
 *                 if sound_instance.marker_count > 0:
 *                     for index in range(sound_instance.marker_count):             # <<<<<<<<<<<<<<
 *                         request_message.data.play.markers[index] = <long>(sound_instance.markers[index]['time'] * seconds_to_bytes_factor)
 * 
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_marker_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2378, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2378, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2378, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
          __pyx_t_8 = __pyx_t_2; __Pyx_INCREF(__pyx_t_8); __pyx_t_7 = 0;
          __pyx_t_16 = NULL;
        } else {
          __pyx_t_7 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2378, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_16 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2378, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        for (;;) {
          if (likely(!__pyx_t_16)) {
            if (likely(PyList_CheckExact(__pyx_t_8))) {
              if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_8)) break;
              #if CYTHON_COMPILING_IN_CPYTHON
              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 2378, __pyx_L1_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_8, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2378, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            } else {
              if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
              #if CYTHON_COMPILING_IN_CPYTHON
              __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 2378, __pyx_L1_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_8, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2378, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            }
          } else {
            __pyx_t_2 = __pyx_t_16(__pyx_t_8);
            if (unlikely(!__pyx_t_2)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 2378, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2379
 *                 if sound_instance.marker_count > 0:
 *                     for index in range(sound_instance.marker_count):
 *                         request_message.data.play.markers[index] = <long>(sound_instance.markers[index]['time'] * seconds_to_bytes_factor)             # <<<<<<<<<<<<<<
 * 
 *                 # If the sound has ducking settings, apply them
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_markers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2379, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2379, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_u_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2379, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2379, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 2379, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2379, __pyx_L1_error)
          (__pyx_v_request_message->data.play.markers[__pyx_t_17]) = ((long)__pyx_t_11);

          /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2378
 *                 request_message.data.play.marker_count = sound_instance.marker_count
 *                 if sound_instance.marker_count > 0:
 *                     for index in range(sound_instance.marker_count):             # <<<<<<<<<<<<<<
 *                         request_message.data.play.markers[index] = <long>(sound_instance.markers[index]['time'] * seconds_to_bytes_factor)
 * 
 */
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2377
 *                 # If the sound has any markers, set them
 *                 request_message.data.play.marker_count = sound_instance.marker_count
 *                 if sound_instance.marker_count > 0:             # <<<<<<<<<<<<<<
 *                     for index in range(sound_instance.marker_count):
 *                         request_message.data.play.markers[index] = <long>(sound_instance.markers[index]['time'] * seconds_to_bytes_factor)
 */
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2382
 * 
 *                 # If the sound has ducking settings, apply them
 *                 if sound_instance.ducking is not None and sound_instance.ducking.track_bit_mask != 0:             # <<<<<<<<<<<<<<
 *                     # To convert between the number of seconds and a buffer position (bytes), we need to
 *                     # account for the sample rate (sampes per second), the number of audio channels, and the
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = (__pyx_t_8 != Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_18 = (__pyx_t_10 != 0);
      if (__pyx_t_18) {
      } else {
        __pyx_t_9 = __pyx_t_18;
        goto __pyx_L14_bool_binop_done;
      }
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_track_bit_mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = __pyx_t_18;
      __pyx_L14_bool_binop_done:;
      if (__pyx_t_9) {

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2386
 *                     # account for the sample rate (sampes per second), the number of audio channels, and the
 *                     # number of bytes per sample (all samples are 16 bits)
 *                     seconds_to_bytes_factor = self._audio_callback_data.sample_rate * self._audio_callback_data.audio_channels * BYTES_PER_SAMPLE             # <<<<<<<<<<<<<<
 * 
 *                     request_message.data.play.sound_has_ducking = True
 */
        __pyx_t_8 = __Pyx_PyInt_From_long(((__pyx_v_self->__pyx_base._audio_callback_data->sample_rate * __pyx_v_self->__pyx_base._audio_callback_data->audio_channels) * 2)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF_SET(__pyx_v_seconds_to_bytes_factor, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2388
 *                     seconds_to_bytes_factor = self._audio_callback_data.sample_rate * self._audio_callback_data.audio_channels * BYTES_PER_SAMPLE
 * 
 *                     request_message.data.play.sound_has_ducking = True             # <<<<<<<<<<<<<<
 *                     request_message.data.play.ducking_settings.track_bit_mask = sound_instance.ducking.track_bit_mask
 *                     request_message.data.play.ducking_settings.attack_start_pos = sound_instance.ducking.delay * seconds_to_bytes_factor
 */
        __pyx_v_request_message->data.play.sound_has_ducking = 1;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2389
 * 
 *                     request_message.data.play.sound_has_ducking = True
 *                     request_message.data.play.ducking_settings.track_bit_mask = sound_instance.ducking.track_bit_mask             # <<<<<<<<<<<<<<
 *                     request_message.data.play.ducking_settings.attack_start_pos = sound_instance.ducking.delay * seconds_to_bytes_factor
 *                     request_message.data.play.ducking_settings.attack_duration = sound_instance.ducking.attack * seconds_to_bytes_factor
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_track_bit_mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2389, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_request_message->data.play.ducking_settings.track_bit_mask = __pyx_t_12;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2390
 *                     request_message.data.play.sound_has_ducking = True
 *                     request_message.data.play.ducking_settings.track_bit_mask = sound_instance.ducking.track_bit_mask
 *                     request_message.data.play.ducking_settings.attack_start_pos = sound_instance.ducking.delay * seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 *                     request_message.data.play.ducking_settings.attack_duration = sound_instance.ducking.attack * seconds_to_bytes_factor
 *                     request_message.data.play.ducking_settings.attenuation_volume = <Uint8>(sound_instance.ducking.attenuation * MIX_MAX_VOLUME)
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2390, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_delay); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2390, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Multiply(__pyx_t_8, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2390, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_19 = __Pyx_PyInt_As_Sint32(__pyx_t_1); if (unlikely((__pyx_t_19 == (Sint32)-1) && PyErr_Occurred())) __PYX_ERR(0, 2390, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_request_message->data.play.ducking_settings.attack_start_pos = __pyx_t_19;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2391
 *                     request_message.data.play.ducking_settings.track_bit_mask = sound_instance.ducking.track_bit_mask
 *                     request_message.data.play.ducking_settings.attack_start_pos = sound_instance.ducking.delay * seconds_to_bytes_factor
 *                     request_message.data.play.ducking_settings.attack_duration = sound_instance.ducking.attack * seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 *                     request_message.data.play.ducking_settings.attenuation_volume = <Uint8>(sound_instance.ducking.attenuation * MIX_MAX_VOLUME)
 *                     request_message.data.play.ducking_settings.release_start_pos = sound_instance.ducking.release_point * seconds_to_bytes_factor
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2391, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_attack); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2391, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Multiply(__pyx_t_8, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2391, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_19 = __Pyx_PyInt_As_Sint32(__pyx_t_1); if (unlikely((__pyx_t_19 == (Sint32)-1) && PyErr_Occurred())) __PYX_ERR(0, 2391, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_request_message->data.play.ducking_settings.attack_duration = __pyx_t_19;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2392
 *                     request_message.data.play.ducking_settings.attack_start_pos = sound_instance.ducking.delay * seconds_to_bytes_factor
 *                     request_message.data.play.ducking_settings.attack_duration = sound_instance.ducking.attack * seconds_to_bytes_factor
 *                     request_message.data.play.ducking_settings.attenuation_volume = <Uint8>(sound_instance.ducking.attenuation * MIX_MAX_VOLUME)             # <<<<<<<<<<<<<<
 *                     request_message.data.play.ducking_settings.release_start_pos = sound_instance.ducking.release_point * seconds_to_bytes_factor
 *                     request_message.data.play.ducking_settings.release_duration = sound_instance.ducking.release * seconds_to_bytes_factor
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2392, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_attenuation); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2392, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyInt_From_int(MIX_MAX_VOLUME); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2392, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyNumber_Multiply(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_15 = __Pyx_PyInt_As_Uint8(__pyx_t_2); if (unlikely((__pyx_t_15 == (Uint8)-1) && PyErr_Occurred())) __PYX_ERR(0, 2392, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_request_message->data.play.ducking_settings.attenuation_volume = ((Uint8)__pyx_t_15);

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2393
 *                     request_message.data.play.ducking_settings.attack_duration = sound_instance.ducking.attack * seconds_to_bytes_factor
 *                     request_message.data.play.ducking_settings.attenuation_volume = <Uint8>(sound_instance.ducking.attenuation * MIX_MAX_VOLUME)
 *                     request_message.data.play.ducking_settings.release_start_pos = sound_instance.ducking.release_point * seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 *                     request_message.data.play.ducking_settings.release_duration = sound_instance.ducking.release * seconds_to_bytes_factor
 *                 else:
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_release_point); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_19 = __Pyx_PyInt_As_Sint32(__pyx_t_2); if (unlikely((__pyx_t_19 == (Sint32)-1) && PyErr_Occurred())) __PYX_ERR(0, 2393, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_request_message->data.play.ducking_settings.release_start_pos = __pyx_t_19;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2394
 *                     request_message.data.play.ducking_settings.attenuation_volume = <Uint8>(sound_instance.ducking.attenuation * MIX_MAX_VOLUME)
 *                     request_message.data.play.ducking_settings.release_start_pos = sound_instance.ducking.release_point * seconds_to_bytes_factor
 *                     request_message.data.play.ducking_settings.release_duration = sound_instance.ducking.release * seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 *                 else:
 *                     request_message.data.play.sound_has_ducking = False
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2394, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_release); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2394, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_seconds_to_bytes_factor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2394, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_19 = __Pyx_PyInt_As_Sint32(__pyx_t_2); if (unlikely((__pyx_t_19 == (Sint32)-1) && PyErr_Occurred())) __PYX_ERR(0, 2394, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_request_message->data.play.ducking_settings.release_duration = __pyx_t_19;

        /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2382
 * 
 *                 # If the sound has ducking settings, apply them
 *                 if sound_instance.ducking is not None and sound_instance.ducking.track_bit_mask != 0:             # <<<<<<<<<<<<<<
 *                     # To convert between the number of seconds and a buffer position (bytes), we need to
 *                     # account for the sample rate (sampes per second), the number of audio channels, and the
 */
        goto __pyx_L13;
      }

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2396
 *                     request_message.data.play.ducking_settings.release_duration = sound_instance.ducking.release * seconds_to_bytes_factor
 *                 else:
 *                     request_message.data.play.sound_has_ducking = False             # <<<<<<<<<<<<<<
 * 
 * 
 */
      /*else*/ {
        __pyx_v_request_message->data.play.sound_has_ducking = 0;
      }
      __pyx_L13:;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2343
 *             # Set play sound event
 *             request_message = self._get_available_request_message()
 *             if request_message != NULL:             # <<<<<<<<<<<<<<
 * 
 *                 # Add sound to the dictionary of active sound instances
 */
      goto __pyx_L8;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2400
 * 
 *             else:
 *                 self.log.warning("All internal audio messages are "             # <<<<<<<<<<<<<<
 *                                "currently in use, could not play sound %s"
 *                                , sound_instance.name)
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_warning); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2402
 *                 self.log.warning("All internal audio messages are "
 *                                "currently in use, could not play sound %s"
 *                                , sound_instance.name)             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_All_internal_audio_messages_are_3);
      __Pyx_GIVEREF(__pyx_kp_u_All_internal_audio_messages_are_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_kp_u_All_internal_audio_messages_are_3);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2403
 *                                "currently in use, could not play sound %s"
 *                                , sound_instance.name)
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *             self.log.debug("Sound %s is set to begin playback on player %d (loops=%d)",
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }
    __pyx_L8:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2405
 *                 return False
 * 
 *             self.log.debug("Sound %s is set to begin playback on player %d (loops=%d)",             # <<<<<<<<<<<<<<
 *                            sound_instance.name, player, sound_instance.loops)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2406
 * 
 *             self.log.debug("Sound %s is set to begin playback on player %d (loops=%d)",
 *                            sound_instance.name, player, sound_instance.loops)             # <<<<<<<<<<<<<<
 * 
 *             return True
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_player); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_loops); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_6 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Sound_s_is_set_to_begin_playback);
    __Pyx_GIVEREF(__pyx_kp_u_Sound_s_is_set_to_begin_playback);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_kp_u_Sound_s_is_set_to_begin_playback);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_t_3);
    __pyx_t_5 = 0;
    __pyx_t_8 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2408
 *                            sound_instance.name, player, sound_instance.loops)
 * 
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         return False
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2333
 * 
 *         # Make sure the player in range
 *         if player in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 * 
 *             # If the specified sound player is not idle do not play the sound if force is not set
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2410
 *             return True
 * 
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef int _get_player_playing_sound_instance(self, sound_instance):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2307
 *         return sound_player, lowest_priority
 * 
 *     cdef bint _play_sound_on_sound_player(self, sound_instance, int player, bint force=False):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound using the specified sound player
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard._play_sound_on_sound_player", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_chunk_container);
  __Pyx_XDECREF(__pyx_v_seconds_to_bytes_factor);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2412
 *         return False
 * 
 *     cdef int _get_player_playing_sound_instance(self, sound_instance):             # <<<<<<<<<<<<<<
 *         """
 *         Return the player currently playing the specified sound instance
 */

static int __pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_player_playing_sound_instance(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_get_player_playing_sound_instance", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2424
 *         # NOTE: The SDL Mutex must be held while calling this function
 * 
 *         for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 */
  __pyx_t_1 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2425
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \             # <<<<<<<<<<<<<<
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 return i
 */
    __pyx_t_4 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2426
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:             # <<<<<<<<<<<<<<
 *                 return i
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2426, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2426, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2425
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \             # <<<<<<<<<<<<<<
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 return i
 */
    if (__pyx_t_3) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2427
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 return i             # <<<<<<<<<<<<<<
 * 
 *         return -1
 */
      __pyx_r = __pyx_v_i;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2425
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \             # <<<<<<<<<<<<<<
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 return i
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2429
 *                 return i
 * 
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     def get_status(self):
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2412
 *         return False
 * 
 *     cdef int _get_player_playing_sound_instance(self, sound_instance):             # <<<<<<<<<<<<<<
 *         """
 *         Return the player currently playing the specified sound instance
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard._get_player_playing_sound_instance", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2431
 *         return -1
 * 
 *     def get_status(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current track status (status of all sound players on the track).
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_29get_status(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_28get_status[] = "TrackStandard.get_status(self)\n\n        Get the current track status (status of all sound players on the track).\n        Used for debugging and testing.\n        Returns:\n            A list of status dictionaries containing the current settings for each\n            sound player.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_29get_status(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_status (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_28get_status(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_28get_status(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_v_status = NULL;
  int __pyx_v_player;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  Py_ssize_t __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("get_status", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2439
 *             sound player.
 *         """
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *         status = []
 *         for player in range(self.type_state.sound_player_count):
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2440
 *         """
 *         SDL_LockMutex(self.mutex)
 *         status = []             # <<<<<<<<<<<<<<
 *         for player in range(self.type_state.sound_player_count):
 *             status.append({
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_status = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2441
 *         SDL_LockMutex(self.mutex)
 *         status = []
 *         for player in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             status.append({
 *                 "player": player,
 */
  __pyx_t_2 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_player = __pyx_t_3;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2443
 *         for player in range(self.type_state.sound_player_count):
 *             status.append({
 *                 "player": player,             # <<<<<<<<<<<<<<
 *                 "status": TrackStandard.player_status_to_text(<int>self.type_state.sound_players[player].status),
 *                 "fading_status": TrackStandard.player_fading_status_to_text(<int>self.type_state.sound_players[player].current.fading_status),
 */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_player); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_player, __pyx_t_4) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2444
 *             status.append({
 *                 "player": player,
 *                 "status": TrackStandard.player_status_to_text(<int>self.type_state.sound_players[player].status),             # <<<<<<<<<<<<<<
 *                 "fading_status": TrackStandard.player_fading_status_to_text(<int>self.type_state.sound_players[player].current.fading_status),
 *                 "volume": self.type_state.sound_players[player].current.volume,
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard), __pyx_n_s_player_status_to_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_int(((int)(__pyx_v_self->type_state->sound_players[__pyx_v_player]).status)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2444, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_status, __pyx_t_4) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2445
 *                 "player": player,
 *                 "status": TrackStandard.player_status_to_text(<int>self.type_state.sound_players[player].status),
 *                 "fading_status": TrackStandard.player_fading_status_to_text(<int>self.type_state.sound_players[player].current.fading_status),             # <<<<<<<<<<<<<<
 *                 "volume": self.type_state.sound_players[player].current.volume,
 *                 "sound_id": self.type_state.sound_players[player].current.sound_id,
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard), __pyx_n_s_player_fading_status_to_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyInt_From_int(((int)(__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.fading_status)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2445, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_fading_status, __pyx_t_4) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2446
 *                 "status": TrackStandard.player_status_to_text(<int>self.type_state.sound_players[player].status),
 *                 "fading_status": TrackStandard.player_fading_status_to_text(<int>self.type_state.sound_players[player].current.fading_status),
 *                 "volume": self.type_state.sound_players[player].current.volume,             # <<<<<<<<<<<<<<
 *                 "sound_id": self.type_state.sound_players[player].current.sound_id,
 *                 "sound_instance_id": self.type_state.sound_players[player].current.sound_instance_id,
 */
    __pyx_t_4 = __Pyx_PyInt_From_Uint8((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.volume); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2446, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_volume, __pyx_t_4) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2447
 *                 "fading_status": TrackStandard.player_fading_status_to_text(<int>self.type_state.sound_players[player].current.fading_status),
 *                 "volume": self.type_state.sound_players[player].current.volume,
 *                 "sound_id": self.type_state.sound_players[player].current.sound_id,             # <<<<<<<<<<<<<<
 *                 "sound_instance_id": self.type_state.sound_players[player].current.sound_instance_id,
 *                 "priority": self.type_state.sound_players[player].current.sound_priority,
 */
    __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2447, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_sound_id, __pyx_t_4) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2448
 *                 "volume": self.type_state.sound_players[player].current.volume,
 *                 "sound_id": self.type_state.sound_players[player].current.sound_id,
 *                 "sound_instance_id": self.type_state.sound_players[player].current.sound_instance_id,             # <<<<<<<<<<<<<<
 *                 "priority": self.type_state.sound_players[player].current.sound_priority,
 *                 "loops": self.type_state.sound_players[player].current.loops_remaining,
 */
    __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_instance_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_sound_instance_id, __pyx_t_4) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2449
 *                 "sound_id": self.type_state.sound_players[player].current.sound_id,
 *                 "sound_instance_id": self.type_state.sound_players[player].current.sound_instance_id,
 *                 "priority": self.type_state.sound_players[player].current.sound_priority,             # <<<<<<<<<<<<<<
 *                 "loops": self.type_state.sound_players[player].current.loops_remaining,
 *                 "has_ducking": self.type_state.sound_players[player].current.sound_has_ducking,
 */
    __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_priority); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_priority, __pyx_t_4) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2450
 *                 "sound_instance_id": self.type_state.sound_players[player].current.sound_instance_id,
 *                 "priority": self.type_state.sound_players[player].current.sound_priority,
 *                 "loops": self.type_state.sound_players[player].current.loops_remaining,             # <<<<<<<<<<<<<<
 *                 "has_ducking": self.type_state.sound_players[player].current.sound_has_ducking,
 *                 "sample_pos": self.type_state.sound_players[player].current.sample_pos
 */
    __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.loops_remaining); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_loops, __pyx_t_4) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2451
 *                 "priority": self.type_state.sound_players[player].current.sound_priority,
 *                 "loops": self.type_state.sound_players[player].current.loops_remaining,
 *                 "has_ducking": self.type_state.sound_players[player].current.sound_has_ducking,             # <<<<<<<<<<<<<<
 *                 "sample_pos": self.type_state.sound_players[player].current.sample_pos
 *             })
 */
    __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_has_ducking); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_has_ducking, __pyx_t_4) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2452
 *                 "loops": self.type_state.sound_players[player].current.loops_remaining,
 *                 "has_ducking": self.type_state.sound_players[player].current.sound_has_ducking,
 *                 "sample_pos": self.type_state.sound_players[player].current.sample_pos             # <<<<<<<<<<<<<<
 *             })
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_Uint32((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sample_pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2452, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_sample_pos, __pyx_t_4) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2442
 *         status = []
 *         for player in range(self.type_state.sound_player_count):
 *             status.append({             # <<<<<<<<<<<<<<
 *                 "player": player,
 *                 "status": TrackStandard.player_status_to_text(<int>self.type_state.sound_players[player].status),
 */
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_status, __pyx_t_1); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 2442, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2455
 *             })
 * 
 *             self.log.debug("Status - Player %d: Status=%s, Sound=%d, SoundInstance=%d"             # <<<<<<<<<<<<<<
 *                            "Priority=%d, Loops=%d, SamplePos=%d",
 *                            player,
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2457
 *             self.log.debug("Status - Player %d: Status=%s, Sound=%d, SoundInstance=%d"
 *                            "Priority=%d, Loops=%d, SamplePos=%d",
 *                            player,             # <<<<<<<<<<<<<<
 *                            TrackStandard.player_status_to_text(
 *                                self.type_state.sound_players[player].status),
 */
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_player); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2458
 *                            "Priority=%d, Loops=%d, SamplePos=%d",
 *                            player,
 *                            TrackStandard.player_status_to_text(             # <<<<<<<<<<<<<<
 *                                self.type_state.sound_players[player].status),
 *                            self.type_state.sound_players[player].current.sound_id,
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard), __pyx_n_s_player_status_to_text); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2459
 *                            player,
 *                            TrackStandard.player_status_to_text(
 *                                self.type_state.sound_players[player].status),             # <<<<<<<<<<<<<<
 *                            self.type_state.sound_players[player].current.sound_id,
 *                            self.type_state.sound_players[player].current.sound_instance_id,
 */
    __pyx_t_6 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus((__pyx_v_self->type_state->sound_players[__pyx_v_player]).status); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2458, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2460
 *                            TrackStandard.player_status_to_text(
 *                                self.type_state.sound_players[player].status),
 *                            self.type_state.sound_players[player].current.sound_id,             # <<<<<<<<<<<<<<
 *                            self.type_state.sound_players[player].current.sound_instance_id,
 *                            self.type_state.sound_players[player].current.sound_priority,
 */
    __pyx_t_8 = __Pyx_PyInt_From_long((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2461
 *                                self.type_state.sound_players[player].status),
 *                            self.type_state.sound_players[player].current.sound_id,
 *                            self.type_state.sound_players[player].current.sound_instance_id,             # <<<<<<<<<<<<<<
 *                            self.type_state.sound_players[player].current.sound_priority,
 *                            self.type_state.sound_players[player].current.loops_remaining,
 */
    __pyx_t_11 = __Pyx_PyInt_From_long((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_instance_id); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2461, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2462
 *                            self.type_state.sound_players[player].current.sound_id,
 *                            self.type_state.sound_players[player].current.sound_instance_id,
 *                            self.type_state.sound_players[player].current.sound_priority,             # <<<<<<<<<<<<<<
 *                            self.type_state.sound_players[player].current.loops_remaining,
 *                            self.type_state.sound_players[player].current.sample_pos)
 */
    __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_priority); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2463
 *                            self.type_state.sound_players[player].current.sound_instance_id,
 *                            self.type_state.sound_players[player].current.sound_priority,
 *                            self.type_state.sound_players[player].current.loops_remaining,             # <<<<<<<<<<<<<<
 *                            self.type_state.sound_players[player].current.sample_pos)
 * 
 */
    __pyx_t_10 = __Pyx_PyInt_From_int((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.loops_remaining); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2464
 *                            self.type_state.sound_players[player].current.sound_priority,
 *                            self.type_state.sound_players[player].current.loops_remaining,
 *                            self.type_state.sound_players[player].current.sample_pos)             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
    __pyx_t_12 = __Pyx_PyInt_From_Uint32((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sample_pos); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = NULL;
    __pyx_t_14 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_14 = 1;
      }
    }
    __pyx_t_15 = PyTuple_New(8+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    if (__pyx_t_13) {
      __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Status_Player_d_Status_s_Sound_d);
    __Pyx_GIVEREF(__pyx_kp_u_Status_Player_d_Status_s_Sound_d);
    PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_kp_u_Status_Player_d_Status_s_Sound_d);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_14, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_14, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_15, 4+__pyx_t_14, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_15, 5+__pyx_t_14, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_15, 6+__pyx_t_14, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_15, 7+__pyx_t_14, __pyx_t_12);
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_11 = 0;
    __pyx_t_6 = 0;
    __pyx_t_10 = 0;
    __pyx_t_12 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2466
 *                            self.type_state.sound_players[player].current.sample_pos)
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         return status
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2468
 *         SDL_UnlockMutex(self.mutex)
 * 
 *         return status             # <<<<<<<<<<<<<<
 * 
 *     def get_sound_queue_count(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_status);
  __pyx_r = __pyx_v_status;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2431
 *         return -1
 * 
 *     def get_status(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current track status (status of all sound players on the track).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.get_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_status);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2470
 *         return status
 * 
 *     def get_sound_queue_count(self):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the number of sounds currently in the track sound queue.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_31get_sound_queue_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_30get_sound_queue_count[] = "TrackStandard.get_sound_queue_count(self)\n\n        Gets the number of sounds currently in the track sound queue.\n        Returns:\n            Integer number of sounds currently in the track sound queue.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_31get_sound_queue_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sound_queue_count (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_30get_sound_queue_count(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_30get_sound_queue_count(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_sound_queue_count", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2476
 *             Integer number of sounds currently in the track sound queue.
 *         """
 *         return self._sound_queue.qsize()             # <<<<<<<<<<<<<<
 * 
 *     def get_sound_players_in_use_count(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_qsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2476, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2476, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2470
 *         return status
 * 
 *     def get_sound_queue_count(self):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the number of sounds currently in the track sound queue.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.get_sound_queue_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2478
 *         return self._sound_queue.qsize()
 * 
 *     def get_sound_players_in_use_count(self):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the current count of sound players in use on the track.  Used for
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_33get_sound_players_in_use_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_32get_sound_players_in_use_count[] = "TrackStandard.get_sound_players_in_use_count(self)\n\n        Gets the current count of sound players in use on the track.  Used for\n        debugging and testing.\n        Returns:\n            Integer number of sound players currently in use on the track.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_33get_sound_players_in_use_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sound_players_in_use_count (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_32get_sound_players_in_use_count(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_32get_sound_players_in_use_count(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_v_players_in_use_count = NULL;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("get_sound_players_in_use_count", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2485
 *             Integer number of sound players currently in use on the track.
 *         """
 *         players_in_use_count = 0             # <<<<<<<<<<<<<<
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_players_in_use_count = __pyx_int_0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2486
 *         """
 *         players_in_use_count = 0
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2487
 *         players_in_use_count = 0
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[i].status != player_idle:
 *                 players_in_use_count += 1
 */
  __pyx_t_1 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2488
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:             # <<<<<<<<<<<<<<
 *                 players_in_use_count += 1
 *         SDL_UnlockMutex(self.mutex)
 */
    __pyx_t_3 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (__pyx_t_3) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2489
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:
 *                 players_in_use_count += 1             # <<<<<<<<<<<<<<
 *         SDL_UnlockMutex(self.mutex)
 *         return players_in_use_count
 */
      __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_players_in_use_count, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_players_in_use_count, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2488
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:             # <<<<<<<<<<<<<<
 *                 players_in_use_count += 1
 *         SDL_UnlockMutex(self.mutex)
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2490
 *             if self.type_state.sound_players[i].status != player_idle:
 *                 players_in_use_count += 1
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *         return players_in_use_count
 * 
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2491
 *                 players_in_use_count += 1
 *         SDL_UnlockMutex(self.mutex)
 *         return players_in_use_count             # <<<<<<<<<<<<<<
 * 
 *     def sound_is_playing(self, sound not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_players_in_use_count);
  __pyx_r = __pyx_v_players_in_use_count;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2478
 *         return self._sound_queue.qsize()
 * 
 *     def get_sound_players_in_use_count(self):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the current count of sound players in use on the track.  Used for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.get_sound_players_in_use_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_players_in_use_count);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2493
 *         return players_in_use_count
 * 
 *     def sound_is_playing(self, sound not None):             # <<<<<<<<<<<<<<
 *         """Returns whether or not the specified sound is currently playing on the track"""
 *         SDL_LockMutex(self.mutex)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_35sound_is_playing(PyObject *__pyx_v_self, PyObject *__pyx_v_sound); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_34sound_is_playing[] = "TrackStandard.sound_is_playing(self, sound)\nReturns whether or not the specified sound is currently playing on the track";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_35sound_is_playing(PyObject *__pyx_v_self, PyObject *__pyx_v_sound) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sound_is_playing (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound"); __PYX_ERR(0, 2493, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_34sound_is_playing(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_sound));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_34sound_is_playing(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound) {
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("sound_is_playing", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2495
 *     def sound_is_playing(self, sound not None):
 *         """Returns whether or not the specified sound is currently playing on the track"""
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2496
 *         """Returns whether or not the specified sound is currently playing on the track"""
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_id == sound.id:
 */
  __pyx_t_1 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2497
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \             # <<<<<<<<<<<<<<
 *                             self.type_state.sound_players[i].current.sound_id == sound.id:
 *                 SDL_UnlockMutex(self.mutex)
 */
    __pyx_t_4 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2498
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_id == sound.id:             # <<<<<<<<<<<<<<
 *                 SDL_UnlockMutex(self.mutex)
 *                 return True
 */
    __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2498, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2498, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2497
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \             # <<<<<<<<<<<<<<
 *                             self.type_state.sound_players[i].current.sound_id == sound.id:
 *                 SDL_UnlockMutex(self.mutex)
 */
    if (__pyx_t_3) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2499
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_id == sound.id:
 *                 SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
      SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2500
 *                             self.type_state.sound_players[i].current.sound_id == sound.id:
 *                 SDL_UnlockMutex(self.mutex)
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2497
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \             # <<<<<<<<<<<<<<
 *                             self.type_state.sound_players[i].current.sound_id == sound.id:
 *                 SDL_UnlockMutex(self.mutex)
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2502
 *                 return True
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2503
 * 
 *         SDL_UnlockMutex(self.mutex)
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def sound_instance_is_playing(self, sound_instance not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2493
 *         return players_in_use_count
 * 
 *     def sound_is_playing(self, sound not None):             # <<<<<<<<<<<<<<
 *         """Returns whether or not the specified sound is currently playing on the track"""
 *         SDL_LockMutex(self.mutex)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.sound_is_playing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2505
 *         return False
 * 
 *     def sound_instance_is_playing(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """Returns whether or not the specified sound instance is currently playing on the track"""
 *         SDL_LockMutex(self.mutex)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_37sound_instance_is_playing(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_36sound_instance_is_playing[] = "TrackStandard.sound_instance_is_playing(self, sound_instance)\nReturns whether or not the specified sound instance is currently playing on the track";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_37sound_instance_is_playing(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sound_instance_is_playing (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 2505, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_36sound_instance_is_playing(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_36sound_instance_is_playing(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("sound_instance_is_playing", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2507
 *     def sound_instance_is_playing(self, sound_instance not None):
 *         """Returns whether or not the specified sound instance is currently playing on the track"""
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2508
 *         """Returns whether or not the specified sound instance is currently playing on the track"""
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 */
  __pyx_t_1 = __pyx_v_self->type_state->sound_player_count;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2509
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \             # <<<<<<<<<<<<<<
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 SDL_UnlockMutex(self.mutex)
 */
    __pyx_t_4 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2510
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:             # <<<<<<<<<<<<<<
 *                 SDL_UnlockMutex(self.mutex)
 *                 return True
 */
    __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2510, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2510, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2509
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \             # <<<<<<<<<<<<<<
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 SDL_UnlockMutex(self.mutex)
 */
    if (__pyx_t_3) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2511
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
      SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2512
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 SDL_UnlockMutex(self.mutex)
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2509
 *         SDL_LockMutex(self.mutex)
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \             # <<<<<<<<<<<<<<
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 SDL_UnlockMutex(self.mutex)
 */
    }
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2514
 *                 return True
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2515
 * 
 *         SDL_UnlockMutex(self.mutex)
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def sound_is_in_queue(self, sound not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2505
 *         return False
 * 
 *     def sound_instance_is_playing(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """Returns whether or not the specified sound instance is currently playing on the track"""
 *         SDL_LockMutex(self.mutex)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.sound_instance_is_playing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2517
 *         return False
 * 
 *     def sound_is_in_queue(self, sound not None):             # <<<<<<<<<<<<<<
 *         """Returns whether or not an instance of the specified sound is currently in the queue"""
 *         for sound_instance in self._sound_queue_items:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_39sound_is_in_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_38sound_is_in_queue[] = "TrackStandard.sound_is_in_queue(self, sound)\nReturns whether or not an instance of the specified sound is currently in the queue";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_39sound_is_in_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sound_is_in_queue (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound"); __PYX_ERR(0, 2517, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_38sound_is_in_queue(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_sound));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_38sound_is_in_queue(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound) {
  PyObject *__pyx_v_sound_instance = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("sound_is_in_queue", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2519
 *     def sound_is_in_queue(self, sound not None):
 *         """Returns whether or not an instance of the specified sound is currently in the queue"""
 *         for sound_instance in self._sound_queue_items:             # <<<<<<<<<<<<<<
 *             if sound_instance.sound.id == sound.id:
 *                 return True
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 2519, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_sound_queue_items, 1, ((PyObject *)NULL), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, NULL, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_6 == 0)) break;
    if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 2519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2520
 *         """Returns whether or not an instance of the specified sound is currently in the queue"""
 *         for sound_instance in self._sound_queue_items:
 *             if sound_instance.sound.id == sound.id:             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2520, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2520, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_9) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2521
 *         for sound_instance in self._sound_queue_items:
 *             if sound_instance.sound.id == sound.id:
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *         return False
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2520
 *         """Returns whether or not an instance of the specified sound is currently in the queue"""
 *         for sound_instance in self._sound_queue_items:
 *             if sound_instance.sound.id == sound.id:             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2523
 *                 return True
 * 
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def sound_instance_is_in_queue(self, sound_instance not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2517
 *         return False
 * 
 *     def sound_is_in_queue(self, sound not None):             # <<<<<<<<<<<<<<
 *         """Returns whether or not an instance of the specified sound is currently in the queue"""
 *         for sound_instance in self._sound_queue_items:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.sound_is_in_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2525
 *         return False
 * 
 *     def sound_instance_is_in_queue(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """Returns whether or not the specified sound instance is currently in the queue"""
 *         return sound_instance in self._sound_queue_items
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_41sound_instance_is_in_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_40sound_instance_is_in_queue[] = "TrackStandard.sound_instance_is_in_queue(self, sound_instance)\nReturns whether or not the specified sound instance is currently in the queue";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_41sound_instance_is_in_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sound_instance_is_in_queue (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 2525, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_40sound_instance_is_in_queue(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_40sound_instance_is_in_queue(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("sound_instance_is_in_queue", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2527
 *     def sound_instance_is_in_queue(self, sound_instance not None):
 *         """Returns whether or not the specified sound instance is currently in the queue"""
 *         return sound_instance in self._sound_queue_items             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_sound_queue_items == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 2527, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_sound_instance, __pyx_v_self->_sound_queue_items, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2527, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2525
 *         return False
 * 
 *     def sound_instance_is_in_queue(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """Returns whether or not the specified sound instance is currently in the queue"""
 *         return sound_instance in self._sound_queue_items
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.sound_instance_is_in_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2530
 * 
 *     @staticmethod
 *     def player_status_to_text(int status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player status value into an equivalent text string.  Used for testing
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_43player_status_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_42player_status_to_text[] = "TrackStandard.player_status_to_text(int status)\n\n        Converts a sound player status value into an equivalent text string.  Used for testing\n        purposes only.\n        Args:\n            status: Integer sound player status value\n\n        Returns:\n            string containing the equivalent status text\n        ";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_43player_status_to_text = {"player_status_to_text", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_43player_status_to_text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_42player_status_to_text};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_43player_status_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_status;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("player_status_to_text (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_status,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_status)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "player_status_to_text") < 0)) __PYX_ERR(0, 2530, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_status = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_status == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2530, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("player_status_to_text", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2530, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.player_status_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_42player_status_to_text(__pyx_v_status);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_42player_status_to_text(int __pyx_v_status) {
  PyObject *__pyx_v_status_values = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("player_status_to_text", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2541
 *         """
 *         status_values = {
 *             player_idle: "idle",             # <<<<<<<<<<<<<<
 *             player_pending: "pending",
 *             player_replacing: "replacing",
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus(__pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_idle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_u_idle) < 0) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2542
 *         status_values = {
 *             player_idle: "idle",
 *             player_pending: "pending",             # <<<<<<<<<<<<<<
 *             player_replacing: "replacing",
 *             player_playing: "playing",
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus(__pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_pending); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_u_pending) < 0) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2543
 *             player_idle: "idle",
 *             player_pending: "pending",
 *             player_replacing: "replacing",             # <<<<<<<<<<<<<<
 *             player_playing: "playing",
 *             player_finished: "finished",
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus(__pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_replacing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_u_replacing) < 0) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2544
 *             player_pending: "pending",
 *             player_replacing: "replacing",
 *             player_playing: "playing",             # <<<<<<<<<<<<<<
 *             player_finished: "finished",
 *             player_stopping: "stopping",
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus(__pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_playing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_u_playing) < 0) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2545
 *             player_replacing: "replacing",
 *             player_playing: "playing",
 *             player_finished: "finished",             # <<<<<<<<<<<<<<
 *             player_stopping: "stopping",
 *         }
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus(__pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_finished); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_u_finished) < 0) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2546
 *             player_playing: "playing",
 *             player_finished: "finished",
 *             player_stopping: "stopping",             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus(__pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_player_stopping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_u_stopping) < 0) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_status_values = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2549
 *         }
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return status_values.get(status)
 *         except KeyError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2550
 * 
 *         try:
 *             return status_values.get(status)             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return "unknown"
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2550, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_status_values, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2550, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7_try_return;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2549
 *         }
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return status_values.get(status)
 *         except KeyError:
 */
    }
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2551
 *         try:
 *             return status_values.get(status)
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return "unknown"
 * 
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.player_status_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 2551, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2552
 *             return status_values.get(status)
 *         except KeyError:
 *             return "unknown"             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_n_u_unknown);
      __pyx_r = __pyx_n_u_unknown;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2549
 *         }
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return status_values.get(status)
 *         except KeyError:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2530
 * 
 *     @staticmethod
 *     def player_status_to_text(int status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player status value into an equivalent text string.  Used for testing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.player_status_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_status_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2555
 * 
 *     @staticmethod
 *     def player_fading_status_to_text(int fading_status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player fading status value into an equivalent text string.  Used for
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_45player_fading_status_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_44player_fading_status_to_text[] = "TrackStandard.player_fading_status_to_text(int fading_status)\n\n        Converts a sound player fading status value into an equivalent text string.  Used for\n        testing purposes only.\n        Args:\n            fading_status: Integer sound player fading status value\n\n        Returns:\n            string containing the equivalent fading status text\n        ";
static PyMethodDef __pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_45player_fading_status_to_text = {"player_fading_status_to_text", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_45player_fading_status_to_text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_44player_fading_status_to_text};
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_45player_fading_status_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_fading_status;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("player_fading_status_to_text (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fading_status,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fading_status)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "player_fading_status_to_text") < 0)) __PYX_ERR(0, 2555, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_fading_status = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_fading_status == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2555, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("player_fading_status_to_text", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2555, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.player_fading_status_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_44player_fading_status_to_text(__pyx_v_fading_status);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_44player_fading_status_to_text(int __pyx_v_fading_status) {
  PyObject *__pyx_v_fading_status_values = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("player_fading_status_to_text", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2566
 *         """
 *         fading_status_values = {
 *             fading_status_not_fading: "not fading",             # <<<<<<<<<<<<<<
 *             fading_status_fading_in: "fade in",
 *             fading_status_fading_out: "fade out",
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus(__pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_not_fading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_kp_u_not_fading) < 0) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2567
 *         fading_status_values = {
 *             fading_status_not_fading: "not fading",
 *             fading_status_fading_in: "fade in",             # <<<<<<<<<<<<<<
 *             fading_status_fading_out: "fade out",
 *         }
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus(__pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_fading_in); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_kp_u_fade_in_2) < 0) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2568
 *             fading_status_not_fading: "not fading",
 *             fading_status_fading_in: "fade in",
 *             fading_status_fading_out: "fade out",             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus(__pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_fading_status_fading_out); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_kp_u_fade_out_2) < 0) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_fading_status_values = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2571
 *         }
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return fading_status_values.get(fading_status)
 *         except KeyError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2572
 * 
 *         try:
 *             return fading_status_values.get(fading_status)             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return "unknown"
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_fading_status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2572, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_fading_status_values, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2572, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7_try_return;

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2571
 *         }
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return fading_status_values.get(fading_status)
 *         except KeyError:
 */
    }
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2573
 *         try:
 *             return fading_status_values.get(fading_status)
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return "unknown"
 * 
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.player_fading_status_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 2573, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2574
 *             return fading_status_values.get(fading_status)
 *         except KeyError:
 *             return "unknown"             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_n_u_unknown);
      __pyx_r = __pyx_n_u_unknown;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2571
 *         }
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return fading_status_values.get(fading_status)
 *         except KeyError:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2555
 * 
 *     @staticmethod
 *     def player_fading_status_to_text(int fading_status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player fading status value into an equivalent text string.  Used for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.player_fading_status_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fading_status_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2591
 *     cdef TrackLiveLoopState *type_state
 * 
 *     def __cinit__(self, *args, **kw):             # <<<<<<<<<<<<<<
 *         """C Constructor"""
 *         self.type_state = NULL
 */

/* Python wrapper */
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kw = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop___cinit__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self), __pyx_v_args, __pyx_v_kw);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kw);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop___cinit__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kw) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2593
 *     def __cinit__(self, *args, **kw):
 *         """C Constructor"""
 *         self.type_state = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, object mc, object audio_callback_data, str name, int track_num, int buffer_size,
 */
  __pyx_v_self->type_state = NULL;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2591
 *     cdef TrackLiveLoopState *type_state
 * 
 *     def __cinit__(self, *args, **kw):             # <<<<<<<<<<<<<<
 *         """C Constructor"""
 *         self.type_state = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2595
 *         self.type_state = NULL
 * 
 *     def __init__(self, object mc, object audio_callback_data, str name, int track_num, int buffer_size,             # <<<<<<<<<<<<<<
 *                  float volume=1.0):
 *         """
 */

/* Python wrapper */
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_2__init__[] = "\n        Constructor\n        Args:\n            mc: The media controller object\n            audio_callback_data: The AudioCallbackData struct wrapped in a PyCapsule\n            name: The track name\n            track_num: The track number\n            buffer_size: The length of the track audio buffer in bytes\n            volume: The track volume (0.0 to 1.0)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_2__init__;
#endif
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mc = 0;
  PyObject *__pyx_v_audio_callback_data = 0;
  PyObject *__pyx_v_name = 0;
  int __pyx_v_track_num;
  int __pyx_v_buffer_size;
  float __pyx_v_volume;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mc,&__pyx_n_s_audio_callback_data,&__pyx_n_s_name,&__pyx_n_s_track_num,&__pyx_n_s_buffer_size,&__pyx_n_s_volume,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_audio_callback_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 1); __PYX_ERR(0, 2595, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 2); __PYX_ERR(0, 2595, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_track_num)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 3); __PYX_ERR(0, 2595, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buffer_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 4); __PYX_ERR(0, 2595, __pyx_L3_error)
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_volume);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 2595, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mc = values[0];
    __pyx_v_audio_callback_data = values[1];
    __pyx_v_name = ((PyObject*)values[2]);
    __pyx_v_track_num = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_track_num == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2595, __pyx_L3_error)
    __pyx_v_buffer_size = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_buffer_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2595, __pyx_L3_error)
    if (values[5]) {
      __pyx_v_volume = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_volume == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 2596, __pyx_L3_error)
    } else {
      __pyx_v_volume = ((float)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2595, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackLiveLoop.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 2595, __pyx_L1_error)
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_2__init__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self), __pyx_v_mc, __pyx_v_audio_callback_data, __pyx_v_name, __pyx_v_track_num, __pyx_v_buffer_size, __pyx_v_volume);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_2__init__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self, PyObject *__pyx_v_mc, PyObject *__pyx_v_audio_callback_data, PyObject *__pyx_v_name, int __pyx_v_track_num, int __pyx_v_buffer_size, float __pyx_v_volume) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2608
 *         """
 *         # IMPORTANT: Call super class init function to allocate track state memory!
 *         super().__init__(mc, audio_callback_data, name, track_num, buffer_size, volume)             # <<<<<<<<<<<<<<
 * 
 *         self.log = logging.getLogger("Track." + str(track_num) + ".TrackLiveLoop")
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_track_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_buffer_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_volume); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_v_mc);
  __Pyx_GIVEREF(__pyx_v_mc);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_mc);
  __Pyx_INCREF(__pyx_v_audio_callback_data);
  __Pyx_GIVEREF(__pyx_v_audio_callback_data);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_audio_callback_data);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, __pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2610
 *         super().__init__(mc, audio_callback_data, name, track_num, buffer_size, volume)
 * 
 *         self.log = logging.getLogger("Track." + str(track_num) + ".TrackLiveLoop")             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockMutex(self.mutex)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_track_num); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Track_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_t_5, __pyx_kp_u_TrackLiveLoop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2610, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.log);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.log);
  __pyx_v_self->__pyx_base.log = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2612
 *         self.log = logging.getLogger("Track." + str(track_num) + ".TrackLiveLoop")
 * 
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         # Set track type specific settings
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2615
 * 
 *         # Set track type specific settings
 *         self.state.type = track_type_live_loop             # <<<<<<<<<<<<<<
 * 
 *         # Allocate memory for the specific track type state struct (TrackLiveLoopState)
 */
  __pyx_v_self->__pyx_base.state->type = __pyx_e_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_track_type_live_loop;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2618
 * 
 *         # Allocate memory for the specific track type state struct (TrackLiveLoopState)
 *         self.type_state = <TrackLiveLoopState*> PyMem_Malloc(sizeof(TrackLiveLoopState))             # <<<<<<<<<<<<<<
 *         self.state.type_state = <void*>self.type_state
 * 
 */
  __pyx_v_self->type_state = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoopState *)PyMem_Malloc((sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoopState))));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2619
 *         # Allocate memory for the specific track type state struct (TrackLiveLoopState)
 *         self.type_state = <TrackLiveLoopState*> PyMem_Malloc(sizeof(TrackLiveLoopState))
 *         self.state.type_state = <void*>self.type_state             # <<<<<<<<<<<<<<
 * 
 *         self.type_state.master_sound_player = <SoundPlayer*> PyMem_Malloc(sizeof(SoundPlayer))
 */
  __pyx_v_self->__pyx_base.state->type_state = ((void *)__pyx_v_self->type_state);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2621
 *         self.state.type_state = <void*>self.type_state
 * 
 *         self.type_state.master_sound_player = <SoundPlayer*> PyMem_Malloc(sizeof(SoundPlayer))             # <<<<<<<<<<<<<<
 *         self.type_state.slave_sound_player_count = 0
 *         self.type_state.slave_sound_players = NULL
 */
  __pyx_v_self->type_state->master_sound_player = ((__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer *)PyMem_Malloc((sizeof(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayer))));

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2622
 * 
 *         self.type_state.master_sound_player = <SoundPlayer*> PyMem_Malloc(sizeof(SoundPlayer))
 *         self.type_state.slave_sound_player_count = 0             # <<<<<<<<<<<<<<
 *         self.type_state.slave_sound_players = NULL
 * 
 */
  __pyx_v_self->type_state->slave_sound_player_count = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2623
 *         self.type_state.master_sound_player = <SoundPlayer*> PyMem_Malloc(sizeof(SoundPlayer))
 *         self.type_state.slave_sound_player_count = 0
 *         self.type_state.slave_sound_players = NULL             # <<<<<<<<<<<<<<
 * 
 *         # TODO: Allocate slave sound players
 */
  __pyx_v_self->type_state->slave_sound_players = NULL;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2595
 *         self.type_state = NULL
 * 
 *     def __init__(self, object mc, object audio_callback_data, str name, int track_num, int buffer_size,             # <<<<<<<<<<<<<<
 *                  float volume=1.0):
 *         """
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackLiveLoop.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2627
 *         # TODO: Allocate slave sound players
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Destructor"""
 * 
 */

/* Python wrapper */
static void __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_4__dealloc__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_4__dealloc__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2630
 *         """Destructor"""
 * 
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         # Free the specific track type state and other allocated memory
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2633
 * 
 *         # Free the specific track type state and other allocated memory
 *         if self.type_state != NULL:             # <<<<<<<<<<<<<<
 *             if self.type_state.master_sound_player != NULL:
 *                 PyMem_Free(self.type_state.master_sound_player)
 */
  __pyx_t_1 = ((__pyx_v_self->type_state != NULL) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2634
 *         # Free the specific track type state and other allocated memory
 *         if self.type_state != NULL:
 *             if self.type_state.master_sound_player != NULL:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(self.type_state.master_sound_player)
 * 
 */
    __pyx_t_1 = ((__pyx_v_self->type_state->master_sound_player != NULL) != 0);
    if (__pyx_t_1) {

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2635
 *         if self.type_state != NULL:
 *             if self.type_state.master_sound_player != NULL:
 *                 PyMem_Free(self.type_state.master_sound_player)             # <<<<<<<<<<<<<<
 * 
 *             # TODO: Clean-up slave sound players
 */
      PyMem_Free(__pyx_v_self->type_state->master_sound_player);

      /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2634
 *         # Free the specific track type state and other allocated memory
 *         if self.type_state != NULL:
 *             if self.type_state.master_sound_player != NULL:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(self.type_state.master_sound_player)
 * 
 */
    }

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2641
 *             #    PyMem_Free(self.type_state.slave_sound_players[player])
 * 
 *             PyMem_Free(self.type_state)             # <<<<<<<<<<<<<<
 *             self.type_state = NULL
 *             self.state.type_state = NULL
 */
    PyMem_Free(__pyx_v_self->type_state);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2642
 * 
 *             PyMem_Free(self.type_state)
 *             self.type_state = NULL             # <<<<<<<<<<<<<<
 *             self.state.type_state = NULL
 * 
 */
    __pyx_v_self->type_state = NULL;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2643
 *             PyMem_Free(self.type_state)
 *             self.type_state = NULL
 *             self.state.type_state = NULL             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockMutex(self.mutex)
 */
    __pyx_v_self->__pyx_base.state->type_state = NULL;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2633
 * 
 *         # Free the specific track type state and other allocated memory
 *         if self.type_state != NULL:             # <<<<<<<<<<<<<<
 *             if self.type_state.master_sound_player != NULL:
 *                 PyMem_Free(self.type_state.master_sound_player)
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2645
 *             self.state.type_state = NULL
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2627
 *         # TODO: Allocate slave sound players
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Destructor"""
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2647
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Track.{}.LiveLoop.{}>'.format(self.number, self.name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_7__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_7__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_6__repr__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_6__repr__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2648
 * 
 *     def __repr__(self):
 *         return '<Track.{}.LiveLoop.{}>'.format(self.number, self.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Track_LiveLoop, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_number); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2647
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Track.{}.LiveLoop.{}>'.format(self.number, self.name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackLiveLoop.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2651
 * 
 *     @property
 *     def supports_in_memory_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track supports in-memory sounds"""
 *         return True
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_in_memory_sounds_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_in_memory_sounds_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_in_memory_sounds___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_in_memory_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2653
 *     def supports_in_memory_sounds(self):
 *         """Return whether or not track supports in-memory sounds"""
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2651
 * 
 *     @property
 *     def supports_in_memory_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track supports in-memory sounds"""
 *         return True
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2656
 * 
 *     @property
 *     def supports_streaming_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track supports streaming sounds"""
 *         return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_streaming_sounds_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_streaming_sounds_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_streaming_sounds___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_streaming_sounds___get__(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2658
 *     def supports_streaming_sounds(self):
 *         """Return whether or not track supports streaming sounds"""
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def play_sound(self, sound_instance not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2656
 * 
 *     @property
 *     def supports_streaming_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track supports streaming sounds"""
 *         return False
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2660
 *         return False
 * 
 *     def play_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound on the current track.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_9play_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_8play_sound[] = "TrackLiveLoop.play_sound(self, sound_instance)\n\n        Plays a sound on the current track.\n        Args:\n            sound_instance: The SoundInstance object to play\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_9play_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("play_sound (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 2660, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_8play_sound(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_8play_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("play_sound", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2666
 *             sound_instance: The SoundInstance object to play
 *         """
 *         self.log.debug("play_sound - Processing sound '%s' for playback (%s).", sound_instance.name)             # <<<<<<<<<<<<<<
 * 
 *         # Make sure the sound is loaded and therefore ready to play immediately.
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_u_play_sound_Processing_sound_s_fo_2);
  __Pyx_GIVEREF(__pyx_kp_u_play_sound_Processing_sound_s_fo_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_u_play_sound_Processing_sound_s_fo_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2670
 *         # Make sure the sound is loaded and therefore ready to play immediately.
 * 
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         # TODO: play the sound instance
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2674
 *         # TODO: play the sound instance
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound(self, sound_instance not None):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2660
 *         return False
 * 
 *     def play_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound on the current track.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackLiveLoop.play_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2676
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def stop_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound immediately on the track. Any queued instances
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_11stop_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_10stop_sound[] = "TrackLiveLoop.stop_sound(self, sound_instance)\n\n        Stops all instances of the specified sound immediately on the track. Any queued instances\n        will be removed from the queue.\n        Args:\n            sound_instance: The SoundInstance to stop\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_11stop_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 2676, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_10stop_sound(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_10stop_sound(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2684
 *         """
 * 
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         # TODO: stop the sound instance
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2688
 *         # TODO: stop the sound instance
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound_looping(self, sound_instance not None):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2676
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def stop_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound immediately on the track. Any queued instances
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2690
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def stop_sound_looping(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound on the track after they finish the current loop.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_13stop_sound_looping(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_12stop_sound_looping[] = "TrackLiveLoop.stop_sound_looping(self, sound_instance)\n\n        Stops all instances of the specified sound on the track after they finish the current loop.\n        Any queued instances of the sound will be removed.\n        Args:\n            sound_instance: The Sound to stop\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_13stop_sound_looping(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound_looping (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 2690, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_12stop_sound_looping(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_12stop_sound_looping(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound_looping", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2698
 *         """
 * 
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         # TODO: stop looping the sound instance
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2702
 *         # TODO: stop looping the sound instance
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def stop_all_sounds(self):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2690
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def stop_sound_looping(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound on the track after they finish the current loop.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2704
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def stop_all_sounds(self):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all playing sounds immediately on the track.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_15stop_all_sounds(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_14stop_all_sounds[] = "TrackLiveLoop.stop_all_sounds(self)\n\n        Stops all playing sounds immediately on the track.\n        ";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_15stop_all_sounds(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_all_sounds (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_14stop_all_sounds(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_14stop_all_sounds(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_all_sounds", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2708
 *         Stops all playing sounds immediately on the track.
 *         """
 *         SDL_LockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *         # TODO: stop looping the sound instance
 */
  SDL_LockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2712
 *         # TODO: stop looping the sound instance
 * 
 *         SDL_UnlockMutex(self.mutex)             # <<<<<<<<<<<<<<
 * 
 *     def process(self):
 */
  SDL_UnlockMutex(__pyx_v_self->__pyx_base.mutex);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2704
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def stop_all_sounds(self):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all playing sounds immediately on the track.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2714
 *         SDL_UnlockMutex(self.mutex)
 * 
 *     def process(self):             # <<<<<<<<<<<<<<
 *         """Processes the track queue each tick."""
 *         pass
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_17process(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_16process[] = "TrackLiveLoop.process(self)\nProcesses the track queue each tick.";
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_17process(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("process (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_16process(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_16process(CYTHON_UNUSED struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("process", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2731
 *     cdef Mix_Chunk *chunk
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.chunk = NULL
 * 
 */

/* Python wrapper */
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer___init__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer___init__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2732
 * 
 *     def __init__(self):
 *         self.chunk = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->chunk = NULL;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2731
 *     cdef Mix_Chunk *chunk
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.chunk = NULL
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2734
 *         self.chunk = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.chunk != NULL:
 *             Mix_FreeChunk(self.chunk)
 */

/* Python wrapper */
static void __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_2__dealloc__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_2__dealloc__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2735
 * 
 *     def __dealloc__(self):
 *         if self.chunk != NULL:             # <<<<<<<<<<<<<<
 *             Mix_FreeChunk(self.chunk)
 *             self.chunk = NULL
 */
  __pyx_t_1 = ((__pyx_v_self->chunk != NULL) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2736
 *     def __dealloc__(self):
 *         if self.chunk != NULL:
 *             Mix_FreeChunk(self.chunk)             # <<<<<<<<<<<<<<
 *             self.chunk = NULL
 * 
 */
    Mix_FreeChunk(__pyx_v_self->chunk);

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2737
 *         if self.chunk != NULL:
 *             Mix_FreeChunk(self.chunk)
 *             self.chunk = NULL             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __pyx_v_self->chunk = NULL;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2735
 * 
 *     def __dealloc__(self):
 *         if self.chunk != NULL:             # <<<<<<<<<<<<<<
 *             Mix_FreeChunk(self.chunk)
 *             self.chunk = NULL
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2734
 *         self.chunk = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.chunk != NULL:
 *             Mix_FreeChunk(self.chunk)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2740
 * 
 *     @property
 *     def loaded(self):             # <<<<<<<<<<<<<<
 *         """Returns whether or not the chunk is loaded in memory"""
 *         return self.chunk != NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6loaded_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6loaded_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6loaded___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6loaded___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2742
 *     def loaded(self):
 *         """Returns whether or not the chunk is loaded in memory"""
 *         return self.chunk != NULL             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->chunk != NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2740
 * 
 *     @property
 *     def loaded(self):             # <<<<<<<<<<<<<<
 *         """Returns whether or not the chunk is loaded in memory"""
 *         return self.chunk != NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.MixChunkContainer.loaded.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2745
 * 
 *     @property
 *     def length(self):             # <<<<<<<<<<<<<<
 *         """Returns the length of the Mix_Chunk (in samples)"""
 *         if self.chunk == NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6length_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6length_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6length___get__(((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6length___get__(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2747
 *     def length(self):
 *         """Returns the length of the Mix_Chunk (in samples)"""
 *         if self.chunk == NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->chunk == NULL) != 0);
  if (__pyx_t_1) {

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2748
 *         """Returns the length of the Mix_Chunk (in samples)"""
 *         if self.chunk == NULL:
 *             return 0             # <<<<<<<<<<<<<<
 *         else:
 *             return self.chunk.alen
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;

    /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2747
 *     def length(self):
 *         """Returns the length of the Mix_Chunk (in samples)"""
 *         if self.chunk == NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         else:
 */
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2750
 *             return 0
 *         else:
 *             return self.chunk.alen             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_Uint32(__pyx_v_self->chunk->alen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2745
 * 
 *     @property
 *     def length(self):             # <<<<<<<<<<<<<<
 *         """Returns the length of the Mix_Chunk (in samples)"""
 *         if self.chunk == NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("Pinball.mpf_mc.mpfmc.core.audio.audio_interface.MixChunkContainer.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)o);
  p->__pyx_vtab = __pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface;
  p->tracks = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->mc = Py_None; Py_INCREF(Py_None);
  p->log = Py_None; Py_INCREF(Py_None);
  p->sound_instances_by_id = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->tracks);
  Py_CLEAR(p->mc);
  Py_CLEAR(p->log);
  Py_CLEAR(p->sound_instances_by_id);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)o;
  if (p->tracks) {
    e = (*v)(p->tracks, a); if (e) return e;
  }
  if (p->mc) {
    e = (*v)(p->mc, a); if (e) return e;
  }
  if (p->log) {
    e = (*v)(p->log, a); if (e) return e;
  }
  if (p->sound_instances_by_id) {
    e = (*v)(p->sound_instances_by_id, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface *)o;
  tmp = ((PyObject*)p->tracks);
  p->tracks = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mc);
  p->mc = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->log);
  p->log = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->sound_instances_by_id);
  p->sound_instances_by_id = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_enabled(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7enabled_1__get__(o);
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_sample_rate(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate_1__get__(o);
}

static int __pyx_setprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_sample_rate(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11sample_rate_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface[] = {
  {"__del__", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_5__del__, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_4__del__},
  {"initialize", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7initialize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_6initialize},
  {"power_of_two", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_9power_of_two, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_8power_of_two},
  {"db_to_gain", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11db_to_gain, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_10db_to_gain},
  {"string_to_gain", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_13string_to_gain, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_12string_to_gain},
  {"convert_seconds_to_samples", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_15convert_seconds_to_samples, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_14convert_seconds_to_samples},
  {"convert_seconds_to_buffer_length", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_17convert_seconds_to_buffer_length, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_16convert_seconds_to_buffer_length},
  {"convert_buffer_length_to_seconds", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_19convert_buffer_length_to_seconds, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_18convert_buffer_length_to_seconds},
  {"string_to_secs", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_21string_to_secs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_20string_to_secs},
  {"string_to_samples", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_23string_to_samples, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_22string_to_samples},
  {"get_version", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_25get_version, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_24get_version},
  {"get_sdl_version", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_27get_sdl_version, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_26get_sdl_version},
  {"get_sdl_mixer_version", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_29get_sdl_mixer_version, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_28get_sdl_mixer_version},
  {"supported_extensions", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_31supported_extensions, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_30supported_extensions},
  {"get_master_volume", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_33get_master_volume, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_32get_master_volume},
  {"set_master_volume", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_35set_master_volume, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_34set_master_volume},
  {"get_settings", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_37get_settings, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_36get_settings},
  {"enable", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_39enable, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_38enable},
  {"disable", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_41disable, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_40disable},
  {"get_max_tracks", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_43get_max_tracks, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_42get_max_tracks},
  {"get_max_markers", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_45get_max_markers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_44get_max_markers},
  {"get_track_count", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_47get_track_count, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_46get_track_count},
  {"get_track", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_49get_track, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_48get_track},
  {"get_track_by_name", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_51get_track_by_name, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_50get_track_by_name},
  {"create_standard_track", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_53create_standard_track, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_52create_standard_track},
  {"create_live_loop_track", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_55create_live_loop_track, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_54create_live_loop_track},
  {"load_sound_chunk", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_57load_sound_chunk, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_56load_sound_chunk},
  {"unload_sound_chunk", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_59unload_sound_chunk, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_58unload_sound_chunk},
  {"stop_sound", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_61stop_sound, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_60stop_sound},
  {"stop_all_sounds", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_63stop_all_sounds, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_62stop_all_sounds},
  {"process", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_65process, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_64process},
  {"get_in_use_request_message_count", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_67get_in_use_request_message_count, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_66get_in_use_request_message_count},
  {"get_in_use_notification_message_count", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_69get_in_use_notification_message_count, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_68get_in_use_notification_message_count},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface[] = {
  {(char *)"enabled", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_enabled, 0, (char *)0, 0},
  {(char *)"sample_rate", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_sample_rate, __pyx_setprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_sample_rate, (char *)"sample_rate: 'int'", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "AudioInterface(rate=44100, channels=2, buffer_samples=4096)\n\n    The AudioInterface class provides a management wrapper around the SDL2 and SDL_Mixer\n    libraries.\n    ", /*tp_doc*/
  __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, /*tp_traverse*/
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)o);
  p->__pyx_vtab = __pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track;
  p->_sound_instances_by_id = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->log = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_sound_instances_by_id);
  Py_CLEAR(p->_name);
  Py_CLEAR(p->log);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)o;
  if (p->_sound_instances_by_id) {
    e = (*v)(p->_sound_instances_by_id, a); if (e) return e;
  }
  if (p->log) {
    e = (*v)(p->log, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *)o;
  tmp = ((PyObject*)p->_sound_instances_by_id);
  p->_sound_instances_by_id = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->log);
  p->log = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_4name_1__get__(o);
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_volume(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume_1__get__(o);
}

static int __pyx_setprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_volume(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6volume_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_number(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6number_1__get__(o);
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_supports_in_memory_sounds(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_in_memory_sounds_1__get__(o);
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_supports_streaming_sounds(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_25supports_streaming_sounds_1__get__(o);
}

static PyMethodDef __pyx_methods_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track[] = {
  {"play_sound", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_7play_sound, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_6play_sound},
  {"stop_sound", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_9stop_sound, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_8stop_sound},
  {"stop_sound_looping", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_11stop_sound_looping, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_10stop_sound_looping},
  {"stop_all_sounds", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_13stop_all_sounds, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_12stop_all_sounds},
  {"process", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_15process, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_14process},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track[] = {
  {(char *)"name", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_name, 0, (char *)0, 0},
  {(char *)"volume", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_volume, __pyx_setprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_volume, (char *)0, 0},
  {(char *)"number", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_number, 0, (char *)"Return the track number", 0},
  {(char *)"supports_in_memory_sounds", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_supports_in_memory_sounds, 0, (char *)"Return whether or not track supports in-memory sounds", 0},
  {(char *)"supports_streaming_sounds", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_supports_streaming_sounds, 0, (char *)"Return whether or not track supports streaming sounds", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.Track", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_5__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Track(dict sound_instances_by_id, audio_callback_data, unicode name, int track_num, int buffer_size, float volume=1.0)\n\n    Track base class\n    ", /*tp_doc*/
  __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track, /*tp_traverse*/
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *p;
  PyObject *o = __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track*)__pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard;
  p->_sound_queue = Py_None; Py_INCREF(Py_None);
  p->_sound_queue_items = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_sound_queue);
  Py_CLEAR(p->_sound_queue_items);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(o);
}

static int __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)o;
  e = __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(o, v, a); if (e) return e;
  if (p->_sound_queue) {
    e = (*v)(p->_sound_queue, a); if (e) return e;
  }
  if (p->_sound_queue_items) {
    e = (*v)(p->_sound_queue_items, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *)o;
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(o);
  tmp = ((PyObject*)p->_sound_queue);
  p->_sound_queue = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_sound_queue_items);
  p->_sound_queue_items = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_supports_in_memory_sounds(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_in_memory_sounds_1__get__(o);
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_supports_streaming_sounds(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25supports_streaming_sounds_1__get__(o);
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_max_simultaneous_sounds(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_23max_simultaneous_sounds_1__get__(o);
}

static PyMethodDef __pyx_methods_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard[] = {
  {"process", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_7process, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_6process},
  {"process_notification_message", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_9process_notification_message, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_8process_notification_message},
  {"_get_next_sound", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_11_get_next_sound, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_10_get_next_sound},
  {"_remove_sound_from_queue", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_13_remove_sound_from_queue, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_12_remove_sound_from_queue},
  {"_remove_all_sounds_from_queue", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_15_remove_all_sounds_from_queue, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_14_remove_all_sounds_from_queue},
  {"play_sound", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_17play_sound, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_16play_sound},
  {"replace_sound", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_19replace_sound, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_18replace_sound},
  {"_queue_sound", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_21_queue_sound, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_20_queue_sound},
  {"stop_sound", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_23stop_sound, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_22stop_sound},
  {"stop_sound_looping", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_25stop_sound_looping, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_24stop_sound_looping},
  {"stop_all_sounds", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_27stop_all_sounds, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_26stop_all_sounds},
  {"get_status", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_29get_status, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_28get_status},
  {"get_sound_queue_count", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_31get_sound_queue_count, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_30get_sound_queue_count},
  {"get_sound_players_in_use_count", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_33get_sound_players_in_use_count, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_32get_sound_players_in_use_count},
  {"sound_is_playing", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_35sound_is_playing, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_34sound_is_playing},
  {"sound_instance_is_playing", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_37sound_instance_is_playing, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_36sound_instance_is_playing},
  {"sound_is_in_queue", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_39sound_is_in_queue, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_38sound_is_in_queue},
  {"sound_instance_is_in_queue", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_41sound_instance_is_in_queue, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_40sound_instance_is_in_queue},
  {"player_status_to_text", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_43player_status_to_text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_42player_status_to_text},
  {"player_fading_status_to_text", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_45player_fading_status_to_text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_44player_fading_status_to_text},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard[] = {
  {(char *)"supports_in_memory_sounds", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_supports_in_memory_sounds, 0, (char *)"Return whether or not track accepts in-memory sounds", 0},
  {(char *)"supports_streaming_sounds", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_supports_streaming_sounds, 0, (char *)"Return whether or not track accepts streaming sounds", 0},
  {(char *)"max_simultaneous_sounds", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_max_simultaneous_sounds, 0, (char *)"Return the number of sounds that can be played simultaneously on this track", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_5__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "TrackStandard(dict sound_instances_by_id, audio_callback_data, unicode name, int track_num, int buffer_size, int max_simultaneous_sounds=8, float volume=1.0)\n\n    Track class\n    ", /*tp_doc*/
  __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard, /*tp_traverse*/
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *p;
  PyObject *o = __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track*)__pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop;
  if (unlikely(__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track(o);
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_supports_in_memory_sounds(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_in_memory_sounds_1__get__(o);
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_supports_streaming_sounds(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_25supports_streaming_sounds_1__get__(o);
}

static PyMethodDef __pyx_methods_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop[] = {
  {"play_sound", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_9play_sound, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_8play_sound},
  {"stop_sound", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_11stop_sound, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_10stop_sound},
  {"stop_sound_looping", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_13stop_sound_looping, METH_O, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_12stop_sound_looping},
  {"stop_all_sounds", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_15stop_all_sounds, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_14stop_all_sounds},
  {"process", (PyCFunction)__pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_17process, METH_NOARGS, __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_16process},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop[] = {
  {(char *)"supports_in_memory_sounds", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_supports_in_memory_sounds, 0, (char *)"Return whether or not track supports in-memory sounds", 0},
  {(char *)"supports_streaming_sounds", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_supports_streaming_sounds, 0, (char *)"Return whether or not track supports streaming sounds", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackLiveLoop", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_7__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "TrackLiveLoop(mc, audio_callback_data, unicode name, int track_num, int buffer_size, float volume=1.0)\n\n    TrackLiveLoop class\n    ", /*tp_doc*/
  __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track, /*tp_traverse*/
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_loaded(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6loaded_1__get__(o);
}

static PyObject *__pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_length(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_6length_1__get__(o);
}

static PyMethodDef __pyx_methods_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer[] = {
  {(char *)"loaded", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_loaded, 0, (char *)"Returns whether or not the chunk is loaded in memory", 0},
  {(char *)"length", __pyx_getprop_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_length, 0, (char *)"Returns the length of the Mix_Chunk (in samples)", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.MixChunkContainer", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "MixChunkContainer()\n\n    MixChunkContainer is a wrapper class to manage a SDL_Mixer Mix_Chunk C pointer (points\n    to a block of memory that contains an audio sample in a format ready for playback).\n    This class will properly unload/free the memory allocated when loading the sound when\n    it is destroyed.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_17MixChunkContainer_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain *__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain[8];
static int __pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain = 0;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain)))) {
    o = (PyObject*)__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain[--__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain];
    memset(o, 0, sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain));
    (void) PyObject_INIT(o, t);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain *)o;
  Py_CLEAR(p->__pyx_v_gain_string);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain)))) {
    __pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain[__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain++] = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.__pyx_scope_struct__string_to_gain", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr[--__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr[__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs[8];
static int __pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs = 0;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs)))) {
    o = (PyObject*)__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs[--__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs];
    memset(o, 0, sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs));
    (void) PyObject_INIT(o, t);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *)o;
  Py_CLEAR(p->__pyx_v_time_string);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs)))) {
    __pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs[__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs++] = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.__pyx_scope_struct_2_string_to_secs", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr[8];
static int __pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr = 0;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr[--__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr)))) {
    __pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr[__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr[8];
static int __pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr = 0;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr[--__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr)))) {
    __pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr[__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.__pyx_scope_struct_4_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr[8];
static int __pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr = 0;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr[--__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr)))) {
    __pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr[__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.__pyx_scope_struct_5_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr, /*tp_traverse*/
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr[8];
static int __pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr = 0;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr[--__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr)))) {
    __pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr[__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.__pyx_scope_struct_6_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr, /*tp_traverse*/
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr[8];
static int __pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr = 0;

static PyObject *__pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr[--__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr(PyObject *o) {
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr)))) {
    __pyx_freelist_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr[__pyx_freecount_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "Pinball.mpf_mc.mpfmc.core.audio.audio_interface.__pyx_scope_struct_7_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr, /*tp_traverse*/
  __pyx_tp_clear_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "audio_interface",
    __pyx_k_Audio_Library_This_library_requ, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_0, __pyx_k_0, sizeof(__pyx_k_0), 0, 1, 0, 0},
  {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0},
  {&__pyx_kp_u_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 1, 0, 0},
  {&__pyx_kp_u_Add_track_failed_the_maximum_num, __pyx_k_Add_track_failed_the_maximum_num, sizeof(__pyx_k_Add_track_failed_the_maximum_num), 0, 1, 0, 0},
  {&__pyx_kp_u_Add_track_failed_the_track_name, __pyx_k_Add_track_failed_the_track_name, sizeof(__pyx_k_Add_track_failed_the_track_name), 0, 1, 0, 0},
  {&__pyx_kp_u_Adding_sound_instance_s_to_activ, __pyx_k_Adding_sound_instance_s_to_activ, sizeof(__pyx_k_Adding_sound_instance_s_to_activ), 0, 1, 0, 0},
  {&__pyx_kp_u_All_internal_audio_messages_are, __pyx_k_All_internal_audio_messages_are, sizeof(__pyx_k_All_internal_audio_messages_are), 0, 1, 0, 0},
  {&__pyx_kp_u_All_internal_audio_messages_are_2, __pyx_k_All_internal_audio_messages_are_2, sizeof(__pyx_k_All_internal_audio_messages_are_2), 0, 1, 0, 0},
  {&__pyx_kp_u_All_internal_audio_messages_are_3, __pyx_k_All_internal_audio_messages_are_3, sizeof(__pyx_k_All_internal_audio_messages_are_3), 0, 1, 0, 0},
  {&__pyx_kp_u_All_sound_players_are_currently, __pyx_k_All_sound_players_are_currently, sizeof(__pyx_k_All_sound_players_are_currently), 0, 1, 0, 0},
  {&__pyx_kp_u_Allocated_track_audio_buffer_d_b, __pyx_k_Allocated_track_audio_buffer_d_b, sizeof(__pyx_k_Allocated_track_audio_buffer_d_b), 0, 1, 0, 0},
  {&__pyx_n_s_AudioException, __pyx_k_AudioException, sizeof(__pyx_k_AudioException), 0, 0, 1, 1},
  {&__pyx_n_u_AudioException, __pyx_k_AudioException, sizeof(__pyx_k_AudioException), 0, 1, 0, 1},
  {&__pyx_n_u_AudioInterface, __pyx_k_AudioInterface, sizeof(__pyx_k_AudioInterface), 0, 1, 0, 1},
  {&__pyx_kp_u_Buffer_samples_is_required_to_be, __pyx_k_Buffer_samples_is_required_to_be, sizeof(__pyx_k_Buffer_samples_is_required_to_be), 0, 1, 0, 0},
  {&__pyx_n_u_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 1, 0, 1},
  {&__pyx_n_u_DB, __pyx_k_DB, sizeof(__pyx_k_DB), 0, 1, 0, 1},
  {&__pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_k_D_Development_Pinball_mpf_mc_mpf, sizeof(__pyx_k_D_Development_Pinball_mpf_mc_mpf), 0, 0, 1, 0},
  {&__pyx_kp_u_Disabling_audio_playback, __pyx_k_Disabling_audio_playback, sizeof(__pyx_k_Disabling_audio_playback), 0, 1, 0, 0},
  {&__pyx_kp_u_Discarding_expired_sound_from_qu, __pyx_k_Discarding_expired_sound_from_qu, sizeof(__pyx_k_Discarding_expired_sound_from_qu), 0, 1, 0, 0},
  {&__pyx_n_s_Empty, __pyx_k_Empty, sizeof(__pyx_k_Empty), 0, 0, 1, 1},
  {&__pyx_kp_u_Enabling_audio_playback, __pyx_k_Enabling_audio_playback, sizeof(__pyx_k_Enabling_audio_playback), 0, 1, 0, 0},
  {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
  {&__pyx_kp_s_Exception_returned_by_the_audio, __pyx_k_Exception_returned_by_the_audio, sizeof(__pyx_k_Exception_returned_by_the_audio), 0, 0, 1, 0},
  {&__pyx_kp_u_Getting_sound_from_queue_s, __pyx_k_Getting_sound_from_queue_s, sizeof(__pyx_k_Getting_sound_from_queue_s), 0, 1, 0, 0},
  {&__pyx_n_u_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 1, 0, 1},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_kp_u_Initialized_s, __pyx_k_Initialized_s, sizeof(__pyx_k_Initialized_s), 0, 1, 0, 0},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_kp_u_Loaded_s, __pyx_k_Loaded_s, sizeof(__pyx_k_Loaded_s), 0, 1, 0, 0},
  {&__pyx_n_u_M, __pyx_k_M, sizeof(__pyx_k_M), 0, 1, 0, 1},
  {&__pyx_n_u_MS, __pyx_k_MS, sizeof(__pyx_k_MS), 0, 1, 0, 1},
  {&__pyx_n_u_MSEC, __pyx_k_MSEC, sizeof(__pyx_k_MSEC), 0, 1, 0, 1},
  {&__pyx_n_u_MixChunkContainer, __pyx_k_MixChunkContainer, sizeof(__pyx_k_MixChunkContainer), 0, 1, 0, 1},
  {&__pyx_kp_u_Mix_OpenAudio_error_s, __pyx_k_Mix_OpenAudio_error_s, sizeof(__pyx_k_Mix_OpenAudio_error_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Must_be_overridden_in_derived_cl, __pyx_k_Must_be_overridden_in_derived_cl, sizeof(__pyx_k_Must_be_overridden_in_derived_cl), 0, 1, 0, 0},
  {&__pyx_n_u_NONE, __pyx_k_NONE, sizeof(__pyx_k_NONE), 0, 1, 0, 1},
  {&__pyx_kp_u_NOTE_You_may_experience_noise_an, __pyx_k_NOTE_You_may_experience_noise_an, sizeof(__pyx_k_NOTE_You_may_experience_noise_an), 0, 1, 0, 0},
  {&__pyx_kp_u_Next_pending_sound_in_queue_is_s, __pyx_k_Next_pending_sound_in_queue_is_s, sizeof(__pyx_k_Next_pending_sound_in_queue_is_s), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio, __pyx_k_Pinball_mpf_mc_mpfmc_core_audio, sizeof(__pyx_k_Pinball_mpf_mc_mpfmc_core_audio), 0, 0, 1, 1},
  {&__pyx_n_s_PriorityQueue, __pyx_k_PriorityQueue, sizeof(__pyx_k_PriorityQueue), 0, 0, 1, 1},
  {&__pyx_kp_u_Processing_notification_message, __pyx_k_Processing_notification_message, sizeof(__pyx_k_Processing_notification_message), 0, 1, 0, 0},
  {&__pyx_kp_u_Queueing_sound_s, __pyx_k_Queueing_sound_s, sizeof(__pyx_k_Queueing_sound_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Received_a_notification_message, __pyx_k_Received_a_notification_message, sizeof(__pyx_k_Received_a_notification_message), 0, 1, 0, 0},
  {&__pyx_kp_u_Removing_pending_sound_from_queu, __pyx_k_Removing_pending_sound_from_queu, sizeof(__pyx_k_Removing_pending_sound_from_queu), 0, 1, 0, 0},
  {&__pyx_kp_u_Removing_sound_instance_s_from_a, __pyx_k_Removing_sound_instance_s_from_a, sizeof(__pyx_k_Removing_sound_instance_s_from_a), 0, 1, 0, 0},
  {&__pyx_kp_u_Retrieving_next_pending_sound_fr, __pyx_k_Retrieving_next_pending_sound_fr, sizeof(__pyx_k_Retrieving_next_pending_sound_fr), 0, 1, 0, 0},
  {&__pyx_n_u_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 1, 0, 1},
  {&__pyx_kp_u_SDL, __pyx_k_SDL, sizeof(__pyx_k_SDL), 0, 1, 0, 0},
  {&__pyx_kp_u_SDL_Init_error_s, __pyx_k_SDL_Init_error_s, sizeof(__pyx_k_SDL_Init_error_s), 0, 1, 0, 0},
  {&__pyx_kp_u_SDL_Mixer, __pyx_k_SDL_Mixer, sizeof(__pyx_k_SDL_Mixer), 0, 1, 0, 0},
  {&__pyx_n_u_SEC, __pyx_k_SEC, sizeof(__pyx_k_SEC), 0, 1, 0, 1},
  {&__pyx_kp_u_Settings_in_use_rate_d_channels, __pyx_k_Settings_in_use_rate_d_channels, sizeof(__pyx_k_Settings_in_use_rate_d_channels), 0, 1, 0, 0},
  {&__pyx_kp_u_Settings_requested_rate_d_channe, __pyx_k_Settings_requested_rate_d_channe, sizeof(__pyx_k_Settings_requested_rate_d_channe), 0, 1, 0, 0},
  {&__pyx_kp_u_Shutting_down_and_cleaning_up_al, __pyx_k_Shutting_down_and_cleaning_up_al, sizeof(__pyx_k_Shutting_down_and_cleaning_up_al), 0, 1, 0, 0},
  {&__pyx_kp_u_Sound_s_is_set_to_begin_playback, __pyx_k_Sound_s_is_set_to_begin_playback, sizeof(__pyx_k_Sound_s_is_set_to_begin_playback), 0, 1, 0, 0},
  {&__pyx_kp_u_Specified_sound_is_not_loaded_co, __pyx_k_Specified_sound_is_not_loaded_co, sizeof(__pyx_k_Specified_sound_is_not_loaded_co), 0, 1, 0, 0},
  {&__pyx_kp_u_Status_Player_d_Status_s_Sound_d, __pyx_k_Status_Player_d_Status_s_Sound_d, sizeof(__pyx_k_Status_Player_d_Status_s_Sound_d), 0, 1, 0, 0},
  {&__pyx_kp_u_Stopping_all_sounds_and_removing, __pyx_k_Stopping_all_sounds_and_removing, sizeof(__pyx_k_Stopping_all_sounds_and_removing), 0, 1, 0, 0},
  {&__pyx_kp_u_Stopping_sound_s_and_removing_an, __pyx_k_Stopping_sound_s_and_removing_an, sizeof(__pyx_k_Stopping_sound_s_and_removing_an), 0, 1, 0, 0},
  {&__pyx_kp_u_The_maximum_number_of_simultaneo, __pyx_k_The_maximum_number_of_simultaneo, sizeof(__pyx_k_The_maximum_number_of_simultaneo), 0, 1, 0, 0},
  {&__pyx_kp_u_The_minimum_number_of_simultaneo, __pyx_k_The_minimum_number_of_simultaneo, sizeof(__pyx_k_The_minimum_number_of_simultaneo), 0, 1, 0, 0},
  {&__pyx_kp_u_The_s_live_loop_track_has_succes, __pyx_k_The_s_live_loop_track_has_succes, sizeof(__pyx_k_The_s_live_loop_track_has_succes), 0, 1, 0, 0},
  {&__pyx_kp_u_The_s_standard_track_has_success, __pyx_k_The_s_standard_track_has_success, sizeof(__pyx_k_The_s_standard_track_has_success), 0, 1, 0, 0},
  {&__pyx_n_u_Track, __pyx_k_Track, sizeof(__pyx_k_Track), 0, 1, 0, 1},
  {&__pyx_kp_u_TrackLiveLoop, __pyx_k_TrackLiveLoop, sizeof(__pyx_k_TrackLiveLoop), 0, 1, 0, 0},
  {&__pyx_kp_u_TrackStandard, __pyx_k_TrackStandard, sizeof(__pyx_k_TrackStandard), 0, 1, 0, 0},
  {&__pyx_kp_u_Track_2, __pyx_k_Track_2, sizeof(__pyx_k_Track_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Track_3, __pyx_k_Track_3, sizeof(__pyx_k_Track_3), 0, 1, 0, 0},
  {&__pyx_kp_u_Track_LiveLoop, __pyx_k_Track_LiveLoop, sizeof(__pyx_k_Track_LiveLoop), 0, 1, 0, 0},
  {&__pyx_kp_u_Track_Standard, __pyx_k_Track_Standard, sizeof(__pyx_k_Track_Standard), 0, 1, 0, 0},
  {&__pyx_kp_u_Unable_to_initialize_Audio_Inter, __pyx_k_Unable_to_initialize_Audio_Inter, sizeof(__pyx_k_Unable_to_initialize_Audio_Inter), 0, 1, 0, 0},
  {&__pyx_kp_u_Unable_to_initialize_SDL_SDL_Ini, __pyx_k_Unable_to_initialize_SDL_SDL_Ini, sizeof(__pyx_k_Unable_to_initialize_SDL_SDL_Ini), 0, 1, 0, 0},
  {&__pyx_kp_u_Unable_to_load_sound_from_source, __pyx_k_Unable_to_load_sound_from_source, sizeof(__pyx_k_Unable_to_load_sound_from_source), 0, 1, 0, 0},
  {&__pyx_kp_u_Unable_to_open_audio_for_output, __pyx_k_Unable_to_open_audio_for_output, sizeof(__pyx_k_Unable_to_open_audio_for_output), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_notification_message_rec, __pyx_k_Unknown_notification_message_rec, sizeof(__pyx_k_Unknown_notification_message_rec), 0, 1, 0, 0},
  {&__pyx_kp_u__28, __pyx_k__28, sizeof(__pyx_k__28), 0, 1, 0, 0},
  {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0},
  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_attack, __pyx_k_attack, sizeof(__pyx_k_attack), 0, 0, 1, 1},
  {&__pyx_n_s_attenuation, __pyx_k_attenuation, sizeof(__pyx_k_attenuation), 0, 0, 1, 1},
  {&__pyx_n_s_audio_callback_data, __pyx_k_audio_callback_data, sizeof(__pyx_k_audio_callback_data), 0, 0, 1, 1},
  {&__pyx_n_u_audio_channels, __pyx_k_audio_channels, sizeof(__pyx_k_audio_channels), 0, 1, 0, 1},
  {&__pyx_n_s_audio_interface_instance, __pyx_k_audio_interface_instance, sizeof(__pyx_k_audio_interface_instance), 0, 0, 1, 1},
  {&__pyx_n_s_buffer_samples, __pyx_k_buffer_samples, sizeof(__pyx_k_buffer_samples), 0, 0, 1, 1},
  {&__pyx_n_u_buffer_samples, __pyx_k_buffer_samples, sizeof(__pyx_k_buffer_samples), 0, 1, 0, 1},
  {&__pyx_n_s_buffer_size, __pyx_k_buffer_size, sizeof(__pyx_k_buffer_size), 0, 0, 1, 1},
  {&__pyx_n_u_buffer_size, __pyx_k_buffer_size, sizeof(__pyx_k_buffer_size), 0, 1, 0, 1},
  {&__pyx_n_s_c_file_name, __pyx_k_c_file_name, sizeof(__pyx_k_c_file_name), 0, 0, 1, 1},
  {&__pyx_n_s_channels, __pyx_k_channels, sizeof(__pyx_k_channels), 0, 0, 1, 1},
  {&__pyx_n_s_chunk, __pyx_k_chunk, sizeof(__pyx_k_chunk), 0, 0, 1, 1},
  {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_container, __pyx_k_container, sizeof(__pyx_k_container), 0, 0, 1, 1},
  {&__pyx_n_s_db, __pyx_k_db, sizeof(__pyx_k_db), 0, 0, 1, 1},
  {&__pyx_n_s_db_to_gain, __pyx_k_db_to_gain, sizeof(__pyx_k_db_to_gain), 0, 0, 1, 1},
  {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  {&__pyx_n_s_delay, __pyx_k_delay, sizeof(__pyx_k_delay), 0, 0, 1, 1},
  {&__pyx_n_s_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_ducking, __pyx_k_ducking, sizeof(__pyx_k_ducking), 0, 0, 1, 1},
  {&__pyx_n_s_ducking_release_duration, __pyx_k_ducking_release_duration, sizeof(__pyx_k_ducking_release_duration), 0, 0, 1, 1},
  {&__pyx_n_s_enabled, __pyx_k_enabled, sizeof(__pyx_k_enabled), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_exp_time, __pyx_k_exp_time, sizeof(__pyx_k_exp_time), 0, 0, 1, 1},
  {&__pyx_n_s_fade_in, __pyx_k_fade_in, sizeof(__pyx_k_fade_in), 0, 0, 1, 1},
  {&__pyx_kp_u_fade_in_2, __pyx_k_fade_in_2, sizeof(__pyx_k_fade_in_2), 0, 1, 0, 0},
  {&__pyx_n_s_fade_out, __pyx_k_fade_out, sizeof(__pyx_k_fade_out), 0, 0, 1, 1},
  {&__pyx_kp_u_fade_out_2, __pyx_k_fade_out_2, sizeof(__pyx_k_fade_out_2), 0, 1, 0, 0},
  {&__pyx_n_s_fade_out_duration, __pyx_k_fade_out_duration, sizeof(__pyx_k_fade_out_duration), 0, 0, 1, 1},
  {&__pyx_n_s_fade_out_seconds, __pyx_k_fade_out_seconds, sizeof(__pyx_k_fade_out_seconds), 0, 0, 1, 1},
  {&__pyx_n_s_fading_status, __pyx_k_fading_status, sizeof(__pyx_k_fading_status), 0, 0, 1, 1},
  {&__pyx_n_u_fading_status, __pyx_k_fading_status, sizeof(__pyx_k_fading_status), 0, 1, 0, 1},
  {&__pyx_n_s_fading_status_values, __pyx_k_fading_status_values, sizeof(__pyx_k_fading_status_values), 0, 0, 1, 1},
  {&__pyx_n_s_file_name, __pyx_k_file_name, sizeof(__pyx_k_file_name), 0, 0, 1, 1},
  {&__pyx_n_u_finished, __pyx_k_finished, sizeof(__pyx_k_finished), 0, 1, 0, 1},
  {&__pyx_n_u_flac, __pyx_k_flac, sizeof(__pyx_k_flac), 0, 1, 0, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_gain, __pyx_k_gain, sizeof(__pyx_k_gain), 0, 0, 1, 1},
  {&__pyx_n_s_gain_string, __pyx_k_gain_string, sizeof(__pyx_k_gain_string), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
  {&__pyx_n_s_get_max_markers, __pyx_k_get_max_markers, sizeof(__pyx_k_get_max_markers), 0, 0, 1, 1},
  {&__pyx_n_s_get_max_tracks, __pyx_k_get_max_tracks, sizeof(__pyx_k_get_max_tracks), 0, 0, 1, 1},
  {&__pyx_n_s_get_next_sound, __pyx_k_get_next_sound, sizeof(__pyx_k_get_next_sound), 0, 0, 1, 1},
  {&__pyx_n_s_get_nowait, __pyx_k_get_nowait, sizeof(__pyx_k_get_nowait), 0, 0, 1, 1},
  {&__pyx_n_s_get_sdl_mixer_version, __pyx_k_get_sdl_mixer_version, sizeof(__pyx_k_get_sdl_mixer_version), 0, 0, 1, 1},
  {&__pyx_n_s_get_sdl_version, __pyx_k_get_sdl_version, sizeof(__pyx_k_get_sdl_version), 0, 0, 1, 1},
  {&__pyx_n_s_get_track, __pyx_k_get_track, sizeof(__pyx_k_get_track), 0, 0, 1, 1},
  {&__pyx_n_s_get_version, __pyx_k_get_version, sizeof(__pyx_k_get_version), 0, 0, 1, 1},
  {&__pyx_n_u_has_ducking, __pyx_k_has_ducking, sizeof(__pyx_k_has_ducking), 0, 1, 0, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_u_idle, __pyx_k_idle, sizeof(__pyx_k_idle), 0, 1, 0, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_initialize, __pyx_k_initialize, sizeof(__pyx_k_initialize), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_load, __pyx_k_load, sizeof(__pyx_k_load), 0, 0, 1, 1},
  {&__pyx_n_s_load_sound_chunk, __pyx_k_load_sound_chunk, sizeof(__pyx_k_load_sound_chunk), 0, 0, 1, 1},
  {&__pyx_n_s_loaded, __pyx_k_loaded, sizeof(__pyx_k_loaded), 0, 0, 1, 1},
  {&__pyx_n_s_loading, __pyx_k_loading, sizeof(__pyx_k_loading), 0, 0, 1, 1},
  {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
  {&__pyx_n_s_loops, __pyx_k_loops, sizeof(__pyx_k_loops), 0, 0, 1, 1},
  {&__pyx_n_u_loops, __pyx_k_loops, sizeof(__pyx_k_loops), 0, 1, 0, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_marker_count, __pyx_k_marker_count, sizeof(__pyx_k_marker_count), 0, 0, 1, 1},
  {&__pyx_n_s_markers, __pyx_k_markers, sizeof(__pyx_k_markers), 0, 0, 1, 1},
  {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
  {&__pyx_n_s_max_queue_time, __pyx_k_max_queue_time, sizeof(__pyx_k_max_queue_time), 0, 0, 1, 1},
  {&__pyx_n_s_max_simultaneous_sounds, __pyx_k_max_simultaneous_sounds, sizeof(__pyx_k_max_simultaneous_sounds), 0, 0, 1, 1},
  {&__pyx_n_s_mc, __pyx_k_mc, sizeof(__pyx_k_mc), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_kp_u_not_fading, __pyx_k_not_fading, sizeof(__pyx_k_not_fading), 0, 1, 0, 0},
  {&__pyx_n_s_num, __pyx_k_num, sizeof(__pyx_k_num), 0, 0, 1, 1},
  {&__pyx_n_s_number, __pyx_k_number, sizeof(__pyx_k_number), 0, 0, 1, 1},
  {&__pyx_n_u_ogg, __pyx_k_ogg, sizeof(__pyx_k_ogg), 0, 1, 0, 1},
  {&__pyx_n_s_old_instance, __pyx_k_old_instance, sizeof(__pyx_k_old_instance), 0, 0, 1, 1},
  {&__pyx_n_u_pending, __pyx_k_pending, sizeof(__pyx_k_pending), 0, 1, 0, 1},
  {&__pyx_kp_u_play_sound_No_idle_sound_player, __pyx_k_play_sound_No_idle_sound_player, sizeof(__pyx_k_play_sound_No_idle_sound_player), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_Processing_sound_s_fo, __pyx_k_play_sound_Processing_sound_s_fo, sizeof(__pyx_k_play_sound_Processing_sound_s_fo), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_Processing_sound_s_fo_2, __pyx_k_play_sound_Processing_sound_s_fo_2, sizeof(__pyx_k_play_sound_Processing_sound_s_fo_2), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_Sound_player_d_is_ava, __pyx_k_play_sound_Sound_player_d_is_ava, sizeof(__pyx_k_play_sound_Sound_player_d_is_ava), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_Sound_player_d_is_cur, __pyx_k_play_sound_Sound_player_d_is_cur, sizeof(__pyx_k_play_sound_Sound_player_d_is_cur), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_Sound_priority_d_is_h, __pyx_k_play_sound_Sound_priority_d_is_h, sizeof(__pyx_k_play_sound_Sound_priority_d_is_h), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_Sound_priority_d_is_l, __pyx_k_play_sound_Sound_priority_d_is_l, sizeof(__pyx_k_play_sound_Sound_priority_d_is_l), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_Sound_priority_d_is_l_2, __pyx_k_play_sound_Sound_priority_d_is_l_2, sizeof(__pyx_k_play_sound_Sound_priority_d_is_l_2), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_Sound_s_was_not_loade, __pyx_k_play_sound_Sound_s_was_not_loade, sizeof(__pyx_k_play_sound_Sound_s_was_not_loade), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_Sound_s_was_not_loade_2, __pyx_k_play_sound_Sound_s_was_not_loade_2, sizeof(__pyx_k_play_sound_Sound_s_was_not_loade_2), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_on_sound_player_s_s, __pyx_k_play_sound_on_sound_player_s_s, sizeof(__pyx_k_play_sound_on_sound_player_s_s), 0, 1, 0, 0},
  {&__pyx_n_u_player, __pyx_k_player, sizeof(__pyx_k_player), 0, 1, 0, 1},
  {&__pyx_n_s_player_fading_status_to_text, __pyx_k_player_fading_status_to_text, sizeof(__pyx_k_player_fading_status_to_text), 0, 0, 1, 1},
  {&__pyx_n_s_player_status_to_text, __pyx_k_player_status_to_text, sizeof(__pyx_k_player_status_to_text), 0, 0, 1, 1},
  {&__pyx_n_u_playing, __pyx_k_playing, sizeof(__pyx_k_playing), 0, 1, 0, 1},
  {&__pyx_n_s_pow, __pyx_k_pow, sizeof(__pyx_k_pow), 0, 0, 1, 1},
  {&__pyx_n_s_power_of_two, __pyx_k_power_of_two, sizeof(__pyx_k_power_of_two), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_priority, __pyx_k_priority, sizeof(__pyx_k_priority), 0, 0, 1, 1},
  {&__pyx_n_u_priority, __pyx_k_priority, sizeof(__pyx_k_priority), 0, 1, 0, 1},
  {&__pyx_n_s_process, __pyx_k_process, sizeof(__pyx_k_process), 0, 0, 1, 1},
  {&__pyx_n_s_process_notification_message, __pyx_k_process_notification_message, sizeof(__pyx_k_process_notification_message), 0, 0, 1, 1},
  {&__pyx_n_s_put, __pyx_k_put, sizeof(__pyx_k_put), 0, 0, 1, 1},
  {&__pyx_n_s_py_byte_file_name, __pyx_k_py_byte_file_name, sizeof(__pyx_k_py_byte_file_name), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qsize, __pyx_k_qsize, sizeof(__pyx_k_qsize), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_queue, __pyx_k_queue, sizeof(__pyx_k_queue), 0, 0, 1, 1},
  {&__pyx_n_s_queue_sound, __pyx_k_queue_sound, sizeof(__pyx_k_queue_sound), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_rate, __pyx_k_rate, sizeof(__pyx_k_rate), 0, 0, 1, 1},
  {&__pyx_n_s_release, __pyx_k_release, sizeof(__pyx_k_release), 0, 0, 1, 1},
  {&__pyx_n_s_release_point, __pyx_k_release_point, sizeof(__pyx_k_release_point), 0, 0, 1, 1},
  {&__pyx_n_s_remove_all_sounds_from_queue, __pyx_k_remove_all_sounds_from_queue, sizeof(__pyx_k_remove_all_sounds_from_queue), 0, 0, 1, 1},
  {&__pyx_n_s_remove_sound_from_queue, __pyx_k_remove_sound_from_queue, sizeof(__pyx_k_remove_sound_from_queue), 0, 0, 1, 1},
  {&__pyx_kp_u_replace_sound_Could_not_locate_s, __pyx_k_replace_sound_Could_not_locate_s, sizeof(__pyx_k_replace_sound_Could_not_locate_s), 0, 1, 0, 0},
  {&__pyx_kp_u_replace_sound_Preparing_to_repla, __pyx_k_replace_sound_Preparing_to_repla, sizeof(__pyx_k_replace_sound_Preparing_to_repla), 0, 1, 0, 0},
  {&__pyx_n_u_replacing, __pyx_k_replacing, sizeof(__pyx_k_replacing), 0, 1, 0, 1},
  {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1},
  {&__pyx_n_u_sample_pos, __pyx_k_sample_pos, sizeof(__pyx_k_sample_pos), 0, 1, 0, 1},
  {&__pyx_n_u_sample_rate, __pyx_k_sample_rate, sizeof(__pyx_k_sample_rate), 0, 1, 0, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_set_canceled, __pyx_k_set_canceled, sizeof(__pyx_k_set_canceled), 0, 0, 1, 1},
  {&__pyx_n_s_set_expired, __pyx_k_set_expired, sizeof(__pyx_k_set_expired), 0, 0, 1, 1},
  {&__pyx_n_s_set_looping, __pyx_k_set_looping, sizeof(__pyx_k_set_looping), 0, 0, 1, 1},
  {&__pyx_n_s_set_marker, __pyx_k_set_marker, sizeof(__pyx_k_set_marker), 0, 0, 1, 1},
  {&__pyx_n_s_set_pending, __pyx_k_set_pending, sizeof(__pyx_k_set_pending), 0, 0, 1, 1},
  {&__pyx_n_s_set_playing, __pyx_k_set_playing, sizeof(__pyx_k_set_playing), 0, 0, 1, 1},
  {&__pyx_n_s_set_queued, __pyx_k_set_queued, sizeof(__pyx_k_set_queued), 0, 0, 1, 1},
  {&__pyx_n_s_set_stopped, __pyx_k_set_stopped, sizeof(__pyx_k_set_stopped), 0, 0, 1, 1},
  {&__pyx_n_s_sound, __pyx_k_sound, sizeof(__pyx_k_sound), 0, 0, 1, 1},
  {&__pyx_n_u_sound_id, __pyx_k_sound_id, sizeof(__pyx_k_sound_id), 0, 1, 0, 1},
  {&__pyx_n_s_sound_instance, __pyx_k_sound_instance, sizeof(__pyx_k_sound_instance), 0, 0, 1, 1},
  {&__pyx_n_u_sound_instance_id, __pyx_k_sound_instance_id, sizeof(__pyx_k_sound_instance_id), 0, 1, 0, 1},
  {&__pyx_n_s_sound_instances_by_id, __pyx_k_sound_instances_by_id, sizeof(__pyx_k_sound_instances_by_id), 0, 0, 1, 1},
  {&__pyx_n_s_start_at, __pyx_k_start_at, sizeof(__pyx_k_start_at), 0, 0, 1, 1},
  {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
  {&__pyx_n_s_status, __pyx_k_status, sizeof(__pyx_k_status), 0, 0, 1, 1},
  {&__pyx_n_u_status, __pyx_k_status, sizeof(__pyx_k_status), 0, 1, 0, 1},
  {&__pyx_n_s_status_values, __pyx_k_status_values, sizeof(__pyx_k_status_values), 0, 0, 1, 1},
  {&__pyx_n_s_stop_all_sounds, __pyx_k_stop_all_sounds, sizeof(__pyx_k_stop_all_sounds), 0, 0, 1, 1},
  {&__pyx_n_s_stop_sound, __pyx_k_stop_sound, sizeof(__pyx_k_stop_sound), 0, 0, 1, 1},
  {&__pyx_n_u_stopping, __pyx_k_stopping, sizeof(__pyx_k_stopping), 0, 1, 0, 1},
  {&__pyx_n_s_string_to_gain, __pyx_k_string_to_gain, sizeof(__pyx_k_string_to_gain), 0, 0, 1, 1},
  {&__pyx_n_s_string_to_gain_locals_genexpr, __pyx_k_string_to_gain_locals_genexpr, sizeof(__pyx_k_string_to_gain_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_string_to_secs, __pyx_k_string_to_secs, sizeof(__pyx_k_string_to_secs), 0, 0, 1, 1},
  {&__pyx_n_s_string_to_secs_locals_genexpr, __pyx_k_string_to_secs_locals_genexpr, sizeof(__pyx_k_string_to_secs_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_u_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 1, 0, 1},
  {&__pyx_n_s_time_string, __pyx_k_time_string, sizeof(__pyx_k_time_string), 0, 0, 1, 1},
  {&__pyx_n_s_track_bit_mask, __pyx_k_track_bit_mask, sizeof(__pyx_k_track_bit_mask), 0, 0, 1, 1},
  {&__pyx_n_s_track_num, __pyx_k_track_num, sizeof(__pyx_k_track_num), 0, 0, 1, 1},
  {&__pyx_n_u_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 1, 0, 1},
  {&__pyx_n_s_unload_sound_chunk, __pyx_k_unload_sound_chunk, sizeof(__pyx_k_unload_sound_chunk), 0, 0, 1, 1},
  {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
  {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
  {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1},
  {&__pyx_n_s_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 0, 1, 1},
  {&__pyx_n_u_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 1, 0, 1},
  {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1},
  {&__pyx_n_u_wav, __pyx_k_wav, sizeof(__pyx_k_wav), 0, 1, 0, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) __PYX_ERR(0, 51, __pyx_L1_error)
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 215, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 155, __pyx_L1_error)
  __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s_round); if (!__pyx_builtin_round) __PYX_ERR(0, 267, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 458, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 1675, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 1753, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 2551, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":92
 *             buffer_samples: The audio buffer size to use (in number of samples, must be power of two)
 *         """
 *         self.log = logging.getLogger("AudioInterface")             # <<<<<<<<<<<<<<
 * 
 *         # Initialize threading in the extension library and acquire the Python global interpreter lock
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_u_AudioInterface); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":99
 *         # Make sure buffer samples is a power of two (required by SDL2)
 *         if not AudioInterface.power_of_two(buffer_samples):
 *             self.log.error('Buffer samples is required to be a power of two')             # <<<<<<<<<<<<<<
 *             raise AudioException("Unable to initialize Audio Interface: "
 *                                  "Buffer samples is required to be a power of two")
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Buffer_samples_is_required_to_be); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":100
 *         if not AudioInterface.power_of_two(buffer_samples):
 *             self.log.error('Buffer samples is required to be a power of two')
 *             raise AudioException("Unable to initialize Audio Interface: "             # <<<<<<<<<<<<<<
 *                                  "Buffer samples is required to be a power of two")
 * 
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Unable_to_initialize_Audio_Inter); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":105
 *         # Warn if a small buffer is used
 *         if buffer_samples <= 1024:
 *             self.log.warning('NOTE: You may experience noise and other undesirable sound artifacts '             # <<<<<<<<<<<<<<
 *                              'when you set your buffer at 1024 or smaller.')
 * 
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_NOTE_You_may_experience_noise_an); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":190
 *     def __del__(self):
 *         """Shut down the audio interface and clean up allocated memory"""
 *         self.log.debug("Shutting down and cleaning up allocated memory...")             # <<<<<<<<<<<<<<
 * 
 *         # Stop audio processing (will stop all SDL callbacks)
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Shutting_down_and_cleaning_up_al); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":416
 *         Enables audio playback (begins audio processing)
 *         """
 *         self.log.debug("Enabling audio playback")             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockAudio()
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Enabling_audio_playback); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":427
 *         Disables audio playback (stops audio processing)
 *         """
 *         self.log.debug("Disabling audio playback")             # <<<<<<<<<<<<<<
 * 
 *         self.stop_all_sounds()
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Disabling_audio_playback); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":489
 *         cdef int track_num = len(self.tracks)
 *         if track_num == MAX_TRACKS:
 *             self.log.error("Add track failed - the maximum number of tracks "             # <<<<<<<<<<<<<<
 *                            "(%d) has been reached.", MAX_TRACKS)
 *             return None
 */
  __pyx_tuple__9 = PyTuple_Pack(2, __pyx_kp_u_Add_track_failed_the_maximum_num, __pyx_int_8); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":536
 *         cdef int track_num = len(self.tracks)
 *         if track_num == MAX_TRACKS:
 *             self.log.error("Add track failed - the maximum number of tracks "             # <<<<<<<<<<<<<<
 *                            "(%d) has been reached.", MAX_TRACKS)
 *             return None
 */
  __pyx_tuple__10 = PyTuple_Pack(2, __pyx_kp_u_Add_track_failed_the_maximum_num, __pyx_int_8); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1620
 *             volume: The track volume (0.0 to 1.0)
 *         """
 *         self.log = logging.getLogger("Track")             # <<<<<<<<<<<<<<
 *         self._sound_instances_by_id = sound_instances_by_id
 *         self._name = name
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_u_Track); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 1620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1675
 *     def supports_in_memory_sounds(self):
 *         """Return whether or not track supports in-memory sounds"""
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_Must_be_overridden_in_derived_cl); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 1675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1680
 *     def supports_streaming_sounds(self):
 *         """Return whether or not track supports streaming sounds"""
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     def play_sound(self, sound_instance not None):
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_Must_be_overridden_in_derived_cl); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 1680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1688
 *             sound_instance: The SoundInstance object to play
 *         """
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound(self, sound_instance not None):
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_Must_be_overridden_in_derived_cl); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 1688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1696
 *             sound_instance: The SoundInstance to stop
 *         """
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound_looping(self, sound_instance not None):
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_Must_be_overridden_in_derived_cl); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 1696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1705
 *             sound_instance: The Sound to stop
 *         """
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     def stop_all_sounds(self):
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_Must_be_overridden_in_derived_cl); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 1705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1711
 *         Stops all playing sounds immediately on the track.
 *         """
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 *     def process(self):
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_Must_be_overridden_in_derived_cl); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 1711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1715
 *     def process(self):
 *         """Processes the track queue each tick."""
 *         raise NotImplementedError('Must be overridden in derived class')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_u_Must_be_overridden_in_derived_cl); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 1715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1772
 *         # Make sure the number of simultaneous sounds is within the allowable range
 *         if max_simultaneous_sounds > MAX_SIMULTANEOUS_SOUNDS_LIMIT:
 *             self.log.warning("The maximum number of simultaneous sounds per track is %d",             # <<<<<<<<<<<<<<
 *                              MAX_SIMULTANEOUS_SOUNDS_LIMIT)
 *             max_simultaneous_sounds = MAX_SIMULTANEOUS_SOUNDS_LIMIT
 */
  __pyx_tuple__19 = PyTuple_Pack(2, __pyx_kp_u_The_maximum_number_of_simultaneo, __pyx_int_32); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 1772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1776
 *             max_simultaneous_sounds = MAX_SIMULTANEOUS_SOUNDS_LIMIT
 *         elif max_simultaneous_sounds < 1:
 *             self.log.warning("The minimum number of simultaneous sounds per track is 1")             # <<<<<<<<<<<<<<
 *             max_simultaneous_sounds = 1
 *         self._max_simultaneous_sounds = max_simultaneous_sounds
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_u_The_minimum_number_of_simultaneo); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 1776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2098
 *             else:
 *                 # All sound players are currently busy:
 *                 self.log.debug("play_sound - No idle sound player is available.")             # <<<<<<<<<<<<<<
 *                 self.log.debug("play_sound - Sound player %d is currently playing the sound with "
 *                                "the lowest priority (%d).", player, lowest_priority)
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_play_sound_No_idle_sound_player); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 2098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2136
 *         """
 * 
 *         self.log.debug("replace_sound - Preparing to replace existing sound with a new sound instance")             # <<<<<<<<<<<<<<
 * 
 *         # Find which player is currently playing the specified sound instance to replace
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_u_replace_sound_Preparing_to_repla); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2145
 *             self._play_sound_on_sound_player(sound_instance, player, force=True)
 *         else:
 *             self.log.debug("replace_sound - Could not locate specified sound instance to replace")             # <<<<<<<<<<<<<<
 *             sound_instance.set_canceled()
 * 
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_u_replace_sound_Could_not_locate_s); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 2145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2253
 *         SDL_LockMutex(self.mutex)
 * 
 *         self.log.debug("Stopping all sounds and removing any pending sounds from queue")             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.type_state.sound_player_count):
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_u_Stopping_all_sounds_and_removing); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 2253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2275
 *                     pass
 *                 else:
 *                     self.log.error("All internal audio messages are currently in use, could not stop all sounds")             # <<<<<<<<<<<<<<
 * 
 *         # Remove all sounds that are pending in the sound queue.
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_u_All_internal_audio_messages_are_2); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 2275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":9
 * """
 * 
 * __all__ = ('AudioInterface',             # <<<<<<<<<<<<<<
 *            'AudioException',
 *            'Track',
 */
  __pyx_tuple__26 = PyTuple_Pack(4, __pyx_n_u_AudioInterface, __pyx_n_u_AudioException, __pyx_n_u_Track, __pyx_n_u_MixChunkContainer); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":15
 *            )
 * 
 * __version_info__ = ('0', '31', '1')             # <<<<<<<<<<<<<<
 * __version__ = '.'.join(__version_info__)
 * 
 */
  __pyx_tuple__27 = PyTuple_Pack(3, __pyx_kp_u_0, __pyx_kp_u_31, __pyx_kp_u_1); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":216
 * 
 *     @staticmethod
 *     def initialize(int rate=44100, int channels=2, int buffer_samples=4096, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes and retrieves the audio interface instance.
 */
  __pyx_tuple__29 = PyTuple_Pack(5, __pyx_n_s_rate, __pyx_n_s_channels, __pyx_n_s_buffer_samples, __pyx_n_s_kwargs, __pyx_n_s_audio_interface_instance); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_initialize, 216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 216, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":235
 * 
 *     @staticmethod
 *     def power_of_two(int num):             # <<<<<<<<<<<<<<
 *         """ Returns whether or not the supplied number is a power of 2 """
 *         return ((num & (num - 1)) == 0) and num != 0
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_num); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_power_of_two, 235, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 235, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":240
 * 
 *     @staticmethod
 *     def db_to_gain(float db):             # <<<<<<<<<<<<<<
 *         """Converts a value in decibels (-inf to 0.0) to a gain (0.0 to 1.0)"""
 *         return pow(10, db / 20.0)
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_db); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);
  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_db_to_gain, 240, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 240, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":245
 * 
 *     @staticmethod
 *     def string_to_gain(gain):             # <<<<<<<<<<<<<<
 *         """Converts a string to a gain value (0.0 to 1.0)"""
 *         cdef str gain_string = str(gain).upper()
 */
  __pyx_tuple__35 = PyTuple_Pack(4, __pyx_n_s_gain, __pyx_n_s_gain_string, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);
  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_string_to_gain, 245, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 245, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":270
 * 
 *     @staticmethod
 *     def string_to_secs(time):             # <<<<<<<<<<<<<<
 *         """Decodes a string of real-world time into a float of seconds.
 *         Example inputs:
 */
  __pyx_tuple__37 = PyTuple_Pack(8, __pyx_n_s_time, __pyx_n_s_time_string, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_string_to_secs, 270, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 270, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":437
 * 
 *     @staticmethod
 *     def get_max_tracks():             # <<<<<<<<<<<<<<
 *         """ Returns the maximum number of tracks allowed. """
 *         return MAX_TRACKS
 */
  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_get_max_tracks, 437, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 437, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":442
 * 
 *     @staticmethod
 *     def get_max_markers():             # <<<<<<<<<<<<<<
 *         """Return the maximum number of markers allowed per sound"""
 *         return MAX_MARKERS
 */
  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_get_max_markers, 442, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 442, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":571
 * 
 *     @staticmethod
 *     def load_sound_chunk(str file_name):             # <<<<<<<<<<<<<<
 *         """
 *         Loads an audio file into a MixChunkContainer wrapper object for use in a Sound object.
 */
  __pyx_tuple__41 = PyTuple_Pack(5, __pyx_n_s_file_name, __pyx_n_s_py_byte_file_name, __pyx_n_s_c_file_name, __pyx_n_s_chunk, __pyx_n_s_mc); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_load_sound_chunk, 571, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 571, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":602
 * 
 *     @staticmethod
 *     def unload_sound_chunk(container):             # <<<<<<<<<<<<<<
 *         """
 *         Unloads the source sample (Mix_Chunk) from the supplied container (used in Sound
 */
  __pyx_tuple__43 = PyTuple_Pack(2, __pyx_n_s_container, __pyx_n_s_mc); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);
  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_unload_sound_chunk, 602, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 602, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2530
 * 
 *     @staticmethod
 *     def player_status_to_text(int status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player status value into an equivalent text string.  Used for testing
 */
  __pyx_tuple__45 = PyTuple_Pack(2, __pyx_n_s_status, __pyx_n_s_status_values); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);
  __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_player_status_to_text, 2530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 2530, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2555
 * 
 *     @staticmethod
 *     def player_fading_status_to_text(int fading_status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player fading status value into an equivalent text string.  Used for
 */
  __pyx_tuple__47 = PyTuple_Pack(2, __pyx_n_s_fading_status, __pyx_n_s_fading_status_values); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);
  __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_D_Development_Pinball_mpf_mc_mpf, __pyx_n_s_player_fading_status_to_text, 2555, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4096 = PyInt_FromLong(4096); if (unlikely(!__pyx_int_4096)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_44100 = PyInt_FromLong(44100L); if (unlikely(!__pyx_int_44100)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initaudio_interface(void); /*proto*/
PyMODINIT_FUNC initaudio_interface(void)
#else
PyMODINIT_FUNC PyInit_audio_interface(void); /*proto*/
PyMODINIT_FUNC PyInit_audio_interface(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_audio_interface(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("audio_interface", __pyx_methods, __pyx_k_Audio_Library_This_library_requ, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_Pinball__mpf_mc__mpfmc__core__audio__audio_interface) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "Pinball.mpf_mc.mpfmc.core.audio.audio_interface")) {
      if (unlikely(PyDict_SetItemString(modules, "Pinball.mpf_mc.mpfmc.core.audio.audio_interface", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface = &__pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface;
  __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface.audio_callback = (void (*)(void *, Uint8 *, int))__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_audio_callback;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 59, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_2__init__.doc = __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_2__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_2__init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface.tp_dict, __pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "AudioInterface", (PyObject *)&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface;
  __pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track = &__pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track;
  __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track.get_state = (__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackState *(*)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track *))__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_get_state;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track) < 0) __PYX_ERR(0, 1587, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1587, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_2__init__.doc = __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_2__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_5Track_2__init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track.tp_dict, __pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track) < 0) __PYX_ERR(0, 1587, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Track", (PyObject *)&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track) < 0) __PYX_ERR(0, 1587, __pyx_L1_error)
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track;
  __pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard = &__pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard;
  __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard.__pyx_base = *__pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track;
  __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard._get_idle_sound_player = (int (*)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *))__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_idle_sound_player;
  __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard._get_available_request_message = (__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageContainer *(*)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *))__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_available_request_message;
  __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard._get_sound_player_with_lowest_priority = (PyObject *(*)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *))__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_sound_player_with_lowest_priority;
  __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard._play_sound_on_sound_player = (int (*)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *, PyObject *, int, struct __pyx_opt_args_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player *__pyx_optional_args))__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__play_sound_on_sound_player;
  __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard._get_player_playing_sound_instance = (int (*)(struct __pyx_obj_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard *, PyObject *))__pyx_f_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard__get_player_playing_sound_instance;
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard.tp_base = __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard) < 0) __PYX_ERR(0, 1721, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1721, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard___init__.doc = __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard___init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard.tp_dict, __pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard) < 0) __PYX_ERR(0, 1721, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "TrackStandard", (PyObject *)&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard) < 0) __PYX_ERR(0, 1721, __pyx_L1_error)
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard;
  __pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop = &__pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop;
  __pyx_vtable_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop.__pyx_base = *__pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track;
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop.tp_base = __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_Track;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop) < 0) __PYX_ERR(0, 2580, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 2580, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_2__init__.doc = __pyx_doc_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_2__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackLiveLoop_2__init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop.tp_dict, __pyx_vtabptr_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop) < 0) __PYX_ERR(0, 2580, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "TrackLiveLoop", (PyObject *)&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop) < 0) __PYX_ERR(0, 2580, __pyx_L1_error)
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackLiveLoop;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer) < 0) __PYX_ERR(0, 2722, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "MixChunkContainer", (PyObject *)&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer) < 0) __PYX_ERR(0, 2722, __pyx_L1_error)
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_MixChunkContainer;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain) < 0) __PYX_ERR(0, 245, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain.tp_print = 0;
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct__string_to_gain;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 250, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr.tp_print = 0;
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs) < 0) __PYX_ERR(0, 270, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs.tp_print = 0;
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_2_string_to_secs;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr.tp_print = 0;
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_3_genexpr;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 293, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr.tp_print = 0;
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_4_genexpr;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 297, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr.tp_print = 0;
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_5_genexpr;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr) < 0) __PYX_ERR(0, 301, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr.tp_print = 0;
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_6_genexpr;
  if (PyType_Ready(&__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr) < 0) __PYX_ERR(0, 305, __pyx_L1_error)
  __pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr.tp_print = 0;
  __pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr = &__pyx_type_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface___pyx_scope_struct_7_genexpr;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":9
 * """
 * 
 * __all__ = ('AudioInterface',             # <<<<<<<<<<<<<<
 *            'AudioException',
 *            'Track',
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_tuple__26) < 0) __PYX_ERR(0, 9, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":15
 *            )
 * 
 * __version_info__ = ('0', '31', '1')             # <<<<<<<<<<<<<<
 * __version__ = '.'.join(__version_info__)
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version_info, __pyx_tuple__27) < 0) __PYX_ERR(0, 15, __pyx_L1_error)

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":16
 * 
 * __version_info__ = ('0', '31', '1')
 * __version__ = '.'.join(__version_info__)             # <<<<<<<<<<<<<<
 * 
 * from libc.stdio cimport FILE, fopen, fprintf
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_version_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_Join(__pyx_kp_u__28, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":25
 * import cython
 * 
 * from queue import PriorityQueue, Empty             # <<<<<<<<<<<<<<
 * from math import pow
 * import time
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_PriorityQueue);
  __Pyx_GIVEREF(__pyx_n_s_PriorityQueue);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PriorityQueue);
  __Pyx_INCREF(__pyx_n_s_Empty);
  __Pyx_GIVEREF(__pyx_n_s_Empty);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Empty);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_queue, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_PriorityQueue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PriorityQueue, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Empty, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":26
 * 
 * from queue import PriorityQueue, Empty
 * from math import pow             # <<<<<<<<<<<<<<
 * import time
 * import logging
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_pow);
  __Pyx_GIVEREF(__pyx_n_s_pow);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_pow);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_math, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_pow); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pow, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":27
 * from queue import PriorityQueue, Empty
 * from math import pow
 * import time             # <<<<<<<<<<<<<<
 * import logging
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_2) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":28
 * from math import pow
 * import time
 * import logging             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":51
 * #    AudioException class
 * # ---------------------------------------------------------------------------
 * class AudioException(Exception):             # <<<<<<<<<<<<<<
 *     """Exception returned by the audio module"""
 *     pass
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_AudioException, __pyx_n_s_AudioException, (PyObject *) NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio, __pyx_kp_s_Exception_returned_by_the_audio); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_AudioException, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_AudioException, __pyx_t_4) < 0) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":216
 * 
 *     @staticmethod
 *     def initialize(int rate=44100, int channels=2, int buffer_samples=4096, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes and retrieves the audio interface instance.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_7initialize, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":215
 *         SDL_Quit()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def initialize(int rate=44100, int channels=2, int buffer_samples=4096, **kwargs):
 *         """
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_initialize, __pyx_t_2) < 0) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":216
 * 
 *     @staticmethod
 *     def initialize(int rate=44100, int channels=2, int buffer_samples=4096, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes and retrieves the audio interface instance.
 */
  __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_initialize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":215
 *         SDL_Quit()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def initialize(int rate=44100, int channels=2, int buffer_samples=4096, **kwargs):
 *         """
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_initialize, __pyx_t_2) < 0) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":235
 * 
 *     @staticmethod
 *     def power_of_two(int num):             # <<<<<<<<<<<<<<
 *         """ Returns whether or not the supplied number is a power of 2 """
 *         return ((num & (num - 1)) == 0) and num != 0
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_9power_of_two, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":234
 *         return audio_interface_instance
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def power_of_two(int num):
 *         """ Returns whether or not the supplied number is a power of 2 """
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_power_of_two, __pyx_t_2) < 0) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":235
 * 
 *     @staticmethod
 *     def power_of_two(int num):             # <<<<<<<<<<<<<<
 *         """ Returns whether or not the supplied number is a power of 2 """
 *         return ((num & (num - 1)) == 0) and num != 0
 */
  __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_power_of_two); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":234
 *         return audio_interface_instance
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def power_of_two(int num):
 *         """ Returns whether or not the supplied number is a power of 2 """
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_power_of_two, __pyx_t_2) < 0) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":240
 * 
 *     @staticmethod
 *     def db_to_gain(float db):             # <<<<<<<<<<<<<<
 *         """Converts a value in decibels (-inf to 0.0) to a gain (0.0 to 1.0)"""
 *         return pow(10, db / 20.0)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_11db_to_gain, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":239
 *         return ((num & (num - 1)) == 0) and num != 0
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def db_to_gain(float db):
 *         """Converts a value in decibels (-inf to 0.0) to a gain (0.0 to 1.0)"""
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_db_to_gain, __pyx_t_2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":240
 * 
 *     @staticmethod
 *     def db_to_gain(float db):             # <<<<<<<<<<<<<<
 *         """Converts a value in decibels (-inf to 0.0) to a gain (0.0 to 1.0)"""
 *         return pow(10, db / 20.0)
 */
  __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_db_to_gain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":239
 *         return ((num & (num - 1)) == 0) and num != 0
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def db_to_gain(float db):
 *         """Converts a value in decibels (-inf to 0.0) to a gain (0.0 to 1.0)"""
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_db_to_gain, __pyx_t_2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":245
 * 
 *     @staticmethod
 *     def string_to_gain(gain):             # <<<<<<<<<<<<<<
 *         """Converts a string to a gain value (0.0 to 1.0)"""
 *         cdef str gain_string = str(gain).upper()
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_13string_to_gain, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":244
 *         return pow(10, db / 20.0)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def string_to_gain(gain):
 *         """Converts a string to a gain value (0.0 to 1.0)"""
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_string_to_gain, __pyx_t_2) < 0) __PYX_ERR(0, 245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":245
 * 
 *     @staticmethod
 *     def string_to_gain(gain):             # <<<<<<<<<<<<<<
 *         """Converts a string to a gain value (0.0 to 1.0)"""
 *         cdef str gain_string = str(gain).upper()
 */
  __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_string_to_gain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":244
 *         return pow(10, db / 20.0)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def string_to_gain(gain):
 *         """Converts a string to a gain value (0.0 to 1.0)"""
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_string_to_gain, __pyx_t_2) < 0) __PYX_ERR(0, 245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":270
 * 
 *     @staticmethod
 *     def string_to_secs(time):             # <<<<<<<<<<<<<<
 *         """Decodes a string of real-world time into a float of seconds.
 *         Example inputs:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_21string_to_secs, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":269
 *         return round(buffer_length / (self.sample_rate * self.audio_channels * BYTES_PER_SAMPLE), 3)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def string_to_secs(time):
 *         """Decodes a string of real-world time into a float of seconds.
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_string_to_secs, __pyx_t_2) < 0) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":270
 * 
 *     @staticmethod
 *     def string_to_secs(time):             # <<<<<<<<<<<<<<
 *         """Decodes a string of real-world time into a float of seconds.
 *         Example inputs:
 */
  __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_string_to_secs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":269
 *         return round(buffer_length / (self.sample_rate * self.audio_channels * BYTES_PER_SAMPLE), 3)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def string_to_secs(time):
 *         """Decodes a string of real-world time into a float of seconds.
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_string_to_secs, __pyx_t_2) < 0) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":341
 * 
 *     @classmethod
 *     def get_version(cls):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieves the current version of the audio interface library
 */
  __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_get_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":340
 *         return int(self.sample_rate * seconds)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def get_version(cls):
 *         """
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_get_version, __pyx_t_1) < 0) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":349
 * 
 *     @classmethod
 *     def get_sdl_version(cls):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the version of the SDL library
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_get_sdl_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":348
 *         return __version__
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def get_sdl_version(cls):
 *         """
 */
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_get_sdl_version, __pyx_t_2) < 0) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":359
 * 
 *     @classmethod
 *     def get_sdl_mixer_version(cls):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the version of the dynamically linked SDL_Mixer library
 */
  __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_get_sdl_mixer_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":358
 *         return 'SDL {}.{}.{}'.format(version.major, version.minor, version.patch)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def get_sdl_mixer_version(cls):
 *         """
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_get_sdl_mixer_version, __pyx_t_1) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":437
 * 
 *     @staticmethod
 *     def get_max_tracks():             # <<<<<<<<<<<<<<
 *         """ Returns the maximum number of tracks allowed. """
 *         return MAX_TRACKS
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_43get_max_tracks, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":436
 *         SDL_UnlockAudio()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def get_max_tracks():
 *         """ Returns the maximum number of tracks allowed. """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_get_max_tracks, __pyx_t_1) < 0) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":437
 * 
 *     @staticmethod
 *     def get_max_tracks():             # <<<<<<<<<<<<<<
 *         """ Returns the maximum number of tracks allowed. """
 *         return MAX_TRACKS
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_get_max_tracks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":436
 *         SDL_UnlockAudio()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def get_max_tracks():
 *         """ Returns the maximum number of tracks allowed. """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_get_max_tracks, __pyx_t_1) < 0) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":442
 * 
 *     @staticmethod
 *     def get_max_markers():             # <<<<<<<<<<<<<<
 *         """Return the maximum number of markers allowed per sound"""
 *         return MAX_MARKERS
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_45get_max_markers, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":441
 *         return MAX_TRACKS
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def get_max_markers():
 *         """Return the maximum number of markers allowed per sound"""
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_get_max_markers, __pyx_t_1) < 0) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":442
 * 
 *     @staticmethod
 *     def get_max_markers():             # <<<<<<<<<<<<<<
 *         """Return the maximum number of markers allowed per sound"""
 *         return MAX_MARKERS
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_get_max_markers); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":441
 *         return MAX_TRACKS
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def get_max_markers():
 *         """Return the maximum number of markers allowed per sound"""
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_get_max_markers, __pyx_t_1) < 0) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":571
 * 
 *     @staticmethod
 *     def load_sound_chunk(str file_name):             # <<<<<<<<<<<<<<
 *         """
 *         Loads an audio file into a MixChunkContainer wrapper object for use in a Sound object.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_57load_sound_chunk, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":570
 *         return new_track
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def load_sound_chunk(str file_name):
 *         """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_load_sound_chunk, __pyx_t_1) < 0) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":571
 * 
 *     @staticmethod
 *     def load_sound_chunk(str file_name):             # <<<<<<<<<<<<<<
 *         """
 *         Loads an audio file into a MixChunkContainer wrapper object for use in a Sound object.
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_load_sound_chunk); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":570
 *         return new_track
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def load_sound_chunk(str file_name):
 *         """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_load_sound_chunk, __pyx_t_1) < 0) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":602
 * 
 *     @staticmethod
 *     def unload_sound_chunk(container):             # <<<<<<<<<<<<<<
 *         """
 *         Unloads the source sample (Mix_Chunk) from the supplied container (used in Sound
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_14AudioInterface_59unload_sound_chunk, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":601
 *         return mc
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def unload_sound_chunk(container):
 *         """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_unload_sound_chunk, __pyx_t_1) < 0) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":602
 * 
 *     @staticmethod
 *     def unload_sound_chunk(container):             # <<<<<<<<<<<<<<
 *         """
 *         Unloads the source sample (Mix_Chunk) from the supplied container (used in Sound
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface, __pyx_n_s_unload_sound_chunk); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":601
 *         return mc
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def unload_sound_chunk(container):
 *         """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface->tp_dict, __pyx_n_s_unload_sound_chunk, __pyx_t_1) < 0) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_AudioInterface);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2530
 * 
 *     @staticmethod
 *     def player_status_to_text(int status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player status value into an equivalent text string.  Used for testing
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_43player_status_to_text, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2529
 *         return sound_instance in self._sound_queue_items
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def player_status_to_text(int status):
 *         """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard->tp_dict, __pyx_n_s_player_status_to_text, __pyx_t_1) < 0) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2530
 * 
 *     @staticmethod
 *     def player_status_to_text(int status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player status value into an equivalent text string.  Used for testing
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard, __pyx_n_s_player_status_to_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2529
 *         return sound_instance in self._sound_queue_items
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def player_status_to_text(int status):
 *         """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard->tp_dict, __pyx_n_s_player_status_to_text, __pyx_t_1) < 0) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2555
 * 
 *     @staticmethod
 *     def player_fading_status_to_text(int fading_status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player fading status value into an equivalent text string.  Used for
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_13TrackStandard_45player_fading_status_to_text, NULL, __pyx_n_s_Pinball_mpf_mc_mpfmc_core_audio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2554
 *             return "unknown"
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def player_fading_status_to_text(int fading_status):
 *         """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard->tp_dict, __pyx_n_s_player_fading_status_to_text, __pyx_t_1) < 0) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2555
 * 
 *     @staticmethod
 *     def player_fading_status_to_text(int fading_status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player fading status value into an equivalent text string.  Used for
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard, __pyx_n_s_player_fading_status_to_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":2554
 *             return "unknown"
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def player_fading_status_to_text(int fading_status):
 *         """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard->tp_dict, __pyx_n_s_player_fading_status_to_text, __pyx_t_1) < 0) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_TrackStandard);

  /* "Pinball/mpf_mc/mpfmc/core/audio/audio_interface.pyx":1
 * #!python             # <<<<<<<<<<<<<<
 * #cython: embedsignature=True, language_level=3
 * """
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init Pinball.mpf_mc.mpfmc.core.audio.audio_interface", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init Pinball.mpf_mc.mpfmc.core.audio.audio_interface");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* KeywordStringCheck */
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* GetModuleGlobalName */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

/* PyObjectCall */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
  #if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyErrFetchRestore */
    #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
    #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* PyObjectCallNoArg */
      #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* None */
        static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* IterFinish */
        static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* PyObjectCallMethod0 */
        static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *function = PyMethod_GET_FUNCTION(method);
            result = __Pyx_PyObject_CallOneArg(function, self);
            Py_DECREF(method);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNeedMoreValuesToUnpack */
        static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* RaiseTooManyValuesToUnpack */
        static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* UnpackItemEndCheck */
        static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* RaiseNoneIterError */
        static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
        static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
        static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                             int is_tuple, int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    if (!is_tuple && unlikely(!PyTuple_Check(tuple))) {
        iternextfunc iternext;
        iter = PyObject_GetIter(tuple);
        if (unlikely(!iter)) goto bad;
        if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
        iternext = Py_TYPE(iter)->tp_iternext;
        value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
        value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
        if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
        Py_DECREF(iter);
    } else {
        if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) {
            __Pyx_UnpackTupleError(tuple, 2);
            goto bad;
        }
#if CYTHON_COMPILING_IN_PYPY
        value1 = PySequence_ITEM(tuple, 0);
        if (unlikely(!value1)) goto bad;
        value2 = PySequence_ITEM(tuple, 1);
        if (unlikely(!value2)) goto bad;
#else
        value1 = PyTuple_GET_ITEM(tuple, 0);
        value2 = PyTuple_GET_ITEM(tuple, 1);
        Py_INCREF(value1);
        Py_INCREF(value2);
#endif
        if (decref_tuple) { Py_DECREF(tuple); }
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
        static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
#if !CYTHON_COMPILING_IN_PYPY
    if (is_dict) {
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
    }
#endif
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* MergeKeywords */
        static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) {
    PyObject *iter, *key = NULL, *value = NULL;
    int source_is_dict, result;
    Py_ssize_t orig_length, ppos = 0;
    iter = __Pyx_dict_iterator(source_mapping, 0, __pyx_n_s_items, &orig_length, &source_is_dict);
    if (unlikely(!iter)) {
        PyObject *args;
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        args = PyTuple_Pack(1, source_mapping);
        if (likely(args)) {
            PyObject *fallback = PyObject_Call((PyObject*)&PyDict_Type, args, NULL);
            Py_DECREF(args);
            if (likely(fallback)) {
                iter = __Pyx_dict_iterator(fallback, 1, __pyx_n_s_items, &orig_length, &source_is_dict);
                Py_DECREF(fallback);
            }
        }
        if (unlikely(!iter)) goto bad;
    }
    while (1) {
        result = __Pyx_dict_iter_next(iter, orig_length, &ppos, &key, &value, NULL, source_is_dict);
        if (unlikely(result < 0)) goto bad;
        if (!result) break;
        if (unlikely(PyDict_Contains(kwdict, key))) {
            __Pyx_RaiseDoubleKeywordsError("function", key);
            result = -1;
        } else {
            result = PyDict_SetItem(kwdict, key, value);
        }
        Py_DECREF(key);
        Py_DECREF(value);
        if (unlikely(result < 0)) goto bad;
    }
    Py_XDECREF(iter);
    return 0;
bad:
    Py_XDECREF(iter);
    return -1;
}

/* None */
        static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* unicode_iter */
        static CYTHON_INLINE int __Pyx_init_unicode_iteration(
    PyObject* ustring, Py_ssize_t *length, void** data, int *kind) {
#if CYTHON_PEP393_ENABLED
    if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return -1;
    *kind   = PyUnicode_KIND(ustring);
    *length = PyUnicode_GET_LENGTH(ustring);
    *data   = PyUnicode_DATA(ustring);
#else
    *kind   = 0;
    *length = PyUnicode_GET_SIZE(ustring);
    *data   = (void*)PyUnicode_AS_UNICODE(ustring);
#endif
    return 0;
}

/* unicode_tailmatch */
        static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
                                     Py_ssize_t start, Py_ssize_t end, int direction) {
    if (unlikely(PyTuple_Check(substr))) {
        Py_ssize_t i, count = PyTuple_GET_SIZE(substr);
        for (i = 0; i < count; i++) {
            Py_ssize_t result;
#if CYTHON_COMPILING_IN_CPYTHON
            result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substr, i),
                                         start, end, direction);
#else
            PyObject* sub = PySequence_ITEM(substr, i);
            if (unlikely(!sub)) return -1;
            result = PyUnicode_Tailmatch(s, sub, start, end, direction);
            Py_DECREF(sub);
#endif
            if (result) {
                return (int) result;
            }
        }
        return 0;
    }
    return (int) PyUnicode_Tailmatch(s, substr, start, end, direction);
}

/* pyobject_as_double */
        static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
#if CYTHON_COMPILING_IN_PYPY
    float_value = PyNumber_Float(obj);  if (0) goto bad;
#else
    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
    if (likely(nb) && likely(nb->nb_float)) {
        float_value = nb->nb_float(obj);
        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
            PyErr_Format(PyExc_TypeError,
                "__float__ returned non-float (type %.200s)",
                Py_TYPE(float_value)->tp_name);
            Py_DECREF(float_value);
            goto bad;
        }
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
#endif
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

/* PyIntFromDouble */
        #if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value) {
    if (value >= (double)LONG_MIN && value <= (double)LONG_MAX) {
        return PyInt_FromLong((long)value);
    }
    return PyLong_FromDouble(value);
}
#endif

/* BytesEquals */
        static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
        static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* SaveResetException */
        #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* GetException */
        #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
#endif
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* GetItemInt */
          static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* PyErrExceptionMatches */
          #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    return PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* ArgTypeTest */
          static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

/* ExtTypeTest */
          static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* PyIntBinop */
          #if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    }
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* WriteUnraisableException */
          static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* None */
          static CYTHON_INLINE int __Pyx_div_int(int a, int b) {
    int q = a / b;
    int r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* SetItemInt */
          static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
#else
    if (is_list || PySequence_Check(o)) {
#endif
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

/* PyIntBinop */
            #if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) {
            Py_RETURN_TRUE;
        } else {
            Py_RETURN_FALSE;
        }
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
                default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
                #else
                default: Py_RETURN_FALSE;
                #endif
            }
        }
            if (a == b) {
                Py_RETURN_TRUE;
            } else {
                Py_RETURN_FALSE;
            }
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            if ((double)a == (double)b) {
                Py_RETURN_TRUE;
            } else {
                Py_RETURN_FALSE;
            }
    }
    return PyObject_RichCompare(op1, op2, Py_EQ);
}
#endif

/* dict_getitem_default */
            static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
#else
    if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    } else {
        if (default_value == Py_None)
            default_value = NULL;
        value = PyObject_CallMethodObjArgs(
            d, __pyx_n_s_get, key, default_value, NULL);
    }
#endif
    return value;
}

/* SetVTable */
            static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* Import */
            static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
            static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* CalculateMetaclass */
            static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
            static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* GetNameInClass */
            static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) {
    PyObject *result;
    result = __Pyx_PyObject_GetAttrStr(nmspace, name);
    if (!result)
        result = __Pyx_GetModuleGlobalName(name);
    return result;
}

/* CodeObjectCache */
            static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
            #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntFromPyVerify */
            #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint8(Uint8 value) {
    const Uint8 neg_one = (Uint8) -1, const_zero = (Uint8) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Uint8) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Uint8) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(Uint8) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(Uint8) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Uint8) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(Uint8),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage value) {
    const enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage neg_one = (enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage) -1, const_zero = (enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_NotificationMessage),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint32(Uint32 value) {
    const Uint32 neg_one = (Uint32) -1, const_zero = (Uint32) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Uint32) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Uint32) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(Uint32) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(Uint32) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Uint32) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(Uint32),
                                     little, !is_unsigned);
    }
}

static PyObject* __pyx_convert__to_py___pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataStopSound(__pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_RequestMessageDataStopSound s) {
              PyObject* res;
              PyObject* member;
              res = PyDict_New(); if (unlikely(!res)) return NULL;
              member = __Pyx_PyInt_From_Uint32(s.fade_out_duration); if (unlikely(!member)) goto bad;
              if (unlikely(PyDict_SetItem(res, __pyx_n_s_fade_out_duration, member) < 0)) goto bad;
              Py_DECREF(member);
              return res;
              bad:
              Py_XDECREF(member);
              Py_DECREF(res);
              return NULL;
            }
            /* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus value) {
    const enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus neg_one = (enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus) -1, const_zero = (enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_SoundPlayerStatus),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus value) {
    const enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus neg_one = (enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus) -1, const_zero = (enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7Pinball_6mpf_mc_5mpfmc_4core_5audio_15audio_interface_FadingStatus),
                                     little, !is_unsigned);
    }
}

/* ClassMethod */
            static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
#if CYTHON_COMPILING_IN_PYPY
    if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
        return PyClassMethod_New(method);
    }
#else
    static PyTypeObject *methoddescr_type = NULL;
    if (methoddescr_type == NULL) {
       PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append");
       if (!meth) return NULL;
       methoddescr_type = Py_TYPE(meth);
       Py_DECREF(meth);
    }
    if (PyObject_TypeCheck(method, methoddescr_type)) {
        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
        #if PY_VERSION_HEX < 0x03020000
        PyTypeObject *d_type = descr->d_type;
        #else
        PyTypeObject *d_type = descr->d_common.d_type;
        #endif
        return PyDescr_NewClassMethod(d_type, descr->d_method);
    }
#endif
    else if (PyMethod_Check(method)) {
        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
    }
    else if (PyCFunction_Check(method)) {
        return PyClassMethod_New(method);
    }
#ifdef __Pyx_CyFunction_USED
    else if (PyObject_TypeCheck(method, __pyx_CyFunctionType)) {
        return PyClassMethod_New(method);
    }
#endif
    PyErr_SetString(PyExc_TypeError,
                   "Class-level classmethod() can only be called on "
                   "a method_descriptor or instance method.");
    return NULL;
}

/* CIntFromPy */
            static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
            static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
            static CYTHON_INLINE Uint32 __Pyx_PyInt_As_Uint32(PyObject *x) {
    const Uint32 neg_one = (Uint32) -1, const_zero = (Uint32) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(Uint32) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(Uint32, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (Uint32) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (Uint32) 0;
                case  1: __PYX_VERIFY_RETURN_INT(Uint32, digit, digits[0])
                case 2:
                    if (8 * sizeof(Uint32) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint32) >= 2 * PyLong_SHIFT) {
                            return (Uint32) (((((Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(Uint32) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint32) >= 3 * PyLong_SHIFT) {
                            return (Uint32) (((((((Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(Uint32) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint32) >= 4 * PyLong_SHIFT) {
                            return (Uint32) (((((((((Uint32)digits[3]) << PyLong_SHIFT) | (Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (Uint32) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(Uint32) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint32, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(Uint32) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (Uint32) 0;
                case -1: __PYX_VERIFY_RETURN_INT(Uint32, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(Uint32,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(Uint32) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint32) - 1 > 2 * PyLong_SHIFT) {
                            return (Uint32) (((Uint32)-1)*(((((Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(Uint32) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint32) - 1 > 2 * PyLong_SHIFT) {
                            return (Uint32) ((((((Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(Uint32) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint32) - 1 > 3 * PyLong_SHIFT) {
                            return (Uint32) (((Uint32)-1)*(((((((Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(Uint32) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint32) - 1 > 3 * PyLong_SHIFT) {
                            return (Uint32) ((((((((Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(Uint32) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint32, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint32) - 1 > 4 * PyLong_SHIFT) {
                            return (Uint32) (((Uint32)-1)*(((((((((Uint32)digits[3]) << PyLong_SHIFT) | (Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(Uint32) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint32) - 1 > 4 * PyLong_SHIFT) {
                            return (Uint32) ((((((((((Uint32)digits[3]) << PyLong_SHIFT) | (Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(Uint32) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint32, long, PyLong_AsLong(x))
            } else if (sizeof(Uint32) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint32, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            Uint32 val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (Uint32) -1;
        }
    } else {
        Uint32 val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (Uint32) -1;
        val = __Pyx_PyInt_As_Uint32(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to Uint32");
    return (Uint32) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to Uint32");
    return (Uint32) -1;
}

/* CIntFromPy */
            static CYTHON_INLINE Uint8 __Pyx_PyInt_As_Uint8(PyObject *x) {
    const Uint8 neg_one = (Uint8) -1, const_zero = (Uint8) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(Uint8) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(Uint8, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (Uint8) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (Uint8) 0;
                case  1: __PYX_VERIFY_RETURN_INT(Uint8, digit, digits[0])
                case 2:
                    if (8 * sizeof(Uint8) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint8) >= 2 * PyLong_SHIFT) {
                            return (Uint8) (((((Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(Uint8) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint8) >= 3 * PyLong_SHIFT) {
                            return (Uint8) (((((((Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(Uint8) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint8) >= 4 * PyLong_SHIFT) {
                            return (Uint8) (((((((((Uint8)digits[3]) << PyLong_SHIFT) | (Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (Uint8) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(Uint8) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint8, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(Uint8) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint8, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (Uint8) 0;
                case -1: __PYX_VERIFY_RETURN_INT(Uint8, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(Uint8,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(Uint8) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint8, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint8) - 1 > 2 * PyLong_SHIFT) {
                            return (Uint8) (((Uint8)-1)*(((((Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(Uint8) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint8) - 1 > 2 * PyLong_SHIFT) {
                            return (Uint8) ((((((Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(Uint8) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint8, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint8) - 1 > 3 * PyLong_SHIFT) {
                            return (Uint8) (((Uint8)-1)*(((((((Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(Uint8) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint8) - 1 > 3 * PyLong_SHIFT) {
                            return (Uint8) ((((((((Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(Uint8) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint8, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint8) - 1 > 4 * PyLong_SHIFT) {
                            return (Uint8) (((Uint8)-1)*(((((((((Uint8)digits[3]) << PyLong_SHIFT) | (Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(Uint8) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint8) - 1 > 4 * PyLong_SHIFT) {
                            return (Uint8) ((((((((((Uint8)digits[3]) << PyLong_SHIFT) | (Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(Uint8) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint8, long, PyLong_AsLong(x))
            } else if (sizeof(Uint8) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint8, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            Uint8 val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (Uint8) -1;
        }
    } else {
        Uint8 val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (Uint8) -1;
        val = __Pyx_PyInt_As_Uint8(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to Uint8");
    return (Uint8) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to Uint8");
    return (Uint8) -1;
}

/* CIntFromPy */
            static CYTHON_INLINE Sint32 __Pyx_PyInt_As_Sint32(PyObject *x) {
    const Sint32 neg_one = (Sint32) -1, const_zero = (Sint32) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(Sint32) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(Sint32, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (Sint32) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (Sint32) 0;
                case  1: __PYX_VERIFY_RETURN_INT(Sint32, digit, digits[0])
                case 2:
                    if (8 * sizeof(Sint32) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Sint32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Sint32) >= 2 * PyLong_SHIFT) {
                            return (Sint32) (((((Sint32)digits[1]) << PyLong_SHIFT) | (Sint32)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(Sint32) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Sint32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Sint32) >= 3 * PyLong_SHIFT) {
                            return (Sint32) (((((((Sint32)digits[2]) << PyLong_SHIFT) | (Sint32)digits[1]) << PyLong_SHIFT) | (Sint32)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(Sint32) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Sint32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Sint32) >= 4 * PyLong_SHIFT) {
                            return (Sint32) (((((((((Sint32)digits[3]) << PyLong_SHIFT) | (Sint32)digits[2]) << PyLong_SHIFT) | (Sint32)digits[1]) << PyLong_SHIFT) | (Sint32)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (Sint32) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(Sint32) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(Sint32, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(Sint32) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Sint32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (Sint32) 0;
                case -1: __PYX_VERIFY_RETURN_INT(Sint32, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(Sint32,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(Sint32) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Sint32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Sint32) - 1 > 2 * PyLong_SHIFT) {
                            return (Sint32) (((Sint32)-1)*(((((Sint32)digits[1]) << PyLong_SHIFT) | (Sint32)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(Sint32) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Sint32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Sint32) - 1 > 2 * PyLong_SHIFT) {
                            return (Sint32) ((((((Sint32)digits[1]) << PyLong_SHIFT) | (Sint32)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(Sint32) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Sint32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Sint32) - 1 > 3 * PyLong_SHIFT) {
                            return (Sint32) (((Sint32)-1)*(((((((Sint32)digits[2]) << PyLong_SHIFT) | (Sint32)digits[1]) << PyLong_SHIFT) | (Sint32)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(Sint32) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Sint32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Sint32) - 1 > 3 * PyLong_SHIFT) {
                            return (Sint32) ((((((((Sint32)digits[2]) << PyLong_SHIFT) | (Sint32)digits[1]) << PyLong_SHIFT) | (Sint32)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(Sint32) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Sint32, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Sint32) - 1 > 4 * PyLong_SHIFT) {
                            return (Sint32) (((Sint32)-1)*(((((((((Sint32)digits[3]) << PyLong_SHIFT) | (Sint32)digits[2]) << PyLong_SHIFT) | (Sint32)digits[1]) << PyLong_SHIFT) | (Sint32)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(Sint32) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Sint32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Sint32) - 1 > 4 * PyLong_SHIFT) {
                            return (Sint32) ((((((((((Sint32)digits[3]) << PyLong_SHIFT) | (Sint32)digits[2]) << PyLong_SHIFT) | (Sint32)digits[1]) << PyLong_SHIFT) | (Sint32)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(Sint32) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(Sint32, long, PyLong_AsLong(x))
            } else if (sizeof(Sint32) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Sint32, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            Sint32 val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (Sint32) -1;
        }
    } else {
        Sint32 val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (Sint32) -1;
        val = __Pyx_PyInt_As_Sint32(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to Sint32");
    return (Sint32) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to Sint32");
    return (Sint32) -1;
}

/* FetchCommonType */
            static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* SwapException */
            #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* PyObjectCallMethod1 */
            static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            args = PyTuple_New(2);
            if (unlikely(!args)) goto bad;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
bad:
    Py_XDECREF(method);
    return result;
}

/* CoroutineBase */
            #include <structmember.h>
#include <frameobject.h>
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
#if PY_VERSION_HEX >= 0x030300A0
        if (ev && Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
#endif
        if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            if (!ev) {
                Py_INCREF(Py_None);
                ev = Py_None;
            } else if (PyTuple_Check(ev)) {
                if (PyTuple_GET_SIZE(ev) >= 1) {
                    PyObject *value;
#if CYTHON_COMPILING_IN_CPYTHON
                    value = PySequence_ITEM(ev, 0);
#else
                    value = PyTuple_GET_ITEM(ev, 0);
                    Py_INCREF(value);
#endif
                    Py_DECREF(ev);
                    ev = value;
                } else {
                    Py_INCREF(Py_None);
                    Py_DECREF(ev);
                    ev = Py_None;
                }
            }
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = ev;
            return 0;
        }
    } else if (!PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
#endif
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) {
    PyObject *exc_type = self->exc_type;
    PyObject *exc_value = self->exc_value;
    PyObject *exc_traceback = self->exc_traceback;
    self->exc_type = NULL;
    self->exc_value = NULL;
    self->exc_traceback = NULL;
    Py_XDECREF(exc_type);
    Py_XDECREF(exc_value);
    Py_XDECREF(exc_traceback);
}
static CYTHON_INLINE
int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) {
    if (unlikely(gen->is_running)) {
        PyErr_SetString(PyExc_ValueError,
                        "generator already executing");
        return 1;
    }
    return 0;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) {
    PyObject *retval;
    __Pyx_PyThreadState_declare
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            PyErr_SetString(PyExc_TypeError,
                            "can't send non-None value to a "
                            "just-started generator");
            return NULL;
        }
    }
    if (unlikely(self->resume_label == -1)) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    __Pyx_PyThreadState_assign
    if (value) {
#if CYTHON_COMPILING_IN_PYPY
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(__pyx_tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = __pyx_tstate->frame;
        }
#endif
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(self);
    }
    self->is_running = 1;
    retval = self->body((PyObject *) self, value);
    self->is_running = 0;
    if (retval) {
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_CLEAR(f->f_back);
        }
#endif
    } else {
        __Pyx_Coroutine_ExceptionClear(self);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(PyObject *retval) {
    if (unlikely(!retval && !PyErr_Occurred())) {
        PyErr_SetNone(PyExc_StopIteration);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen_FetchStopIterationValue(&val);
    ret = __Pyx_Coroutine_SendEx(gen, val);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value);
    }
    return __Pyx_Coroutine_MethodReturn(retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL);
    if (retval) {
        Py_DECREF(retval);
        PyErr_SetString(PyExc_RuntimeError,
                        "generator ignored GeneratorExit");
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (!raised_exception
        || raised_exception == PyExc_StopIteration
        || raised_exception == PyExc_GeneratorExit
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
    {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *typ;
    PyObject *tb = NULL;
    PyObject *val = NULL;
    PyObject *yf = gen->yieldfrom;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL));
            goto throw_here;
        }
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Throw(yf, args);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Throw(yf, args);
        } else
        #endif
        {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            ret = PyObject_CallObject(meth, args);
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL));
}
static int __Pyx_Coroutine_traverse(PyObject *self, visitproc visit, void *arg) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    Py_VISIT(gen->exc_type);
    Py_VISIT(gen->exc_value);
    Py_VISIT(gen->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    Py_CLEAR(gen->exc_type);
    Py_CLEAR(gen->exc_value);
    Py_CLEAR(gen->exc_traceback);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label > 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *res;
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label <= 0)
        return ;
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
    res = __Pyx_Coroutine_Close(self);
    if (res == NULL)
        PyErr_WriteUnraisable(self);
    else
        Py_DECREF(res);
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self)
{
    Py_INCREF(self->gi_name);
    return self->gi_name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self)
{
    Py_INCREF(self->gi_qualname);
    return self->gi_qualname;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (gen == NULL)
        return NULL;
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->exc_type = NULL;
    gen->exc_value = NULL;
    gen->exc_traceback = NULL;
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
                static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
                #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (!abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_VERSION_HEX >= 0x03030000) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if (0) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
                static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if PY_VERSION_HEX >= 0x030400a1
    __Pyx_Coroutine_del,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

/* CheckBinaryVersion */
                static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* InitStrings */
                static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else
        return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return __Pyx_NewRef(x);
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(x);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
