/* Generated by Cython 0.29.21 */

#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 < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_21"
#define CYTHON_HEX_VERSION 0x001D15F0
#define CYTHON_FUTURE_DIVISION 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
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#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_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#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
#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_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif 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 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"
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #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)
#endif
  #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
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#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
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #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_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#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_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #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_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #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_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #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_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #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
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? 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
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#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
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#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) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#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_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

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

#define __PYX_HAVE__mpfmc__core__audio__track_standard
#define __PYX_HAVE_API__mpfmc__core__audio__track_standard
/* Early includes */
#include "stdio.h"
#include "SDL.h"
#include "sdl2_helper.h"
#include "SDL_mixer.h"
#include "gst/gst.h"
#include "glib.h"
#include "gstreamer_helper.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#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_UTF8 1
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING "utf-8"
#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)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#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)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_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 const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const 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_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const 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)
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);
}
#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)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#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) + 1);
    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 CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
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[] = {
  "mpfmc\\core\\audio\\track_standard.pyx",
  "stringsource",
  "mpfmc\\core\\audio\\sound_file.pxd",
};
/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()

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


/*--- Type declarations ---*/
struct __pyx_obj_5mpfmc_4core_5audio_5track_Track;
struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundFile;
struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundMemoryFile;
struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundStreamingFile;
struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard;
struct __pyx_t_5mpfmc_4core_5audio_4sdl2_Sample16Bytes;
union __pyx_t_5mpfmc_4core_5audio_4sdl2_Sample16;
struct __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData;
typedef struct __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData;

/* "mpfmc/core/audio/sdl2.pxd":231
 * # 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_5mpfmc_4core_5audio_4sdl2_Sample16Bytes {
  Uint8 byte0;
  Uint8 byte1;
};

/* "mpfmc/core/audio/sdl2.pxd":238
 *     Uint8 byte1
 * 
 * cdef union Sample16:             # <<<<<<<<<<<<<<
 *     # 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_5mpfmc_4core_5audio_4sdl2_Sample16 {
  Sint16 value;
  struct __pyx_t_5mpfmc_4core_5audio_4sdl2_Sample16Bytes bytes;
};

/* "mpfmc/core/audio/sdl2.pxd":251
 * # ---------------------------------------------------------------------------
 * 
 * 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_5mpfmc_4core_5audio_4sdl2_AudioCallbackData {
  SDL_AudioFormat format;
  int sample_rate;
  int channels;
  Uint16 buffer_samples;
  Uint32 buffer_size;
  Uint16 bytes_per_control_point;
  Uint8 bytes_per_sample;
  double seconds_to_bytes_factor;
  Uint8 quick_fade_steps;
  Uint8 master_volume;
  Uint8 silence;
  Uint8 track_count;
  void **tracks;
  FILE *c_log_file;
};
struct __pyx_t_5mpfmc_4core_5audio_5track_TrackState;
typedef struct __pyx_t_5mpfmc_4core_5audio_5track_TrackState __pyx_t_5mpfmc_4core_5audio_5track_TrackState;

/* "mpfmc/core/audio/track.pxd":10
 * 
 * # The number of control points per audio buffer (sets control rate for ducking)
 * cdef enum:             # <<<<<<<<<<<<<<
 *     CONTROL_POINTS_PER_BUFFER = 8
 * 
 */
enum  {
  __pyx_e_5mpfmc_4core_5audio_5track_CONTROL_POINTS_PER_BUFFER = 8
};

/* "mpfmc/core/audio/track.pxd":13
 *     CONTROL_POINTS_PER_BUFFER = 8
 * 
 * cdef enum:             # <<<<<<<<<<<<<<
 *     MAX_SIMULTANEOUS_SOUNDS_DEFAULT = 8
 * 
 */
enum  {
  __pyx_e_5mpfmc_4core_5audio_5track_MAX_SIMULTANEOUS_SOUNDS_DEFAULT = 8
};

/* "mpfmc/core/audio/track.pxd":16
 *     MAX_SIMULTANEOUS_SOUNDS_DEFAULT = 8
 * 
 * cdef enum:             # <<<<<<<<<<<<<<
 *     MAX_SIMULTANEOUS_SOUNDS_LIMIT = 32
 * 
 */
enum  {
  __pyx_e_5mpfmc_4core_5audio_5track_MAX_SIMULTANEOUS_SOUNDS_LIMIT = 32
};

/* "mpfmc/core/audio/track.pxd":20
 * 
 * 
 * cdef enum TrackStatus:             # <<<<<<<<<<<<<<
 *     track_status_stopped = 0
 *     track_status_stopping = 1
 */
enum __pyx_t_5mpfmc_4core_5audio_5track_TrackStatus {
  __pyx_e_5mpfmc_4core_5audio_5track_track_status_stopped = 0,
  __pyx_e_5mpfmc_4core_5audio_5track_track_status_stopping = 1,
  __pyx_e_5mpfmc_4core_5audio_5track_track_status_playing = 2,
  __pyx_e_5mpfmc_4core_5audio_5track_track_status_pausing = 3,
  __pyx_e_5mpfmc_4core_5audio_5track_track_status_paused = 4
};

/* "mpfmc/core/audio/track.pxd":27
 *     track_status_paused = 4
 * 
 * ctypedef struct TrackState:             # <<<<<<<<<<<<<<
 *     # Common track state variables (for all track types)
 *     AudioCallbackData *callback_data
 */
struct __pyx_t_5mpfmc_4core_5audio_5track_TrackState {
  __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData *callback_data;
  void (*mix_callback_function)(__pyx_t_5mpfmc_4core_5audio_5track_TrackState *, Uint32, __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData *);
  void *type_state;
  enum __pyx_t_5mpfmc_4core_5audio_5track_TrackStatus status;
  int active;
  int number;
  Uint8 volume;
  Uint8 fade_volume_start;
  Uint8 fade_volume_target;
  Uint8 fade_volume_current;
  Uint32 fade_steps;
  Uint32 fade_steps_remaining;
  int buffer_size;
  Uint8 *buffer;
  GSList *notification_messages;
  int ducking_is_active;
  GArray *ducking_control_points;
};
struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageDataLooping;
typedef struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageDataLooping __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageDataLooping;
struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageDataMarker;
typedef struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageDataMarker __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageDataMarker;
struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageSoundLoopSet;
typedef struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageSoundLoopSet __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageSoundLoopSet;
union __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageData;
typedef union __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageData __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageData;
struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer;
typedef struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer;

/* "mpfmc/core/audio/notification_message.pxd":10
 * # ---------------------------------------------------------------------------
 * 
 * cdef enum NotificationMessage:             # <<<<<<<<<<<<<<
 *     notification_sound_started = 1            # Notification that a sound has started playing
 *     notification_sound_stopped = 2            # Notification that a sound has stopped
 */
enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage {
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_started = 1,
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_stopped = 2,
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_looping = 3,
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_marker = 4,
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_about_to_finish = 5,
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_player_idle = 10,
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_track_stopped = 0,
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_track_paused = 21,
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_loop_set_started = 31,
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_loop_set_stopped = 32,
  __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_loop_set_looping = 33
};

/* "mpfmc/core/audio/notification_message.pxd":23
 *     notification_sound_loop_set_looping = 33  # Notification that a sound_loop_set is looping back to the beginning
 * 
 * ctypedef struct NotificationMessageDataLooping:             # <<<<<<<<<<<<<<
 *     int loop_count
 *     int loops_remaining
 */
struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageDataLooping {
  int loop_count;
  int loops_remaining;
};

/* "mpfmc/core/audio/notification_message.pxd":27
 *     int loops_remaining
 * 
 * ctypedef struct NotificationMessageDataMarker:             # <<<<<<<<<<<<<<
 *     int id
 * 
 */
struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageDataMarker {
  int id;
};

/* "mpfmc/core/audio/notification_message.pxd":30
 *     int id
 * 
 * ctypedef struct NotificationMessageSoundLoopSet:             # <<<<<<<<<<<<<<
 *     long id
 *     gpointer player
 */
struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageSoundLoopSet {
  long id;
  gpointer player;
};

/* "mpfmc/core/audio/notification_message.pxd":35
 * 
 * 
 * ctypedef union NotificationMessageData:             # <<<<<<<<<<<<<<
 *     NotificationMessageDataLooping looping
 *     NotificationMessageDataMarker marker
 */
union __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageData {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageDataLooping looping;
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageDataMarker marker;
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageSoundLoopSet sound_loop_set;
};

/* "mpfmc/core/audio/notification_message.pxd":40
 *     NotificationMessageSoundLoopSet sound_loop_set
 * 
 * ctypedef struct NotificationMessageContainer:             # <<<<<<<<<<<<<<
 *     NotificationMessage message
 *     Uint64 sound_id
 */
struct __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer {
  enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage message;
  Uint64 sound_id;
  Uint64 sound_instance_id;
  int player;
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageData data;
};
struct __pyx_t_5mpfmc_4core_5audio_10sound_file_SampleMemory;
typedef struct __pyx_t_5mpfmc_4core_5audio_10sound_file_SampleMemory __pyx_t_5mpfmc_4core_5audio_10sound_file_SampleMemory;
struct __pyx_t_5mpfmc_4core_5audio_10sound_file_SampleStream;
typedef struct __pyx_t_5mpfmc_4core_5audio_10sound_file_SampleStream __pyx_t_5mpfmc_4core_5audio_10sound_file_SampleStream;
union __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSampleData;
typedef union __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSampleData __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSampleData;
struct __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSample;
typedef struct __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSample __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSample;

/* "mpfmc/core/audio/sound_file.pxd":19
 *     gint null_buffer_count
 * 
 * cdef enum SoundType:             # <<<<<<<<<<<<<<
 *     sound_type_memory = 0
 *     sound_type_streaming = 1
 */
enum __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundType {
  __pyx_e_5mpfmc_4core_5audio_10sound_file_sound_type_memory = 0,
  __pyx_e_5mpfmc_4core_5audio_10sound_file_sound_type_streaming = 1
};

/* "mpfmc/core/audio/sound_file.pxd":5
 * 
 * 
 * ctypedef struct SampleMemory:             # <<<<<<<<<<<<<<
 *     gpointer data
 *     gsize size
 */
struct __pyx_t_5mpfmc_4core_5audio_10sound_file_SampleMemory {
  gpointer data;
  gsize size;
};

/* "mpfmc/core/audio/sound_file.pxd":9
 *     gsize size
 * 
 * ctypedef struct SampleStream:             # <<<<<<<<<<<<<<
 *     GstElement *pipeline
 *     GstElement *sink
 */
struct __pyx_t_5mpfmc_4core_5audio_10sound_file_SampleStream {
  GstElement *pipeline;
  GstElement *sink;
  GstSample *sample;
  GstBuffer *buffer;
  GstMapInfo map_info;
  Uint32 map_buffer_pos;
  gboolean map_contains_valid_sample_data;
  gint null_buffer_count;
};

/* "mpfmc/core/audio/sound_file.pxd":23
 *     sound_type_streaming = 1
 * 
 * ctypedef union SoundSampleData:             # <<<<<<<<<<<<<<
 *     SampleMemory *memory
 *     SampleStream *stream
 */
union __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSampleData {
  __pyx_t_5mpfmc_4core_5audio_10sound_file_SampleMemory *memory;
  __pyx_t_5mpfmc_4core_5audio_10sound_file_SampleStream *stream;
};

/* "mpfmc/core/audio/sound_file.pxd":27
 *     SampleStream *stream
 * 
 * ctypedef struct SoundSample:             # <<<<<<<<<<<<<<
 *     SoundType type
 *     SoundSampleData data
 */
struct __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSample {
  enum __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundType type;
  __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSampleData data;
  double duration;
  Uint32 size;
};
struct __pyx_t_5mpfmc_4core_5audio_14track_standard_TrackStandardState;
typedef struct __pyx_t_5mpfmc_4core_5audio_14track_standard_TrackStandardState __pyx_t_5mpfmc_4core_5audio_14track_standard_TrackStandardState;
struct __pyx_t_5mpfmc_4core_5audio_14track_standard_DuckingSettings;
typedef struct __pyx_t_5mpfmc_4core_5audio_14track_standard_DuckingSettings __pyx_t_5mpfmc_4core_5audio_14track_standard_DuckingSettings;
struct __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings;
typedef struct __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings;
struct __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer;
typedef struct __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer;
struct __pyx_opt_args_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player;

/* "mpfmc/core/audio/track_standard.pxd":12
 * # ---------------------------------------------------------------------------
 * 
 * cdef enum:             # <<<<<<<<<<<<<<
 *     no_marker = 0xFFFFFFFF
 * 
 */
enum  {
  __pyx_e_5mpfmc_4core_5audio_14track_standard_no_marker = 0xFFFFFFFF
};

/* "mpfmc/core/audio/track_standard.pxd":20
 *     SoundPlayer *sound_players
 * 
 * cdef enum SoundPlayerStatus:             # <<<<<<<<<<<<<<
 *     # Enumeration of the possible sound player status values.
 *     player_idle = 0
 */
enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus {
  __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle = 0,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_player_pending = 1,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_player_replacing = 2,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_player_fading_in = 3,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_player_fading_out = 4,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_player_playing = 5,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_player_finished = 6,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_player_stopping = 7
};

/* "mpfmc/core/audio/track_standard.pxd":39
 *     Sint32 release_duration
 * 
 * cdef enum DuckingStage:             # <<<<<<<<<<<<<<
 *     ducking_stage_idle = 0
 *     ducking_stage_delay = 1
 */
enum __pyx_t_5mpfmc_4core_5audio_14track_standard_DuckingStage {
  __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_idle = 0,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_delay = 1,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_attack = 2,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_hold = 3,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_release = 4,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_finished = 5
};

/* "mpfmc/core/audio/track_standard.pxd":47
 *     ducking_stage_finished = 5
 * 
 * cdef enum FadingStatus:             # <<<<<<<<<<<<<<
 *     fading_status_not_fading = 0
 *     fading_status_fading_in = 1
 */
enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus {
  __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_not_fading = 0,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_in = 1,
  __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_out = 2
};

/* "mpfmc/core/audio/track_standard.pxd":15
 *     no_marker = 0xFFFFFFFF
 * 
 * ctypedef struct TrackStandardState:             # <<<<<<<<<<<<<<
 *     # State variables for TrackStandard tracks
 *     int sound_player_count
 */
struct __pyx_t_5mpfmc_4core_5audio_14track_standard_TrackStandardState {
  int sound_player_count;
  __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *sound_players;
};

/* "mpfmc/core/audio/track_standard.pxd":31
 *     player_stopping = 7
 * 
 * ctypedef struct DuckingSettings:             # <<<<<<<<<<<<<<
 *     int track_bit_mask
 *     Sint32 attack_start_pos
 */
struct __pyx_t_5mpfmc_4core_5audio_14track_standard_DuckingSettings {
  int track_bit_mask;
  Sint32 attack_start_pos;
  Sint32 attack_duration;
  Uint8 attenuation_volume;
  Sint32 release_start_pos;
  Sint32 release_duration;
};

/* "mpfmc/core/audio/track_standard.pxd":52
 *     fading_status_fading_out = 2
 * 
 * ctypedef struct SoundSettings:             # <<<<<<<<<<<<<<
 *     SoundSample *sample
 *     Uint8 volume
 */
struct __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings {
  __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSample *sample;
  Uint8 volume;
  Uint8 volume_left;
  Uint8 volume_right;
  int loops_remaining;
  int current_loop;
  Uint32 sample_pos;
  Uint32 loop_start_pos;
  Uint32 loop_end_pos;
  Uint64 sound_id;
  Uint64 sound_instance_id;
  int sound_priority;
  enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus fading_status;
  Uint32 fade_in_steps;
  Uint32 fade_out_steps;
  Uint32 fade_steps_remaining;
  Uint8 marker_count;
  GArray *markers;
  Uint32 about_to_finish_marker;
  int sound_has_ducking;
  __pyx_t_5mpfmc_4core_5audio_14track_standard_DuckingSettings ducking_settings;
  enum __pyx_t_5mpfmc_4core_5audio_14track_standard_DuckingStage ducking_stage;
  GArray *ducking_control_points;
};

/* "mpfmc/core/audio/track_standard.pxd":77
 *     GArray *ducking_control_points
 * 
 * ctypedef struct SoundPlayer:             # <<<<<<<<<<<<<<
 *     # The SoundPlayer keeps track of the current sample position in the source audio
 *     # samples and is also keeps track of variables for sound looping and determining when the
 */
struct __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer {
  enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus status;
  __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings current;
  __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings next;
  int track_num;
  int number;
};

/* "mpfmc/core/audio/track_standard.pxd":108
 *     cdef process_notification_message(self, NotificationMessageContainer *notification_message)
 *     cdef tuple _get_sound_player_with_lowest_priority(self)
 *     cdef bint _play_sound_on_sound_player(self, sound_instance, int player, bint force=?)             # <<<<<<<<<<<<<<
 *     cdef _set_player_sound_settings(self, SoundSettings *sound_settings, object sound_instance)
 *     cdef _set_player_playing(self, SoundPlayer *player, object sound_instance)
 */
struct __pyx_opt_args_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player {
  int __pyx_n;
  int force;
};

/* "mpfmc/core/audio/track.pxd":51
 * #    Track base class
 * # ---------------------------------------------------------------------------
 * cdef class Track:             # <<<<<<<<<<<<<<
 * 
 *     cdef str _name
 */
struct __pyx_obj_5mpfmc_4core_5audio_5track_Track {
  PyObject_HEAD
  struct __pyx_vtabstruct_5mpfmc_4core_5audio_5track_Track *__pyx_vtab;
  PyObject *_name;
  int _number;
  PyObject *_events_when_stopped;
  PyObject *_events_when_played;
  PyObject *_events_when_paused;
  PyObject *mc;
  SDL_AudioDeviceID device_id;
  PyObject *log;
  __pyx_t_5mpfmc_4core_5audio_5track_TrackState *state;
};


/* "mpfmc/core/audio/sound_file.pxd":34
 * 
 * 
 * cdef class SoundFile:             # <<<<<<<<<<<<<<
 *     """SoundFile is the base class for wrapper classes used to manage sound sample data."""
 *     cdef str file_name
 */
struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundFile {
  PyObject_HEAD
  PyObject *file_name;
  __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData *callback_data;
  __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSample sample;
  PyObject *log;
};


/* "mpfmc/core/audio/sound_file.pxd":42
 * 
 * 
 * cdef class SoundMemoryFile(SoundFile):             # <<<<<<<<<<<<<<
 *     """SoundMemoryFile is a wrapper class to manage sound sample data stored
 *     in memory."""
 */
struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundMemoryFile {
  struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundFile __pyx_base;
  int _loaded_using_sdl;
};


/* "mpfmc/core/audio/sound_file.pxd":48
 * 
 * 
 * cdef class SoundStreamingFile(SoundFile):             # <<<<<<<<<<<<<<
 *     """SoundStreamingFile is a wrapper class to manage streaming sound sample data."""
 *     cdef GstElement *pipeline
 */
struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundStreamingFile {
  struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundFile __pyx_base;
  GstElement *pipeline;
  GstElement *source;
  GstElement *convert;
  GstElement *resample;
  GstElement *sink;
  GstBus *bus;
  gulong bus_message_handler_id;
};


/* "mpfmc/core/audio/track_standard.pyx":33
 * #    TrackStandard class
 * # ---------------------------------------------------------------------------
 * cdef class TrackStandard(Track):             # <<<<<<<<<<<<<<
 *     """
 *     Track class
 */
struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard {
  struct __pyx_obj_5mpfmc_4core_5audio_5track_Track __pyx_base;
  PyObject *_sound_queue;
  PyObject *_playing_instances_by_id;
  int _max_simultaneous_sounds;
  __pyx_t_5mpfmc_4core_5audio_14track_standard_TrackStandardState *type_state;
};



/* "mpfmc/core/audio/track.pxd":51
 * #    Track base class
 * # ---------------------------------------------------------------------------
 * cdef class Track:             # <<<<<<<<<<<<<<
 * 
 *     cdef str _name
 */

struct __pyx_vtabstruct_5mpfmc_4core_5audio_5track_Track {
  __pyx_t_5mpfmc_4core_5audio_5track_TrackState *(*get_state)(struct __pyx_obj_5mpfmc_4core_5audio_5track_Track *);
  void (*mix_track_to_output)(__pyx_t_5mpfmc_4core_5audio_5track_TrackState *, __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData *, Uint8 *, Uint32);
  void (*mix_audio)(Uint8 *, Uint8 const *, Uint32, int);
  void (*mix_audio_stereo)(Uint8 *, Uint8 const *, Uint32, int, int);
  void (*apply_volume)(Uint8 *, Uint8 const *, Uint32, int);
  void (*apply_volume_stereo)(Uint8 *, Uint8 const *, Uint32, int, int);
};
static struct __pyx_vtabstruct_5mpfmc_4core_5audio_5track_Track *__pyx_vtabptr_5mpfmc_4core_5audio_5track_Track;


/* "mpfmc/core/audio/track_standard.pyx":33
 * #    TrackStandard class
 * # ---------------------------------------------------------------------------
 * cdef class TrackStandard(Track):             # <<<<<<<<<<<<<<
 *     """
 *     Track class
 */

struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard {
  struct __pyx_vtabstruct_5mpfmc_4core_5audio_5track_Track __pyx_base;
  int (*_get_playing_sound_count)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, Uint64);
  PyObject *(*_get_playing_sound_instances)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, Uint64);
  int (*_get_idle_sound_player)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *);
  PyObject *(*process_notification_message)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *);
  PyObject *(*_get_sound_player_with_lowest_priority)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *);
  int (*_play_sound_on_sound_player)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, PyObject *, int, struct __pyx_opt_args_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player *__pyx_optional_args);
  PyObject *(*_set_player_sound_settings)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings *, PyObject *);
  PyObject *(*_set_player_playing)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *, PyObject *);
  PyObject *(*_set_player_replacing)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *, PyObject *);
  int (*_get_player_playing_sound_instance)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, PyObject *);
  Uint32 (*_fix_sample_frame_pos)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, Uint32, Uint8, int);
  void (*mix_playing_sounds)(__pyx_t_5mpfmc_4core_5audio_5track_TrackState *, Uint32, __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData *);
};
static struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_vtabptr_5mpfmc_4core_5audio_14track_standard_TrackStandard;

/* --- 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_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *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);

/* 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);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* 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

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#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);

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* 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

/* 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);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#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);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, 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);

/* 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));
}

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
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);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#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

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#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

/* 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 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);

/* SliceTupleAndList.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#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);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#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

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#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

/* py_dict_values.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    (likely((cfunc)->func) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
            (PY_VERSION_HEX >= 0x030700A0 ?\
                (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
                (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
          (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
            (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
            (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
               ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
               __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

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

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

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_SubtractCObj(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

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

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

/* CallUnboundCMethod1.proto */
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* CallUnboundCMethod2.proto */
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

/* CallNextTpDealloc.proto */
static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);

/* CallNextTpTraverse.proto */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);

/* CallNextTpClear.proto */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyObject *dict);

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

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

/* PyObjectGetAttrStrNoError.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

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

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

/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name)  (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* 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_enum____pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage(enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint64(Uint64 value);

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint16(Uint16 value);

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus value);

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

/* CIntFromPy.proto */
static CYTHON_INLINE Uint64 __Pyx_PyInt_As_Uint64(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 guint __Pyx_PyInt_As_guint(PyObject *);

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

/* CIntFromPy.proto */
static CYTHON_INLINE gint64 __Pyx_PyInt_As_gint64(PyObject *);

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

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

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

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

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

static int __pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_idle_sound_player(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard_process_notification_message(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message); /* proto*/
static int __pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_playing_sound_count(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, Uint64 __pyx_v_sound_id); /* proto*/
static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_playing_sound_instances(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, Uint64 __pyx_v_sound_id); /* proto*/
static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_sound_player_with_lowest_priority(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto*/
static int __pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance, int __pyx_v_player, struct __pyx_opt_args_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__set_player_sound_settings(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings *__pyx_v_sound_settings, PyObject *__pyx_v_sound_instance); /* proto*/
static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__set_player_playing(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *__pyx_v_player, PyObject *__pyx_v_sound_instance); /* proto*/
static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__set_player_replacing(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *__pyx_v_player, PyObject *__pyx_v_sound_instance); /* proto*/
static int __pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_player_playing_sound_instance(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto*/
static Uint32 __pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__fix_sample_frame_pos(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, Uint32 __pyx_v_sample_pos, Uint8 __pyx_v_bytes_per_sample, int __pyx_v_channels); /* proto*/
static void __pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard_mix_playing_sounds(__pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track, Uint32 __pyx_v_buffer_length, __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData *__pyx_v_callback_data); /* proto*/

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

/* Module declarations from 'cython' */

/* Module declarations from 'mpfmc.core.audio.sdl2' */

/* Module declarations from 'mpfmc.core.audio.gstreamer' */

/* Module declarations from 'mpfmc.core.audio.track' */
static PyTypeObject *__pyx_ptype_5mpfmc_4core_5audio_5track_Track = 0;

/* Module declarations from 'mpfmc.core.audio.inline' */
static CYTHON_INLINE Uint8 __pyx_f_5mpfmc_4core_5audio_6inline_lerpU8(float, Uint8, Uint8); /*proto*/
static CYTHON_INLINE float __pyx_f_5mpfmc_4core_5audio_6inline_in_out_quad(float); /*proto*/

/* Module declarations from 'mpfmc.core.audio.notification_message' */
static CYTHON_INLINE __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message(void); /*proto*/
static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_started_notification(int, Uint64, Uint64, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *); /*proto*/
static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_stopped_notification(int, Uint64, Uint64, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *); /*proto*/
static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_looping_notification(int, Uint64, Uint64, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *); /*proto*/
static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_about_to_finish_notification(int, Uint64, Uint64, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *); /*proto*/
static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_marker_notification(int, Uint64, Uint64, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *, int); /*proto*/

/* Module declarations from 'mpfmc.core.audio.sound_file' */
static PyTypeObject *__pyx_ptype_5mpfmc_4core_5audio_10sound_file_SoundFile = 0;
static PyTypeObject *__pyx_ptype_5mpfmc_4core_5audio_10sound_file_SoundMemoryFile = 0;
static PyTypeObject *__pyx_ptype_5mpfmc_4core_5audio_10sound_file_SoundStreamingFile = 0;

/* Module declarations from 'mpfmc.core.audio.track_standard' */
static PyTypeObject *__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard = 0;
static int __pyx_f_5mpfmc_4core_5audio_14track_standard_get_memory_sound_samples(__pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings *, Uint32, Uint8 *, int, Uint8, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *, int); /*proto*/
static int __pyx_f_5mpfmc_4core_5audio_14track_standard_get_streaming_sound_samples(__pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings *, Uint32, Uint8 *, int, Uint8, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *, int); /*proto*/
#define __Pyx_MODULE_NAME "mpfmc.core.audio.track_standard"
extern int __pyx_module_is_main_mpfmc__core__audio__track_standard;
int __pyx_module_is_main_mpfmc__core__audio__track_standard = 0;

/* Implementation of 'mpfmc.core.audio.track_standard' */
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_TypeError;
static const char __pyx_k_id[] = "id";
static const char __pyx_k_mc[] = "mc";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_pan[] = "pan";
static const char __pyx_k_ceil[] = "ceil";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_idle[] = "idle";
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_test[] = "__test__";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_Track[] = "Track.";
static const char __pyx_k_clear[] = "clear";
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_heapq[] = "heapq";
static const char __pyx_k_loops[] = "loops";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_sound[] = "sound";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_track[] = "track";
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_loaded[] = "loaded";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_newest[] = "newest";
static const char __pyx_k_number[] = "number";
static const char __pyx_k_oldest[] = "oldest";
static const char __pyx_k_player[] = "player";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_remove[] = "remove";
static const char __pyx_k_status[] = "status";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_volume[] = "volume";
static const char __pyx_k_context[] = "context";
static const char __pyx_k_ducking[] = "ducking";
static const char __pyx_k_fade_in[] = "fade_in";
static const char __pyx_k_heapify[] = "heapify";
static const char __pyx_k_heappop[] = "heappop";
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_release[] = "release";
static const char __pyx_k_unknown[] = "unknown";
static const char __pyx_k_warning[] = "warning";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_duration[] = "duration";
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_getstate[] = "__getstate__";
static const char __pyx_k_heappush[] = "heappush";
static const char __pyx_k_priority[] = "priority";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_settings[] = "settings";
static const char __pyx_k_sound_id[] = "sound_id";
static const char __pyx_k_standard[] = "standard";
static const char __pyx_k_start_at[] = "start_at";
static const char __pyx_k_stopping[] = "stopping";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_container[] = "container";
static const char __pyx_k_fade_in_2[] = "fade in";
static const char __pyx_k_getLogger[] = "getLogger";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_replacing[] = "replacing";
static const char __pyx_k_timestamp[] = "timestamp";
static const char __pyx_k_track_num[] = "track_num";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_fade_out_2[] = "fade out";
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_attenuation[] = "attenuation";
static const char __pyx_k_buffer_size[] = "buffer_size";
static const char __pyx_k_has_ducking[] = "has_ducking";
static const char __pyx_k_loop_end_at[] = "loop_end_at";
static const char __pyx_k_queue_sound[] = "_queue_sound";
static const char __pyx_k_reset_state[] = "_reset_state";
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_current_loop[] = "current_loop";
static const char __pyx_k_loop_end_pos[] = "loop_end_pos";
static const char __pyx_k_marker_count[] = "marker_count";
static const char __pyx_k_old_instance[] = "old_instance";
static const char __pyx_k_set_canceled[] = "set_canceled";
static const char __pyx_k_sound_system[] = "sound_system";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_SoundInstance[] = "SoundInstance";
static const char __pyx_k_TrackStandard[] = ".TrackStandard.";
static const char __pyx_k_fading_status[] = "fading_status";
static const char __pyx_k_loop_start_at[] = "loop_start_at";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
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_Track_Standard[] = "<Track.{}.Standard.{}>";
static const char __pyx_k_get_next_sound[] = "_get_next_sound";
static const char __pyx_k_loop_start_pos[] = "loop_start_pos";
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_track_bit_mask[] = "track_bit_mask";
static const char __pyx_k_TrackStandard_2[] = "TrackStandard";
static const char __pyx_k_audio_interface[] = "audio_interface";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_stealing_method[] = "stealing_method";
static const char __pyx_k_Queueing_sound_s[] = "Queueing sound %s";
static const char __pyx_k_fade_out_seconds[] = "fade_out_seconds";
static const char __pyx_k_stop_on_mode_end[] = "stop_on_mode_end";
static const char __pyx_k_sound_instance_id[] = "sound_instance_id";
static const char __pyx_k_Clearing_context_s[] = "Clearing context %s";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_events_when_paused[] = "events_when_paused";
static const char __pyx_k_mpfmc_assets_sound[] = "mpfmc.assets.sound";
static const char __pyx_k_simultaneous_limit[] = "simultaneous_limit";
static const char __pyx_k_SoundStealingMethod[] = "SoundStealingMethod";
static const char __pyx_k_audio_callback_data[] = "audio_callback_data";
static const char __pyx_k_events_when_stopped[] = "events_when_stopped";
static const char __pyx_k_set_about_to_finish[] = "set_about_to_finish";
static const char __pyx_k_stop_sound_instance[] = "stop_sound_instance";
static const char __pyx_k_about_to_finish_time[] = "about_to_finish_time";
static const char __pyx_k_fading_status_values[] = "fading_status_values";
static const char __pyx_k_post_mc_native_event[] = "post_mc_native_event";
static const char __pyx_k_player_status_to_text[] = "player_status_to_text";
static const char __pyx_k_replace_sound_instance[] = "_replace_sound_instance";
static const char __pyx_k_get_playlist_controller[] = "get_playlist_controller";
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_Getting_sound_from_queue_s[] = "Getting sound from queue %s";
static const char __pyx_k_sound_instance_is_in_queue[] = "sound_instance_is_in_queue";
static const char __pyx_k_stop_sound_instance_looping[] = "stop_sound_instance_looping";
static const char __pyx_k_player_fading_status_to_text[] = "player_fading_status_to_text";
static const char __pyx_k_remove_all_sounds_from_queue[] = "_remove_all_sounds_from_queue";
static const char __pyx_k_get_sound_instances_for_sound[] = "_get_sound_instances_for_sound";
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_remove_all_sounds_with_context[] = "_remove_all_sounds_with_context_from_queue";
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_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_Removing_pending_sound_with_key[] = "Removing pending sound with key %s from queue %s";
static const char __pyx_k_Sound_s_has_reached_the_maximum[] = "Sound %s has reached the maximum number of instances. Replacing oldest instance";
static const char __pyx_k_Track_play_sound_encountered_an[] = "Track {} play_sound encountered an unexpected exception while attempting to play the {} sound.";
static const char __pyx_k_get_newest_playing_sound_instan[] = "_get_newest_playing_sound_instance";
static const char __pyx_k_get_oldest_playing_sound_instan[] = "_get_oldest_playing_sound_instance";
static const char __pyx_k_mpfmc_core_audio_track_standard[] = "mpfmc\\core\\audio\\track_standard.pyx";
static const char __pyx_k_play_sound_No_idle_sound_player[] = "play_sound - No idle sound player is available.";
static const char __pyx_k_play_sound_on_sound_player_s_tr[] = "_play_sound_on_sound_player - %s track is not currently playing and therefore the request to play sound %s will be canceled";
static const char __pyx_k_remove_sound_instance_from_queu[] = "_remove_sound_instance_from_queue";
static const char __pyx_k_Adding_sound_instance_s_to_activ[] = "Adding sound instance %s to active sound dictionary";
static const char __pyx_k_Created_Track_d_s_with_the_follo[] = "Created Track %d %s with the following settings: simultaneous_sounds = %d, volume = %f";
static const char __pyx_k_Discarding_expired_sound_from_qu[] = "Discarding expired sound from queue %s";
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_pending_sound_with_cont[] = "Removing pending sound with context %s from queue %s";
static const char __pyx_k_Removing_sound_instance_s_from_p[] = "Removing sound instance %s from playing sound instance dictionary";
static const char __pyx_k_Resetting_track_state_sounds_wil[] = "Resetting track state (sounds will be stopped and queue cleared";
static const char __pyx_k_Retrieving_next_pending_sound_fr[] = "Retrieving next pending sound from queue %s";
static const char __pyx_k_Skip_clearing_context_s_playlist[] = "Skip clearing context %s (playlist controller will handle it)";
static const char __pyx_k_Sound_s_is_set_to_begin_playback[] = "Sound %s is set to begin playback on standard track (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_Track_s_play_sound_encountered_a[] = "Track %s: play_sound encountered an unexpected exception while attempting to play the %s sound: %s";
static const char __pyx_k_Unknown_notification_message_rec[] = "Unknown notification message received on %s track";
static const char __pyx_k_mpfmc_core_audio_audio_exception[] = "mpfmc.core.audio.audio_exception";
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_play_sound_s_track_is_not_curren[] = "play_sound - %s track is not currently playing and therefore the request to play sound %s will be canceled";
static const char __pyx_k_replace_sound_instance_Could_not[] = "replace_sound_instance - Could not locate specified sound instance to replace";
static const char __pyx_k_replace_sound_instance_Preparing[] = "replace_sound_instance - Preparing to replace existing sound with a new sound instance";
static const char __pyx_k_self_state_self_type_state_canno[] = "self.state,self.type_state cannot be converted to a Python object for pickling";
static const char __pyx_k_Sound_s_has_reached_the_maximum_2[] = "Sound %s has reached the maximum number of instances. Replacing newest instance";
static const char __pyx_k_Sound_s_has_reached_the_maximum_3[] = "Sound %s has reached the maximum number of instances. Sound will be skipped";
static const char __pyx_k_mpfmc_core_audio_track_standard_2[] = "mpfmc.core.audio.track_standard";
static const char __pyx_k_Sound_s_is_set_to_begin_playback_2[] = "Sound %s is set to begin playback on playlist track (loops=%d)";
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_Adding_sound_instance_s_to_activ;
static PyObject *__pyx_kp_u_All_sound_players_are_currently;
static PyObject *__pyx_n_s_AudioException;
static PyObject *__pyx_kp_u_Clearing_context_s;
static PyObject *__pyx_kp_u_Created_Track_d_s_with_the_follo;
static PyObject *__pyx_kp_u_Discarding_expired_sound_from_qu;
static PyObject *__pyx_kp_u_Getting_sound_from_queue_s;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_kp_u_Next_pending_sound_in_queue_is_s;
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_pending_sound_with_cont;
static PyObject *__pyx_kp_u_Removing_pending_sound_with_key;
static PyObject *__pyx_kp_u_Removing_sound_instance_s_from_p;
static PyObject *__pyx_kp_u_Resetting_track_state_sounds_wil;
static PyObject *__pyx_kp_u_Retrieving_next_pending_sound_fr;
static PyObject *__pyx_kp_u_Skip_clearing_context_s_playlist;
static PyObject *__pyx_n_s_SoundInstance;
static PyObject *__pyx_n_s_SoundStealingMethod;
static PyObject *__pyx_kp_u_Sound_s_has_reached_the_maximum;
static PyObject *__pyx_kp_u_Sound_s_has_reached_the_maximum_2;
static PyObject *__pyx_kp_u_Sound_s_has_reached_the_maximum_3;
static PyObject *__pyx_kp_u_Sound_s_is_set_to_begin_playback;
static PyObject *__pyx_kp_u_Sound_s_is_set_to_begin_playback_2;
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_Track;
static PyObject *__pyx_kp_u_TrackStandard;
static PyObject *__pyx_n_s_TrackStandard_2;
static PyObject *__pyx_kp_u_Track_Standard;
static PyObject *__pyx_kp_u_Track_play_sound_encountered_an;
static PyObject *__pyx_kp_u_Track_s_play_sound_encountered_a;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_u_Unknown_notification_message_rec;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_about_to_finish_time;
static PyObject *__pyx_n_s_attack;
static PyObject *__pyx_n_s_attenuation;
static PyObject *__pyx_n_s_audio_callback_data;
static PyObject *__pyx_n_s_audio_interface;
static PyObject *__pyx_n_s_buffer_size;
static PyObject *__pyx_n_s_ceil;
static PyObject *__pyx_n_s_clear;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_container;
static PyObject *__pyx_n_s_context;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_u_current_loop;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_delay;
static PyObject *__pyx_n_s_ducking;
static PyObject *__pyx_n_s_duration;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_events_when_paused;
static PyObject *__pyx_n_s_events_when_stopped;
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_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_u_finished;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_getLogger;
static PyObject *__pyx_n_s_get_newest_playing_sound_instan;
static PyObject *__pyx_n_s_get_next_sound;
static PyObject *__pyx_n_s_get_oldest_playing_sound_instan;
static PyObject *__pyx_n_s_get_playlist_controller;
static PyObject *__pyx_n_s_get_sound_instances_for_sound;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_u_has_ducking;
static PyObject *__pyx_n_s_heapify;
static PyObject *__pyx_n_s_heappop;
static PyObject *__pyx_n_s_heappush;
static PyObject *__pyx_n_s_heapq;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_u_idle;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_load;
static PyObject *__pyx_n_s_loaded;
static PyObject *__pyx_n_s_loading;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_loop_end_at;
static PyObject *__pyx_n_u_loop_end_pos;
static PyObject *__pyx_n_s_loop_start_at;
static PyObject *__pyx_n_u_loop_start_pos;
static PyObject *__pyx_n_s_loops;
static PyObject *__pyx_n_u_loops;
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_mpfmc_assets_sound;
static PyObject *__pyx_n_s_mpfmc_core_audio_audio_exception;
static PyObject *__pyx_kp_s_mpfmc_core_audio_track_standard;
static PyObject *__pyx_n_s_mpfmc_core_audio_track_standard_2;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_newest;
static PyObject *__pyx_kp_u_not_fading;
static PyObject *__pyx_n_s_number;
static PyObject *__pyx_n_s_old_instance;
static PyObject *__pyx_n_s_oldest;
static PyObject *__pyx_n_s_pan;
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_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_kp_u_play_sound_on_sound_player_s_tr;
static PyObject *__pyx_kp_u_play_sound_s_track_is_not_curren;
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_post_mc_native_event;
static PyObject *__pyx_n_s_priority;
static PyObject *__pyx_n_u_priority;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_queue_sound;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_release;
static PyObject *__pyx_n_s_release_point;
static PyObject *__pyx_n_s_remove;
static PyObject *__pyx_n_s_remove_all_sounds_from_queue;
static PyObject *__pyx_n_s_remove_all_sounds_with_context;
static PyObject *__pyx_n_s_remove_sound_from_queue;
static PyObject *__pyx_n_s_remove_sound_instance_from_queu;
static PyObject *__pyx_n_s_replace_sound_instance;
static PyObject *__pyx_kp_u_replace_sound_instance_Could_not;
static PyObject *__pyx_kp_u_replace_sound_instance_Preparing;
static PyObject *__pyx_n_u_replacing;
static PyObject *__pyx_n_s_reset_state;
static PyObject *__pyx_n_u_sample_pos;
static PyObject *__pyx_kp_s_self_state_self_type_state_canno;
static PyObject *__pyx_n_s_set_about_to_finish;
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_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_settings;
static PyObject *__pyx_n_s_simultaneous_limit;
static PyObject *__pyx_n_s_sound;
static PyObject *__pyx_n_s_sound_id;
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_instance_is_in_queue;
static PyObject *__pyx_n_s_sound_system;
static PyObject *__pyx_n_u_standard;
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_stealing_method;
static PyObject *__pyx_n_s_stop_on_mode_end;
static PyObject *__pyx_n_s_stop_sound_instance;
static PyObject *__pyx_n_s_stop_sound_instance_looping;
static PyObject *__pyx_n_u_stopping;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_u_time;
static PyObject *__pyx_n_s_timestamp;
static PyObject *__pyx_n_s_track;
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_values;
static PyObject *__pyx_n_s_volume;
static PyObject *__pyx_n_u_volume;
static PyObject *__pyx_n_s_warning;
static int __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard___init__(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__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, int __pyx_v_max_simultaneous_sounds, float __pyx_v_volume); /* proto */
static void __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_2__dealloc__(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_4__repr__(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_4type___get__(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25supports_in_memory_sounds___get__(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25supports_streaming_sounds___get__(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_23max_simultaneous_sounds___get__(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_6process(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_8_get_next_sound(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_10_remove_sound_from_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_12_remove_sound_instance_from_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_14_remove_all_sounds_with_context_from_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_16_remove_all_sounds_with_key_from_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_18_remove_all_sounds_from_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_20_get_oldest_playing_sound_instance(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, Uint64 __pyx_v_sound_id); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_22_get_newest_playing_sound_instance(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, Uint64 __pyx_v_sound_id); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_24play_sound(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound, PyObject *__pyx_v_context, PyObject *__pyx_v_settings); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_26_replace_sound_instance(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_old_instance, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_28_queue_sound(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_30_get_sound_instances_for_sound(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_32stop_sound(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound, PyObject *__pyx_v_fade_out); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_34stop_sound_instance(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance, PyObject *__pyx_v_fade_out); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_36stop_sound_looping(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_38stop_sound_instance_looping(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_40clear_context(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_42_reset_state(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_44stop_all_sounds(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, float __pyx_v_fade_out_seconds); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_46get_playing_sound_instance_by_id(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance_id); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_48get_status(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_50get_sound_queue_count(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_52get_sound_players_in_use_count(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_54sound_is_playing(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_56sound_instance_is_playing(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_58sound_is_in_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_60sound_instance_is_in_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_62player_status_to_text(int __pyx_v_status); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_64player_fading_status_to_text(int __pyx_v_fading_status); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_66__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_68__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_5mpfmc_4core_5audio_14track_standard_TrackStandard(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values = {0, &__pyx_n_s_values, 0, 0, 0};
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static int __pyx_k_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_codeobj__5;
static PyObject *__pyx_codeobj__7;
/* Late includes */

/* "mpfmc/core/audio/track_standard.pyx":38
 *     """
 * 
 *     def __init__(self, object mc, 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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard___init__[] = "\n        Constructor\n        Args:\n            mc: The media controller app\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_5mpfmc_4core_5audio_14track_standard_13TrackStandard___init__;
#endif
static int __pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_1__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;
  int __pyx_v_max_simultaneous_sounds;
  float __pyx_v_volume;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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_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);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_audio_callback_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 1); __PYX_ERR(0, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 2); __PYX_ERR(0, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_track_num)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 3); __PYX_ERR(0, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 4); __PYX_ERR(0, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_simultaneous_sounds);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 38, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        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, 38, __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, 38, __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, 39, __pyx_L3_error)
    } else {
      __pyx_v_max_simultaneous_sounds = __pyx_k_;
    }
    if (values[6]) {
      __pyx_v_volume = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_volume == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 40, __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, 38, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.__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, 38, __pyx_L1_error)
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard___init__(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), __pyx_v_mc, __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_5mpfmc_4core_5audio_14track_standard_13TrackStandard___init__(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__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, 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;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "mpfmc/core/audio/track_standard.pyx":54
 *         """
 *         # 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) + ".TrackStandard." + name)
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_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, 54, __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, 54, __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, 54, __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, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_volume); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && 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;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[7] = {__pyx_t_6, __pyx_v_mc, __pyx_v_audio_callback_data, __pyx_v_name, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[7] = {__pyx_t_6, __pyx_v_mc, __pyx_v_audio_callback_data, __pyx_v_name, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 54, __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, 54, __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;

  /* "mpfmc/core/audio/track_standard.pyx":56
 *         super().__init__(mc, audio_callback_data, name, track_num, buffer_size, volume)
 * 
 *         self.log = logging.getLogger("Track." + str(track_num) + ".TrackStandard." + name)             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockAudio()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __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, 56, __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, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Track, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_t_2, __pyx_kp_u_TrackStandard); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyUnicode_ConcatSafe(__pyx_t_5, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __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->__pyx_base.log);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.log);
  __pyx_v_self->__pyx_base.log = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":58
 *         self.log = logging.getLogger("Track." + str(track_num) + ".TrackStandard." + name)
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         # Dictionary of SoundInstance class objects keyed by SoundInstance.id
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":61
 * 
 *         # Dictionary of SoundInstance class objects keyed by SoundInstance.id
 *         self._playing_instances_by_id = dict()             # <<<<<<<<<<<<<<
 * 
 *         # Priority queue of SoundInstance objects waiting to be played
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_playing_instances_by_id);
  __Pyx_DECREF(__pyx_v_self->_playing_instances_by_id);
  __pyx_v_self->_playing_instances_by_id = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":64
 * 
 *         # Priority queue of SoundInstance objects waiting to be played
 *         self._sound_queue = list()             # <<<<<<<<<<<<<<
 * 
 *         # Set track type specific settings
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_sound_queue);
  __Pyx_DECREF(__pyx_v_self->_sound_queue);
  __pyx_v_self->_sound_queue = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":67
 * 
 *         # Set track type specific settings
 *         self.state.mix_callback_function = TrackStandard.mix_playing_sounds             # <<<<<<<<<<<<<<
 * 
 *         # Allocate memory for the specific track type state struct (TrackStandardState)
 */
  __pyx_v_self->__pyx_base.state->mix_callback_function = __pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard_mix_playing_sounds;

  /* "mpfmc/core/audio/track_standard.pyx":70
 * 
 *         # 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_5mpfmc_4core_5audio_14track_standard_TrackStandardState *)PyMem_Malloc((sizeof(__pyx_t_5mpfmc_4core_5audio_14track_standard_TrackStandardState))));

  /* "mpfmc/core/audio/track_standard.pyx":71
 *         # 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);

  /* "mpfmc/core/audio/track_standard.pyx":74
 * 
 *         # 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 > __pyx_e_5mpfmc_4core_5audio_5track_MAX_SIMULTANEOUS_SOUNDS_LIMIT) != 0);
  if (__pyx_t_9) {

    /* "mpfmc/core/audio/track_standard.pyx":75
 *         # 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_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_warning); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 75, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);

    /* "mpfmc/core/audio/track_standard.pyx":76
 *         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
 *         elif max_simultaneous_sounds < 1:
 */
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_e_5mpfmc_4core_5audio_5track_MAX_SIMULTANEOUS_SOUNDS_LIMIT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(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);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_The_maximum_number_of_simultaneo, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_The_maximum_number_of_simultaneo, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __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_The_maximum_number_of_simultaneo);
      __Pyx_GIVEREF(__pyx_kp_u_The_maximum_number_of_simultaneo);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_kp_u_The_maximum_number_of_simultaneo);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __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, 75, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":77
 *             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 = __pyx_e_5mpfmc_4core_5audio_5track_MAX_SIMULTANEOUS_SOUNDS_LIMIT;

    /* "mpfmc/core/audio/track_standard.pyx":74
 * 
 *         # 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;
  }

  /* "mpfmc/core/audio/track_standard.pyx":78
 *                              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) {

    /* "mpfmc/core/audio/track_standard.pyx":79
 *             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, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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);
      }
    }
    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_kp_u_The_minimum_number_of_simultaneo) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_u_The_minimum_number_of_simultaneo);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __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;

    /* "mpfmc/core/audio/track_standard.pyx":80
 *         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;

    /* "mpfmc/core/audio/track_standard.pyx":78
 *                              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:;

  /* "mpfmc/core/audio/track_standard.pyx":81
 *             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;

  /* "mpfmc/core/audio/track_standard.pyx":82
 *             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;

  /* "mpfmc/core/audio/track_standard.pyx":86
 *         # 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_5mpfmc_4core_5audio_14track_standard_SoundPlayer *)PyMem_Malloc((__pyx_v_self->type_state->sound_player_count * (sizeof(__pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer)))));

  /* "mpfmc/core/audio/track_standard.pyx":89
 * 
 *         # 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_7 = __pyx_v_self->type_state->sound_player_count;
  __pyx_t_10 = __pyx_t_7;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "mpfmc/core/audio/track_standard.pyx":90
 *         # 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].number = i
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).status = __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle;

    /* "mpfmc/core/audio/track_standard.pyx":91
 *         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].number = i
 *             self.type_state.sound_players[i].current.sample = NULL
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __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, 91, __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;

    /* "mpfmc/core/audio/track_standard.pyx":92
 *             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].number = i             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.sample = NULL
 *             self.type_state.sound_players[i].current.loops_remaining = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).number = __pyx_v_i;

    /* "mpfmc/core/audio/track_standard.pyx":93
 *             self.type_state.sound_players[i].track_num = self.number
 *             self.type_state.sound_players[i].number = i
 *             self.type_state.sound_players[i].current.sample = 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.sample = NULL;

    /* "mpfmc/core/audio/track_standard.pyx":94
 *             self.type_state.sound_players[i].number = i
 *             self.type_state.sound_players[i].current.sample = 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;

    /* "mpfmc/core/audio/track_standard.pyx":95
 *             self.type_state.sound_players[i].current.sample = 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;

    /* "mpfmc/core/audio/track_standard.pyx":96
 *             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.loop_start_pos = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.volume = 0;

    /* "mpfmc/core/audio/track_standard.pyx":97
 *             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.loop_start_pos = 0
 *             self.type_state.sound_players[i].current.loop_end_pos = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sample_pos = 0;

    /* "mpfmc/core/audio/track_standard.pyx":98
 *             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.loop_start_pos = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.loop_end_pos = 0
 *             self.type_state.sound_players[i].current.sound_id = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.loop_start_pos = 0;

    /* "mpfmc/core/audio/track_standard.pyx":99
 *             self.type_state.sound_players[i].current.sample_pos = 0
 *             self.type_state.sound_players[i].current.loop_start_pos = 0
 *             self.type_state.sound_players[i].current.loop_end_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.loop_end_pos = 0;

    /* "mpfmc/core/audio/track_standard.pyx":100
 *             self.type_state.sound_players[i].current.loop_start_pos = 0
 *             self.type_state.sound_players[i].current.loop_end_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;

    /* "mpfmc/core/audio/track_standard.pyx":101
 *             self.type_state.sound_players[i].current.loop_end_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.fading_status = fading_status_not_fading
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id = 0;

    /* "mpfmc/core/audio/track_standard.pyx":102
 *             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.fading_status = fading_status_not_fading
 *             self.type_state.sound_players[i].current.about_to_finish_marker = no_marker
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_priority = 0;

    /* "mpfmc/core/audio/track_standard.pyx":103
 *             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.fading_status = fading_status_not_fading             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.about_to_finish_marker = no_marker
 *             self.type_state.sound_players[i].current.sound_has_ducking = False
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.fading_status = __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_not_fading;

    /* "mpfmc/core/audio/track_standard.pyx":104
 *             self.type_state.sound_players[i].current.sound_priority = 0
 *             self.type_state.sound_players[i].current.fading_status = fading_status_not_fading
 *             self.type_state.sound_players[i].current.about_to_finish_marker = no_marker             # <<<<<<<<<<<<<<
 *             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.about_to_finish_marker = __pyx_e_5mpfmc_4core_5audio_14track_standard_no_marker;

    /* "mpfmc/core/audio/track_standard.pyx":105
 *             self.type_state.sound_players[i].current.fading_status = fading_status_not_fading
 *             self.type_state.sound_players[i].current.about_to_finish_marker = no_marker
 *             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].current.ducking_control_points = g_array_sized_new(False, False, sizeof(guint8), CONTROL_POINTS_PER_BUFFER)
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_has_ducking = 0;

    /* "mpfmc/core/audio/track_standard.pyx":106
 *             self.type_state.sound_players[i].current.about_to_finish_marker = no_marker
 *             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].current.ducking_control_points = g_array_sized_new(False, False, sizeof(guint8), CONTROL_POINTS_PER_BUFFER)
 *             self.type_state.sound_players[i].current.marker_count = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.ducking_stage = __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_idle;

    /* "mpfmc/core/audio/track_standard.pyx":107
 *             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].current.ducking_control_points = g_array_sized_new(False, False, sizeof(guint8), CONTROL_POINTS_PER_BUFFER)             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.marker_count = 0
 *             self.type_state.sound_players[i].current.markers = g_array_new(False, False, sizeof(guint))
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.ducking_control_points = g_array_sized_new(0, 0, (sizeof(guint8)), __pyx_e_5mpfmc_4core_5audio_5track_CONTROL_POINTS_PER_BUFFER);

    /* "mpfmc/core/audio/track_standard.pyx":108
 *             self.type_state.sound_players[i].current.ducking_stage = ducking_stage_idle
 *             self.type_state.sound_players[i].current.ducking_control_points = g_array_sized_new(False, False, sizeof(guint8), CONTROL_POINTS_PER_BUFFER)
 *             self.type_state.sound_players[i].current.marker_count = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].current.markers = g_array_new(False, False, sizeof(guint))
 *             self.type_state.sound_players[i].next.sample = NULL
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.marker_count = 0;

    /* "mpfmc/core/audio/track_standard.pyx":109
 *             self.type_state.sound_players[i].current.ducking_control_points = g_array_sized_new(False, False, sizeof(guint8), CONTROL_POINTS_PER_BUFFER)
 *             self.type_state.sound_players[i].current.marker_count = 0
 *             self.type_state.sound_players[i].current.markers = g_array_new(False, False, sizeof(guint))             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.sample = NULL
 *             self.type_state.sound_players[i].next.loops_remaining = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.markers = g_array_new(0, 0, (sizeof(guint)));

    /* "mpfmc/core/audio/track_standard.pyx":110
 *             self.type_state.sound_players[i].current.marker_count = 0
 *             self.type_state.sound_players[i].current.markers = g_array_new(False, False, sizeof(guint))
 *             self.type_state.sound_players[i].next.sample = 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.sample = NULL;

    /* "mpfmc/core/audio/track_standard.pyx":111
 *             self.type_state.sound_players[i].current.markers = g_array_new(False, False, sizeof(guint))
 *             self.type_state.sound_players[i].next.sample = 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;

    /* "mpfmc/core/audio/track_standard.pyx":112
 *             self.type_state.sound_players[i].next.sample = 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;

    /* "mpfmc/core/audio/track_standard.pyx":113
 *             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.loop_start_pos = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.volume = 0;

    /* "mpfmc/core/audio/track_standard.pyx":114
 *             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.loop_start_pos = 0
 *             self.type_state.sound_players[i].next.loop_end_pos = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.sample_pos = 0;

    /* "mpfmc/core/audio/track_standard.pyx":115
 *             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.loop_start_pos = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.loop_end_pos = 0
 *             self.type_state.sound_players[i].next.sound_id = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.loop_start_pos = 0;

    /* "mpfmc/core/audio/track_standard.pyx":116
 *             self.type_state.sound_players[i].next.sample_pos = 0
 *             self.type_state.sound_players[i].next.loop_start_pos = 0
 *             self.type_state.sound_players[i].next.loop_end_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.loop_end_pos = 0;

    /* "mpfmc/core/audio/track_standard.pyx":117
 *             self.type_state.sound_players[i].next.loop_start_pos = 0
 *             self.type_state.sound_players[i].next.loop_end_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;

    /* "mpfmc/core/audio/track_standard.pyx":118
 *             self.type_state.sound_players[i].next.loop_end_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.fading_status = fading_status_not_fading
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.sound_instance_id = 0;

    /* "mpfmc/core/audio/track_standard.pyx":119
 *             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.fading_status = fading_status_not_fading
 *             self.type_state.sound_players[i].next.about_to_finish_marker = no_marker
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.sound_priority = 0;

    /* "mpfmc/core/audio/track_standard.pyx":120
 *             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.fading_status = fading_status_not_fading             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.about_to_finish_marker = no_marker
 *             self.type_state.sound_players[i].next.sound_has_ducking = False
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.fading_status = __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_not_fading;

    /* "mpfmc/core/audio/track_standard.pyx":121
 *             self.type_state.sound_players[i].next.sound_priority = 0
 *             self.type_state.sound_players[i].next.fading_status = fading_status_not_fading
 *             self.type_state.sound_players[i].next.about_to_finish_marker = no_marker             # <<<<<<<<<<<<<<
 *             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.about_to_finish_marker = __pyx_e_5mpfmc_4core_5audio_14track_standard_no_marker;

    /* "mpfmc/core/audio/track_standard.pyx":122
 *             self.type_state.sound_players[i].next.fading_status = fading_status_not_fading
 *             self.type_state.sound_players[i].next.about_to_finish_marker = no_marker
 *             self.type_state.sound_players[i].next.sound_has_ducking = False             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.ducking_stage = ducking_stage_idle
 *             self.type_state.sound_players[i].next.ducking_control_points = g_array_sized_new(False, False, sizeof(guint8), CONTROL_POINTS_PER_BUFFER)
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.sound_has_ducking = 0;

    /* "mpfmc/core/audio/track_standard.pyx":123
 *             self.type_state.sound_players[i].next.about_to_finish_marker = no_marker
 *             self.type_state.sound_players[i].next.sound_has_ducking = False
 *             self.type_state.sound_players[i].next.ducking_stage = ducking_stage_idle             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.ducking_control_points = g_array_sized_new(False, False, sizeof(guint8), CONTROL_POINTS_PER_BUFFER)
 *             self.type_state.sound_players[i].next.marker_count = 0
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.ducking_stage = __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_idle;

    /* "mpfmc/core/audio/track_standard.pyx":124
 *             self.type_state.sound_players[i].next.sound_has_ducking = False
 *             self.type_state.sound_players[i].next.ducking_stage = ducking_stage_idle
 *             self.type_state.sound_players[i].next.ducking_control_points = g_array_sized_new(False, False, sizeof(guint8), CONTROL_POINTS_PER_BUFFER)             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.marker_count = 0
 *             self.type_state.sound_players[i].next.markers = g_array_new(False, False, sizeof(guint))
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.ducking_control_points = g_array_sized_new(0, 0, (sizeof(guint8)), __pyx_e_5mpfmc_4core_5audio_5track_CONTROL_POINTS_PER_BUFFER);

    /* "mpfmc/core/audio/track_standard.pyx":125
 *             self.type_state.sound_players[i].next.ducking_stage = ducking_stage_idle
 *             self.type_state.sound_players[i].next.ducking_control_points = g_array_sized_new(False, False, sizeof(guint8), CONTROL_POINTS_PER_BUFFER)
 *             self.type_state.sound_players[i].next.marker_count = 0             # <<<<<<<<<<<<<<
 *             self.type_state.sound_players[i].next.markers = g_array_new(False, False, sizeof(guint))
 * 
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.marker_count = 0;

    /* "mpfmc/core/audio/track_standard.pyx":126
 *             self.type_state.sound_players[i].next.ducking_control_points = g_array_sized_new(False, False, sizeof(guint8), CONTROL_POINTS_PER_BUFFER)
 *             self.type_state.sound_players[i].next.marker_count = 0
 *             self.type_state.sound_players[i].next.markers = g_array_new(False, False, sizeof(guint))             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("Created Track %d %s with the following settings: "
 */
    (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.markers = g_array_new(0, 0, (sizeof(guint)));
  }

  /* "mpfmc/core/audio/track_standard.pyx":128
 *             self.type_state.sound_players[i].next.markers = g_array_new(False, False, sizeof(guint))
 * 
 *         self.log.debug("Created Track %d %s with the following settings: "             # <<<<<<<<<<<<<<
 *                        "simultaneous_sounds = %d, volume = %f",
 *                        self.number, self.name, self.max_simultaneous_sounds, self.volume)
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "mpfmc/core/audio/track_standard.pyx":130
 *         self.log.debug("Created Track %d %s with the following settings: "
 *                        "simultaneous_sounds = %d, volume = %f",
 *                        self.number, self.name, self.max_simultaneous_sounds, self.volume)             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_number); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_max_simultaneous_sounds); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_volume); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[6] = {__pyx_t_6, __pyx_kp_u_Created_Track_d_s_with_the_follo, __pyx_t_4, __pyx_t_2, __pyx_t_5, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[6] = {__pyx_t_6, __pyx_kp_u_Created_Track_d_s_with_the_follo, __pyx_t_4, __pyx_t_2, __pyx_t_5, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_13 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Created_Track_d_s_with_the_follo);
    __Pyx_GIVEREF(__pyx_kp_u_Created_Track_d_s_with_the_follo);
    PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_7, __pyx_kp_u_Created_Track_d_s_with_the_follo);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_7, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_7, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_13, 4+__pyx_t_7, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":132
 *                        self.number, self.name, self.max_simultaneous_sounds, self.volume)
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":38
 *     """
 * 
 *     def __init__(self, object mc, 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_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":134
 *         SDL_UnlockAudio()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Destructor"""
 * 
 */

/* Python wrapper */
static void __pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_2__dealloc__(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static void __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_2__dealloc__(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  int __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "mpfmc/core/audio/track_standard.pyx":137
 *         """Destructor"""
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         # Free the specific track type state and other allocated memory
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":140
 * 
 *         # Free the specific track type state and other allocated memory
 *         if self.type_state != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(self.type_state.sound_player_count):
 *                 g_array_free(self.type_state.sound_players[i].current.ducking_control_points, True)
 */
  __pyx_t_1 = ((__pyx_v_self->type_state != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":141
 *         # Free the specific track type state and other allocated memory
 *         if self.type_state != NULL:
 *             for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *                 g_array_free(self.type_state.sound_players[i].current.ducking_control_points, True)
 *                 g_array_free(self.type_state.sound_players[i].next.ducking_control_points, True)
 */
    __pyx_t_2 = __pyx_v_self->type_state->sound_player_count;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "mpfmc/core/audio/track_standard.pyx":142
 *         if self.type_state != NULL:
 *             for i in range(self.type_state.sound_player_count):
 *                 g_array_free(self.type_state.sound_players[i].current.ducking_control_points, True)             # <<<<<<<<<<<<<<
 *                 g_array_free(self.type_state.sound_players[i].next.ducking_control_points, True)
 *                 g_array_free(self.type_state.sound_players[i].current.markers, True)
 */
      (void)(g_array_free((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.ducking_control_points, 1));

      /* "mpfmc/core/audio/track_standard.pyx":143
 *             for i in range(self.type_state.sound_player_count):
 *                 g_array_free(self.type_state.sound_players[i].current.ducking_control_points, True)
 *                 g_array_free(self.type_state.sound_players[i].next.ducking_control_points, True)             # <<<<<<<<<<<<<<
 *                 g_array_free(self.type_state.sound_players[i].current.markers, True)
 *                 g_array_free(self.type_state.sound_players[i].next.markers, True)
 */
      (void)(g_array_free((__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.ducking_control_points, 1));

      /* "mpfmc/core/audio/track_standard.pyx":144
 *                 g_array_free(self.type_state.sound_players[i].current.ducking_control_points, True)
 *                 g_array_free(self.type_state.sound_players[i].next.ducking_control_points, True)
 *                 g_array_free(self.type_state.sound_players[i].current.markers, True)             # <<<<<<<<<<<<<<
 *                 g_array_free(self.type_state.sound_players[i].next.markers, True)
 * 
 */
      (void)(g_array_free((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.markers, 1));

      /* "mpfmc/core/audio/track_standard.pyx":145
 *                 g_array_free(self.type_state.sound_players[i].next.ducking_control_points, True)
 *                 g_array_free(self.type_state.sound_players[i].current.markers, True)
 *                 g_array_free(self.type_state.sound_players[i].next.markers, True)             # <<<<<<<<<<<<<<
 * 
 *             PyMem_Free(self.type_state.sound_players)
 */
      (void)(g_array_free((__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.markers, 1));
    }

    /* "mpfmc/core/audio/track_standard.pyx":147
 *                 g_array_free(self.type_state.sound_players[i].next.markers, True)
 * 
 *             PyMem_Free(self.type_state.sound_players)             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.type_state)
 *             self.type_state = NULL
 */
    PyMem_Free(__pyx_v_self->type_state->sound_players);

    /* "mpfmc/core/audio/track_standard.pyx":148
 * 
 *             PyMem_Free(self.type_state.sound_players)
 *             PyMem_Free(self.type_state)             # <<<<<<<<<<<<<<
 *             self.type_state = NULL
 *             if self.state != NULL:
 */
    PyMem_Free(__pyx_v_self->type_state);

    /* "mpfmc/core/audio/track_standard.pyx":149
 *             PyMem_Free(self.type_state.sound_players)
 *             PyMem_Free(self.type_state)
 *             self.type_state = NULL             # <<<<<<<<<<<<<<
 *             if self.state != NULL:
 *                 self.state.type_state = NULL
 */
    __pyx_v_self->type_state = NULL;

    /* "mpfmc/core/audio/track_standard.pyx":150
 *             PyMem_Free(self.type_state)
 *             self.type_state = NULL
 *             if self.state != NULL:             # <<<<<<<<<<<<<<
 *                 self.state.type_state = NULL
 * 
 */
    __pyx_t_1 = ((__pyx_v_self->__pyx_base.state != NULL) != 0);
    if (__pyx_t_1) {

      /* "mpfmc/core/audio/track_standard.pyx":151
 *             self.type_state = NULL
 *             if self.state != NULL:
 *                 self.state.type_state = NULL             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
      __pyx_v_self->__pyx_base.state->type_state = NULL;

      /* "mpfmc/core/audio/track_standard.pyx":150
 *             PyMem_Free(self.type_state)
 *             self.type_state = NULL
 *             if self.state != NULL:             # <<<<<<<<<<<<<<
 *                 self.state.type_state = NULL
 * 
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":140
 * 
 *         # Free the specific track type state and other allocated memory
 *         if self.type_state != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(self.type_state.sound_player_count):
 *                 g_array_free(self.type_state.sound_players[i].current.ducking_control_points, True)
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":153
 *                 self.state.type_state = NULL
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":134
 *         SDL_UnlockAudio()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Destructor"""
 * 
 */

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

/* "mpfmc/core/audio/track_standard.pyx":155
 *         SDL_UnlockAudio()
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Track.{}.Standard.{}>'.format(self.number, self.name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_4__repr__(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_4__repr__(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "mpfmc/core/audio/track_standard.pyx":156
 * 
 *     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, 156, __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, 156, __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, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && 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;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __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, 156, __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;

  /* "mpfmc/core/audio/track_standard.pyx":155
 *         SDL_UnlockAudio()
 * 
 *     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("mpfmc.core.audio.track_standard.TrackStandard.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":159
 * 
 *     @property
 *     def type(self):             # <<<<<<<<<<<<<<
 *         return "standard"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_4type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_4type___get__(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_4type___get__(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "mpfmc/core/audio/track_standard.pyx":160
 *     @property
 *     def type(self):
 *         return "standard"             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_n_u_standard);
  __pyx_r = __pyx_n_u_standard;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":159
 * 
 *     @property
 *     def type(self):             # <<<<<<<<<<<<<<
 *         return "standard"
 * 
 */

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

/* "mpfmc/core/audio/track_standard.pyx":163
 * 
 *     @property
 *     def supports_in_memory_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track accepts in-memory sounds"""
 *         return True
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25supports_in_memory_sounds_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25supports_in_memory_sounds___get__(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25supports_in_memory_sounds___get__(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "mpfmc/core/audio/track_standard.pyx":165
 *     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;

  /* "mpfmc/core/audio/track_standard.pyx":163
 * 
 *     @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;
}

/* "mpfmc/core/audio/track_standard.pyx":168
 * 
 *     @property
 *     def supports_streaming_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track accepts streaming sounds"""
 *         return True
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25supports_streaming_sounds_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25supports_streaming_sounds___get__(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25supports_streaming_sounds___get__(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "mpfmc/core/audio/track_standard.pyx":170
 *     def supports_streaming_sounds(self):
 *         """Return whether or not track accepts streaming sounds"""
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":168
 * 
 *     @property
 *     def supports_streaming_sounds(self):             # <<<<<<<<<<<<<<
 *         """Return whether or not track accepts streaming sounds"""
 *         return True
 */

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

/* "mpfmc/core/audio/track_standard.pyx":173
 * 
 *     @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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_23max_simultaneous_sounds_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_23max_simultaneous_sounds___get__(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_23max_simultaneous_sounds___get__(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "mpfmc/core/audio/track_standard.pyx":175
 *     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, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":173
 * 
 *     @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("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":177
 *         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_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_idle_sound_player(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_get_idle_sound_player", 0);

  /* "mpfmc/core/audio/track_standard.pyx":182
 *         players are currently busy playing, -1 is returned.
 *         """
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         for index in range(self.type_state.sound_player_count):
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":184
 *         SDL_LockAudio()
 * 
 *         for index in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[index].status == player_idle:
 *                 SDL_UnlockAudio()
 */
  __pyx_t_1 = __pyx_v_self->type_state->sound_player_count;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_index = __pyx_t_3;

    /* "mpfmc/core/audio/track_standard.pyx":185
 * 
 *         for index in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[index].status == player_idle:             # <<<<<<<<<<<<<<
 *                 SDL_UnlockAudio()
 *                 return index
 */
    __pyx_t_4 = (((__pyx_v_self->type_state->sound_players[__pyx_v_index]).status == __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_4) {

      /* "mpfmc/core/audio/track_standard.pyx":186
 *         for index in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[index].status == player_idle:
 *                 SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *                 return index
 * 
 */
      SDL_UnlockAudio();

      /* "mpfmc/core/audio/track_standard.pyx":187
 *             if self.type_state.sound_players[index].status == player_idle:
 *                 SDL_UnlockAudio()
 *                 return index             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
      __pyx_r = __pyx_v_index;
      goto __pyx_L0;

      /* "mpfmc/core/audio/track_standard.pyx":185
 * 
 *         for index in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[index].status == player_idle:             # <<<<<<<<<<<<<<
 *                 SDL_UnlockAudio()
 *                 return index
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":189
 *                 return index
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *         return -1
 * 
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":190
 * 
 *         SDL_UnlockAudio()
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     def process(self):
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":177
 *         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;
}

/* "mpfmc/core/audio/track_standard.pyx":192
 *         return -1
 * 
 *     def process(self):             # <<<<<<<<<<<<<<
 *         """Processes the track queue each tick."""
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_7process(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_6process[] = "TrackStandard.process(self)\nProcesses the track queue each tick.";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_6process(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_6process(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  int __pyx_v_keep_checking;
  int __pyx_v_idle_sound_player;
  GSList *__pyx_v_iterator;
  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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  GSList *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("process", 0);

  /* "mpfmc/core/audio/track_standard.pyx":195
 *         """Processes the track queue each tick."""
 * 
 *         cdef bint keep_checking = True             # <<<<<<<<<<<<<<
 *         cdef int idle_sound_player
 *         cdef GSList *iterator = NULL
 */
  __pyx_v_keep_checking = 1;

  /* "mpfmc/core/audio/track_standard.pyx":197
 *         cdef bint keep_checking = True
 *         cdef int idle_sound_player
 *         cdef GSList *iterator = NULL             # <<<<<<<<<<<<<<
 * 
 *         # Lock the mutex to ensure no audio data is changed during the playback processing
 */
  __pyx_v_iterator = NULL;

  /* "mpfmc/core/audio/track_standard.pyx":201
 *         # Lock the mutex to ensure no audio data is changed during the playback processing
 *         # (multi-threaded protection)
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         while keep_checking:
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":203
 *         SDL_LockAudio()
 * 
 *         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;

    /* "mpfmc/core/audio/track_standard.pyx":205
 *         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_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_idle_sound_player(__pyx_v_self);

    /* "mpfmc/core/audio/track_standard.pyx":206
 *             # 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) {

      /* "mpfmc/core/audio/track_standard.pyx":208
 *             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, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && 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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __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;

      /* "mpfmc/core/audio/track_standard.pyx":210
 *                 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) {

        /* "mpfmc/core/audio/track_standard.pyx":211
 * 
 *                 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, 211, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && 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;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_Getting_sound_from_queue_s, __pyx_v_sound_instance};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_Getting_sound_from_queue_s, __pyx_v_sound_instance};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __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, 211, __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;

        /* "mpfmc/core/audio/track_standard.pyx":212
 *                 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
 */
        (void)(((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_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));

        /* "mpfmc/core/audio/track_standard.pyx":210
 *                 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;
      }

      /* "mpfmc/core/audio/track_standard.pyx":214
 *                     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:;

      /* "mpfmc/core/audio/track_standard.pyx":206
 *             # 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;
    }

    /* "mpfmc/core/audio/track_standard.pyx":216
 *                     keep_checking = False
 *             else:
 *                 keep_checking = False             # <<<<<<<<<<<<<<
 * 
 *         # Process track notification messages
 */
    /*else*/ {
      __pyx_v_keep_checking = 0;
    }
    __pyx_L5:;
  }

  /* "mpfmc/core/audio/track_standard.pyx":219
 * 
 *         # Process track notification messages
 *         if self.state.notification_messages != NULL:             # <<<<<<<<<<<<<<
 *             self.state.notification_messages = g_slist_reverse(self.state.notification_messages)
 *             iterator = self.state.notification_messages
 */
  __pyx_t_5 = ((__pyx_v_self->__pyx_base.state->notification_messages != NULL) != 0);
  if (__pyx_t_5) {

    /* "mpfmc/core/audio/track_standard.pyx":220
 *         # Process track notification messages
 *         if self.state.notification_messages != NULL:
 *             self.state.notification_messages = g_slist_reverse(self.state.notification_messages)             # <<<<<<<<<<<<<<
 *             iterator = self.state.notification_messages
 *             while iterator != NULL:
 */
    __pyx_v_self->__pyx_base.state->notification_messages = g_slist_reverse(__pyx_v_self->__pyx_base.state->notification_messages);

    /* "mpfmc/core/audio/track_standard.pyx":221
 *         if self.state.notification_messages != NULL:
 *             self.state.notification_messages = g_slist_reverse(self.state.notification_messages)
 *             iterator = self.state.notification_messages             # <<<<<<<<<<<<<<
 *             while iterator != NULL:
 *                 self.process_notification_message(<NotificationMessageContainer*>iterator.data)
 */
    __pyx_t_8 = __pyx_v_self->__pyx_base.state->notification_messages;
    __pyx_v_iterator = __pyx_t_8;

    /* "mpfmc/core/audio/track_standard.pyx":222
 *             self.state.notification_messages = g_slist_reverse(self.state.notification_messages)
 *             iterator = self.state.notification_messages
 *             while iterator != NULL:             # <<<<<<<<<<<<<<
 *                 self.process_notification_message(<NotificationMessageContainer*>iterator.data)
 *                 g_slice_free1(sizeof(NotificationMessageContainer), iterator.data)
 */
    while (1) {
      __pyx_t_5 = ((__pyx_v_iterator != NULL) != 0);
      if (!__pyx_t_5) break;

      /* "mpfmc/core/audio/track_standard.pyx":223
 *             iterator = self.state.notification_messages
 *             while iterator != NULL:
 *                 self.process_notification_message(<NotificationMessageContainer*>iterator.data)             # <<<<<<<<<<<<<<
 *                 g_slice_free1(sizeof(NotificationMessageContainer), iterator.data)
 *                 iterator = iterator.next
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->process_notification_message(__pyx_v_self, ((__pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *)__pyx_v_iterator->data)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":224
 *             while iterator != NULL:
 *                 self.process_notification_message(<NotificationMessageContainer*>iterator.data)
 *                 g_slice_free1(sizeof(NotificationMessageContainer), iterator.data)             # <<<<<<<<<<<<<<
 *                 iterator = iterator.next
 * 
 */
      g_slice_free1((sizeof(__pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer)), __pyx_v_iterator->data);

      /* "mpfmc/core/audio/track_standard.pyx":225
 *                 self.process_notification_message(<NotificationMessageContainer*>iterator.data)
 *                 g_slice_free1(sizeof(NotificationMessageContainer), iterator.data)
 *                 iterator = iterator.next             # <<<<<<<<<<<<<<
 * 
 *             g_slist_free(self.state.notification_messages)
 */
      __pyx_t_8 = __pyx_v_iterator->next;
      __pyx_v_iterator = __pyx_t_8;
    }

    /* "mpfmc/core/audio/track_standard.pyx":227
 *                 iterator = iterator.next
 * 
 *             g_slist_free(self.state.notification_messages)             # <<<<<<<<<<<<<<
 *             self.state.notification_messages = NULL
 * 
 */
    g_slist_free(__pyx_v_self->__pyx_base.state->notification_messages);

    /* "mpfmc/core/audio/track_standard.pyx":228
 * 
 *             g_slist_free(self.state.notification_messages)
 *             self.state.notification_messages = NULL             # <<<<<<<<<<<<<<
 * 
 *         # Unlock the mutex since we are done accessing the audio data
 */
    __pyx_v_self->__pyx_base.state->notification_messages = NULL;

    /* "mpfmc/core/audio/track_standard.pyx":219
 * 
 *         # Process track notification messages
 *         if self.state.notification_messages != NULL:             # <<<<<<<<<<<<<<
 *             self.state.notification_messages = g_slist_reverse(self.state.notification_messages)
 *             iterator = self.state.notification_messages
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":231
 * 
 *         # Unlock the mutex since we are done accessing the audio data
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     cdef process_notification_message(self, NotificationMessageContainer *notification_message):
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":192
 *         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("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":233
 *         SDL_UnlockAudio()
 * 
 *     cdef process_notification_message(self, NotificationMessageContainer *notification_message):             # <<<<<<<<<<<<<<
 *         """Process a notification message to this track"""
 * 
 */

static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard_process_notification_message(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message) {
  PyObject *__pyx_v_event = NULL;
  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)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("process_notification_message", 0);

  /* "mpfmc/core/audio/track_standard.pyx":236
 *         """Process a notification message to this track"""
 * 
 *         if notification_message == NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = ((__pyx_v_notification_message == NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":237
 * 
 *         if notification_message == NULL:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockAudio()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":236
 *         """Process a notification message to this track"""
 * 
 *         if notification_message == NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":239
 *             return
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         # Check for track notification messages first (they do not need sound instance information)
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":242
 * 
 *         # Check for track notification messages first (they do not need sound instance information)
 *         if notification_message.message in (notification_track_stopped, notification_track_paused):             # <<<<<<<<<<<<<<
 *             if notification_message.message == notification_track_stopped:
 *                 self._reset_state()
 */
  switch (__pyx_v_notification_message->message) {
    case __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_track_stopped:
    case __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_track_paused:

    /* "mpfmc/core/audio/track_standard.pyx":243
 *         # Check for track notification messages first (they do not need sound instance information)
 *         if notification_message.message in (notification_track_stopped, notification_track_paused):
 *             if notification_message.message == notification_track_stopped:             # <<<<<<<<<<<<<<
 *                 self._reset_state()
 *                 # Trigger any events
 */
    switch (__pyx_v_notification_message->message) {
      case __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_track_stopped:

      /* "mpfmc/core/audio/track_standard.pyx":244
 *         if notification_message.message in (notification_track_stopped, notification_track_paused):
 *             if notification_message.message == notification_track_stopped:
 *                 self._reset_state()             # <<<<<<<<<<<<<<
 *                 # Trigger any events
 *                 if self.events_when_stopped is not None:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && 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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __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;

      /* "mpfmc/core/audio/track_standard.pyx":246
 *                 self._reset_state()
 *                 # Trigger any events
 *                 if self.events_when_stopped is not None:             # <<<<<<<<<<<<<<
 *                     for event in self.events_when_stopped:
 *                         self.mc.post_mc_native_event(event, track=self._name)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_events_when_stopped); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = (__pyx_t_2 != Py_None);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = (__pyx_t_1 != 0);
      if (__pyx_t_5) {

        /* "mpfmc/core/audio/track_standard.pyx":247
 *                 # Trigger any events
 *                 if self.events_when_stopped is not None:
 *                     for event in self.events_when_stopped:             # <<<<<<<<<<<<<<
 *                         self.mc.post_mc_native_event(event, track=self._name)
 * 
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_events_when_stopped); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
          __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
          __pyx_t_7 = NULL;
        } else {
          __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 247, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        for (;;) {
          if (likely(!__pyx_t_7)) {
            if (likely(PyList_CheckExact(__pyx_t_3))) {
              if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            } else {
              if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            }
          } else {
            __pyx_t_2 = __pyx_t_7(__pyx_t_3);
            if (unlikely(!__pyx_t_2)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 247, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "mpfmc/core/audio/track_standard.pyx":248
 *                 if self.events_when_stopped is not None:
 *                     for event in self.events_when_stopped:
 *                         self.mc.post_mc_native_event(event, track=self._name)             # <<<<<<<<<<<<<<
 * 
 *             elif notification_message.message == notification_track_paused:
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.mc, __pyx_n_s_post_mc_native_event); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_v_event);
          __Pyx_GIVEREF(__pyx_v_event);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_event);
          __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 248, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_track, __pyx_v_self->__pyx_base._name) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 248, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

          /* "mpfmc/core/audio/track_standard.pyx":247
 *                 # Trigger any events
 *                 if self.events_when_stopped is not None:
 *                     for event in self.events_when_stopped:             # <<<<<<<<<<<<<<
 *                         self.mc.post_mc_native_event(event, track=self._name)
 * 
 */
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "mpfmc/core/audio/track_standard.pyx":246
 *                 self._reset_state()
 *                 # Trigger any events
 *                 if self.events_when_stopped is not None:             # <<<<<<<<<<<<<<
 *                     for event in self.events_when_stopped:
 *                         self.mc.post_mc_native_event(event, track=self._name)
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":243
 *         # Check for track notification messages first (they do not need sound instance information)
 *         if notification_message.message in (notification_track_stopped, notification_track_paused):
 *             if notification_message.message == notification_track_stopped:             # <<<<<<<<<<<<<<
 *                 self._reset_state()
 *                 # Trigger any events
 */
      break;
      case __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_track_paused:

      /* "mpfmc/core/audio/track_standard.pyx":252
 *             elif notification_message.message == notification_track_paused:
 *                 # Trigger any events
 *                 if self.events_when_paused is not None:             # <<<<<<<<<<<<<<
 *                     for event in self.events_when_paused:
 *                         self.mc.post_mc_native_event(event, track=self._name)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_events_when_paused); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = (__pyx_t_3 != Py_None);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = (__pyx_t_5 != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":253
 *                 # Trigger any events
 *                 if self.events_when_paused is not None:
 *                     for event in self.events_when_paused:             # <<<<<<<<<<<<<<
 *                         self.mc.post_mc_native_event(event, track=self._name)
 *                 pass
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_events_when_paused); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
          __pyx_t_9 = __pyx_t_3; __Pyx_INCREF(__pyx_t_9); __pyx_t_6 = 0;
          __pyx_t_7 = NULL;
        } else {
          __pyx_t_6 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 253, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        for (;;) {
          if (likely(!__pyx_t_7)) {
            if (likely(PyList_CheckExact(__pyx_t_9))) {
              if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_9)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_3 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 253, __pyx_L1_error)
              #else
              __pyx_t_3 = PySequence_ITEM(__pyx_t_9, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 253, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              #endif
            } else {
              if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 253, __pyx_L1_error)
              #else
              __pyx_t_3 = PySequence_ITEM(__pyx_t_9, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 253, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              #endif
            }
          } else {
            __pyx_t_3 = __pyx_t_7(__pyx_t_9);
            if (unlikely(!__pyx_t_3)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 253, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_3);
          }
          __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_3);
          __pyx_t_3 = 0;

          /* "mpfmc/core/audio/track_standard.pyx":254
 *                 if self.events_when_paused is not None:
 *                     for event in self.events_when_paused:
 *                         self.mc.post_mc_native_event(event, track=self._name)             # <<<<<<<<<<<<<<
 *                 pass
 * 
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.mc, __pyx_n_s_post_mc_native_event); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_INCREF(__pyx_v_event);
          __Pyx_GIVEREF(__pyx_v_event);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_event);
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 254, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_track, __pyx_v_self->__pyx_base._name) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "mpfmc/core/audio/track_standard.pyx":253
 *                 # Trigger any events
 *                 if self.events_when_paused is not None:
 *                     for event in self.events_when_paused:             # <<<<<<<<<<<<<<
 *                         self.mc.post_mc_native_event(event, track=self._name)
 *                 pass
 */
        }
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "mpfmc/core/audio/track_standard.pyx":252
 *             elif notification_message.message == notification_track_paused:
 *                 # Trigger any events
 *                 if self.events_when_paused is not None:             # <<<<<<<<<<<<<<
 *                     for event in self.events_when_paused:
 *                         self.mc.post_mc_native_event(event, track=self._name)
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":250
 *                         self.mc.post_mc_native_event(event, track=self._name)
 * 
 *             elif notification_message.message == notification_track_paused:             # <<<<<<<<<<<<<<
 *                 # Trigger any events
 *                 if self.events_when_paused is not None:
 */
      break;
      default: break;
    }

    /* "mpfmc/core/audio/track_standard.pyx":257
 *                 pass
 * 
 *             SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    SDL_UnlockAudio();

    /* "mpfmc/core/audio/track_standard.pyx":258
 * 
 *             SDL_UnlockAudio()
 *             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;

    /* "mpfmc/core/audio/track_standard.pyx":242
 * 
 *         # Check for track notification messages first (they do not need sound instance information)
 *         if notification_message.message in (notification_track_stopped, notification_track_paused):             # <<<<<<<<<<<<<<
 *             if notification_message.message == notification_track_stopped:
 *                 self._reset_state()
 */
    break;
    default: break;
  }

  /* "mpfmc/core/audio/track_standard.pyx":260
 *             return
 * 
 *         self.log.debug("Processing notification message %d for sound instance (id: %d)",             # <<<<<<<<<<<<<<
 *                        notification_message.message, notification_message.sound_instance_id)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "mpfmc/core/audio/track_standard.pyx":261
 * 
 *         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._playing_instances_by_id:
 */
  __pyx_t_4 = __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage(__pyx_v_notification_message->message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyInt_From_Uint64(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && 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_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_u_Processing_notification_message, __pyx_t_4, __pyx_t_8};
    __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_u_Processing_notification_message, __pyx_t_4, __pyx_t_8};
    __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Processing_notification_message);
    __Pyx_GIVEREF(__pyx_kp_u_Processing_notification_message);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_kp_u_Processing_notification_message);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_8);
    __pyx_t_4 = 0;
    __pyx_t_8 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":263
 *                        notification_message.message, notification_message.sound_instance_id)
 * 
 *         if notification_message.sound_instance_id not in self._playing_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_9 = __Pyx_PyInt_From_Uint64(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 263, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_t_9, __pyx_v_self->_playing_instances_by_id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (__pyx_t_5) {

    /* "mpfmc/core/audio/track_standard.pyx":264
 * 
 *         if notification_message.sound_instance_id not in self._playing_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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_warning); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "mpfmc/core/audio/track_standard.pyx":267
 *                              "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_11 = __Pyx_PyInt_From_Uint64(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_8 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && 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_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_kp_u_Received_a_notification_message, __pyx_t_11};
      __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 264, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_kp_u_Received_a_notification_message, __pyx_t_11};
      __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 264, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = 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_10, __pyx_kp_u_Received_a_notification_message);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_10, __pyx_t_11);
      __pyx_t_11 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 264, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":263
 *                        notification_message.message, notification_message.sound_instance_id)
 * 
 *         if notification_message.sound_instance_id not in self._playing_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_L10;
  }

  /* "mpfmc/core/audio/track_standard.pyx":269
 *                              notification_message.sound_instance_id)
 * 
 *         elif notification_message.message == notification_sound_started:             # <<<<<<<<<<<<<<
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
  __pyx_t_5 = ((__pyx_v_notification_message->message == __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_started) != 0);
  if (__pyx_t_5) {

    /* "mpfmc/core/audio/track_standard.pyx":270
 * 
 *         elif notification_message.message == notification_sound_started:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]             # <<<<<<<<<<<<<<
 *             if sound_instance is not None:
 *                 sound_instance.set_playing()
 */
    if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 270, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_PyInt_From_Uint64(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->_playing_instances_by_id, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_sound_instance = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":271
 *         elif notification_message.message == notification_sound_started:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_playing()
 * 
 */
    __pyx_t_5 = (__pyx_v_sound_instance != Py_None);
    __pyx_t_1 = (__pyx_t_5 != 0);
    if (__pyx_t_1) {

      /* "mpfmc/core/audio/track_standard.pyx":272
 *             sound_instance = self._playing_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_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_playing); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":271
 *         elif notification_message.message == notification_sound_started:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_playing()
 * 
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":269
 *                              notification_message.sound_instance_id)
 * 
 *         elif notification_message.message == notification_sound_started:             # <<<<<<<<<<<<<<
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
    goto __pyx_L10;
  }

  /* "mpfmc/core/audio/track_standard.pyx":274
 *                 sound_instance.set_playing()
 * 
 *         elif notification_message.message == notification_sound_stopped:             # <<<<<<<<<<<<<<
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
  __pyx_t_1 = ((__pyx_v_notification_message->message == __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_stopped) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":275
 * 
 *         elif notification_message.message == notification_sound_stopped:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]             # <<<<<<<<<<<<<<
 *             if sound_instance is not None:
 *                 sound_instance.set_stopped()
 */
    if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 275, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyInt_From_Uint64(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_self->_playing_instances_by_id, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_sound_instance = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":276
 *         elif notification_message.message == notification_sound_stopped:
 *             sound_instance = self._playing_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 playing sound "
 */
    __pyx_t_1 = (__pyx_v_sound_instance != Py_None);
    __pyx_t_5 = (__pyx_t_1 != 0);
    if (__pyx_t_5) {

      /* "mpfmc/core/audio/track_standard.pyx":277
 *             sound_instance = self._playing_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 playing sound "
 *                                "instance dictionary", str(sound_instance))
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_stopped); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && 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_9 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":278
 *             if sound_instance is not None:
 *                 sound_instance.set_stopped()
 *                 self.log.debug("Removing sound instance %s from playing sound "             # <<<<<<<<<<<<<<
 *                                "instance dictionary", str(sound_instance))
 *                 del self._playing_instances_by_id[sound_instance.id]
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "mpfmc/core/audio/track_standard.pyx":279
 *                 sound_instance.set_stopped()
 *                 self.log.debug("Removing sound instance %s from playing sound "
 *                                "instance dictionary", str(sound_instance))             # <<<<<<<<<<<<<<
 *                 del self._playing_instances_by_id[sound_instance.id]
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_sound_instance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_kp_u_Removing_sound_instance_s_from_p, __pyx_t_4};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_kp_u_Removing_sound_instance_s_from_p, __pyx_t_4};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 278, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_11) {
          __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11); __pyx_t_11 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_Removing_sound_instance_s_from_p);
        __Pyx_GIVEREF(__pyx_kp_u_Removing_sound_instance_s_from_p);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_kp_u_Removing_sound_instance_s_from_p);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":280
 *                 self.log.debug("Removing sound instance %s from playing sound "
 *                                "instance dictionary", str(sound_instance))
 *                 del self._playing_instances_by_id[sound_instance.id]             # <<<<<<<<<<<<<<
 * 
 *         elif notification_message.message == notification_sound_looping:
 */
      if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 280, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (unlikely(PyDict_DelItem(__pyx_v_self->_playing_instances_by_id, __pyx_t_9) < 0)) __PYX_ERR(0, 280, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":276
 *         elif notification_message.message == notification_sound_stopped:
 *             sound_instance = self._playing_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 playing sound "
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":274
 *                 sound_instance.set_playing()
 * 
 *         elif notification_message.message == notification_sound_stopped:             # <<<<<<<<<<<<<<
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
    goto __pyx_L10;
  }

  /* "mpfmc/core/audio/track_standard.pyx":282
 *                 del self._playing_instances_by_id[sound_instance.id]
 * 
 *         elif notification_message.message == notification_sound_looping:             # <<<<<<<<<<<<<<
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
  __pyx_t_5 = ((__pyx_v_notification_message->message == __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_looping) != 0);
  if (__pyx_t_5) {

    /* "mpfmc/core/audio/track_standard.pyx":283
 * 
 *         elif notification_message.message == notification_sound_looping:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]             # <<<<<<<<<<<<<<
 *             if sound_instance is not None:
 *                 sound_instance.set_looping()
 */
    if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 283, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_PyInt_From_Uint64(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->_playing_instances_by_id, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_sound_instance = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":284
 *         elif notification_message.message == notification_sound_looping:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_looping()
 * 
 */
    __pyx_t_5 = (__pyx_v_sound_instance != Py_None);
    __pyx_t_1 = (__pyx_t_5 != 0);
    if (__pyx_t_1) {

      /* "mpfmc/core/audio/track_standard.pyx":285
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 *                 sound_instance.set_looping()             # <<<<<<<<<<<<<<
 * 
 *         elif notification_message.message == notification_sound_about_to_finish:
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_looping); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && 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 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":284
 *         elif notification_message.message == notification_sound_looping:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_looping()
 * 
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":282
 *                 del self._playing_instances_by_id[sound_instance.id]
 * 
 *         elif notification_message.message == notification_sound_looping:             # <<<<<<<<<<<<<<
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
    goto __pyx_L10;
  }

  /* "mpfmc/core/audio/track_standard.pyx":287
 *                 sound_instance.set_looping()
 * 
 *         elif notification_message.message == notification_sound_about_to_finish:             # <<<<<<<<<<<<<<
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
  __pyx_t_1 = ((__pyx_v_notification_message->message == __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_about_to_finish) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":288
 * 
 *         elif notification_message.message == notification_sound_about_to_finish:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]             # <<<<<<<<<<<<<<
 *             if sound_instance is not None:
 *                 sound_instance.set_about_to_finish()
 */
    if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 288, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyInt_From_Uint64(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_self->_playing_instances_by_id, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_sound_instance = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":289
 *         elif notification_message.message == notification_sound_about_to_finish:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_about_to_finish()
 * 
 */
    __pyx_t_1 = (__pyx_v_sound_instance != Py_None);
    __pyx_t_5 = (__pyx_t_1 != 0);
    if (__pyx_t_5) {

      /* "mpfmc/core/audio/track_standard.pyx":290
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 *                 sound_instance.set_about_to_finish()             # <<<<<<<<<<<<<<
 * 
 *         elif notification_message.message == notification_sound_marker:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_about_to_finish); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && 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_9 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":289
 *         elif notification_message.message == notification_sound_about_to_finish:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_about_to_finish()
 * 
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":287
 *                 sound_instance.set_looping()
 * 
 *         elif notification_message.message == notification_sound_about_to_finish:             # <<<<<<<<<<<<<<
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
    goto __pyx_L10;
  }

  /* "mpfmc/core/audio/track_standard.pyx":292
 *                 sound_instance.set_about_to_finish()
 * 
 *         elif notification_message.message == notification_sound_marker:             # <<<<<<<<<<<<<<
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
  __pyx_t_5 = ((__pyx_v_notification_message->message == __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_marker) != 0);
  if (likely(__pyx_t_5)) {

    /* "mpfmc/core/audio/track_standard.pyx":293
 * 
 *         elif notification_message.message == notification_sound_marker:
 *             sound_instance = self._playing_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->_playing_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 293, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_PyInt_From_Uint64(__pyx_v_notification_message->sound_instance_id); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->_playing_instances_by_id, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_sound_instance = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":294
 *         elif notification_message.message == notification_sound_marker:
 *             sound_instance = self._playing_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_5 = (__pyx_v_sound_instance != Py_None);
    __pyx_t_1 = (__pyx_t_5 != 0);
    if (__pyx_t_1) {

      /* "mpfmc/core/audio/track_standard.pyx":295
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 *                 sound_instance.set_marker(notification_message.data.marker.id)             # <<<<<<<<<<<<<<
 *         else:
 *             raise AudioException("Unknown notification message received on %s track", self.name)
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_marker); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_notification_message->data.marker.id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_4, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":294
 *         elif notification_message.message == notification_sound_marker:
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:             # <<<<<<<<<<<<<<
 *                 sound_instance.set_marker(notification_message.data.marker.id)
 *         else:
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":292
 *                 sound_instance.set_about_to_finish()
 * 
 *         elif notification_message.message == notification_sound_marker:             # <<<<<<<<<<<<<<
 *             sound_instance = self._playing_instances_by_id[notification_message.sound_instance_id]
 *             if sound_instance is not None:
 */
    goto __pyx_L10;
  }

  /* "mpfmc/core/audio/track_standard.pyx":297
 *                 sound_instance.set_marker(notification_message.data.marker.id)
 *         else:
 *             raise AudioException("Unknown notification message received on %s track", self.name)             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_AudioException); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_Unknown_notification_message_rec, __pyx_t_8};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_Unknown_notification_message_rec, __pyx_t_8};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_Unknown_notification_message_rec);
      __Pyx_GIVEREF(__pyx_kp_u_Unknown_notification_message_rec);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_kp_u_Unknown_notification_message_rec);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 297, __pyx_L1_error)
  }
  __pyx_L10:;

  /* "mpfmc/core/audio/track_standard.pyx":299
 *             raise AudioException("Unknown notification message received on %s track", self.name)
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     def _get_next_sound(self):
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":233
 *         SDL_UnlockAudio()
 * 
 *     cdef process_notification_message(self, NotificationMessageContainer *notification_message):             # <<<<<<<<<<<<<<
 *         """Process a notification message to this track"""
 * 
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.process_notification_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":301
 *         SDL_UnlockAudio()
 * 
 *     def _get_next_sound(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the next sound in the priority queue ready for playback.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_9_get_next_sound(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_8_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_9_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_8_get_next_sound(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_8_get_next_sound(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_v_sound_instances_retrieved_from_queue = 0;
  PyObject *__pyx_v_sound_instance = 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;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_next_sound", 0);

  /* "mpfmc/core/audio/track_standard.pyx":315
 *         # processed.  Once an item has been processed and retrieved again,
 *         # we are done and return None.
 *         cdef list sound_instances_retrieved_from_queue = list()             # <<<<<<<<<<<<<<
 *         while True:
 *             # Return none if sound queue is empty
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sound_instances_retrieved_from_queue = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":316
 *         # we are done and return None.
 *         cdef list sound_instances_retrieved_from_queue = list()
 *         while True:             # <<<<<<<<<<<<<<
 *             # Return none if sound queue is empty
 *             if len(self._sound_queue) == 0:
 */
  while (1) {

    /* "mpfmc/core/audio/track_standard.pyx":318
 *         while True:
 *             # Return none if sound queue is empty
 *             if len(self._sound_queue) == 0:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    __pyx_t_1 = __pyx_v_self->_sound_queue;
    __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, 318, __pyx_L1_error)
    }
    __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = ((__pyx_t_2 == 0) != 0);
    if (__pyx_t_3) {

      /* "mpfmc/core/audio/track_standard.pyx":319
 *             # Return none if sound queue is empty
 *             if len(self._sound_queue) == 0:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             # Get the next item in the queue (sorted by priority and expiration time)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "mpfmc/core/audio/track_standard.pyx":318
 *         while True:
 *             # Return none if sound queue is empty
 *             if len(self._sound_queue) == 0:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":322
 * 
 *             # Get the next item in the queue (sorted by priority and expiration time)
 *             sound_instance = heappop(self._sound_queue)             # <<<<<<<<<<<<<<
 * 
 *             # Check if we've already processed the sound instance during this call (if
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_heappop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_self->_sound_queue) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self->_sound_queue);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":326
 *             # Check if we've already processed the sound instance during this call (if
 *             # so, put it back in the queue and return)
 *             if sound_instance in sound_instances_retrieved_from_queue:             # <<<<<<<<<<<<<<
 *                 heappush(self._sound_queue, sound_instance)
 *                 return None
 */
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_sound_instance, __pyx_v_sound_instances_retrieved_from_queue, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 326, __pyx_L1_error)
    __pyx_t_6 = (__pyx_t_3 != 0);
    if (__pyx_t_6) {

      /* "mpfmc/core/audio/track_standard.pyx":327
 *             # so, put it back in the queue and return)
 *             if sound_instance in sound_instances_retrieved_from_queue:
 *                 heappush(self._sound_queue, sound_instance)             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_heappush); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(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_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_self->_sound_queue, __pyx_v_sound_instance};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_self->_sound_queue, __pyx_v_sound_instance};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 327, __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_v_self->_sound_queue);
        __Pyx_GIVEREF(__pyx_v_self->_sound_queue);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_self->_sound_queue);
        __Pyx_INCREF(__pyx_v_sound_instance);
        __Pyx_GIVEREF(__pyx_v_sound_instance);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_sound_instance);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":328
 *             if sound_instance in sound_instances_retrieved_from_queue:
 *                 heappush(self._sound_queue, sound_instance)
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             # Keep track of entries we've processed during this call
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "mpfmc/core/audio/track_standard.pyx":326
 *             # Check if we've already processed the sound instance during this call (if
 *             # so, put it back in the queue and return)
 *             if sound_instance in sound_instances_retrieved_from_queue:             # <<<<<<<<<<<<<<
 *                 heappush(self._sound_queue, sound_instance)
 *                 return None
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":331
 * 
 *             # Keep track of entries we've processed during this call
 *             sound_instances_retrieved_from_queue.append(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *             # If the sound is still loading and not expired, put it back in the queue
 */
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_sound_instances_retrieved_from_queue, __pyx_v_sound_instance); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 331, __pyx_L1_error)

    /* "mpfmc/core/audio/track_standard.pyx":334
 * 
 *             # If the sound is still loading and not expired, put it back in the queue
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \             # <<<<<<<<<<<<<<
 *                     (sound_instance.exp_time is None or sound_instance.exp_time > time.time()):
 *                 heappush(self._sound_queue, sound_instance)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_loaded); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = ((!__pyx_t_3) != 0);
    if (__pyx_t_10) {
    } else {
      __pyx_t_6 = __pyx_t_10;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_loading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_10) {
    } else {
      __pyx_t_6 = __pyx_t_10;
      goto __pyx_L8_bool_binop_done;
    }

    /* "mpfmc/core/audio/track_standard.pyx":335
 *             # If the sound is still loading and not expired, put it back in the queue
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \
 *                     (sound_instance.exp_time is None or sound_instance.exp_time > time.time()):             # <<<<<<<<<<<<<<
 *                 heappush(self._sound_queue, sound_instance)
 *                 self.log.debug("Next pending sound in queue is still loading, "
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_exp_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = (__pyx_t_1 == Py_None);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = (__pyx_t_10 != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_6 = __pyx_t_3;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_exp_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_time); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __pyx_t_3;
    __pyx_L8_bool_binop_done:;

    /* "mpfmc/core/audio/track_standard.pyx":334
 * 
 *             # If the sound is still loading and not expired, put it back in the queue
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \             # <<<<<<<<<<<<<<
 *                     (sound_instance.exp_time is None or sound_instance.exp_time > time.time()):
 *                 heappush(self._sound_queue, sound_instance)
 */
    if (__pyx_t_6) {

      /* "mpfmc/core/audio/track_standard.pyx":336
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \
 *                     (sound_instance.exp_time is None or sound_instance.exp_time > time.time()):
 *                 heappush(self._sound_queue, sound_instance)             # <<<<<<<<<<<<<<
 *                 self.log.debug("Next pending sound in queue is still loading, "
 *                                "re-queueing sound %s",
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_heappush); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_self->_sound_queue, __pyx_v_sound_instance};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 336, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_self->_sound_queue, __pyx_v_sound_instance};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 336, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_1) {
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL;
        }
        __Pyx_INCREF(__pyx_v_self->_sound_queue);
        __Pyx_GIVEREF(__pyx_v_self->_sound_queue);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_self->_sound_queue);
        __Pyx_INCREF(__pyx_v_sound_instance);
        __Pyx_GIVEREF(__pyx_v_sound_instance);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_sound_instance);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":337
 *                     (sound_instance.exp_time is None or sound_instance.exp_time > time.time()):
 *                 heappush(self._sound_queue, sound_instance)
 *                 self.log.debug("Next pending sound in queue is still loading, "             # <<<<<<<<<<<<<<
 *                                "re-queueing sound %s",
 *                                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, 337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "mpfmc/core/audio/track_standard.pyx":339
 *                 self.log.debug("Next pending sound in queue is still loading, "
 *                                "re-queueing sound %s",
 *                                sound_instance)             # <<<<<<<<<<<<<<
 *             else:
 *                 # Return the next sound from the priority queue if it has not expired
 */
      __pyx_t_8 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_kp_u_Next_pending_sound_in_queue_is_s, __pyx_v_sound_instance};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_kp_u_Next_pending_sound_in_queue_is_s, __pyx_v_sound_instance};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_8) {
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = 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_1, 0+__pyx_t_7, __pyx_kp_u_Next_pending_sound_in_queue_is_s);
        __Pyx_INCREF(__pyx_v_sound_instance);
        __Pyx_GIVEREF(__pyx_v_sound_instance);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_7, __pyx_v_sound_instance);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":334
 * 
 *             # If the sound is still loading and not expired, put it back in the queue
 *             if not sound_instance.sound.loaded and sound_instance.sound.loading and \             # <<<<<<<<<<<<<<
 *                     (sound_instance.exp_time is None or sound_instance.exp_time > time.time()):
 *                 heappush(self._sound_queue, sound_instance)
 */
      goto __pyx_L7;
    }

    /* "mpfmc/core/audio/track_standard.pyx":342
 *             else:
 *                 # Return the next sound from the priority queue if it has not expired
 *                 if sound_instance.exp_time is None or sound_instance.exp_time > time.time():             # <<<<<<<<<<<<<<
 *                     self.log.debug("Retrieving next pending sound from queue %s", sound_instance)
 *                     sound_instance.set_pending()  # Notify sound instance it is no longer queued
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_exp_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = (__pyx_t_5 == Py_None);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = (__pyx_t_3 != 0);
      if (!__pyx_t_10) {
      } else {
        __pyx_t_6 = __pyx_t_10;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_exp_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_6 = __pyx_t_10;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_6) {

        /* "mpfmc/core/audio/track_standard.pyx":343
 *                 # Return the next sound from the priority queue if it has not expired
 *                 if sound_instance.exp_time is None or sound_instance.exp_time > time.time():
 *                     self.log.debug("Retrieving next pending sound from queue %s", sound_instance)             # <<<<<<<<<<<<<<
 *                     sound_instance.set_pending()  # Notify sound instance it is no longer queued
 *                     return 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, 343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && 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_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_Retrieving_next_pending_sound_fr, __pyx_v_sound_instance};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_8);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_Retrieving_next_pending_sound_fr, __pyx_v_sound_instance};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_8);
        } else
        #endif
        {
          __pyx_t_1 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __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_Retrieving_next_pending_sound_fr);
          __Pyx_GIVEREF(__pyx_kp_u_Retrieving_next_pending_sound_fr);
          PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_7, __pyx_kp_u_Retrieving_next_pending_sound_fr);
          __Pyx_INCREF(__pyx_v_sound_instance);
          __Pyx_GIVEREF(__pyx_v_sound_instance);
          PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_7, __pyx_v_sound_instance);
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "mpfmc/core/audio/track_standard.pyx":344
 *                 if sound_instance.exp_time is None or sound_instance.exp_time > time.time():
 *                     self.log.debug("Retrieving next pending sound from queue %s", sound_instance)
 *                     sound_instance.set_pending()  # Notify sound instance it is no longer queued             # <<<<<<<<<<<<<<
 *                     return sound_instance
 *                 else:
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_pending); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 344, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_8 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 344, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "mpfmc/core/audio/track_standard.pyx":345
 *                     self.log.debug("Retrieving next pending sound from queue %s", sound_instance)
 *                     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", sound_instance)
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_sound_instance);
        __pyx_r = __pyx_v_sound_instance;
        goto __pyx_L0;

        /* "mpfmc/core/audio/track_standard.pyx":342
 *             else:
 *                 # Return the next sound from the priority queue if it has not expired
 *                 if sound_instance.exp_time is None or sound_instance.exp_time > time.time():             # <<<<<<<<<<<<<<
 *                     self.log.debug("Retrieving next pending sound from queue %s", sound_instance)
 *                     sound_instance.set_pending()  # Notify sound instance it is no longer queued
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":347
 *                     return sound_instance
 *                 else:
 *                     self.log.debug("Discarding expired sound from queue %s", sound_instance)             # <<<<<<<<<<<<<<
 *                     sound_instance.set_expired()  # Notify sound instance it has expired
 * 
 */
      /*else*/ {
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_u_Discarding_expired_sound_from_qu, __pyx_v_sound_instance};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 347, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_8);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_u_Discarding_expired_sound_from_qu, __pyx_v_sound_instance};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 347, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_8);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__pyx_t_1) {
            __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = 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_5, 0+__pyx_t_7, __pyx_kp_u_Discarding_expired_sound_from_qu);
          __Pyx_INCREF(__pyx_v_sound_instance);
          __Pyx_GIVEREF(__pyx_v_sound_instance);
          PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_sound_instance);
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 347, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "mpfmc/core/audio/track_standard.pyx":348
 *                 else:
 *                     self.log.debug("Discarding expired sound from queue %s", sound_instance)
 *                     sound_instance.set_expired()  # Notify sound instance it has expired             # <<<<<<<<<<<<<<
 * 
 *     def _remove_sound_from_queue(self, sound not None):
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_expired); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && 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_8 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 348, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __pyx_L7:;
  }

  /* "mpfmc/core/audio/track_standard.pyx":301
 *         SDL_UnlockAudio()
 * 
 *     def _get_next_sound(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the next sound in the priority queue ready for playback.
 */

  /* 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._get_next_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sound_instances_retrieved_from_queue);
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":350
 *                     sound_instance.set_expired()  # Notify sound instance it has expired
 * 
 *     def _remove_sound_from_queue(self, sound not None):             # <<<<<<<<<<<<<<
 *         """
 *         Removes all sound instances of the specify sound from the priority sound queue.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_11_remove_sound_from_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_10_remove_sound_from_queue[] = "TrackStandard._remove_sound_from_queue(self, sound)\n\n        Removes all sound instances of the specify sound from the priority sound queue.\n\n        Args:\n            sound: The sound object to remove\n        ";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_11_remove_sound_from_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_remove_sound_from_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, 350, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_10_remove_sound_from_queue(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_10_remove_sound_from_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound) {
  PyObject *__pyx_v_sound_queue_copy = 0;
  PyObject *__pyx_v_sound_instance = 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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_remove_sound_from_queue", 0);

  /* "mpfmc/core/audio/track_standard.pyx":357
 *             sound: The sound object to remove
 *         """
 *         cdef list sound_queue_copy = self._sound_queue.copy()             # <<<<<<<<<<<<<<
 *         for sound_instance in sound_queue_copy:
 *             if sound_instance.sound_id == sound.id:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 357, __pyx_L1_error)
  __pyx_v_sound_queue_copy = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":358
 *         """
 *         cdef list sound_queue_copy = self._sound_queue.copy()
 *         for sound_instance in sound_queue_copy:             # <<<<<<<<<<<<<<
 *             if sound_instance.sound_id == sound.id:
 *                 self._sound_queue.remove(sound_instance)
 */
  if (unlikely(__pyx_v_sound_queue_copy == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 358, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_sound_queue_copy; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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, 358, __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, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":359
 *         cdef list sound_queue_copy = self._sound_queue.copy()
 *         for sound_instance in sound_queue_copy:
 *             if sound_instance.sound_id == sound.id:             # <<<<<<<<<<<<<<
 *                 self._sound_queue.remove(sound_instance)
 *                 sound_instance.set_canceled()
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 359, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 359, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 359, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 359, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {

      /* "mpfmc/core/audio/track_standard.pyx":360
 *         for sound_instance in sound_queue_copy:
 *             if sound_instance.sound_id == sound.id:
 *                 self._sound_queue.remove(sound_instance)             # <<<<<<<<<<<<<<
 *                 sound_instance.set_canceled()
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_remove); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_sound_instance);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":361
 *             if sound_instance.sound_id == sound.id:
 *                 self._sound_queue.remove(sound_instance)
 *                 sound_instance.set_canceled()             # <<<<<<<<<<<<<<
 * 
 *         heapify(self._sound_queue)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_canceled); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 361, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":359
 *         cdef list sound_queue_copy = self._sound_queue.copy()
 *         for sound_instance in sound_queue_copy:
 *             if sound_instance.sound_id == sound.id:             # <<<<<<<<<<<<<<
 *                 self._sound_queue.remove(sound_instance)
 *                 sound_instance.set_canceled()
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":358
 *         """
 *         cdef list sound_queue_copy = self._sound_queue.copy()
 *         for sound_instance in sound_queue_copy:             # <<<<<<<<<<<<<<
 *             if sound_instance.sound_id == sound.id:
 *                 self._sound_queue.remove(sound_instance)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":363
 *                 sound_instance.set_canceled()
 * 
 *         heapify(self._sound_queue)             # <<<<<<<<<<<<<<
 * 
 *     def _remove_sound_instance_from_queue(self, sound_instance not None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_heapify); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_v_self->_sound_queue) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self->_sound_queue);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":350
 *                     sound_instance.set_expired()  # Notify sound instance it has expired
 * 
 *     def _remove_sound_from_queue(self, sound not None):             # <<<<<<<<<<<<<<
 *         """
 *         Removes all sound instances of the specify 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_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._remove_sound_from_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sound_queue_copy);
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":365
 *         heapify(self._sound_queue)
 * 
 *     def _remove_sound_instance_from_queue(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Removes a sound from the priority sound queue.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_13_remove_sound_instance_from_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_12_remove_sound_instance_from_queue[] = "TrackStandard._remove_sound_instance_from_queue(self, sound_instance)\n\n        Removes a sound from the priority sound queue.\n        Args:\n            sound_instance: The sound instance object to remove\n        ";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_13_remove_sound_instance_from_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_remove_sound_instance_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, 365, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_12_remove_sound_instance_from_queue(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_12_remove_sound_instance_from_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_remove_sound_instance_from_queue", 0);

  /* "mpfmc/core/audio/track_standard.pyx":371
 *             sound_instance: The sound instance object to remove
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             self._sound_queue.remove(sound_instance)
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 */
  {
    __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:*/ {

      /* "mpfmc/core/audio/track_standard.pyx":372
 *         """
 *         try:
 *             self._sound_queue.remove(sound_instance)             # <<<<<<<<<<<<<<
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_remove); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && 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_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_sound_instance);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":373
 *         try:
 *             self._sound_queue.remove(sound_instance)
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)             # <<<<<<<<<<<<<<
 *             sound_instance.set_canceled()
 *             heapify(self._sound_queue)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 373, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && 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;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_Removing_pending_sound_from_queu, __pyx_v_sound_instance};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_Removing_pending_sound_from_queu, __pyx_v_sound_instance};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 373, __pyx_L3_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_Removing_pending_sound_from_queu);
        __Pyx_GIVEREF(__pyx_kp_u_Removing_pending_sound_from_queu);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __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_8, 1+__pyx_t_7, __pyx_v_sound_instance);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":374
 *             self._sound_queue.remove(sound_instance)
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()             # <<<<<<<<<<<<<<
 *             heapify(self._sound_queue)
 *         except ValueError:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_canceled); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 374, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":375
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()
 *             heapify(self._sound_queue)             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             pass
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_heapify); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_v_self->_sound_queue) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self->_sound_queue);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 375, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":371
 *             sound_instance: The sound instance object to remove
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             self._sound_queue.remove(sound_instance)
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":376
 *             sound_instance.set_canceled()
 *             heapify(self._sound_queue)
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             pass
 * 
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_7) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "mpfmc/core/audio/track_standard.pyx":371
 *             sound_instance: The sound instance object to remove
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             self._sound_queue.remove(sound_instance)
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 */
    __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_L4_exception_handled:;
    __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);
    __pyx_L8_try_end:;
  }

  /* "mpfmc/core/audio/track_standard.pyx":365
 *         heapify(self._sound_queue)
 * 
 *     def _remove_sound_instance_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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._remove_sound_instance_from_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":379
 *             pass
 * 
 *     def _remove_all_sounds_with_context_from_queue(self, context):             # <<<<<<<<<<<<<<
 *         """Removes all sounds with the specified context from the priority sound queue.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_15_remove_all_sounds_with_context_from_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_context); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_14_remove_all_sounds_with_context_from_queue[] = "TrackStandard._remove_all_sounds_with_context_from_queue(self, context)\nRemoves all sounds with the specified context from the priority sound queue.\n        ";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_15_remove_all_sounds_with_context_from_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_remove_all_sounds_with_context_from_queue (wrapper)", 0);
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_14_remove_all_sounds_with_context_from_queue(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_context));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_14_remove_all_sounds_with_context_from_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_v_sound_instance = 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;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_remove_all_sounds_with_context_from_queue", 0);

  /* "mpfmc/core/audio/track_standard.pyx":382
 *         """Removes all sounds with the specified context from the priority sound queue.
 *         """
 *         for sound_instance in self._sound_queue.copy():             # <<<<<<<<<<<<<<
 *             if sound_instance.context == context:
 *                 self.log.debug("Removing pending sound with context %s from queue %s", context, sound_instance)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 382, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 382, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 382, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 382, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":383
 *         """
 *         for sound_instance in self._sound_queue.copy():
 *             if sound_instance.context == context:             # <<<<<<<<<<<<<<
 *                 self.log.debug("Removing pending sound with context %s from queue %s", context, sound_instance)
 *                 sound_instance.set_canceled()
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_context, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 383, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_6) {

      /* "mpfmc/core/audio/track_standard.pyx":384
 *         for sound_instance in self._sound_queue.copy():
 *             if sound_instance.context == context:
 *                 self.log.debug("Removing pending sound with context %s from queue %s", context, sound_instance)             # <<<<<<<<<<<<<<
 *                 sound_instance.set_canceled()
 *                 self._sound_queue.remove(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, 384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && 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_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_kp_u_Removing_pending_sound_with_cont, __pyx_v_context, __pyx_v_sound_instance};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_kp_u_Removing_pending_sound_with_cont, __pyx_v_context, __pyx_v_sound_instance};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 384, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_Removing_pending_sound_with_cont);
        __Pyx_GIVEREF(__pyx_kp_u_Removing_pending_sound_with_cont);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_u_Removing_pending_sound_with_cont);
        __Pyx_INCREF(__pyx_v_context);
        __Pyx_GIVEREF(__pyx_v_context);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_context);
        __Pyx_INCREF(__pyx_v_sound_instance);
        __Pyx_GIVEREF(__pyx_v_sound_instance);
        PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_sound_instance);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":385
 *             if sound_instance.context == context:
 *                 self.log.debug("Removing pending sound with context %s from queue %s", context, sound_instance)
 *                 sound_instance.set_canceled()             # <<<<<<<<<<<<<<
 *                 self._sound_queue.remove(sound_instance)
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_canceled); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 385, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && 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_3 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 385, __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;

      /* "mpfmc/core/audio/track_standard.pyx":386
 *                 self.log.debug("Removing pending sound with context %s from queue %s", context, sound_instance)
 *                 sound_instance.set_canceled()
 *                 self._sound_queue.remove(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         heapify(self._sound_queue)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_remove); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && 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_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sound_instance);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __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;

      /* "mpfmc/core/audio/track_standard.pyx":383
 *         """
 *         for sound_instance in self._sound_queue.copy():
 *             if sound_instance.context == context:             # <<<<<<<<<<<<<<
 *                 self.log.debug("Removing pending sound with context %s from queue %s", context, sound_instance)
 *                 sound_instance.set_canceled()
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":382
 *         """Removes all sounds with the specified context from the priority sound queue.
 *         """
 *         for sound_instance in self._sound_queue.copy():             # <<<<<<<<<<<<<<
 *             if sound_instance.context == context:
 *                 self.log.debug("Removing pending sound with context %s from queue %s", context, sound_instance)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":388
 *                 self._sound_queue.remove(sound_instance)
 * 
 *         heapify(self._sound_queue)             # <<<<<<<<<<<<<<
 * 
 *     def _remove_all_sounds_with_key_from_queue(self, key):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_heapify); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_self->_sound_queue) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->_sound_queue);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __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;

  /* "mpfmc/core/audio/track_standard.pyx":379
 *             pass
 * 
 *     def _remove_all_sounds_with_context_from_queue(self, context):             # <<<<<<<<<<<<<<
 *         """Removes all sounds with the specified context 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._remove_all_sounds_with_context_from_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;
}

/* "mpfmc/core/audio/track_standard.pyx":390
 *         heapify(self._sound_queue)
 * 
 *     def _remove_all_sounds_with_key_from_queue(self, key):             # <<<<<<<<<<<<<<
 *         """Removes all sounds with the specified key from the priority sound queue.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_17_remove_all_sounds_with_key_from_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_16_remove_all_sounds_with_key_from_queue[] = "TrackStandard._remove_all_sounds_with_key_from_queue(self, key)\nRemoves all sounds with the specified key from the priority sound queue.\n        ";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_17_remove_all_sounds_with_key_from_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_remove_all_sounds_with_key_from_queue (wrapper)", 0);
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_16_remove_all_sounds_with_key_from_queue(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_16_remove_all_sounds_with_key_from_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_sound_instance = 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;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_remove_all_sounds_with_key_from_queue", 0);

  /* "mpfmc/core/audio/track_standard.pyx":393
 *         """Removes all sounds with the specified key from the priority sound queue.
 *         """
 *         for sound_instance in self._sound_queue.copy():             # <<<<<<<<<<<<<<
 *             if sound_instance.key == key:
 *                 self.log.debug("Removing pending sound with key %s from queue %s", key, sound_instance)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 393, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 393, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 393, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":394
 *         """
 *         for sound_instance in self._sound_queue.copy():
 *             if sound_instance.key == key:             # <<<<<<<<<<<<<<
 *                 self.log.debug("Removing pending sound with key %s from queue %s", key, sound_instance)
 *                 sound_instance.set_canceled()
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_key, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 394, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_6) {

      /* "mpfmc/core/audio/track_standard.pyx":395
 *         for sound_instance in self._sound_queue.copy():
 *             if sound_instance.key == key:
 *                 self.log.debug("Removing pending sound with key %s from queue %s", key, sound_instance)             # <<<<<<<<<<<<<<
 *                 sound_instance.set_canceled()
 *                 self._sound_queue.remove(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, 395, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && 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_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_kp_u_Removing_pending_sound_with_key, __pyx_v_key, __pyx_v_sound_instance};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_kp_u_Removing_pending_sound_with_key, __pyx_v_key, __pyx_v_sound_instance};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 395, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_Removing_pending_sound_with_key);
        __Pyx_GIVEREF(__pyx_kp_u_Removing_pending_sound_with_key);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_u_Removing_pending_sound_with_key);
        __Pyx_INCREF(__pyx_v_key);
        __Pyx_GIVEREF(__pyx_v_key);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_key);
        __Pyx_INCREF(__pyx_v_sound_instance);
        __Pyx_GIVEREF(__pyx_v_sound_instance);
        PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_sound_instance);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":396
 *             if sound_instance.key == key:
 *                 self.log.debug("Removing pending sound with key %s from queue %s", key, sound_instance)
 *                 sound_instance.set_canceled()             # <<<<<<<<<<<<<<
 *                 self._sound_queue.remove(sound_instance)
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_canceled); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && 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_3 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __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;

      /* "mpfmc/core/audio/track_standard.pyx":397
 *                 self.log.debug("Removing pending sound with key %s from queue %s", key, sound_instance)
 *                 sound_instance.set_canceled()
 *                 self._sound_queue.remove(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         heapify(self._sound_queue)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_remove); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && 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_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sound_instance);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __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;

      /* "mpfmc/core/audio/track_standard.pyx":394
 *         """
 *         for sound_instance in self._sound_queue.copy():
 *             if sound_instance.key == key:             # <<<<<<<<<<<<<<
 *                 self.log.debug("Removing pending sound with key %s from queue %s", key, sound_instance)
 *                 sound_instance.set_canceled()
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":393
 *         """Removes all sounds with the specified key from the priority sound queue.
 *         """
 *         for sound_instance in self._sound_queue.copy():             # <<<<<<<<<<<<<<
 *             if sound_instance.key == key:
 *                 self.log.debug("Removing pending sound with key %s from queue %s", key, sound_instance)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":399
 *                 self._sound_queue.remove(sound_instance)
 * 
 *         heapify(self._sound_queue)             # <<<<<<<<<<<<<<
 * 
 *     def _remove_all_sounds_from_queue(self):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_heapify); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_self->_sound_queue) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->_sound_queue);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __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;

  /* "mpfmc/core/audio/track_standard.pyx":390
 *         heapify(self._sound_queue)
 * 
 *     def _remove_all_sounds_with_key_from_queue(self, key):             # <<<<<<<<<<<<<<
 *         """Removes all sounds with the specified key 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._remove_all_sounds_with_key_from_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;
}

/* "mpfmc/core/audio/track_standard.pyx":401
 *         heapify(self._sound_queue)
 * 
 *     def _remove_all_sounds_from_queue(self):             # <<<<<<<<<<<<<<
 *         """Removes all sounds from the priority sound queue.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_19_remove_all_sounds_from_queue(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_18_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_19_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_18_remove_all_sounds_from_queue(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_18_remove_all_sounds_from_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_v_sound_instance = 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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_remove_all_sounds_from_queue", 0);

  /* "mpfmc/core/audio/track_standard.pyx":404
 *         """Removes all sounds from the priority sound queue.
 *         """
 *         for sound_instance in self._sound_queue:             # <<<<<<<<<<<<<<
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()
 */
  if (unlikely(__pyx_v_self->_sound_queue == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 404, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->_sound_queue; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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, 404, __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, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":405
 *         """
 *         for sound_instance in self._sound_queue:
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)             # <<<<<<<<<<<<<<
 *             sound_instance.set_canceled()
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && 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;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_Removing_pending_sound_from_queu, __pyx_v_sound_instance};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 405, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_Removing_pending_sound_from_queu, __pyx_v_sound_instance};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 405, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 405, __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, 405, __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;

    /* "mpfmc/core/audio/track_standard.pyx":406
 *         for sound_instance in self._sound_queue:
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()             # <<<<<<<<<<<<<<
 * 
 *         self._sound_queue.clear()
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_canceled); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && 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);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 406, __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;

    /* "mpfmc/core/audio/track_standard.pyx":404
 *         """Removes all sounds from the priority sound queue.
 *         """
 *         for sound_instance in self._sound_queue:             # <<<<<<<<<<<<<<
 *             self.log.debug("Removing pending sound from queue %s", sound_instance)
 *             sound_instance.set_canceled()
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":408
 *             sound_instance.set_canceled()
 * 
 *         self._sound_queue.clear()             # <<<<<<<<<<<<<<
 * 
 *     cdef int _get_playing_sound_count(self, Uint64 sound_id):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_sound_queue, __pyx_n_s_clear); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":401
 *         heapify(self._sound_queue)
 * 
 *     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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._remove_all_sounds_from_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;
}

/* "mpfmc/core/audio/track_standard.pyx":410
 *         self._sound_queue.clear()
 * 
 *     cdef int _get_playing_sound_count(self, Uint64 sound_id):             # <<<<<<<<<<<<<<
 *         """Return the number of currently playing instances of the given sound id"""
 *         cdef int count = 0
 */

static int __pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_playing_sound_count(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, Uint64 __pyx_v_sound_id) {
  int __pyx_v_count;
  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;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_get_playing_sound_count", 0);

  /* "mpfmc/core/audio/track_standard.pyx":412
 *     cdef int _get_playing_sound_count(self, Uint64 sound_id):
 *         """Return the number of currently playing instances of the given sound id"""
 *         cdef int count = 0             # <<<<<<<<<<<<<<
 *         SDL_LockAudio()
 * 
 */
  __pyx_v_count = 0;

  /* "mpfmc/core/audio/track_standard.pyx":413
 *         """Return the number of currently playing instances of the given sound id"""
 *         cdef int count = 0
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.type_state.sound_player_count):
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":415
 *         SDL_LockAudio()
 * 
 *         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;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "mpfmc/core/audio/track_standard.pyx":416
 * 
 *         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:
 *                 count += 1
 */
    __pyx_t_5 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }

    /* "mpfmc/core/audio/track_standard.pyx":417
 *         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:             # <<<<<<<<<<<<<<
 *                 count += 1
 * 
 */
    __pyx_t_5 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_id == __pyx_v_sound_id) != 0);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;

    /* "mpfmc/core/audio/track_standard.pyx":416
 * 
 *         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:
 *                 count += 1
 */
    if (__pyx_t_4) {

      /* "mpfmc/core/audio/track_standard.pyx":418
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_id == sound_id:
 *                 count += 1             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
      __pyx_v_count = (__pyx_v_count + 1);

      /* "mpfmc/core/audio/track_standard.pyx":416
 * 
 *         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:
 *                 count += 1
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":420
 *                 count += 1
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *         return count
 * 
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":421
 * 
 *         SDL_UnlockAudio()
 *         return count             # <<<<<<<<<<<<<<
 * 
 *     cdef list _get_playing_sound_instances(self, Uint64 sound_id):
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":410
 *         self._sound_queue.clear()
 * 
 *     cdef int _get_playing_sound_count(self, Uint64 sound_id):             # <<<<<<<<<<<<<<
 *         """Return the number of currently playing instances of the given sound id"""
 *         cdef int count = 0
 */

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

/* "mpfmc/core/audio/track_standard.pyx":423
 *         return count
 * 
 *     cdef list _get_playing_sound_instances(self, Uint64 sound_id):             # <<<<<<<<<<<<<<
 *         """Return the list of currently playing instances of the given sound id"""
 *         cdef list instances = list()
 */

static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_playing_sound_instances(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, Uint64 __pyx_v_sound_id) {
  PyObject *__pyx_v_instances = 0;
  Uint64 __pyx_v_instance_id;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Uint64 __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_playing_sound_instances", 0);

  /* "mpfmc/core/audio/track_standard.pyx":425
 *     cdef list _get_playing_sound_instances(self, Uint64 sound_id):
 *         """Return the list of currently playing instances of the given sound id"""
 *         cdef list instances = list()             # <<<<<<<<<<<<<<
 *         cdef Uint64 instance_id
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_instances = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":428
 *         cdef Uint64 instance_id
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.type_state.sound_player_count):
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":430
 *         SDL_LockAudio()
 * 
 *         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_2 = __pyx_v_self->type_state->sound_player_count;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "mpfmc/core/audio/track_standard.pyx":431
 * 
 *         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_6 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L6_bool_binop_done;
    }

    /* "mpfmc/core/audio/track_standard.pyx":432
 *         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:             # <<<<<<<<<<<<<<
 * 
 *                 if self.type_state.sound_players[i].status == player_replacing:
 */
    __pyx_t_6 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_id == __pyx_v_sound_id) != 0);
    __pyx_t_5 = __pyx_t_6;
    __pyx_L6_bool_binop_done:;

    /* "mpfmc/core/audio/track_standard.pyx":431
 * 
 *         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:
 * 
 */
    if (__pyx_t_5) {

      /* "mpfmc/core/audio/track_standard.pyx":434
 *                             self.type_state.sound_players[i].current.sound_id == sound_id:
 * 
 *                 if self.type_state.sound_players[i].status == player_replacing:             # <<<<<<<<<<<<<<
 *                     instance_id = self.type_state.sound_players[i].next.sound_instance_id
 *                 else:
 */
      __pyx_t_5 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status == __pyx_e_5mpfmc_4core_5audio_14track_standard_player_replacing) != 0);
      if (__pyx_t_5) {

        /* "mpfmc/core/audio/track_standard.pyx":435
 * 
 *                 if self.type_state.sound_players[i].status == player_replacing:
 *                     instance_id = self.type_state.sound_players[i].next.sound_instance_id             # <<<<<<<<<<<<<<
 *                 else:
 *                     instance_id = self.type_state.sound_players[i].current.sound_instance_id
 */
        __pyx_t_7 = (__pyx_v_self->type_state->sound_players[__pyx_v_i]).next.sound_instance_id;
        __pyx_v_instance_id = __pyx_t_7;

        /* "mpfmc/core/audio/track_standard.pyx":434
 *                             self.type_state.sound_players[i].current.sound_id == sound_id:
 * 
 *                 if self.type_state.sound_players[i].status == player_replacing:             # <<<<<<<<<<<<<<
 *                     instance_id = self.type_state.sound_players[i].next.sound_instance_id
 *                 else:
 */
        goto __pyx_L8;
      }

      /* "mpfmc/core/audio/track_standard.pyx":437
 *                     instance_id = self.type_state.sound_players[i].next.sound_instance_id
 *                 else:
 *                     instance_id = self.type_state.sound_players[i].current.sound_instance_id             # <<<<<<<<<<<<<<
 * 
 *                 if instance_id in self._playing_instances_by_id:
 */
      /*else*/ {
        __pyx_t_7 = (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id;
        __pyx_v_instance_id = __pyx_t_7;
      }
      __pyx_L8:;

      /* "mpfmc/core/audio/track_standard.pyx":439
 *                     instance_id = self.type_state.sound_players[i].current.sound_instance_id
 * 
 *                 if instance_id in self._playing_instances_by_id:             # <<<<<<<<<<<<<<
 *                     instances.append(self._playing_instances_by_id[instance_id])
 * 
 */
      __pyx_t_1 = __Pyx_PyInt_From_Uint64(__pyx_v_instance_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 439, __pyx_L1_error)
      }
      __pyx_t_5 = (__Pyx_PyDict_ContainsTF(__pyx_t_1, __pyx_v_self->_playing_instances_by_id, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 439, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {

        /* "mpfmc/core/audio/track_standard.pyx":440
 * 
 *                 if instance_id in self._playing_instances_by_id:
 *                     instances.append(self._playing_instances_by_id[instance_id])             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
        if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 440, __pyx_L1_error)
        }
        __pyx_t_1 = __Pyx_PyInt_From_Uint64(__pyx_v_instance_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_self->_playing_instances_by_id, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 440, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_instances, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 440, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "mpfmc/core/audio/track_standard.pyx":439
 *                     instance_id = self.type_state.sound_players[i].current.sound_instance_id
 * 
 *                 if instance_id in self._playing_instances_by_id:             # <<<<<<<<<<<<<<
 *                     instances.append(self._playing_instances_by_id[instance_id])
 * 
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":431
 * 
 *         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:
 * 
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":442
 *                     instances.append(self._playing_instances_by_id[instance_id])
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *         return instances
 * 
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":443
 * 
 *         SDL_UnlockAudio()
 *         return instances             # <<<<<<<<<<<<<<
 * 
 *     def _get_oldest_playing_sound_instance(self, Uint64 sound_id):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_instances);
  __pyx_r = __pyx_v_instances;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":423
 *         return count
 * 
 *     cdef list _get_playing_sound_instances(self, Uint64 sound_id):             # <<<<<<<<<<<<<<
 *         """Return the list of currently playing instances of the given sound id"""
 *         cdef list instances = list()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._get_playing_sound_instances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_instances);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":445
 *         return instances
 * 
 *     def _get_oldest_playing_sound_instance(self, Uint64 sound_id):             # <<<<<<<<<<<<<<
 *         """Return the oldest sound instance currently playing"""
 *         cdef list playing_instances = self._get_playing_sound_instances(sound_id)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_21_get_oldest_playing_sound_instance(PyObject *__pyx_v_self, PyObject *__pyx_arg_sound_id); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_20_get_oldest_playing_sound_instance[] = "TrackStandard._get_oldest_playing_sound_instance(self, Uint64 sound_id)\nReturn the oldest sound instance currently playing";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_21_get_oldest_playing_sound_instance(PyObject *__pyx_v_self, PyObject *__pyx_arg_sound_id) {
  Uint64 __pyx_v_sound_id;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_oldest_playing_sound_instance (wrapper)", 0);
  assert(__pyx_arg_sound_id); {
    __pyx_v_sound_id = __Pyx_PyInt_As_Uint64(__pyx_arg_sound_id); if (unlikely((__pyx_v_sound_id == ((Uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 445, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._get_oldest_playing_sound_instance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_20_get_oldest_playing_sound_instance(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), ((Uint64)__pyx_v_sound_id));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_20_get_oldest_playing_sound_instance(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, Uint64 __pyx_v_sound_id) {
  PyObject *__pyx_v_playing_instances = 0;
  PyObject *__pyx_v_oldest_instance = NULL;
  PyObject *__pyx_v_sound_instance = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_oldest_playing_sound_instance", 0);

  /* "mpfmc/core/audio/track_standard.pyx":447
 *     def _get_oldest_playing_sound_instance(self, Uint64 sound_id):
 *         """Return the oldest sound instance currently playing"""
 *         cdef list playing_instances = self._get_playing_sound_instances(sound_id)             # <<<<<<<<<<<<<<
 * 
 *         if not playing_instances:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_playing_sound_instances(__pyx_v_self, __pyx_v_sound_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_playing_instances = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":449
 *         cdef list playing_instances = self._get_playing_sound_instances(sound_id)
 * 
 *         if not playing_instances:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_2 = (__pyx_v_playing_instances != Py_None)&&(PyList_GET_SIZE(__pyx_v_playing_instances) != 0);
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "mpfmc/core/audio/track_standard.pyx":450
 * 
 *         if not playing_instances:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         oldest_instance = playing_instances[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":449
 *         cdef list playing_instances = self._get_playing_sound_instances(sound_id)
 * 
 *         if not playing_instances:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":452
 *             return None
 * 
 *         oldest_instance = playing_instances[0]             # <<<<<<<<<<<<<<
 *         for sound_instance in playing_instances[1:]:
 *             if sound_instance.timestamp < oldest_instance.timestamp:
 */
  if (unlikely(__pyx_v_playing_instances == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 452, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_playing_instances, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_oldest_instance = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":453
 * 
 *         oldest_instance = playing_instances[0]
 *         for sound_instance in playing_instances[1:]:             # <<<<<<<<<<<<<<
 *             if sound_instance.timestamp < oldest_instance.timestamp:
 *                 oldest_instance = sound_instance
 */
  if (unlikely(__pyx_v_playing_instances == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 453, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_playing_instances, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 453, __pyx_L1_error)
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":454
 *         oldest_instance = playing_instances[0]
 *         for sound_instance in playing_instances[1:]:
 *             if sound_instance.timestamp < oldest_instance.timestamp:             # <<<<<<<<<<<<<<
 *                 oldest_instance = sound_instance
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_oldest_instance, __pyx_n_s_timestamp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 454, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 454, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {

      /* "mpfmc/core/audio/track_standard.pyx":455
 *         for sound_instance in playing_instances[1:]:
 *             if sound_instance.timestamp < oldest_instance.timestamp:
 *                 oldest_instance = sound_instance             # <<<<<<<<<<<<<<
 * 
 *         return oldest_instance
 */
      __Pyx_INCREF(__pyx_v_sound_instance);
      __Pyx_DECREF_SET(__pyx_v_oldest_instance, __pyx_v_sound_instance);

      /* "mpfmc/core/audio/track_standard.pyx":454
 *         oldest_instance = playing_instances[0]
 *         for sound_instance in playing_instances[1:]:
 *             if sound_instance.timestamp < oldest_instance.timestamp:             # <<<<<<<<<<<<<<
 *                 oldest_instance = sound_instance
 * 
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":453
 * 
 *         oldest_instance = playing_instances[0]
 *         for sound_instance in playing_instances[1:]:             # <<<<<<<<<<<<<<
 *             if sound_instance.timestamp < oldest_instance.timestamp:
 *                 oldest_instance = sound_instance
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":457
 *                 oldest_instance = sound_instance
 * 
 *         return oldest_instance             # <<<<<<<<<<<<<<
 * 
 *     def _get_newest_playing_sound_instance(self, Uint64 sound_id):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_oldest_instance);
  __pyx_r = __pyx_v_oldest_instance;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":445
 *         return instances
 * 
 *     def _get_oldest_playing_sound_instance(self, Uint64 sound_id):             # <<<<<<<<<<<<<<
 *         """Return the oldest sound instance currently playing"""
 *         cdef list playing_instances = self._get_playing_sound_instances(sound_id)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._get_oldest_playing_sound_instance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_playing_instances);
  __Pyx_XDECREF(__pyx_v_oldest_instance);
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":459
 *         return oldest_instance
 * 
 *     def _get_newest_playing_sound_instance(self, Uint64 sound_id):             # <<<<<<<<<<<<<<
 *         """Return the newest sound instance currently playing"""
 *         cdef list playing_instances = self._get_playing_sound_instances(sound_id)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_23_get_newest_playing_sound_instance(PyObject *__pyx_v_self, PyObject *__pyx_arg_sound_id); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_22_get_newest_playing_sound_instance[] = "TrackStandard._get_newest_playing_sound_instance(self, Uint64 sound_id)\nReturn the newest sound instance currently playing";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_23_get_newest_playing_sound_instance(PyObject *__pyx_v_self, PyObject *__pyx_arg_sound_id) {
  Uint64 __pyx_v_sound_id;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_newest_playing_sound_instance (wrapper)", 0);
  assert(__pyx_arg_sound_id); {
    __pyx_v_sound_id = __Pyx_PyInt_As_Uint64(__pyx_arg_sound_id); if (unlikely((__pyx_v_sound_id == ((Uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 459, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._get_newest_playing_sound_instance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_22_get_newest_playing_sound_instance(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), ((Uint64)__pyx_v_sound_id));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_22_get_newest_playing_sound_instance(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, Uint64 __pyx_v_sound_id) {
  PyObject *__pyx_v_playing_instances = 0;
  PyObject *__pyx_v_newest_instance = NULL;
  PyObject *__pyx_v_sound_instance = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_newest_playing_sound_instance", 0);

  /* "mpfmc/core/audio/track_standard.pyx":461
 *     def _get_newest_playing_sound_instance(self, Uint64 sound_id):
 *         """Return the newest sound instance currently playing"""
 *         cdef list playing_instances = self._get_playing_sound_instances(sound_id)             # <<<<<<<<<<<<<<
 * 
 *         if not playing_instances:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_playing_sound_instances(__pyx_v_self, __pyx_v_sound_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_playing_instances = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":463
 *         cdef list playing_instances = self._get_playing_sound_instances(sound_id)
 * 
 *         if not playing_instances:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_2 = (__pyx_v_playing_instances != Py_None)&&(PyList_GET_SIZE(__pyx_v_playing_instances) != 0);
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "mpfmc/core/audio/track_standard.pyx":464
 * 
 *         if not playing_instances:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         newest_instance = playing_instances[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":463
 *         cdef list playing_instances = self._get_playing_sound_instances(sound_id)
 * 
 *         if not playing_instances:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":466
 *             return None
 * 
 *         newest_instance = playing_instances[0]             # <<<<<<<<<<<<<<
 *         for sound_instance in playing_instances[1:]:
 *             if sound_instance.timestamp > newest_instance.timestamp:
 */
  if (unlikely(__pyx_v_playing_instances == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 466, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_playing_instances, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_newest_instance = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":467
 * 
 *         newest_instance = playing_instances[0]
 *         for sound_instance in playing_instances[1:]:             # <<<<<<<<<<<<<<
 *             if sound_instance.timestamp > newest_instance.timestamp:
 *                 newest_instance = sound_instance
 */
  if (unlikely(__pyx_v_playing_instances == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 467, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_playing_instances, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 467, __pyx_L1_error)
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":468
 *         newest_instance = playing_instances[0]
 *         for sound_instance in playing_instances[1:]:
 *             if sound_instance.timestamp > newest_instance.timestamp:             # <<<<<<<<<<<<<<
 *                 newest_instance = sound_instance
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_newest_instance, __pyx_n_s_timestamp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {

      /* "mpfmc/core/audio/track_standard.pyx":469
 *         for sound_instance in playing_instances[1:]:
 *             if sound_instance.timestamp > newest_instance.timestamp:
 *                 newest_instance = sound_instance             # <<<<<<<<<<<<<<
 * 
 *         return newest_instance
 */
      __Pyx_INCREF(__pyx_v_sound_instance);
      __Pyx_DECREF_SET(__pyx_v_newest_instance, __pyx_v_sound_instance);

      /* "mpfmc/core/audio/track_standard.pyx":468
 *         newest_instance = playing_instances[0]
 *         for sound_instance in playing_instances[1:]:
 *             if sound_instance.timestamp > newest_instance.timestamp:             # <<<<<<<<<<<<<<
 *                 newest_instance = sound_instance
 * 
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":467
 * 
 *         newest_instance = playing_instances[0]
 *         for sound_instance in playing_instances[1:]:             # <<<<<<<<<<<<<<
 *             if sound_instance.timestamp > newest_instance.timestamp:
 *                 newest_instance = sound_instance
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":471
 *                 newest_instance = sound_instance
 * 
 *         return newest_instance             # <<<<<<<<<<<<<<
 * 
 *     def play_sound(self, sound not None, context=None, settings=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_newest_instance);
  __pyx_r = __pyx_v_newest_instance;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":459
 *         return oldest_instance
 * 
 *     def _get_newest_playing_sound_instance(self, Uint64 sound_id):             # <<<<<<<<<<<<<<
 *         """Return the newest sound instance currently playing"""
 *         cdef list playing_instances = self._get_playing_sound_instances(sound_id)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._get_newest_playing_sound_instance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_playing_instances);
  __Pyx_XDECREF(__pyx_v_newest_instance);
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":473
 *         return newest_instance
 * 
 *     def play_sound(self, sound not None, context=None, settings=None):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound on the current track.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25play_sound(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_24play_sound[] = "TrackStandard.play_sound(self, sound, context=None, settings=None)\n\n        Plays a sound on the current track.\n        Args:\n            sound: The SoundAsset or SoundPool object to play\n            context: The context from which the sound is played.\n            settings: A dictionary of settings for playback\n        Returns:\n            A SoundInstance object if the sound will be played (or queued for playback).\n            None if the sound could not be played.\n        ";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25play_sound(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sound = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_settings = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("play_sound (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sound,&__pyx_n_s_context,&__pyx_n_s_settings,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sound)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_context);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_settings);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "play_sound") < 0)) __PYX_ERR(0, 473, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sound = values[0];
    __pyx_v_context = values[1];
    __pyx_v_settings = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("play_sound", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 473, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.play_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(((PyObject *)__pyx_v_sound) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound"); __PYX_ERR(0, 473, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_24play_sound(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), __pyx_v_sound, __pyx_v_context, __pyx_v_settings);

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_24play_sound(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound, PyObject *__pyx_v_context, PyObject *__pyx_v_settings) {
  PyObject *__pyx_v_sound_instance = NULL;
  PyObject *__pyx_v_oldest_instance = NULL;
  PyObject *__pyx_v_newest_instance = NULL;
  PyObject *__pyx_v_sound_player = NULL;
  PyObject *__pyx_v_player = NULL;
  PyObject *__pyx_v_lowest_priority = NULL;
  PyObject *__pyx_v_ex = 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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  Uint64 __pyx_t_14;
  struct __pyx_opt_args_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_t_21;
  char const *__pyx_t_22;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  PyObject *__pyx_t_27 = NULL;
  PyObject *__pyx_t_28 = NULL;
  char const *__pyx_t_29;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("play_sound", 0);

  /* "mpfmc/core/audio/track_standard.pyx":484
 *             None if the sound could not be played.
 *         """
 *         self.log.debug("play_sound - Processing sound '%s' for playback.", sound.name)             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockAudio()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && 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;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_play_sound_Processing_sound_s_fo, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_play_sound_Processing_sound_s_fo, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 484, __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, 484, __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;

  /* "mpfmc/core/audio/track_standard.pyx":486
 *         self.log.debug("play_sound - Processing sound '%s' for playback.", sound.name)
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         # A try/else/finally block is used here to ensure SDL_UnlockAudio is always called
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":491
 *         # before the function returns (since there are so many return branches it is easier
 *         # to use than placing the SDL_UnlockAudio call before every return).
 *         try:             # <<<<<<<<<<<<<<
 * 
 *             # Sound cannot be played if the track is stopped or paused
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "mpfmc/core/audio/track_standard.pyx":494
 * 
 *             # Sound cannot be played if the track is stopped or paused
 *             if self.state.status == track_status_stopped or self.state.status == track_status_paused:             # <<<<<<<<<<<<<<
 *                 self.log.debug("play_sound - %s track is not currently playing and "
 *                                "therefore the request to play sound %s will be canceled",
 */
        switch (__pyx_v_self->__pyx_base.state->status) {
          case __pyx_e_5mpfmc_4core_5audio_5track_track_status_stopped:
          case __pyx_e_5mpfmc_4core_5audio_5track_track_status_paused:

          /* "mpfmc/core/audio/track_standard.pyx":495
 *             # Sound cannot be played if the track is stopped or paused
 *             if self.state.status == track_status_stopped or self.state.status == track_status_paused:
 *                 self.log.debug("play_sound - %s track is not currently playing and "             # <<<<<<<<<<<<<<
 *                                "therefore the request to play sound %s will be canceled",
 *                                self.name, sound.name)
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);

          /* "mpfmc/core/audio/track_standard.pyx":497
 *                 self.log.debug("play_sound - %s track is not currently playing and "
 *                                "therefore the request to play sound %s will be canceled",
 *                                self.name, sound.name)             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 497, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 497, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = NULL;
          __pyx_t_5 = 0;
          if (CYTHON_UNPACK_METHODS && 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;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_2)) {
            PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_kp_u_play_sound_s_track_is_not_curren, __pyx_t_6, __pyx_t_3};
            __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L6_error)
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
            PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_kp_u_play_sound_s_track_is_not_curren, __pyx_t_6, __pyx_t_3};
            __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L6_error)
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          {
            __pyx_t_10 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 495, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_10);
            if (__pyx_t_4) {
              __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __pyx_t_4 = NULL;
            }
            __Pyx_INCREF(__pyx_kp_u_play_sound_s_track_is_not_curren);
            __Pyx_GIVEREF(__pyx_kp_u_play_sound_s_track_is_not_curren);
            PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_5, __pyx_kp_u_play_sound_s_track_is_not_curren);
            __Pyx_GIVEREF(__pyx_t_6);
            PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_t_6);
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_5, __pyx_t_3);
            __pyx_t_6 = 0;
            __pyx_t_3 = 0;
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "mpfmc/core/audio/track_standard.pyx":498
 *                                "therefore the request to play sound %s will be canceled",
 *                                self.name, sound.name)
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             sound_instance = None
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_r = Py_None; __Pyx_INCREF(Py_None);
          goto __pyx_L10_try_return;

          /* "mpfmc/core/audio/track_standard.pyx":494
 * 
 *             # Sound cannot be played if the track is stopped or paused
 *             if self.state.status == track_status_stopped or self.state.status == track_status_paused:             # <<<<<<<<<<<<<<
 *                 self.log.debug("play_sound - %s track is not currently playing and "
 *                                "therefore the request to play sound %s will be canceled",
 */
          break;
          default: break;
        }

        /* "mpfmc/core/audio/track_standard.pyx":500
 *                 return None
 * 
 *             sound_instance = None             # <<<<<<<<<<<<<<
 * 
 *             # Check if sound can be played based on if the maximum number of playing instances of
 */
        __Pyx_INCREF(Py_None);
        __pyx_v_sound_instance = Py_None;

        /* "mpfmc/core/audio/track_standard.pyx":504
 *             # Check if sound can be played based on if the maximum number of playing instances of
 *             # this sound has been reached or not.
 *             if sound.simultaneous_limit is not None and self._get_playing_sound_count(sound.id) >= sound.simultaneous_limit:             # <<<<<<<<<<<<<<
 * 
 *                 # Maximum number of simultaneous instances of the specified sound has been reached.
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_simultaneous_limit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_12 = (__pyx_t_1 != Py_None);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_13 = (__pyx_t_12 != 0);
        if (__pyx_t_13) {
        } else {
          __pyx_t_11 = __pyx_t_13;
          goto __pyx_L13_bool_binop_done;
        }
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_14 = __Pyx_PyInt_As_Uint64(__pyx_t_1); if (unlikely((__pyx_t_14 == ((Uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 504, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_playing_sound_count(__pyx_v_self, __pyx_t_14)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_simultaneous_limit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 504, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 504, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = __pyx_t_13;
        __pyx_L13_bool_binop_done:;
        if (__pyx_t_11) {

          /* "mpfmc/core/audio/track_standard.pyx":508
 *                 # Maximum number of simultaneous instances of the specified sound has been reached.
 *                 # Perform action based on sound stealing method
 *                 if sound.stealing_method == SoundStealingMethod.oldest:             # <<<<<<<<<<<<<<
 *                     oldest_instance = self._get_oldest_playing_sound_instance(sound.id)
 *                     if oldest_instance is not None:
 */
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_stealing_method); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 508, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SoundStealingMethod); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_oldest); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyObject_RichCompare(__pyx_t_10, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L6_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 508, __pyx_L6_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (__pyx_t_11) {

            /* "mpfmc/core/audio/track_standard.pyx":509
 *                 # Perform action based on sound stealing method
 *                 if sound.stealing_method == SoundStealingMethod.oldest:
 *                     oldest_instance = self._get_oldest_playing_sound_instance(sound.id)             # <<<<<<<<<<<<<<
 *                     if oldest_instance is not None:
 *                         sound_instance = SoundInstance(sound, context, settings)
 */
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_oldest_playing_sound_instan); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_id); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 509, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_3 = NULL;
            if (CYTHON_UNPACK_METHODS && 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_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_10);
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_v_oldest_instance = __pyx_t_2;
            __pyx_t_2 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":510
 *                 if sound.stealing_method == SoundStealingMethod.oldest:
 *                     oldest_instance = self._get_oldest_playing_sound_instance(sound.id)
 *                     if oldest_instance is not None:             # <<<<<<<<<<<<<<
 *                         sound_instance = SoundInstance(sound, context, settings)
 *                         self._replace_sound_instance(oldest_instance, sound_instance)
 */
            __pyx_t_11 = (__pyx_v_oldest_instance != Py_None);
            __pyx_t_13 = (__pyx_t_11 != 0);
            if (__pyx_t_13) {

              /* "mpfmc/core/audio/track_standard.pyx":511
 *                     oldest_instance = self._get_oldest_playing_sound_instance(sound.id)
 *                     if oldest_instance is not None:
 *                         sound_instance = SoundInstance(sound, context, settings)             # <<<<<<<<<<<<<<
 *                         self._replace_sound_instance(oldest_instance, sound_instance)
 *                         self.log.debug("Sound %s has reached the maximum number of instances. "
 */
              __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SoundInstance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_10 = NULL;
              __pyx_t_5 = 0;
              if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
                __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
                if (likely(__pyx_t_10)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                  __Pyx_INCREF(__pyx_t_10);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_1, function);
                  __pyx_t_5 = 1;
                }
              }
              #if CYTHON_FAST_PYCALL
              if (PyFunction_Check(__pyx_t_1)) {
                PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_sound, __pyx_v_context, __pyx_v_settings};
                __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_GOTREF(__pyx_t_2);
              } else
              #endif
              #if CYTHON_FAST_PYCCALL
              if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
                PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_sound, __pyx_v_context, __pyx_v_settings};
                __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_GOTREF(__pyx_t_2);
              } else
              #endif
              {
                __pyx_t_3 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_3);
                if (__pyx_t_10) {
                  __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __pyx_t_10 = NULL;
                }
                __Pyx_INCREF(__pyx_v_sound);
                __Pyx_GIVEREF(__pyx_v_sound);
                PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_v_sound);
                __Pyx_INCREF(__pyx_v_context);
                __Pyx_GIVEREF(__pyx_v_context);
                PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_context);
                __Pyx_INCREF(__pyx_v_settings);
                __Pyx_GIVEREF(__pyx_v_settings);
                PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_5, __pyx_v_settings);
                __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L6_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_SET(__pyx_v_sound_instance, __pyx_t_2);
              __pyx_t_2 = 0;

              /* "mpfmc/core/audio/track_standard.pyx":512
 *                     if oldest_instance is not None:
 *                         sound_instance = SoundInstance(sound, context, settings)
 *                         self._replace_sound_instance(oldest_instance, sound_instance)             # <<<<<<<<<<<<<<
 *                         self.log.debug("Sound %s has reached the maximum number of instances. "
 *                                        "Replacing oldest instance", sound.name)
 */
              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_replace_sound_instance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_3 = NULL;
              __pyx_t_5 = 0;
              if (CYTHON_UNPACK_METHODS && 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_5 = 1;
                }
              }
              #if CYTHON_FAST_PYCALL
              if (PyFunction_Check(__pyx_t_1)) {
                PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_oldest_instance, __pyx_v_sound_instance};
                __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_GOTREF(__pyx_t_2);
              } else
              #endif
              #if CYTHON_FAST_PYCCALL
              if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
                PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_oldest_instance, __pyx_v_sound_instance};
                __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_GOTREF(__pyx_t_2);
              } else
              #endif
              {
                __pyx_t_10 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 512, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_10);
                if (__pyx_t_3) {
                  __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
                }
                __Pyx_INCREF(__pyx_v_oldest_instance);
                __Pyx_GIVEREF(__pyx_v_oldest_instance);
                PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_5, __pyx_v_oldest_instance);
                __Pyx_INCREF(__pyx_v_sound_instance);
                __Pyx_GIVEREF(__pyx_v_sound_instance);
                PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_v_sound_instance);
                __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              }
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

              /* "mpfmc/core/audio/track_standard.pyx":513
 *                         sound_instance = SoundInstance(sound, context, settings)
 *                         self._replace_sound_instance(oldest_instance, sound_instance)
 *                         self.log.debug("Sound %s has reached the maximum number of instances. "             # <<<<<<<<<<<<<<
 *                                        "Replacing oldest instance", sound.name)
 *                         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, 513, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);

              /* "mpfmc/core/audio/track_standard.pyx":514
 *                         self._replace_sound_instance(oldest_instance, sound_instance)
 *                         self.log.debug("Sound %s has reached the maximum number of instances. "
 *                                        "Replacing oldest instance", sound.name)             # <<<<<<<<<<<<<<
 *                         return sound_instance
 * 
 */
              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 514, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_3 = NULL;
              __pyx_t_5 = 0;
              if (CYTHON_UNPACK_METHODS && 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_5 = 1;
                }
              }
              #if CYTHON_FAST_PYCALL
              if (PyFunction_Check(__pyx_t_1)) {
                PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_Sound_s_has_reached_the_maximum, __pyx_t_10};
                __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              } else
              #endif
              #if CYTHON_FAST_PYCCALL
              if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
                PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_Sound_s_has_reached_the_maximum, __pyx_t_10};
                __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              } else
              #endif
              {
                __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 513, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_6);
                if (__pyx_t_3) {
                  __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
                }
                __Pyx_INCREF(__pyx_kp_u_Sound_s_has_reached_the_maximum);
                __Pyx_GIVEREF(__pyx_kp_u_Sound_s_has_reached_the_maximum);
                PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_u_Sound_s_has_reached_the_maximum);
                __Pyx_GIVEREF(__pyx_t_10);
                PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_10);
                __pyx_t_10 = 0;
                __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L6_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;

              /* "mpfmc/core/audio/track_standard.pyx":515
 *                         self.log.debug("Sound %s has reached the maximum number of instances. "
 *                                        "Replacing oldest instance", sound.name)
 *                         return sound_instance             # <<<<<<<<<<<<<<
 * 
 *                 elif sound.stealing_method == SoundStealingMethod.newest:
 */
              __Pyx_XDECREF(__pyx_r);
              __Pyx_INCREF(__pyx_v_sound_instance);
              __pyx_r = __pyx_v_sound_instance;
              goto __pyx_L10_try_return;

              /* "mpfmc/core/audio/track_standard.pyx":510
 *                 if sound.stealing_method == SoundStealingMethod.oldest:
 *                     oldest_instance = self._get_oldest_playing_sound_instance(sound.id)
 *                     if oldest_instance is not None:             # <<<<<<<<<<<<<<
 *                         sound_instance = SoundInstance(sound, context, settings)
 *                         self._replace_sound_instance(oldest_instance, sound_instance)
 */
            }

            /* "mpfmc/core/audio/track_standard.pyx":508
 *                 # Maximum number of simultaneous instances of the specified sound has been reached.
 *                 # Perform action based on sound stealing method
 *                 if sound.stealing_method == SoundStealingMethod.oldest:             # <<<<<<<<<<<<<<
 *                     oldest_instance = self._get_oldest_playing_sound_instance(sound.id)
 *                     if oldest_instance is not None:
 */
            goto __pyx_L15;
          }

          /* "mpfmc/core/audio/track_standard.pyx":517
 *                         return sound_instance
 * 
 *                 elif sound.stealing_method == SoundStealingMethod.newest:             # <<<<<<<<<<<<<<
 *                     newest_instance = self._get_newest_playing_sound_instance(sound.id)
 *                     if newest_instance is not None:
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_stealing_method); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SoundStealingMethod); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_newest); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 517, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L6_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 517, __pyx_L6_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_13) {

            /* "mpfmc/core/audio/track_standard.pyx":518
 * 
 *                 elif sound.stealing_method == SoundStealingMethod.newest:
 *                     newest_instance = self._get_newest_playing_sound_instance(sound.id)             # <<<<<<<<<<<<<<
 *                     if newest_instance is not None:
 *                         sound_instance = SoundInstance(sound, context, settings)
 */
            __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_newest_playing_sound_instan); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 518, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_10 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
              __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
              if (likely(__pyx_t_10)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
                __Pyx_INCREF(__pyx_t_10);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_6, function);
              }
            }
            __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2);
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_v_newest_instance = __pyx_t_1;
            __pyx_t_1 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":519
 *                 elif sound.stealing_method == SoundStealingMethod.newest:
 *                     newest_instance = self._get_newest_playing_sound_instance(sound.id)
 *                     if newest_instance is not None:             # <<<<<<<<<<<<<<
 *                         sound_instance = SoundInstance(sound, context, settings)
 *                         self._replace_sound_instance(newest_instance, sound_instance)
 */
            __pyx_t_13 = (__pyx_v_newest_instance != Py_None);
            __pyx_t_11 = (__pyx_t_13 != 0);
            if (__pyx_t_11) {

              /* "mpfmc/core/audio/track_standard.pyx":520
 *                     newest_instance = self._get_newest_playing_sound_instance(sound.id)
 *                     if newest_instance is not None:
 *                         sound_instance = SoundInstance(sound, context, settings)             # <<<<<<<<<<<<<<
 *                         self._replace_sound_instance(newest_instance, sound_instance)
 *                         self.log.debug("Sound %s has reached the maximum number of instances. "
 */
              __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_SoundInstance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 520, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_2 = NULL;
              __pyx_t_5 = 0;
              if (CYTHON_UNPACK_METHODS && 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);
                  __pyx_t_5 = 1;
                }
              }
              #if CYTHON_FAST_PYCALL
              if (PyFunction_Check(__pyx_t_6)) {
                PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_sound, __pyx_v_context, __pyx_v_settings};
                __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_GOTREF(__pyx_t_1);
              } else
              #endif
              #if CYTHON_FAST_PYCCALL
              if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
                PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_sound, __pyx_v_context, __pyx_v_settings};
                __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_GOTREF(__pyx_t_1);
              } else
              #endif
              {
                __pyx_t_10 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 520, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_10);
                if (__pyx_t_2) {
                  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
                }
                __Pyx_INCREF(__pyx_v_sound);
                __Pyx_GIVEREF(__pyx_v_sound);
                PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_5, __pyx_v_sound);
                __Pyx_INCREF(__pyx_v_context);
                __Pyx_GIVEREF(__pyx_v_context);
                PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_v_context);
                __Pyx_INCREF(__pyx_v_settings);
                __Pyx_GIVEREF(__pyx_v_settings);
                PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_5, __pyx_v_settings);
                __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              }
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF_SET(__pyx_v_sound_instance, __pyx_t_1);
              __pyx_t_1 = 0;

              /* "mpfmc/core/audio/track_standard.pyx":521
 *                     if newest_instance is not None:
 *                         sound_instance = SoundInstance(sound, context, settings)
 *                         self._replace_sound_instance(newest_instance, sound_instance)             # <<<<<<<<<<<<<<
 *                         self.log.debug("Sound %s has reached the maximum number of instances. "
 *                                        "Replacing newest instance", sound.name)
 */
              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_replace_sound_instance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 521, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_10 = NULL;
              __pyx_t_5 = 0;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
                __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
                if (likely(__pyx_t_10)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
                  __Pyx_INCREF(__pyx_t_10);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_6, function);
                  __pyx_t_5 = 1;
                }
              }
              #if CYTHON_FAST_PYCALL
              if (PyFunction_Check(__pyx_t_6)) {
                PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_newest_instance, __pyx_v_sound_instance};
                __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_GOTREF(__pyx_t_1);
              } else
              #endif
              #if CYTHON_FAST_PYCCALL
              if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
                PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_newest_instance, __pyx_v_sound_instance};
                __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_GOTREF(__pyx_t_1);
              } else
              #endif
              {
                __pyx_t_2 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_2);
                if (__pyx_t_10) {
                  __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __pyx_t_10 = NULL;
                }
                __Pyx_INCREF(__pyx_v_newest_instance);
                __Pyx_GIVEREF(__pyx_v_newest_instance);
                PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_5, __pyx_v_newest_instance);
                __Pyx_INCREF(__pyx_v_sound_instance);
                __Pyx_GIVEREF(__pyx_v_sound_instance);
                PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_5, __pyx_v_sound_instance);
                __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              }
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

              /* "mpfmc/core/audio/track_standard.pyx":522
 *                         sound_instance = SoundInstance(sound, context, settings)
 *                         self._replace_sound_instance(newest_instance, sound_instance)
 *                         self.log.debug("Sound %s has reached the maximum number of instances. "             # <<<<<<<<<<<<<<
 *                                        "Replacing newest instance", sound.name)
 *                         return sound_instance
 */
              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 522, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_6);

              /* "mpfmc/core/audio/track_standard.pyx":523
 *                         self._replace_sound_instance(newest_instance, sound_instance)
 *                         self.log.debug("Sound %s has reached the maximum number of instances. "
 *                                        "Replacing newest instance", sound.name)             # <<<<<<<<<<<<<<
 *                         return sound_instance
 * 
 */
              __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_10 = NULL;
              __pyx_t_5 = 0;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
                __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
                if (likely(__pyx_t_10)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
                  __Pyx_INCREF(__pyx_t_10);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_6, function);
                  __pyx_t_5 = 1;
                }
              }
              #if CYTHON_FAST_PYCALL
              if (PyFunction_Check(__pyx_t_6)) {
                PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_kp_u_Sound_s_has_reached_the_maximum_2, __pyx_t_2};
                __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              } else
              #endif
              #if CYTHON_FAST_PYCCALL
              if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
                PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_kp_u_Sound_s_has_reached_the_maximum_2, __pyx_t_2};
                __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              } else
              #endif
              {
                __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 522, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_3);
                if (__pyx_t_10) {
                  __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __pyx_t_10 = NULL;
                }
                __Pyx_INCREF(__pyx_kp_u_Sound_s_has_reached_the_maximum_2);
                __Pyx_GIVEREF(__pyx_kp_u_Sound_s_has_reached_the_maximum_2);
                PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_kp_u_Sound_s_has_reached_the_maximum_2);
                __Pyx_GIVEREF(__pyx_t_2);
                PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_t_2);
                __pyx_t_2 = 0;
                __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              }
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

              /* "mpfmc/core/audio/track_standard.pyx":524
 *                         self.log.debug("Sound %s has reached the maximum number of instances. "
 *                                        "Replacing newest instance", sound.name)
 *                         return sound_instance             # <<<<<<<<<<<<<<
 * 
 *                 else:
 */
              __Pyx_XDECREF(__pyx_r);
              __Pyx_INCREF(__pyx_v_sound_instance);
              __pyx_r = __pyx_v_sound_instance;
              goto __pyx_L10_try_return;

              /* "mpfmc/core/audio/track_standard.pyx":519
 *                 elif sound.stealing_method == SoundStealingMethod.newest:
 *                     newest_instance = self._get_newest_playing_sound_instance(sound.id)
 *                     if newest_instance is not None:             # <<<<<<<<<<<<<<
 *                         sound_instance = SoundInstance(sound, context, settings)
 *                         self._replace_sound_instance(newest_instance, sound_instance)
 */
            }

            /* "mpfmc/core/audio/track_standard.pyx":517
 *                         return sound_instance
 * 
 *                 elif sound.stealing_method == SoundStealingMethod.newest:             # <<<<<<<<<<<<<<
 *                     newest_instance = self._get_newest_playing_sound_instance(sound.id)
 *                     if newest_instance is not None:
 */
            goto __pyx_L15;
          }

          /* "mpfmc/core/audio/track_standard.pyx":528
 *                 else:
 *                     # New instance will not be played; it will be skipped
 *                     self.log.debug("Sound %s has reached the maximum number of instances. "             # <<<<<<<<<<<<<<
 *                                    "Sound will be skipped", sound.name)
 *                     return None
 */
          /*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, 528, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);

            /* "mpfmc/core/audio/track_standard.pyx":529
 *                     # New instance will not be played; it will be skipped
 *                     self.log.debug("Sound %s has reached the maximum number of instances. "
 *                                    "Sound will be skipped", sound.name)             # <<<<<<<<<<<<<<
 *                     return None
 *             else:
 */
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_2 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && likely(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);
                __pyx_t_5 = 1;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_u_Sound_s_has_reached_the_maximum_3, __pyx_t_3};
              __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L6_error)
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_u_Sound_s_has_reached_the_maximum_3, __pyx_t_3};
              __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L6_error)
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            {
              __pyx_t_10 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 528, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_10);
              if (__pyx_t_2) {
                __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
              }
              __Pyx_INCREF(__pyx_kp_u_Sound_s_has_reached_the_maximum_3);
              __Pyx_GIVEREF(__pyx_kp_u_Sound_s_has_reached_the_maximum_3);
              PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_5, __pyx_kp_u_Sound_s_has_reached_the_maximum_3);
              __Pyx_GIVEREF(__pyx_t_3);
              PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_t_3);
              __pyx_t_3 = 0;
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":530
 *                     self.log.debug("Sound %s has reached the maximum number of instances. "
 *                                    "Sound will be skipped", sound.name)
 *                     return None             # <<<<<<<<<<<<<<
 *             else:
 *                 sound_instance = SoundInstance(sound, context, settings)
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L10_try_return;
          }
          __pyx_L15:;

          /* "mpfmc/core/audio/track_standard.pyx":504
 *             # Check if sound can be played based on if the maximum number of playing instances of
 *             # this sound has been reached or not.
 *             if sound.simultaneous_limit is not None and self._get_playing_sound_count(sound.id) >= sound.simultaneous_limit:             # <<<<<<<<<<<<<<
 * 
 *                 # Maximum number of simultaneous instances of the specified sound has been reached.
 */
          goto __pyx_L12;
        }

        /* "mpfmc/core/audio/track_standard.pyx":532
 *                     return None
 *             else:
 *                 sound_instance = SoundInstance(sound, context, settings)             # <<<<<<<<<<<<<<
 * 
 *             if sound_instance.max_queue_time is None:
 */
        /*else*/ {
          __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_SoundInstance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 532, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_10 = NULL;
          __pyx_t_5 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_10)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
              __pyx_t_5 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_sound, __pyx_v_context, __pyx_v_settings};
            __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L6_error)
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_GOTREF(__pyx_t_1);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_sound, __pyx_v_context, __pyx_v_settings};
            __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L6_error)
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_GOTREF(__pyx_t_1);
          } else
          #endif
          {
            __pyx_t_3 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_3);
            if (__pyx_t_10) {
              __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __pyx_t_10 = NULL;
            }
            __Pyx_INCREF(__pyx_v_sound);
            __Pyx_GIVEREF(__pyx_v_sound);
            PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_v_sound);
            __Pyx_INCREF(__pyx_v_context);
            __Pyx_GIVEREF(__pyx_v_context);
            PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_context);
            __Pyx_INCREF(__pyx_v_settings);
            __Pyx_GIVEREF(__pyx_v_settings);
            PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_5, __pyx_v_settings);
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF_SET(__pyx_v_sound_instance, __pyx_t_1);
          __pyx_t_1 = 0;
        }
        __pyx_L12:;

        /* "mpfmc/core/audio/track_standard.pyx":534
 *                 sound_instance = SoundInstance(sound, context, settings)
 * 
 *             if sound_instance.max_queue_time is None:             # <<<<<<<<<<<<<<
 *                 sound_instance.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, 534, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_11 = (__pyx_t_1 == Py_None);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_13 = (__pyx_t_11 != 0);
        if (__pyx_t_13) {

          /* "mpfmc/core/audio/track_standard.pyx":535
 * 
 *             if sound_instance.max_queue_time is None:
 *                 sound_instance.exp_time = None             # <<<<<<<<<<<<<<
 *             else:
 *                 sound_instance.exp_time = time.time() + sound_instance.max_queue_time
 */
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_sound_instance, __pyx_n_s_exp_time, Py_None) < 0) __PYX_ERR(0, 535, __pyx_L6_error)

          /* "mpfmc/core/audio/track_standard.pyx":534
 *                 sound_instance = SoundInstance(sound, context, settings)
 * 
 *             if sound_instance.max_queue_time is None:             # <<<<<<<<<<<<<<
 *                 sound_instance.exp_time = None
 *             else:
 */
          goto __pyx_L18;
        }

        /* "mpfmc/core/audio/track_standard.pyx":537
 *                 sound_instance.exp_time = None
 *             else:
 *                 sound_instance.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_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 537, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_max_queue_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 537, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_sound_instance, __pyx_n_s_exp_time, __pyx_t_6) < 0) __PYX_ERR(0, 537, __pyx_L6_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __pyx_L18:;

        /* "mpfmc/core/audio/track_standard.pyx":541
 *             # 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_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 541, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_loaded); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 541, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 541, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_11 = ((!__pyx_t_13) != 0);
        if (__pyx_t_11) {

          /* "mpfmc/core/audio/track_standard.pyx":543
 *             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_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_loading); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 543, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 543, __pyx_L6_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_13 = ((!__pyx_t_11) != 0);
          if (__pyx_t_13) {

            /* "mpfmc/core/audio/track_standard.pyx":544
 *                 # 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_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_3 = NULL;
            if (CYTHON_UNPACK_METHODS && 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_6 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 544, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":543
 *             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()
 * 
 */
          }

          /* "mpfmc/core/audio/track_standard.pyx":546
 *                     sound_instance.sound.load()
 * 
 *                 if sound_instance.max_queue_time != 0:             # <<<<<<<<<<<<<<
 *                     self._queue_sound(sound_instance)
 *                     self.log.debug("play_sound - Sound %s was not loaded and therefore has been "
 */
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_max_queue_time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 546, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_t_6, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 546, __pyx_L6_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_13) {

            /* "mpfmc/core/audio/track_standard.pyx":547
 * 
 *                 if sound_instance.max_queue_time != 0:
 *                     self._queue_sound(sound_instance)             # <<<<<<<<<<<<<<
 *                     self.log.debug("play_sound - Sound %s was not loaded and therefore has been "
 *                                    "queued for playback.", sound_instance.name)
 */
            __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_queue_sound); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 547, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_3 = NULL;
            if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_sound_instance);
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":548
 *                 if sound_instance.max_queue_time != 0:
 *                     self._queue_sound(sound_instance)
 *                     self.log.debug("play_sound - Sound %s was not loaded and therefore has been "             # <<<<<<<<<<<<<<
 *                                    "queued for playback.", sound_instance.name)
 *                 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, 548, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);

            /* "mpfmc/core/audio/track_standard.pyx":549
 *                     self._queue_sound(sound_instance)
 *                     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_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 549, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_10 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
              __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
              if (likely(__pyx_t_10)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
                __Pyx_INCREF(__pyx_t_10);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_6, function);
                __pyx_t_5 = 1;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_kp_u_play_sound_Sound_s_was_not_loade, __pyx_t_3};
              __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L6_error)
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_kp_u_play_sound_Sound_s_was_not_loade, __pyx_t_3};
              __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L6_error)
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            {
              __pyx_t_2 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_2);
              if (__pyx_t_10) {
                __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __pyx_t_10 = 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_2, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_s_was_not_loade);
              __Pyx_GIVEREF(__pyx_t_3);
              PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_5, __pyx_t_3);
              __pyx_t_3 = 0;
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            }
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":546
 *                     sound_instance.sound.load()
 * 
 *                 if sound_instance.max_queue_time != 0:             # <<<<<<<<<<<<<<
 *                     self._queue_sound(sound_instance)
 *                     self.log.debug("play_sound - Sound %s was not loaded and therefore has been "
 */
            goto __pyx_L21;
          }

          /* "mpfmc/core/audio/track_standard.pyx":551
 *                                    "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_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 551, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);

            /* "mpfmc/core/audio/track_standard.pyx":552
 *                 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()
 *                     return None
 */
            __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_3 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && 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;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_play_sound_Sound_s_was_not_loade_2, __pyx_t_2};
              __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L6_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_play_sound_Sound_s_was_not_loade_2, __pyx_t_2};
              __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L6_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            } else
            #endif
            {
              __pyx_t_10 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 551, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_10);
              if (__pyx_t_3) {
                __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = 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_10, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_s_was_not_loade_2);
              __Pyx_GIVEREF(__pyx_t_2);
              PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_t_2);
              __pyx_t_2 = 0;
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":553
 *                     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()             # <<<<<<<<<<<<<<
 *                     return None
 * 
 */
            __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_expired); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 553, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_10 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
              __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
              if (likely(__pyx_t_10)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
                __Pyx_INCREF(__pyx_t_10);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_6, function);
              }
            }
            __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":554
 *                                    "therefore it has been discarded and will not be played.", sound_instance.name)
 *                     sound_instance.set_expired()
 *                     return None             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L10_try_return;
          }
          __pyx_L21:;

          /* "mpfmc/core/audio/track_standard.pyx":541
 *             # 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_L19;
        }

        /* "mpfmc/core/audio/track_standard.pyx":560
 *                 # 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_1 = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_sound_player_with_lowest_priority(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_v_sound_player = ((PyObject*)__pyx_t_1);
          __pyx_t_1 = 0;

          /* "mpfmc/core/audio/track_standard.pyx":561
 *                 # 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, 561, __pyx_L6_error)
          }
          __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_sound_player, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_v_player = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "mpfmc/core/audio/track_standard.pyx":562
 *                 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, 562, __pyx_L6_error)
          }
          __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_sound_player, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_v_lowest_priority = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "mpfmc/core/audio/track_standard.pyx":564
 *                 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_13 = (__pyx_v_lowest_priority == Py_None);
          __pyx_t_11 = (__pyx_t_13 != 0);
          if (__pyx_t_11) {

            /* "mpfmc/core/audio/track_standard.pyx":565
 * 
 *                 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_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);

            /* "mpfmc/core/audio/track_standard.pyx":566
 *                 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_10 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
              __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
              if (likely(__pyx_t_10)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
                __Pyx_INCREF(__pyx_t_10);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_6, function);
                __pyx_t_5 = 1;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_kp_u_play_sound_Sound_player_d_is_ava, __pyx_v_player};
              __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L6_error)
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_GOTREF(__pyx_t_1);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_kp_u_play_sound_Sound_player_d_is_ava, __pyx_v_player};
              __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L6_error)
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_GOTREF(__pyx_t_1);
            } else
            #endif
            {
              __pyx_t_2 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_2);
              if (__pyx_t_10) {
                __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __pyx_t_10 = 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_2, 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_2, 1+__pyx_t_5, __pyx_v_player);
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            }
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":568
 *                                    "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_5 = __Pyx_PyInt_As_int(__pyx_v_player); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 568, __pyx_L6_error)
            (void)(((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_play_sound_on_sound_player(__pyx_v_self, __pyx_v_sound_instance, __pyx_t_5, NULL));

            /* "mpfmc/core/audio/track_standard.pyx":564
 *                 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_L22;
          }

          /* "mpfmc/core/audio/track_standard.pyx":571
 *                 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, 571, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_2 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(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);
              }
            }
            __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_2, __pyx_kp_u_play_sound_No_idle_sound_player) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_play_sound_No_idle_sound_player);
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":572
 *                     # 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, 572, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);

            /* "mpfmc/core/audio/track_standard.pyx":573
 *                     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_2 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && likely(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);
                __pyx_t_5 = 1;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_kp_u_play_sound_Sound_player_d_is_cur, __pyx_v_player, __pyx_v_lowest_priority};
              __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L6_error)
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_GOTREF(__pyx_t_1);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_kp_u_play_sound_Sound_player_d_is_cur, __pyx_v_player, __pyx_v_lowest_priority};
              __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L6_error)
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_GOTREF(__pyx_t_1);
            } else
            #endif
            {
              __pyx_t_10 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 572, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_10);
              if (__pyx_t_2) {
                __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = 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_10, 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_10, 1+__pyx_t_5, __pyx_v_player);
              __Pyx_INCREF(__pyx_v_lowest_priority);
              __Pyx_GIVEREF(__pyx_v_lowest_priority);
              PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_5, __pyx_v_lowest_priority);
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "mpfmc/core/audio/track_standard.pyx":577
 *                     # 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_v_lowest_priority, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 577, __pyx_L6_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 577, __pyx_L6_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (__pyx_t_11) {

              /* "mpfmc/core/audio/track_standard.pyx":578
 *                     # 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);

              /* "mpfmc/core/audio/track_standard.pyx":580
 *                         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_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 580, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_2 = NULL;
              __pyx_t_5 = 0;
              if (CYTHON_UNPACK_METHODS && 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);
                  __pyx_t_5 = 1;
                }
              }
              #if CYTHON_FAST_PYCALL
              if (PyFunction_Check(__pyx_t_1)) {
                PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_kp_u_play_sound_Sound_priority_d_is_h, __pyx_t_10, __pyx_v_lowest_priority, __pyx_v_player};
                __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 578, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_GOTREF(__pyx_t_6);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              } else
              #endif
              #if CYTHON_FAST_PYCCALL
              if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
                PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_kp_u_play_sound_Sound_priority_d_is_h, __pyx_t_10, __pyx_v_lowest_priority, __pyx_v_player};
                __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 578, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_GOTREF(__pyx_t_6);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              } else
              #endif
              {
                __pyx_t_3 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_3);
                if (__pyx_t_2) {
                  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = 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_3, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_priority_d_is_h);
                __Pyx_GIVEREF(__pyx_t_10);
                PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_t_10);
                __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_INCREF(__pyx_v_player);
                __Pyx_GIVEREF(__pyx_v_player);
                PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_5, __pyx_v_player);
                __pyx_t_10 = 0;
                __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 578, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_6);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              }
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

              /* "mpfmc/core/audio/track_standard.pyx":582
 *                                        "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_5 = __Pyx_PyInt_As_int(__pyx_v_player); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 582, __pyx_L6_error)

              /* "mpfmc/core/audio/track_standard.pyx":581
 *                                        "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_15.__pyx_n = 1;
              __pyx_t_15.force = 1;
              ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_play_sound_on_sound_player(__pyx_v_self, __pyx_v_sound_instance, __pyx_t_5, &__pyx_t_15); 

              /* "mpfmc/core/audio/track_standard.pyx":577
 *                     # 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_L23;
            }

            /* "mpfmc/core/audio/track_standard.pyx":585
 *                                                          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, 585, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 585, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 585, __pyx_L6_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (__pyx_t_11) {

              /* "mpfmc/core/audio/track_standard.pyx":587
 *                     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, 587, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_6);

              /* "mpfmc/core/audio/track_standard.pyx":591
 *                                        "immediately and has now expired (max_queue_time = 0) and will "
 *                                        "not be played.",
 *                                        sound_instance.priority, lowest_priority)             # <<<<<<<<<<<<<<
 *                         sound_instance.set_expired()
 *                         return None
 */
              __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_10 = NULL;
              __pyx_t_5 = 0;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
                __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
                if (likely(__pyx_t_10)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
                  __Pyx_INCREF(__pyx_t_10);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_6, function);
                  __pyx_t_5 = 1;
                }
              }
              #if CYTHON_FAST_PYCALL
              if (PyFunction_Check(__pyx_t_6)) {
                PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_kp_u_play_sound_Sound_priority_d_is_l, __pyx_t_3, __pyx_v_lowest_priority};
                __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              } else
              #endif
              #if CYTHON_FAST_PYCCALL
              if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
                PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_kp_u_play_sound_Sound_priority_d_is_l, __pyx_t_3, __pyx_v_lowest_priority};
                __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              } else
              #endif
              {
                __pyx_t_2 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_2);
                if (__pyx_t_10) {
                  __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __pyx_t_10 = 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_2, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_priority_d_is_l);
                __Pyx_GIVEREF(__pyx_t_3);
                PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_5, __pyx_t_3);
                __Pyx_INCREF(__pyx_v_lowest_priority);
                __Pyx_GIVEREF(__pyx_v_lowest_priority);
                PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_5, __pyx_v_lowest_priority);
                __pyx_t_3 = 0;
                __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              }
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

              /* "mpfmc/core/audio/track_standard.pyx":592
 *                                        "not be played.",
 *                                        sound_instance.priority, lowest_priority)
 *                         sound_instance.set_expired()             # <<<<<<<<<<<<<<
 *                         return None
 * 
 */
              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_expired); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 592, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_2 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(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);
                }
              }
              __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

              /* "mpfmc/core/audio/track_standard.pyx":593
 *                                        sound_instance.priority, lowest_priority)
 *                         sound_instance.set_expired()
 *                         return None             # <<<<<<<<<<<<<<
 * 
 *                     else:
 */
              __Pyx_XDECREF(__pyx_r);
              __pyx_r = Py_None; __Pyx_INCREF(Py_None);
              goto __pyx_L10_try_return;

              /* "mpfmc/core/audio/track_standard.pyx":585
 *                                                          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 "
 */
            }

            /* "mpfmc/core/audio/track_standard.pyx":597
 *                     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, 597, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_6);

              /* "mpfmc/core/audio/track_standard.pyx":599
 *                         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)
 * 
 */
              __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 599, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_3 = NULL;
              __pyx_t_5 = 0;
              if (CYTHON_UNPACK_METHODS && 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;
                }
              }
              #if CYTHON_FAST_PYCALL
              if (PyFunction_Check(__pyx_t_6)) {
                PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_u_play_sound_Sound_priority_d_is_l_2, __pyx_t_2, __pyx_v_lowest_priority};
                __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              } else
              #endif
              #if CYTHON_FAST_PYCCALL
              if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
                PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_u_play_sound_Sound_priority_d_is_l_2, __pyx_t_2, __pyx_v_lowest_priority};
                __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L6_error)
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              } else
              #endif
              {
                __pyx_t_10 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 597, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_10);
                if (__pyx_t_3) {
                  __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = 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_10, 0+__pyx_t_5, __pyx_kp_u_play_sound_Sound_priority_d_is_l_2);
                __Pyx_GIVEREF(__pyx_t_2);
                PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_t_2);
                __Pyx_INCREF(__pyx_v_lowest_priority);
                __Pyx_GIVEREF(__pyx_v_lowest_priority);
                PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_5, __pyx_v_lowest_priority);
                __pyx_t_2 = 0;
                __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L6_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              }
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

              /* "mpfmc/core/audio/track_standard.pyx":600
 *                                        "lowest sound currently playing (%d). Sound will be queued "
 *                                        "for playback.", sound_instance.priority, lowest_priority)
 *                         self._queue_sound(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         except Exception as ex:
 */
              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_queue_sound); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 600, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_10 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
                __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
                if (likely(__pyx_t_10)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
                  __Pyx_INCREF(__pyx_t_10);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_6, function);
                }
              }
              __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_sound_instance);
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            }
            __pyx_L23:;
          }
          __pyx_L22:;
        }
        __pyx_L19:;

        /* "mpfmc/core/audio/track_standard.pyx":491
 *         # before the function returns (since there are so many return branches it is easier
 *         # to use than placing the SDL_UnlockAudio call before every return).
 *         try:             # <<<<<<<<<<<<<<
 * 
 *             # Sound cannot be played if the track is stopped or paused
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":611
 *         else:
 *             # No exception occurred, return the newly created sound instance that will be played
 *             return sound_instance             # <<<<<<<<<<<<<<
 * 
 *         finally:
 */
      /*else:*/ {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_sound_instance);
        __pyx_r = __pyx_v_sound_instance;
        goto __pyx_L9_except_return;
      }
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __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;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":602
 *                         self._queue_sound(sound_instance)
 * 
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             # An exception occurred, sound could not be played
 *             self.log.error("Track %s: play_sound encountered an unexpected exception while "
 */
      __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_5) {
        __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.play_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_10) < 0) __PYX_ERR(0, 602, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_6);
        __pyx_v_ex = __pyx_t_6;
        /*try:*/ {

          /* "mpfmc/core/audio/track_standard.pyx":604
 *         except Exception as ex:
 *             # An exception occurred, sound could not be played
 *             self.log.error("Track %s: play_sound encountered an unexpected exception while "             # <<<<<<<<<<<<<<
 *                            "attempting to play the %s sound: %s", self.name, sound.name, ex)
 *             raise AudioException("Track {} play_sound encountered an unexpected exception while "
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 604, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_3);

          /* "mpfmc/core/audio/track_standard.pyx":605
 *             # An exception occurred, sound could not be played
 *             self.log.error("Track %s: play_sound encountered an unexpected exception while "
 *                            "attempting to play the %s sound: %s", self.name, sound.name, ex)             # <<<<<<<<<<<<<<
 *             raise AudioException("Track {} play_sound encountered an unexpected exception while "
 *                                  "attempting to play the {} sound.".format(self.name, sound.name)) from ex
 */
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 605, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_name); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 605, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_17 = NULL;
          __pyx_t_5 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_17)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_17);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
              __pyx_t_5 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_3)) {
            PyObject *__pyx_temp[5] = {__pyx_t_17, __pyx_kp_u_Track_s_play_sound_encountered_a, __pyx_t_4, __pyx_t_16, __pyx_v_ex};
            __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __pyx_L29_error)
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
            PyObject *__pyx_temp[5] = {__pyx_t_17, __pyx_kp_u_Track_s_play_sound_encountered_a, __pyx_t_4, __pyx_t_16, __pyx_v_ex};
            __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __pyx_L29_error)
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          } else
          #endif
          {
            __pyx_t_18 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 604, __pyx_L29_error)
            __Pyx_GOTREF(__pyx_t_18);
            if (__pyx_t_17) {
              __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); __pyx_t_17 = NULL;
            }
            __Pyx_INCREF(__pyx_kp_u_Track_s_play_sound_encountered_a);
            __Pyx_GIVEREF(__pyx_kp_u_Track_s_play_sound_encountered_a);
            PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_5, __pyx_kp_u_Track_s_play_sound_encountered_a);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_5, __pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_16);
            PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_5, __pyx_t_16);
            __Pyx_INCREF(__pyx_v_ex);
            __Pyx_GIVEREF(__pyx_v_ex);
            PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_5, __pyx_v_ex);
            __pyx_t_4 = 0;
            __pyx_t_16 = 0;
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __pyx_L29_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "mpfmc/core/audio/track_standard.pyx":606
 *             self.log.error("Track %s: play_sound encountered an unexpected exception while "
 *                            "attempting to play the %s sound: %s", self.name, sound.name, ex)
 *             raise AudioException("Track {} play_sound encountered an unexpected exception while "             # <<<<<<<<<<<<<<
 *                                  "attempting to play the {} sound.".format(self.name, sound.name)) from ex
 * 
 */
          __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_AudioException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 606, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_3);

          /* "mpfmc/core/audio/track_standard.pyx":607
 *                            "attempting to play the %s sound: %s", self.name, sound.name, ex)
 *             raise AudioException("Track {} play_sound encountered an unexpected exception while "
 *                                  "attempting to play the {} sound.".format(self.name, sound.name)) from ex             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Track_play_sound_encountered_an, __pyx_n_s_format); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 607, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_name); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 607, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_19 = NULL;
          __pyx_t_5 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
            __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_16);
            if (likely(__pyx_t_19)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
              __Pyx_INCREF(__pyx_t_19);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_16, function);
              __pyx_t_5 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_16)) {
            PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_4, __pyx_t_17};
            __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 607, __pyx_L29_error)
            __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
            __Pyx_GOTREF(__pyx_t_18);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
            PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_4, __pyx_t_17};
            __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 607, __pyx_L29_error)
            __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
            __Pyx_GOTREF(__pyx_t_18);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          } else
          #endif
          {
            __pyx_t_20 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 607, __pyx_L29_error)
            __Pyx_GOTREF(__pyx_t_20);
            if (__pyx_t_19) {
              __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL;
            }
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_5, __pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_17);
            PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_5, __pyx_t_17);
            __pyx_t_4 = 0;
            __pyx_t_17 = 0;
            __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_20, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 607, __pyx_L29_error)
            __Pyx_GOTREF(__pyx_t_18);
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          }
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __pyx_t_16 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_16)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_16);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          __pyx_t_2 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_16, __pyx_t_18) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_18);
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_Raise(__pyx_t_2, 0, 0, __pyx_v_ex);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(0, 606, __pyx_L29_error)
        }

        /* "mpfmc/core/audio/track_standard.pyx":602
 *                         self._queue_sound(sound_instance)
 * 
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             # An exception occurred, sound could not be played
 *             self.log.error("Track %s: play_sound encountered an unexpected exception while "
 */
        /*finally:*/ {
          __pyx_L29_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0;
            __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
            __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_26, &__pyx_t_27, &__pyx_t_28);
            if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25) < 0)) __Pyx_ErrFetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
            __Pyx_XGOTREF(__pyx_t_23);
            __Pyx_XGOTREF(__pyx_t_24);
            __Pyx_XGOTREF(__pyx_t_25);
            __Pyx_XGOTREF(__pyx_t_26);
            __Pyx_XGOTREF(__pyx_t_27);
            __Pyx_XGOTREF(__pyx_t_28);
            __pyx_t_5 = __pyx_lineno; __pyx_t_21 = __pyx_clineno; __pyx_t_22 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_ex);
              __pyx_v_ex = NULL;
            }
            if (PY_MAJOR_VERSION >= 3) {
              __Pyx_XGIVEREF(__pyx_t_26);
              __Pyx_XGIVEREF(__pyx_t_27);
              __Pyx_XGIVEREF(__pyx_t_28);
              __Pyx_ExceptionReset(__pyx_t_26, __pyx_t_27, __pyx_t_28);
            }
            __Pyx_XGIVEREF(__pyx_t_23);
            __Pyx_XGIVEREF(__pyx_t_24);
            __Pyx_XGIVEREF(__pyx_t_25);
            __Pyx_ErrRestore(__pyx_t_23, __pyx_t_24, __pyx_t_25);
            __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0;
            __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_21; __pyx_filename = __pyx_t_22;
            goto __pyx_L8_except_error;
          }
        }
      }
      goto __pyx_L8_except_error;
      __pyx_L8_except_error:;

      /* "mpfmc/core/audio/track_standard.pyx":491
 *         # before the function returns (since there are so many return branches it is easier
 *         # to use than placing the SDL_UnlockAudio call before every return).
 *         try:             # <<<<<<<<<<<<<<
 * 
 *             # Sound cannot be played if the track is stopped or paused
 */
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L4_error;
      __pyx_L10_try_return:;
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L3_return;
      __pyx_L9_except_return:;
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L3_return;
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":615
 *         finally:
 *             # Always unlock the audio mutex before returning
 *             SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     def _replace_sound_instance(self, old_instance not None, sound_instance not None):
 */
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_28 = 0; __pyx_t_27 = 0; __pyx_t_26 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_28, &__pyx_t_27, &__pyx_t_26);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_28);
      __Pyx_XGOTREF(__pyx_t_27);
      __Pyx_XGOTREF(__pyx_t_26);
      __pyx_t_21 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_29 = __pyx_filename;
      {
        SDL_UnlockAudio();
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_28);
        __Pyx_XGIVEREF(__pyx_t_27);
        __Pyx_XGIVEREF(__pyx_t_26);
        __Pyx_ExceptionReset(__pyx_t_28, __pyx_t_27, __pyx_t_26);
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_28 = 0; __pyx_t_27 = 0; __pyx_t_26 = 0;
      __pyx_lineno = __pyx_t_21; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_29;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_26 = __pyx_r;
      __pyx_r = 0;
      SDL_UnlockAudio();
      __pyx_r = __pyx_t_26;
      __pyx_t_26 = 0;
      goto __pyx_L0;
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":473
 *         return newest_instance
 * 
 *     def play_sound(self, sound not None, context=None, settings=None):             # <<<<<<<<<<<<<<
 *         """
 *         Plays a sound on the current track.
 */

  /* 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_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.play_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sound_instance);
  __Pyx_XDECREF(__pyx_v_oldest_instance);
  __Pyx_XDECREF(__pyx_v_newest_instance);
  __Pyx_XDECREF(__pyx_v_sound_player);
  __Pyx_XDECREF(__pyx_v_player);
  __Pyx_XDECREF(__pyx_v_lowest_priority);
  __Pyx_XDECREF(__pyx_v_ex);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":617
 *             SDL_UnlockAudio()
 * 
 *     def _replace_sound_instance(self, old_instance not None, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Replace a currently playing instance with another sound instance.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_27_replace_sound_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_26_replace_sound_instance[] = "TrackStandard._replace_sound_instance(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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_27_replace_sound_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_old_instance = 0;
  PyObject *__pyx_v_sound_instance = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_replace_sound_instance (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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_old_instance)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sound_instance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_replace_sound_instance", 1, 2, 2, 1); __PYX_ERR(0, 617, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_replace_sound_instance") < 0)) __PYX_ERR(0, 617, __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_instance", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 617, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._replace_sound_instance", __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, 617, __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, 617, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_26_replace_sound_instance(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_26_replace_sound_instance(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  struct __pyx_opt_args_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_replace_sound_instance", 0);

  /* "mpfmc/core/audio/track_standard.pyx":625
 *         """
 * 
 *         self.log.debug("replace_sound_instance - Preparing to replace existing sound with a new sound instance")             # <<<<<<<<<<<<<<
 * 
 *         # Find which player is currently playing the specified sound instance to replace
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_replace_sound_instance_Preparing) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_replace_sound_instance_Preparing);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __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;

  /* "mpfmc/core/audio/track_standard.pyx":628
 * 
 *         # Find which player is currently playing the specified sound instance to replace
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 *         player = self._get_player_playing_sound_instance(old_instance)
 * 
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":629
 *         # Find which player is currently playing the specified sound instance to replace
 *         SDL_LockAudio()
 *         player = self._get_player_playing_sound_instance(old_instance)             # <<<<<<<<<<<<<<
 * 
 *         if player >= 0:
 */
  __pyx_v_player = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_player_playing_sound_instance(__pyx_v_self, __pyx_v_old_instance);

  /* "mpfmc/core/audio/track_standard.pyx":631
 *         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_4 = ((__pyx_v_player >= 0) != 0);
  if (__pyx_t_4) {

    /* "mpfmc/core/audio/track_standard.pyx":632
 * 
 *         if player >= 0:
 *             self._play_sound_on_sound_player(sound_instance, player, force=True)             # <<<<<<<<<<<<<<
 *         else:
 *             self.log.debug("replace_sound_instance - Could not locate specified sound instance to replace")
 */
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.force = 1;
    ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_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_5); 

    /* "mpfmc/core/audio/track_standard.pyx":631
 *         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;
  }

  /* "mpfmc/core/audio/track_standard.pyx":634
 *             self._play_sound_on_sound_player(sound_instance, player, force=True)
 *         else:
 *             self.log.debug("replace_sound_instance - 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, 634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_replace_sound_instance_Could_not) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_replace_sound_instance_Could_not);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __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;

    /* "mpfmc/core/audio/track_standard.pyx":635
 *         else:
 *             self.log.debug("replace_sound_instance - Could not locate specified sound instance to replace")
 *             sound_instance.set_canceled()             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_canceled); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __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:;

  /* "mpfmc/core/audio/track_standard.pyx":637
 *             sound_instance.set_canceled()
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     def _queue_sound(self, sound_instance not None):
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":617
 *             SDL_UnlockAudio()
 * 
 *     def _replace_sound_instance(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_3);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._replace_sound_instance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":639
 *         SDL_UnlockAudio()
 * 
 *     def _queue_sound(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """Adds a sound to the queue to be played when a sound player becomes available.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_29_queue_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_28_queue_sound[] = "TrackStandard._queue_sound(self, sound_instance)\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\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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_29_queue_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_queue_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, 639, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_28_queue_sound(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_28_queue_sound(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__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;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_queue_sound", 0);

  /* "mpfmc/core/audio/track_standard.pyx":649
 *         first.
 *         """
 *         heappush(self._sound_queue, sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         # Notify sound instance it has been queued
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_heappush); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_self->_sound_queue, __pyx_v_sound_instance};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 649, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_self->_sound_queue, __pyx_v_sound_instance};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 649, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 649, __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_v_self->_sound_queue);
    __Pyx_GIVEREF(__pyx_v_self->_sound_queue);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self->_sound_queue);
    __Pyx_INCREF(__pyx_v_sound_instance);
    __Pyx_GIVEREF(__pyx_v_sound_instance);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_sound_instance);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 649, __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;

  /* "mpfmc/core/audio/track_standard.pyx":652
 * 
 *         # Notify sound instance it has been queued
 *         sound_instance.set_queued()             # <<<<<<<<<<<<<<
 *         self.log.debug("Queueing sound %s", sound_instance)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_queued); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 652, __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;

  /* "mpfmc/core/audio/track_standard.pyx":653
 *         # Notify sound instance it has been queued
 *         sound_instance.set_queued()
 *         self.log.debug("Queueing sound %s", sound_instance)             # <<<<<<<<<<<<<<
 * 
 *     def _get_sound_instances_for_sound(self, sound not None):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && 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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_Queueing_sound_s, __pyx_v_sound_instance};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_Queueing_sound_s, __pyx_v_sound_instance};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 653, __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_Queueing_sound_s);
    __Pyx_GIVEREF(__pyx_kp_u_Queueing_sound_s);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_kp_u_Queueing_sound_s);
    __Pyx_INCREF(__pyx_v_sound_instance);
    __Pyx_GIVEREF(__pyx_v_sound_instance);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_sound_instance);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":639
 *         SDL_UnlockAudio()
 * 
 *     def _queue_sound(self, sound_instance not 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_5);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._queue_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":655
 *         self.log.debug("Queueing sound %s", sound_instance)
 * 
 *     def _get_sound_instances_for_sound(self, sound not None):             # <<<<<<<<<<<<<<
 *         """Return list of sound instances of the given sound."""
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_31_get_sound_instances_for_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_30_get_sound_instances_for_sound[] = "TrackStandard._get_sound_instances_for_sound(self, sound)\nReturn list of sound instances of the given sound.";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_31_get_sound_instances_for_sound(PyObject *__pyx_v_self, PyObject *__pyx_v_sound) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_sound_instances_for_sound (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound"); __PYX_ERR(0, 655, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_30_get_sound_instances_for_sound(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_30_get_sound_instances_for_sound(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound) {
  PyObject *__pyx_v_instances = 0;
  int __pyx_v_i;
  Uint64 __pyx_v_sound_instance_id;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Uint64 __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_sound_instances_for_sound", 0);

  /* "mpfmc/core/audio/track_standard.pyx":658
 *         """Return list of sound instances of the given sound."""
 * 
 *         cdef list instances = list()             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockAudio()
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_instances = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":660
 *         cdef list instances = list()
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.type_state.sound_player_count):
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":662
 *         SDL_LockAudio()
 * 
 *         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_2 = __pyx_v_self->type_state->sound_player_count;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "mpfmc/core/audio/track_standard.pyx":663
 * 
 *         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_6 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L6_bool_binop_done;
    }

    /* "mpfmc/core/audio/track_standard.pyx":664
 *         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:             # <<<<<<<<<<<<<<
 * 
 *                 sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 */
    __pyx_t_1 = __Pyx_PyInt_From_Uint64((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = __pyx_t_6;
    __pyx_L6_bool_binop_done:;

    /* "mpfmc/core/audio/track_standard.pyx":663
 * 
 *         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:
 * 
 */
    if (__pyx_t_5) {

      /* "mpfmc/core/audio/track_standard.pyx":666
 *                 i].current.sound_id == sound.id:
 * 
 *                 sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id             # <<<<<<<<<<<<<<
 *                 if sound_instance_id in self._playing_instances_by_id:
 *                     instances.append(self._playing_instances_by_id[sound_instance_id])
 */
      __pyx_t_9 = (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id;
      __pyx_v_sound_instance_id = __pyx_t_9;

      /* "mpfmc/core/audio/track_standard.pyx":667
 * 
 *                 sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 *                 if sound_instance_id in self._playing_instances_by_id:             # <<<<<<<<<<<<<<
 *                     instances.append(self._playing_instances_by_id[sound_instance_id])
 * 
 */
      __pyx_t_8 = __Pyx_PyInt_From_Uint64(__pyx_v_sound_instance_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 667, __pyx_L1_error)
      }
      __pyx_t_5 = (__Pyx_PyDict_ContainsTF(__pyx_t_8, __pyx_v_self->_playing_instances_by_id, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 667, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {

        /* "mpfmc/core/audio/track_standard.pyx":668
 *                 sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 *                 if sound_instance_id in self._playing_instances_by_id:
 *                     instances.append(self._playing_instances_by_id[sound_instance_id])             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
        if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 668, __pyx_L1_error)
        }
        __pyx_t_8 = __Pyx_PyInt_From_Uint64(__pyx_v_sound_instance_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 668, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_self->_playing_instances_by_id, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 668, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_instances, __pyx_t_7); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 668, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "mpfmc/core/audio/track_standard.pyx":667
 * 
 *                 sound_instance_id = self.type_state.sound_players[i].current.sound_instance_id
 *                 if sound_instance_id in self._playing_instances_by_id:             # <<<<<<<<<<<<<<
 *                     instances.append(self._playing_instances_by_id[sound_instance_id])
 * 
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":663
 * 
 *         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:
 * 
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":670
 *                     instances.append(self._playing_instances_by_id[sound_instance_id])
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *         return instances
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":672
 *         SDL_UnlockAudio()
 * 
 *         return instances             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound(self, sound not None, fade_out=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_instances);
  __pyx_r = __pyx_v_instances;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":655
 *         self.log.debug("Queueing sound %s", sound_instance)
 * 
 *     def _get_sound_instances_for_sound(self, sound not None):             # <<<<<<<<<<<<<<
 *         """Return list of sound instances of the given sound."""
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._get_sound_instances_for_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_instances);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":674
 *         return instances
 * 
 *     def stop_sound(self, sound not None, fade_out=None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops all instances of the specified sound immediately on the track. Any queued instances
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_33stop_sound(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_32stop_sound[] = "TrackStandard.stop_sound(self, sound, fade_out=None)\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: The Sound to stop\n            fade_out: Optional amount of time (seconds) to fade out before stopping\n        ";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_33stop_sound(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sound = 0;
  PyObject *__pyx_v_fade_out = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sound,&__pyx_n_s_fade_out,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sound)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fade_out);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stop_sound") < 0)) __PYX_ERR(0, 674, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sound = values[0];
    __pyx_v_fade_out = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("stop_sound", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 674, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.stop_sound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(((PyObject *)__pyx_v_sound) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound"); __PYX_ERR(0, 674, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_32stop_sound(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), __pyx_v_sound, __pyx_v_fade_out);

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_32stop_sound(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound, PyObject *__pyx_v_fade_out) {
  PyObject *__pyx_v_sound_instance = 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;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("stop_sound", 0);

  /* "mpfmc/core/audio/track_standard.pyx":682
 *             fade_out: Optional amount of time (seconds) to fade out before stopping
 *         """
 *         for sound_instance in self._get_sound_instances_for_sound(sound):             # <<<<<<<<<<<<<<
 *             self.stop_sound_instance(sound_instance, fade_out)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_sound_instances_for_sound); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_sound) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sound);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 682, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 682, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 682, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 682, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":683
 *         """
 *         for sound_instance in self._get_sound_instances_for_sound(sound):
 *             self.stop_sound_instance(sound_instance, fade_out)             # <<<<<<<<<<<<<<
 * 
 *         self._remove_sound_from_queue(sound)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop_sound_instance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && 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;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_sound_instance, __pyx_v_fade_out};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_sound_instance, __pyx_v_fade_out};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 683, __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_instance);
      __Pyx_GIVEREF(__pyx_v_sound_instance);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_sound_instance);
      __Pyx_INCREF(__pyx_v_fade_out);
      __Pyx_GIVEREF(__pyx_v_fade_out);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_fade_out);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":682
 *             fade_out: Optional amount of time (seconds) to fade out before stopping
 *         """
 *         for sound_instance in self._get_sound_instances_for_sound(sound):             # <<<<<<<<<<<<<<
 *             self.stop_sound_instance(sound_instance, fade_out)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":685
 *             self.stop_sound_instance(sound_instance, fade_out)
 * 
 *         self._remove_sound_from_queue(sound)             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound_instance(self, sound_instance not None, fade_out=None):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_sound_from_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_sound) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sound);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 685, __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;

  /* "mpfmc/core/audio/track_standard.pyx":674
 *         return instances
 * 
 *     def stop_sound(self, sound not None, fade_out=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_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.stop_sound", __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;
}

/* "mpfmc/core/audio/track_standard.pyx":687
 *         self._remove_sound_from_queue(sound)
 * 
 *     def stop_sound_instance(self, sound_instance not None, fade_out=None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops the specified sound instance immediately on the track. Any queued instances
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_35stop_sound_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_34stop_sound_instance[] = "TrackStandard.stop_sound_instance(self, sound_instance, fade_out=None)\n\n        Stops the specified sound instance immediately on the track. Any queued instances\n        will be removed from the queue.\n        Args:\n            sound_instance: The SoundInstance to stop\n            fade_out: Optional amount of time (seconds) to fade out before stopping\n        ";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_35stop_sound_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sound_instance = 0;
  PyObject *__pyx_v_fade_out = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound_instance (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sound_instance,&__pyx_n_s_fade_out,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sound_instance)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fade_out);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stop_sound_instance") < 0)) __PYX_ERR(0, 687, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        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_fade_out = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("stop_sound_instance", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 687, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.stop_sound_instance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(((PyObject *)__pyx_v_sound_instance) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound_instance"); __PYX_ERR(0, 687, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_34stop_sound_instance(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), __pyx_v_sound_instance, __pyx_v_fade_out);

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_34stop_sound_instance(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance, PyObject *__pyx_v_fade_out) {
  __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *__pyx_v_player;
  int __pyx_v_i;
  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;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  Uint32 __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("stop_sound_instance", 0);
  __Pyx_INCREF(__pyx_v_fade_out);

  /* "mpfmc/core/audio/track_standard.pyx":697
 *         cdef SoundPlayer *player
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("Stopping sound %s and removing any pending instances from queue", sound_instance.name)
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":699
 *         SDL_LockAudio()
 * 
 *         self.log.debug("Stopping sound %s and removing any pending instances from queue", sound_instance.name)             # <<<<<<<<<<<<<<
 * 
 *         if fade_out is None:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __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, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && 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;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_Stopping_sound_s_and_removing_an, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_Stopping_sound_s_and_removing_an, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 699, __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, 699, __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;

  /* "mpfmc/core/audio/track_standard.pyx":701
 *         self.log.debug("Stopping sound %s and removing any pending instances from queue", sound_instance.name)
 * 
 *         if fade_out is None:             # <<<<<<<<<<<<<<
 *             fade_out = sound_instance.fade_out
 * 
 */
  __pyx_t_7 = (__pyx_v_fade_out == Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "mpfmc/core/audio/track_standard.pyx":702
 * 
 *         if fade_out is None:
 *             fade_out = sound_instance.fade_out             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.type_state.sound_player_count):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_fade_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fade_out, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":701
 *         self.log.debug("Stopping sound %s and removing any pending instances from queue", sound_instance.name)
 * 
 *         if fade_out is None:             # <<<<<<<<<<<<<<
 *             fade_out = sound_instance.fade_out
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":704
 *             fade_out = sound_instance.fade_out
 * 
 *         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_5 = __pyx_v_self->type_state->sound_player_count;
  __pyx_t_9 = __pyx_t_5;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "mpfmc/core/audio/track_standard.pyx":705
 * 
 *         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_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_8 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }

    /* "mpfmc/core/audio/track_standard.pyx":706
 *         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:             # <<<<<<<<<<<<<<
 * 
 *                 # Update player to stop playing sound
 */
    __pyx_t_1 = __Pyx_PyInt_From_Uint64((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __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, 706, __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, 706, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __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, 706, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __pyx_t_7;
    __pyx_L7_bool_binop_done:;

    /* "mpfmc/core/audio/track_standard.pyx":705
 * 
 *         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:
 * 
 */
    if (__pyx_t_8) {

      /* "mpfmc/core/audio/track_standard.pyx":709
 * 
 *                 # Update player to stop playing sound
 *                 player = cython.address(self.type_state.sound_players[i])             # <<<<<<<<<<<<<<
 * 
 *                 # Calculate fade out (if necessary)
 */
      __pyx_v_player = (&(__pyx_v_self->type_state->sound_players[__pyx_v_i]));

      /* "mpfmc/core/audio/track_standard.pyx":712
 * 
 *                 # Calculate fade out (if necessary)
 *                 player.current.fade_steps_remaining = fade_out * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point             # <<<<<<<<<<<<<<
 *                 if player.current.fade_steps_remaining > 0:
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining
 */
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyNumber_Multiply(__pyx_v_fade_out, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyInt_From_Uint16(__pyx_v_self->__pyx_base.state->callback_data->bytes_per_control_point); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyNumber_FloorDivide(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = __Pyx_PyInt_As_Uint32(__pyx_t_1); if (unlikely((__pyx_t_11 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_player->current.fade_steps_remaining = __pyx_t_11;

      /* "mpfmc/core/audio/track_standard.pyx":713
 *                 # Calculate fade out (if necessary)
 *                 player.current.fade_steps_remaining = fade_out * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point
 *                 if player.current.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining
 *                     player.current.fading_status = fading_status_fading_out
 */
      __pyx_t_8 = ((__pyx_v_player->current.fade_steps_remaining > 0) != 0);
      if (__pyx_t_8) {

        /* "mpfmc/core/audio/track_standard.pyx":714
 *                 player.current.fade_steps_remaining = fade_out * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point
 *                 if player.current.fade_steps_remaining > 0:
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining             # <<<<<<<<<<<<<<
 *                     player.current.fading_status = fading_status_fading_out
 *                     player.status = player_stopping
 */
        __pyx_t_11 = __pyx_v_player->current.fade_steps_remaining;
        __pyx_v_player->current.fade_out_steps = __pyx_t_11;

        /* "mpfmc/core/audio/track_standard.pyx":715
 *                 if player.current.fade_steps_remaining > 0:
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining
 *                     player.current.fading_status = fading_status_fading_out             # <<<<<<<<<<<<<<
 *                     player.status = player_stopping
 *                 else:
 */
        __pyx_v_player->current.fading_status = __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_out;

        /* "mpfmc/core/audio/track_standard.pyx":716
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining
 *                     player.current.fading_status = fading_status_fading_out
 *                     player.status = player_stopping             # <<<<<<<<<<<<<<
 *                 else:
 *                     # Sound will stop immediately - send sound stopped notification
 */
        __pyx_v_player->status = __pyx_e_5mpfmc_4core_5audio_14track_standard_player_stopping;

        /* "mpfmc/core/audio/track_standard.pyx":713
 *                 # Calculate fade out (if necessary)
 *                 player.current.fade_steps_remaining = fade_out * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point
 *                 if player.current.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining
 *                     player.current.fading_status = fading_status_fading_out
 */
        goto __pyx_L9;
      }

      /* "mpfmc/core/audio/track_standard.pyx":719
 *                 else:
 *                     # Sound will stop immediately - send sound stopped notification
 *                     send_sound_stopped_notification(player.number, player.current.sound_id, player.current.sound_instance_id, self.state)             # <<<<<<<<<<<<<<
 *                     player.status = player_idle
 * 
 */
      /*else*/ {
        __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_stopped_notification(__pyx_v_player->number, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_self->__pyx_base.state);

        /* "mpfmc/core/audio/track_standard.pyx":720
 *                     # Sound will stop immediately - send sound stopped notification
 *                     send_sound_stopped_notification(player.number, player.current.sound_id, player.current.sound_instance_id, self.state)
 *                     player.status = player_idle             # <<<<<<<<<<<<<<
 * 
 *                 # Adjust ducking release (if necessary)
 */
        __pyx_v_player->status = __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle;
      }
      __pyx_L9:;

      /* "mpfmc/core/audio/track_standard.pyx":723
 * 
 *                 # Adjust ducking release (if necessary)
 *                 if player.current.sound_has_ducking:             # <<<<<<<<<<<<<<
 *                     # player.current.ducking_settings.release_duration = min(sound_instance.ducking.release * self.state.callback_data.seconds_to_bytes_factor, request_message.data.stop.fade_out_duration)
 *                     # player.current.ducking_settings.release_start_pos = player.current.sample_pos
 */
      __pyx_t_8 = (__pyx_v_player->current.sound_has_ducking != 0);
      if (__pyx_t_8) {
      }

      /* "mpfmc/core/audio/track_standard.pyx":705
 * 
 *         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:
 * 
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":732
 * 
 *         # Remove any instances of the specified sound that are pending in the sound queue
 *         self._remove_sound_instance_from_queue(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_sound_instance_from_queu); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_2, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_sound_instance);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":734
 *         self._remove_sound_instance_from_queue(sound_instance)
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound_looping(self, sound not None):
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":687
 *         self._remove_sound_from_queue(sound)
 * 
 *     def stop_sound_instance(self, sound_instance not None, fade_out=None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops the specified sound instance 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("mpfmc.core.audio.track_standard.TrackStandard.stop_sound_instance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fade_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":736
 *         SDL_UnlockAudio()
 * 
 *     def stop_sound_looping(self, sound not None):             # <<<<<<<<<<<<<<
 *         """
 *         Cancels looping for all instances of the specified sound on the track. Any queued instances
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_37stop_sound_looping(PyObject *__pyx_v_self, PyObject *__pyx_v_sound); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_36stop_sound_looping[] = "TrackStandard.stop_sound_looping(self, sound)\n\n        Cancels looping for all instances of the specified sound on the track. Any queued instances\n        will be removed from the queue.\n        Args:\n            sound: The Sound to stop looping\n        ";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_37stop_sound_looping(PyObject *__pyx_v_self, PyObject *__pyx_v_sound) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound_looping (wrapper)", 0);
  if (unlikely(((PyObject *)__pyx_v_sound) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sound"); __PYX_ERR(0, 736, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_36stop_sound_looping(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_36stop_sound_looping(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("stop_sound_looping", 0);

  /* "mpfmc/core/audio/track_standard.pyx":743
 *             sound: The Sound to stop looping
 *         """
 *         for sound_instance in self._get_sound_instances_for_sound(sound):             # <<<<<<<<<<<<<<
 *             self.stop_sound_instance_looping(sound_instance)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_sound_instances_for_sound); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_sound) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sound);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 743, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 743, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 743, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 743, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":744
 *         """
 *         for sound_instance in self._get_sound_instances_for_sound(sound):
 *             self.stop_sound_instance_looping(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         self._remove_sound_from_queue(sound)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop_sound_instance_looping); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 744, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_sound_instance);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 744, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":743
 *             sound: The Sound to stop looping
 *         """
 *         for sound_instance in self._get_sound_instances_for_sound(sound):             # <<<<<<<<<<<<<<
 *             self.stop_sound_instance_looping(sound_instance)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":746
 *             self.stop_sound_instance_looping(sound_instance)
 * 
 *         self._remove_sound_from_queue(sound)             # <<<<<<<<<<<<<<
 * 
 *     def stop_sound_instance_looping(self, sound_instance not None):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_sound_from_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_sound) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sound);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __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;

  /* "mpfmc/core/audio/track_standard.pyx":736
 *         SDL_UnlockAudio()
 * 
 *     def stop_sound_looping(self, sound not None):             # <<<<<<<<<<<<<<
 *         """
 *         Cancels looping for all instances of the specified sound 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_6);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.stop_sound_looping", __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;
}

/* "mpfmc/core/audio/track_standard.pyx":748
 *         self._remove_sound_from_queue(sound)
 * 
 *     def stop_sound_instance_looping(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops the specified sound instance on the track after the current loop iteration
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_39stop_sound_instance_looping(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_38stop_sound_instance_looping[] = "TrackStandard.stop_sound_instance_looping(self, sound_instance)\n\n        Stops the specified sound instance on the track after the current loop iteration\n        has finished. Any queued instances of the sound will be removed.\n        Args:\n            sound_instance: The Sound to stop\n        ";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_39stop_sound_instance_looping(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stop_sound_instance_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, 748, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_38stop_sound_instance_looping(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_38stop_sound_instance_looping(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  gsize __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("stop_sound_instance_looping", 0);

  /* "mpfmc/core/audio/track_standard.pyx":756
 *         """
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.type_state.sound_player_count):
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":758
 *         SDL_LockAudio()
 * 
 *         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;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "mpfmc/core/audio/track_standard.pyx":759
 * 
 *         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 and loop end position to the end of the sound
 */
    __pyx_t_5 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }

    /* "mpfmc/core/audio/track_standard.pyx":760
 *         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 and loop end position to the end of the sound
 *                 self.type_state.sound_players[i].current.loops_remaining = 0
 */
    __pyx_t_6 = __Pyx_PyInt_From_Uint64((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 760, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 760, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 760, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 760, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;

    /* "mpfmc/core/audio/track_standard.pyx":759
 * 
 *         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 and loop end position to the end of the sound
 */
    if (__pyx_t_4) {

      /* "mpfmc/core/audio/track_standard.pyx":762
 *                 i].current.sound_instance_id == sound_instance.id:
 *                 # Set sound's loops_remaining variable to zero and loop end position to the end of the sound
 *                 self.type_state.sound_players[i].current.loops_remaining = 0             # <<<<<<<<<<<<<<
 *                 self.type_state.sound_players[i].current.loop_end_pos = self.type_state.sound_players[
 *                     i].current.sample.data.memory.size
 */
      (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.loops_remaining = 0;

      /* "mpfmc/core/audio/track_standard.pyx":764
 *                 self.type_state.sound_players[i].current.loops_remaining = 0
 *                 self.type_state.sound_players[i].current.loop_end_pos = self.type_state.sound_players[
 *                     i].current.sample.data.memory.size             # <<<<<<<<<<<<<<
 * 
 *         # Remove any instances of the specified sound that are pending in the sound queue.
 */
      __pyx_t_9 = (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sample->data.memory->size;

      /* "mpfmc/core/audio/track_standard.pyx":763
 *                 # Set sound's loops_remaining variable to zero and loop end position to the end of the sound
 *                 self.type_state.sound_players[i].current.loops_remaining = 0
 *                 self.type_state.sound_players[i].current.loop_end_pos = self.type_state.sound_players[             # <<<<<<<<<<<<<<
 *                     i].current.sample.data.memory.size
 * 
 */
      (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.loop_end_pos = __pyx_t_9;

      /* "mpfmc/core/audio/track_standard.pyx":759
 * 
 *         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 and loop end position to the end of the sound
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":767
 * 
 *         # Remove any instances of the specified sound that are pending in the sound queue.
 *         if self.sound_instance_is_in_queue(sound_instance):             # <<<<<<<<<<<<<<
 *             self._remove_sound_instance_from_queue(sound_instance)
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sound_instance_is_in_queue); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_sound_instance);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_4) {

    /* "mpfmc/core/audio/track_standard.pyx":768
 *         # Remove any instances of the specified sound that are pending in the sound queue.
 *         if self.sound_instance_is_in_queue(sound_instance):
 *             self._remove_sound_instance_from_queue(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_sound_instance_from_queu); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_sound_instance);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":767
 * 
 *         # Remove any instances of the specified sound that are pending in the sound queue.
 *         if self.sound_instance_is_in_queue(sound_instance):             # <<<<<<<<<<<<<<
 *             self._remove_sound_instance_from_queue(sound_instance)
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":770
 *             self._remove_sound_instance_from_queue(sound_instance)
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     def clear_context(self, context):
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":748
 *         self._remove_sound_from_queue(sound)
 * 
 *     def stop_sound_instance_looping(self, sound_instance not None):             # <<<<<<<<<<<<<<
 *         """
 *         Stops the specified sound instance on the track after the current loop iteration
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.stop_sound_instance_looping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":772
 *         SDL_UnlockAudio()
 * 
 *     def clear_context(self, context):             # <<<<<<<<<<<<<<
 *         """
 *         Triggers the end mode action for current sound instances played from the specified context.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_41clear_context(PyObject *__pyx_v_self, PyObject *__pyx_v_context); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_40clear_context[] = "TrackStandard.clear_context(self, context)\n\n        Triggers the end mode action for current sound instances played from the specified context.\n        Any queued instances with a matching context will be canceled (removed).\n\n        Args:\n            context: The context to clear\n        ";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_41clear_context(PyObject *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_context (wrapper)", 0);
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_40clear_context(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_context));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_40clear_context(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_v_sound_instance = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear_context", 0);

  /* "mpfmc/core/audio/track_standard.pyx":782
 *         # If this track is managed by a playlist controller, do not clear the context as that
 *         # will be handled by the playlist controller.
 *         if self.mc.sound_system.audio_interface.get_playlist_controller(self._name):             # <<<<<<<<<<<<<<
 *             self.log.debug("Skip clearing context %s (playlist controller will handle it)", context)
 *             return
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.mc, __pyx_n_s_sound_system); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_audio_interface); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __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_get_playlist_controller); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_self->__pyx_base._name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->__pyx_base._name);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mpfmc/core/audio/track_standard.pyx":783
 *         # will be handled by the playlist controller.
 *         if self.mc.sound_system.audio_interface.get_playlist_controller(self._name):
 *             self.log.debug("Skip clearing context %s (playlist controller will handle it)", context)             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && 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;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_Skip_clearing_context_s_playlist, __pyx_v_context};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_Skip_clearing_context_s_playlist, __pyx_v_context};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 783, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_Skip_clearing_context_s_playlist);
      __Pyx_GIVEREF(__pyx_kp_u_Skip_clearing_context_s_playlist);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_u_Skip_clearing_context_s_playlist);
      __Pyx_INCREF(__pyx_v_context);
      __Pyx_GIVEREF(__pyx_v_context);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_context);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __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;

    /* "mpfmc/core/audio/track_standard.pyx":784
 *         if self.mc.sound_system.audio_interface.get_playlist_controller(self._name):
 *             self.log.debug("Skip clearing context %s (playlist controller will handle it)", context)
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("Clearing context %s", context)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":782
 *         # If this track is managed by a playlist controller, do not clear the context as that
 *         # will be handled by the playlist controller.
 *         if self.mc.sound_system.audio_interface.get_playlist_controller(self._name):             # <<<<<<<<<<<<<<
 *             self.log.debug("Skip clearing context %s (playlist controller will handle it)", context)
 *             return
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":786
 *             return
 * 
 *         self.log.debug("Clearing context %s", context)             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockAudio()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && 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_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_Clearing_context_s, __pyx_v_context};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_Clearing_context_s, __pyx_v_context};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Clearing_context_s);
    __Pyx_GIVEREF(__pyx_kp_u_Clearing_context_s);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_kp_u_Clearing_context_s);
    __Pyx_INCREF(__pyx_v_context);
    __Pyx_GIVEREF(__pyx_v_context);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_context);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":788
 *         self.log.debug("Clearing context %s", context)
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         # Clear any instances in the queue with the given context value
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":791
 * 
 *         # Clear any instances in the queue with the given context value
 *         self._remove_all_sounds_with_context_from_queue(context)             # <<<<<<<<<<<<<<
 * 
 *         for sound_instance in list(self._playing_instances_by_id.values()):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_all_sounds_with_context); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_context) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_context);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __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;

  /* "mpfmc/core/audio/track_standard.pyx":793
 *         self._remove_all_sounds_with_context_from_queue(context)
 * 
 *         for sound_instance in list(self._playing_instances_by_id.values()):             # <<<<<<<<<<<<<<
 *             if sound_instance.context == context:
 *                 # Stop or stop looping the sound instance (depends upon mode end action value)
 */
  if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values");
    __PYX_ERR(0, 793, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Values(__pyx_v_self->_playing_instances_by_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 793, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 793, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":794
 * 
 *         for sound_instance in list(self._playing_instances_by_id.values()):
 *             if sound_instance.context == context:             # <<<<<<<<<<<<<<
 *                 # Stop or stop looping the sound instance (depends upon mode end action value)
 *                 if sound_instance.stop_on_mode_end:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_context); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_context, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 794, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 794, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "mpfmc/core/audio/track_standard.pyx":796
 *             if sound_instance.context == context:
 *                 # Stop or stop looping the sound instance (depends upon mode end action value)
 *                 if sound_instance.stop_on_mode_end:             # <<<<<<<<<<<<<<
 *                     self.stop_sound_instance(sound_instance)
 *                 else:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_stop_on_mode_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 796, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {

        /* "mpfmc/core/audio/track_standard.pyx":797
 *                 # Stop or stop looping the sound instance (depends upon mode end action value)
 *                 if sound_instance.stop_on_mode_end:
 *                     self.stop_sound_instance(sound_instance)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.stop_sound_instance_looping(sound_instance)
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop_sound_instance); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 797, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && 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_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sound_instance);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 797, __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;

        /* "mpfmc/core/audio/track_standard.pyx":796
 *             if sound_instance.context == context:
 *                 # Stop or stop looping the sound instance (depends upon mode end action value)
 *                 if sound_instance.stop_on_mode_end:             # <<<<<<<<<<<<<<
 *                     self.stop_sound_instance(sound_instance)
 *                 else:
 */
        goto __pyx_L7;
      }

      /* "mpfmc/core/audio/track_standard.pyx":799
 *                     self.stop_sound_instance(sound_instance)
 *                 else:
 *                     self.stop_sound_instance_looping(sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
      /*else*/ {
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop_sound_instance_looping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && 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_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_v_sound_instance) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sound_instance);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __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;
      }
      __pyx_L7:;

      /* "mpfmc/core/audio/track_standard.pyx":794
 * 
 *         for sound_instance in list(self._playing_instances_by_id.values()):
 *             if sound_instance.context == context:             # <<<<<<<<<<<<<<
 *                 # Stop or stop looping the sound instance (depends upon mode end action value)
 *                 if sound_instance.stop_on_mode_end:
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":793
 *         self._remove_all_sounds_with_context_from_queue(context)
 * 
 *         for sound_instance in list(self._playing_instances_by_id.values()):             # <<<<<<<<<<<<<<
 *             if sound_instance.context == context:
 *                 # Stop or stop looping the sound instance (depends upon mode end action value)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":801
 *                     self.stop_sound_instance_looping(sound_instance)
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     def _reset_state(self):
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":772
 *         SDL_UnlockAudio()
 * 
 *     def clear_context(self, context):             # <<<<<<<<<<<<<<
 *         """
 *         Triggers the end mode action for current sound instances played from the specified context.
 */

  /* 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_6);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.clear_context", __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;
}

/* "mpfmc/core/audio/track_standard.pyx":803
 *         SDL_UnlockAudio()
 * 
 *     def _reset_state(self):             # <<<<<<<<<<<<<<
 *         """Resets the track state (stops all sounds immediately and clears the queue)"""
 *         SDL_LockAudio()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_43_reset_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_42_reset_state[] = "TrackStandard._reset_state(self)\nResets the track state (stops all sounds immediately and clears the queue)";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_43_reset_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_reset_state (wrapper)", 0);
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_42_reset_state(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_42_reset_state(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  int __pyx_v_i;
  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;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_reset_state", 0);

  /* "mpfmc/core/audio/track_standard.pyx":805
 *     def _reset_state(self):
 *         """Resets the track state (stops all sounds immediately and clears the queue)"""
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("Resetting track state (sounds will be stopped and queue cleared")
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":807
 *         SDL_LockAudio()
 * 
 *         self.log.debug("Resetting track state (sounds will be stopped and queue cleared")             # <<<<<<<<<<<<<<
 * 
 *         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, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_Resetting_track_state_sounds_wil) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Resetting_track_state_sounds_wil);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __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;

  /* "mpfmc/core/audio/track_standard.pyx":809
 *         self.log.debug("Resetting track state (sounds will be stopped and queue cleared")
 * 
 *         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_4 = __pyx_v_self->type_state->sound_player_count;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "mpfmc/core/audio/track_standard.pyx":810
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:             # <<<<<<<<<<<<<<
 *                 # Set stop sound event
 *                 send_sound_stopped_notification(i,
 */
    __pyx_t_7 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_7) {

      /* "mpfmc/core/audio/track_standard.pyx":812
 *             if self.type_state.sound_players[i].status != player_idle:
 *                 # Set stop sound event
 *                 send_sound_stopped_notification(i,             # <<<<<<<<<<<<<<
 *                                                 self.type_state.sound_players[i].current.sound_id,
 *                                                 self.type_state.sound_players[i].current.sound_instance_id,
 */
      __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_stopped_notification(__pyx_v_i, (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_id, (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id, __pyx_v_self->__pyx_base.state);

      /* "mpfmc/core/audio/track_standard.pyx":816
 *                                                 self.type_state.sound_players[i].current.sound_instance_id,
 *                                                 self.state)
 *                 self.type_state.sound_players[i].status = player_idle             # <<<<<<<<<<<<<<
 * 
 *         # Remove all sounds that are pending in the sound queue.
 */
      (__pyx_v_self->type_state->sound_players[__pyx_v_i]).status = __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle;

      /* "mpfmc/core/audio/track_standard.pyx":810
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:             # <<<<<<<<<<<<<<
 *                 # Set stop sound event
 *                 send_sound_stopped_notification(i,
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":819
 * 
 *         # Remove all sounds that are pending in the sound queue.
 *         self._remove_all_sounds_from_queue()             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_all_sounds_from_queue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 819, __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;

  /* "mpfmc/core/audio/track_standard.pyx":821
 *         self._remove_all_sounds_from_queue()
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     def stop_all_sounds(self, float fade_out_seconds = 0.0):
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":803
 *         SDL_UnlockAudio()
 * 
 *     def _reset_state(self):             # <<<<<<<<<<<<<<
 *         """Resets the track state (stops all sounds immediately and clears the queue)"""
 *         SDL_LockAudio()
 */

  /* 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("mpfmc.core.audio.track_standard.TrackStandard._reset_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":823
 *         SDL_UnlockAudio()
 * 
 *     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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_45stop_all_sounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_44stop_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_45stop_all_sounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_fade_out_seconds;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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);
        CYTHON_FALLTHROUGH;
        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 = __Pyx_PyDict_GetItemStr(__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, 823, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        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, 823, __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, 823, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.stop_all_sounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_44stop_all_sounds(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), __pyx_v_fade_out_seconds);

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_44stop_all_sounds(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, float __pyx_v_fade_out_seconds) {
  int __pyx_v_i;
  __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *__pyx_v_player;
  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;
  int __pyx_t_6;
  int __pyx_t_7;
  double __pyx_t_8;
  Uint32 __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("stop_all_sounds", 0);

  /* "mpfmc/core/audio/track_standard.pyx":829
 *             fade_out_seconds: The number of seconds to fade out the sounds before stopping
 *         """
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("Stopping all sounds and removing any pending sounds from queue")
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":831
 *         SDL_LockAudio()
 * 
 *         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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_Stopping_all_sounds_and_removing) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Stopping_all_sounds_and_removing);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 831, __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;

  /* "mpfmc/core/audio/track_standard.pyx":833
 *         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:
 * 
 */
  __pyx_t_4 = __pyx_v_self->type_state->sound_player_count;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "mpfmc/core/audio/track_standard.pyx":834
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:             # <<<<<<<<<<<<<<
 * 
 *                 # Update player to stop playing sound
 */
    __pyx_t_7 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_7) {

      /* "mpfmc/core/audio/track_standard.pyx":837
 * 
 *                 # Update player to stop playing sound
 *                 player = cython.address(self.type_state.sound_players[i])             # <<<<<<<<<<<<<<
 * 
 *                 # Calculate fade out (if necessary)
 */
      __pyx_v_player = (&(__pyx_v_self->type_state->sound_players[__pyx_v_i]));

      /* "mpfmc/core/audio/track_standard.pyx":840
 * 
 *                 # Calculate fade out (if necessary)
 *                 player.current.fade_steps_remaining = <Uint32>(fade_out_seconds * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point)             # <<<<<<<<<<<<<<
 *                 if player.current.fade_steps_remaining > 0:
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining
 */
      __pyx_t_8 = (__pyx_v_fade_out_seconds * __pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor);
      if (unlikely(__pyx_v_self->__pyx_base.state->callback_data->bytes_per_control_point == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(0, 840, __pyx_L1_error)
      }
      __pyx_v_player->current.fade_steps_remaining = ((Uint32)floor(__pyx_t_8 / __pyx_v_self->__pyx_base.state->callback_data->bytes_per_control_point));

      /* "mpfmc/core/audio/track_standard.pyx":841
 *                 # Calculate fade out (if necessary)
 *                 player.current.fade_steps_remaining = <Uint32>(fade_out_seconds * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point)
 *                 if player.current.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining
 *                     player.current.fading_status = fading_status_fading_out
 */
      __pyx_t_7 = ((__pyx_v_player->current.fade_steps_remaining > 0) != 0);
      if (__pyx_t_7) {

        /* "mpfmc/core/audio/track_standard.pyx":842
 *                 player.current.fade_steps_remaining = <Uint32>(fade_out_seconds * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point)
 *                 if player.current.fade_steps_remaining > 0:
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining             # <<<<<<<<<<<<<<
 *                     player.current.fading_status = fading_status_fading_out
 *                     player.status = player_stopping
 */
        __pyx_t_9 = __pyx_v_player->current.fade_steps_remaining;
        __pyx_v_player->current.fade_out_steps = __pyx_t_9;

        /* "mpfmc/core/audio/track_standard.pyx":843
 *                 if player.current.fade_steps_remaining > 0:
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining
 *                     player.current.fading_status = fading_status_fading_out             # <<<<<<<<<<<<<<
 *                     player.status = player_stopping
 *                 else:
 */
        __pyx_v_player->current.fading_status = __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_out;

        /* "mpfmc/core/audio/track_standard.pyx":844
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining
 *                     player.current.fading_status = fading_status_fading_out
 *                     player.status = player_stopping             # <<<<<<<<<<<<<<
 *                 else:
 *                     # Sound will stop immediately - send sound stopped notification
 */
        __pyx_v_player->status = __pyx_e_5mpfmc_4core_5audio_14track_standard_player_stopping;

        /* "mpfmc/core/audio/track_standard.pyx":841
 *                 # Calculate fade out (if necessary)
 *                 player.current.fade_steps_remaining = <Uint32>(fade_out_seconds * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point)
 *                 if player.current.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *                     player.current.fade_out_steps = player.current.fade_steps_remaining
 *                     player.current.fading_status = fading_status_fading_out
 */
        goto __pyx_L6;
      }

      /* "mpfmc/core/audio/track_standard.pyx":847
 *                 else:
 *                     # Sound will stop immediately - send sound stopped notification
 *                     send_sound_stopped_notification(player.number, player.current.sound_id, player.current.sound_instance_id, self.state)             # <<<<<<<<<<<<<<
 *                     player.status = player_idle
 * 
 */
      /*else*/ {
        __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_stopped_notification(__pyx_v_player->number, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_self->__pyx_base.state);

        /* "mpfmc/core/audio/track_standard.pyx":848
 *                     # Sound will stop immediately - send sound stopped notification
 *                     send_sound_stopped_notification(player.number, player.current.sound_id, player.current.sound_instance_id, self.state)
 *                     player.status = player_idle             # <<<<<<<<<<<<<<
 * 
 *                 # Adjust ducking release (if necessary)
 */
        __pyx_v_player->status = __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle;
      }
      __pyx_L6:;

      /* "mpfmc/core/audio/track_standard.pyx":851
 * 
 *                 # Adjust ducking release (if necessary)
 *                 if player.current.sound_has_ducking:             # <<<<<<<<<<<<<<
 *                     # player.current.ducking_settings.release_duration = min(sound_instance.ducking.release * self.state.callback_data.seconds_to_bytes_factor, request_message.data.stop.fade_out_duration)
 *                     # player.current.ducking_settings.release_start_pos = player.current.sample_pos
 */
      __pyx_t_7 = (__pyx_v_player->current.sound_has_ducking != 0);
      if (__pyx_t_7) {
      }

      /* "mpfmc/core/audio/track_standard.pyx":834
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:             # <<<<<<<<<<<<<<
 * 
 *                 # Update player to stop playing sound
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":860
 * 
 *         # Remove all sounds that are pending in the sound queue.
 *         self._remove_all_sounds_from_queue()             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_all_sounds_from_queue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __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;

  /* "mpfmc/core/audio/track_standard.pyx":862
 *         self._remove_all_sounds_from_queue()
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *     cdef tuple _get_sound_player_with_lowest_priority(self):
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":823
 *         SDL_UnlockAudio()
 * 
 *     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_3);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.stop_all_sounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":864
 *         SDL_UnlockAudio()
 * 
 *     cdef tuple _get_sound_player_with_lowest_priority(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieves the sound player currently with the lowest priority.
 */

static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_sound_player_with_lowest_priority(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_sound_player_with_lowest_priority", 0);

  /* "mpfmc/core/audio/track_standard.pyx":873
 * 
 *         """
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         cdef int lowest_priority = 2147483647
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":875
 *         SDL_LockAudio()
 * 
 *         cdef int lowest_priority = 2147483647             # <<<<<<<<<<<<<<
 *         cdef int sound_player = -1
 *         cdef int i
 */
  __pyx_v_lowest_priority = 0x7FFFFFFF;

  /* "mpfmc/core/audio/track_standard.pyx":876
 * 
 *         cdef int lowest_priority = 2147483647
 *         cdef int sound_player = -1             # <<<<<<<<<<<<<<
 *         cdef int i
 * 
 */
  __pyx_v_sound_player = -1;

  /* "mpfmc/core/audio/track_standard.pyx":879
 *         cdef int i
 * 
 *         for i in range(self.type_state.sound_player_count):             # <<<<<<<<<<<<<<
 *             if self.type_state.sound_players[i].status == player_idle:
 *                 SDL_UnlockAudio()
 */
  __pyx_t_1 = __pyx_v_self->type_state->sound_player_count;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "mpfmc/core/audio/track_standard.pyx":880
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status == player_idle:             # <<<<<<<<<<<<<<
 *                 SDL_UnlockAudio()
 *                 return i, None
 */
    __pyx_t_4 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status == __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_4) {

      /* "mpfmc/core/audio/track_standard.pyx":881
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status == player_idle:
 *                 SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *                 return i, None
 *             elif self.type_state.sound_players[i].current.sound_priority < lowest_priority:
 */
      SDL_UnlockAudio();

      /* "mpfmc/core/audio/track_standard.pyx":882
 *             if self.type_state.sound_players[i].status == player_idle:
 *                 SDL_UnlockAudio()
 *                 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_5 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 882, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_6, 1, Py_None);
      __pyx_t_5 = 0;
      __pyx_r = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "mpfmc/core/audio/track_standard.pyx":880
 * 
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status == player_idle:             # <<<<<<<<<<<<<<
 *                 SDL_UnlockAudio()
 *                 return i, None
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":883
 *                 SDL_UnlockAudio()
 *                 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_4 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_priority < __pyx_v_lowest_priority) != 0);
    if (__pyx_t_4) {

      /* "mpfmc/core/audio/track_standard.pyx":884
 *                 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_7 = (__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_priority;
      __pyx_v_lowest_priority = __pyx_t_7;

      /* "mpfmc/core/audio/track_standard.pyx":885
 *             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             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
      __pyx_v_sound_player = __pyx_v_i;

      /* "mpfmc/core/audio/track_standard.pyx":883
 *                 SDL_UnlockAudio()
 *                 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
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":887
 *                 sound_player = i
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *         return sound_player, lowest_priority
 * 
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":888
 * 
 *         SDL_UnlockAudio()
 *         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_6 = __Pyx_PyInt_From_int(__pyx_v_sound_player); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_lowest_priority); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":864
 *         SDL_UnlockAudio()
 * 
 *     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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":890
 *         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_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance, int __pyx_v_player, struct __pyx_opt_args_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player *__pyx_optional_args) {
  int __pyx_v_force = ((int)0);
  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;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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;
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":903
 *             True if sound instance was able to be played, False otherwise
 *         """
 *         self.log.debug("_play_sound_on_sound_player: %s, %s, %s", str(sound_instance), str(player), str(force))             # <<<<<<<<<<<<<<
 * 
 *         SDL_LockAudio()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_sound_instance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_player); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_force); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && 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_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_kp_u_play_sound_on_sound_player_s_s, __pyx_t_3, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 903, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_kp_u_play_sound_on_sound_player_s_s, __pyx_t_3, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 903, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 903, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = 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_3);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 903, __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;

  /* "mpfmc/core/audio/track_standard.pyx":905
 *         self.log.debug("_play_sound_on_sound_player: %s, %s, %s", str(sound_instance), str(player), str(force))
 * 
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         # The sound cannot be played if the track is stopped or paused
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":908
 * 
 *         # The sound cannot be played if the track is stopped or paused
 *         if self.state.status == track_status_stopped or self.state.status == track_status_paused:             # <<<<<<<<<<<<<<
 *             self.log.debug("_play_sound_on_sound_player - %s track is not currently playing and "
 *                            "therefore the request to play sound %s will be canceled",
 */
  switch (__pyx_v_self->__pyx_base.state->status) {
    case __pyx_e_5mpfmc_4core_5audio_5track_track_status_stopped:
    case __pyx_e_5mpfmc_4core_5audio_5track_track_status_paused:

    /* "mpfmc/core/audio/track_standard.pyx":909
 *         # The sound cannot be played if the track is stopped or paused
 *         if self.state.status == track_status_stopped or self.state.status == track_status_paused:
 *             self.log.debug("_play_sound_on_sound_player - %s track is not currently playing and "             # <<<<<<<<<<<<<<
 *                            "therefore the request to play sound %s will be canceled",
 *                            self.name, sound_instance.name)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "mpfmc/core/audio/track_standard.pyx":911
 *             self.log.debug("_play_sound_on_sound_player - %s track is not currently playing and "
 *                            "therefore the request to play sound %s will be canceled",
 *                            self.name, sound_instance.name)             # <<<<<<<<<<<<<<
 *             sound_instance.set_canceled()
 *             SDL_UnlockAudio()
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && 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;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_kp_u_play_sound_on_sound_player_s_tr, __pyx_t_8, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_kp_u_play_sound_on_sound_player_s_tr, __pyx_t_8, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 909, __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_play_sound_on_sound_player_s_tr);
      __Pyx_GIVEREF(__pyx_kp_u_play_sound_on_sound_player_s_tr);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_kp_u_play_sound_on_sound_player_s_tr);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_7, __pyx_t_6);
      __pyx_t_8 = 0;
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":912
 *                            "therefore the request to play sound %s will be canceled",
 *                            self.name, sound_instance.name)
 *             sound_instance.set_canceled()             # <<<<<<<<<<<<<<
 *             SDL_UnlockAudio()
 *             return False
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_set_canceled); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 912, __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;

    /* "mpfmc/core/audio/track_standard.pyx":913
 *                            self.name, sound_instance.name)
 *             sound_instance.set_canceled()
 *             SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    SDL_UnlockAudio();

    /* "mpfmc/core/audio/track_standard.pyx":914
 *             sound_instance.set_canceled()
 *             SDL_UnlockAudio()
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if not sound_instance.sound.loaded:
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":908
 * 
 *         # The sound cannot be played if the track is stopped or paused
 *         if self.state.status == track_status_stopped or self.state.status == track_status_paused:             # <<<<<<<<<<<<<<
 *             self.log.debug("_play_sound_on_sound_player - %s track is not currently playing and "
 *                            "therefore the request to play sound %s will be canceled",
 */
    break;
    default: break;
  }

  /* "mpfmc/core/audio/track_standard.pyx":916
 *             return False
 * 
 *         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, 916, __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, 916, __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, 916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = ((!__pyx_t_9) != 0);
  if (__pyx_t_10) {

    /* "mpfmc/core/audio/track_standard.pyx":917
 * 
 *         if not sound_instance.sound.loaded:
 *             self.log.debug("Specified sound is not loaded, could not "             # <<<<<<<<<<<<<<
 *                            "play sound %s", sound_instance.name)
 *             SDL_UnlockAudio()
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "mpfmc/core/audio/track_standard.pyx":918
 *         if not sound_instance.sound.loaded:
 *             self.log.debug("Specified sound is not loaded, could not "
 *                            "play sound %s", sound_instance.name)             # <<<<<<<<<<<<<<
 *             SDL_UnlockAudio()
 *             return False
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && 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_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_Specified_sound_is_not_loaded_co, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 917, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_Specified_sound_is_not_loaded_co, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 917, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 917, __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_Specified_sound_is_not_loaded_co);
      __Pyx_GIVEREF(__pyx_kp_u_Specified_sound_is_not_loaded_co);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_Specified_sound_is_not_loaded_co);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 917, __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_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":919
 *             self.log.debug("Specified sound is not loaded, could not "
 *                            "play sound %s", sound_instance.name)
 *             SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    SDL_UnlockAudio();

    /* "mpfmc/core/audio/track_standard.pyx":920
 *                            "play sound %s", sound_instance.name)
 *             SDL_UnlockAudio()
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         # Make sure the player in range
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":916
 *             return False
 * 
 *         if not sound_instance.sound.loaded:             # <<<<<<<<<<<<<<
 *             self.log.debug("Specified sound is not loaded, could not "
 *                            "play sound %s", sound_instance.name)
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":923
 * 
 *         # 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, 923, __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, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_t_8, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_9 = (__pyx_t_10 != 0);
  if (__pyx_t_9) {

    /* "mpfmc/core/audio/track_standard.pyx":926
 * 
 *             # 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_5mpfmc_4core_5audio_14track_standard_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) {

      /* "mpfmc/core/audio/track_standard.pyx":927
 *             # 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)
 *                 SDL_UnlockAudio()
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 927, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "mpfmc/core/audio/track_standard.pyx":928
 *             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)             # <<<<<<<<<<<<<<
 *                 SDL_UnlockAudio()
 *                 return False
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 928, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && 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_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_All_sound_players_are_currently, __pyx_t_1};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 927, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_All_sound_players_are_currently, __pyx_t_1};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 927, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 927, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = 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_6, 0+__pyx_t_7, __pyx_kp_u_All_sound_players_are_currently);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 927, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":929
 *                 self.log.debug("All sound players are currently in use, "
 *                                "could not play sound %s", sound_instance.name)
 *                 SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      SDL_UnlockAudio();

      /* "mpfmc/core/audio/track_standard.pyx":930
 *                                "could not play sound %s", sound_instance.name)
 *                 SDL_UnlockAudio()
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *             # Add sound to the dictionary of active sound instances
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "mpfmc/core/audio/track_standard.pyx":926
 * 
 *             # 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)
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":933
 * 
 *             # Add sound to the dictionary of active sound instances
 *             self.log.debug("Adding sound instance %s to active sound dictionary", str(sound_instance))             # <<<<<<<<<<<<<<
 *             self._playing_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, 933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_sound_instance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && 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_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_u_Adding_sound_instance_s_to_activ, __pyx_t_6};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 933, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_u_Adding_sound_instance_s_to_activ, __pyx_t_6};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 933, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 933, __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_Adding_sound_instance_s_to_activ);
      __Pyx_GIVEREF(__pyx_kp_u_Adding_sound_instance_s_to_activ);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_kp_u_Adding_sound_instance_s_to_activ);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 933, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":934
 *             # Add sound to the dictionary of active sound instances
 *             self.log.debug("Adding sound instance %s to active sound dictionary", str(sound_instance))
 *             self._playing_instances_by_id[sound_instance.id] = sound_instance             # <<<<<<<<<<<<<<
 * 
 *             # Check if sound player is idle
 */
    if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 934, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (unlikely(PyDict_SetItem(__pyx_v_self->_playing_instances_by_id, __pyx_t_8, __pyx_v_sound_instance) < 0)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":937
 * 
 *             # Check if sound player is idle
 *             if self.type_state.sound_players[player].status == player_idle:             # <<<<<<<<<<<<<<
 *                 # Start the player playing the sound instance
 *                 self._set_player_playing(cython.address(self.type_state.sound_players[player]), sound_instance)
 */
    __pyx_t_9 = (((__pyx_v_self->type_state->sound_players[__pyx_v_player]).status == __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_9) {

      /* "mpfmc/core/audio/track_standard.pyx":939
 *             if self.type_state.sound_players[player].status == player_idle:
 *                 # Start the player playing the sound instance
 *                 self._set_player_playing(cython.address(self.type_state.sound_players[player]), sound_instance)             # <<<<<<<<<<<<<<
 *             else:
 *                 # The player is currently busy playing another sound, force it to be replaced with the sound instance
 */
      __pyx_t_8 = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_player_playing(__pyx_v_self, (&(__pyx_v_self->type_state->sound_players[__pyx_v_player])), __pyx_v_sound_instance); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 939, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":937
 * 
 *             # Check if sound player is idle
 *             if self.type_state.sound_players[player].status == player_idle:             # <<<<<<<<<<<<<<
 *                 # Start the player playing the sound instance
 *                 self._set_player_playing(cython.address(self.type_state.sound_players[player]), sound_instance)
 */
      goto __pyx_L8;
    }

    /* "mpfmc/core/audio/track_standard.pyx":942
 *             else:
 *                 # The player is currently busy playing another sound, force it to be replaced with the sound instance
 *                 self._set_player_replacing(cython.address(self.type_state.sound_players[player]), sound_instance)             # <<<<<<<<<<<<<<
 * 
 *             self.log.debug("Sound %s is set to begin playback on standard track (loops=%d)",
 */
    /*else*/ {
      __pyx_t_8 = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_player_replacing(__pyx_v_self, (&(__pyx_v_self->type_state->sound_players[__pyx_v_player])), __pyx_v_sound_instance); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_L8:;

    /* "mpfmc/core/audio/track_standard.pyx":944
 *                 self._set_player_replacing(cython.address(self.type_state.sound_players[player]), sound_instance)
 * 
 *             self.log.debug("Sound %s is set to begin playback on standard track (loops=%d)",             # <<<<<<<<<<<<<<
 *                            sound_instance.name, sound_instance.loops)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "mpfmc/core/audio/track_standard.pyx":945
 * 
 *             self.log.debug("Sound %s is set to begin playback on standard track (loops=%d)",
 *                            sound_instance.name, sound_instance.loops)             # <<<<<<<<<<<<<<
 * 
 *             SDL_UnlockAudio()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_loops); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && 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_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_kp_u_Sound_s_is_set_to_begin_playback, __pyx_t_3, __pyx_t_6};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 944, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_kp_u_Sound_s_is_set_to_begin_playback, __pyx_t_3, __pyx_t_6};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 944, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 944, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = 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_5, 0+__pyx_t_7, __pyx_kp_u_Sound_s_is_set_to_begin_playback);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_t_6);
      __pyx_t_3 = 0;
      __pyx_t_6 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 944, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":947
 *                            sound_instance.name, sound_instance.loops)
 * 
 *             SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
    SDL_UnlockAudio();

    /* "mpfmc/core/audio/track_standard.pyx":948
 * 
 *             SDL_UnlockAudio()
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":923
 * 
 *         # 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
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":950
 *             return True
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":951
 * 
 *         SDL_UnlockAudio()
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef _set_player_sound_settings(self, SoundSettings *sound_settings, object sound_instance):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":890
 *         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("mpfmc.core.audio.track_standard.TrackStandard._play_sound_on_sound_player", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":953
 *         return False
 * 
 *     cdef _set_player_sound_settings(self, SoundSettings *sound_settings, object sound_instance):             # <<<<<<<<<<<<<<
 *         """
 *         Set sound settings for the player from the sound instance.
 */

static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__set_player_sound_settings(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings *__pyx_v_sound_settings, PyObject *__pyx_v_sound_instance) {
  struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundFile *__pyx_v_sound_container = 0;
  PyObject *__pyx_v_index = NULL;
  CYTHON_UNUSED GstStateChangeReturn __pyx_v_ret;
  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;
  PyObject *__pyx_t_6 = NULL;
  Uint32 __pyx_t_7;
  Uint64 __pyx_t_8;
  Uint8 __pyx_t_9;
  int __pyx_t_10;
  float __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  guint __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  guint __pyx_t_16;
  Sint32 __pyx_t_17;
  gint64 __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_player_sound_settings", 0);

  /* "mpfmc/core/audio/track_standard.pyx":962
 *         cdef int bytes_per_sample_frame
 * 
 *         if sound_settings == NULL or sound_instance is None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_2 = ((__pyx_v_sound_settings == NULL) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_sound_instance == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":963
 * 
 *         if sound_settings == NULL or sound_instance is None:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         # Get the sound sample buffer container
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":962
 *         cdef int bytes_per_sample_frame
 * 
 *         if sound_settings == NULL or sound_instance is None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":966
 * 
 *         # Get the sound sample buffer container
 *         cdef SoundFile sound_container = sound_instance.container             # <<<<<<<<<<<<<<
 * 
 *         # Setup the player to start playing the sound
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_container); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5mpfmc_4core_5audio_10sound_file_SoundFile))))) __PYX_ERR(0, 966, __pyx_L1_error)
  __pyx_v_sound_container = ((struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundFile *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":969
 * 
 *         # Setup the player to start playing the sound
 *         sound_settings.sample_pos = <Uint32>(sound_instance.start_at * self.state.callback_data.seconds_to_bytes_factor)             # <<<<<<<<<<<<<<
 *         sound_settings.sample_pos = self._fix_sample_frame_pos(sound_settings.sample_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *         if sound_settings.sample_pos > sound_container.sample.size:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_start_at); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_Uint32(__pyx_t_6); if (unlikely((__pyx_t_7 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_sound_settings->sample_pos = ((Uint32)__pyx_t_7);

  /* "mpfmc/core/audio/track_standard.pyx":970
 *         # Setup the player to start playing the sound
 *         sound_settings.sample_pos = <Uint32>(sound_instance.start_at * self.state.callback_data.seconds_to_bytes_factor)
 *         sound_settings.sample_pos = self._fix_sample_frame_pos(sound_settings.sample_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)             # <<<<<<<<<<<<<<
 *         if sound_settings.sample_pos > sound_container.sample.size:
 *             sound_settings.sample_pos = 0
 */
  __pyx_v_sound_settings->sample_pos = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_fix_sample_frame_pos(__pyx_v_self, __pyx_v_sound_settings->sample_pos, __pyx_v_self->__pyx_base.state->callback_data->bytes_per_sample, __pyx_v_self->__pyx_base.state->callback_data->channels);

  /* "mpfmc/core/audio/track_standard.pyx":971
 *         sound_settings.sample_pos = <Uint32>(sound_instance.start_at * self.state.callback_data.seconds_to_bytes_factor)
 *         sound_settings.sample_pos = self._fix_sample_frame_pos(sound_settings.sample_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *         if sound_settings.sample_pos > sound_container.sample.size:             # <<<<<<<<<<<<<<
 *             sound_settings.sample_pos = 0
 * 
 */
  __pyx_t_1 = ((__pyx_v_sound_settings->sample_pos > __pyx_v_sound_container->sample.size) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":972
 *         sound_settings.sample_pos = self._fix_sample_frame_pos(sound_settings.sample_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *         if sound_settings.sample_pos > sound_container.sample.size:
 *             sound_settings.sample_pos = 0             # <<<<<<<<<<<<<<
 * 
 *         # Setup loop start position (defaults to 0)
 */
    __pyx_v_sound_settings->sample_pos = 0;

    /* "mpfmc/core/audio/track_standard.pyx":971
 *         sound_settings.sample_pos = <Uint32>(sound_instance.start_at * self.state.callback_data.seconds_to_bytes_factor)
 *         sound_settings.sample_pos = self._fix_sample_frame_pos(sound_settings.sample_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *         if sound_settings.sample_pos > sound_container.sample.size:             # <<<<<<<<<<<<<<
 *             sound_settings.sample_pos = 0
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":975
 * 
 *         # Setup loop start position (defaults to 0)
 *         sound_settings.loop_start_pos = <Uint32>(sound_instance.loop_start_at * self.state.callback_data.seconds_to_bytes_factor)             # <<<<<<<<<<<<<<
 *         sound_settings.loop_start_pos = self._fix_sample_frame_pos(sound_settings.loop_start_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *         if sound_settings.loop_start_pos > sound_container.sample.size:
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_loop_start_at); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_Uint32(__pyx_t_4); if (unlikely((__pyx_t_7 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_sound_settings->loop_start_pos = ((Uint32)__pyx_t_7);

  /* "mpfmc/core/audio/track_standard.pyx":976
 *         # Setup loop start position (defaults to 0)
 *         sound_settings.loop_start_pos = <Uint32>(sound_instance.loop_start_at * self.state.callback_data.seconds_to_bytes_factor)
 *         sound_settings.loop_start_pos = self._fix_sample_frame_pos(sound_settings.loop_start_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)             # <<<<<<<<<<<<<<
 *         if sound_settings.loop_start_pos > sound_container.sample.size:
 *             sound_settings.loop_start_pos = 0
 */
  __pyx_v_sound_settings->loop_start_pos = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_fix_sample_frame_pos(__pyx_v_self, __pyx_v_sound_settings->loop_start_pos, __pyx_v_self->__pyx_base.state->callback_data->bytes_per_sample, __pyx_v_self->__pyx_base.state->callback_data->channels);

  /* "mpfmc/core/audio/track_standard.pyx":977
 *         sound_settings.loop_start_pos = <Uint32>(sound_instance.loop_start_at * self.state.callback_data.seconds_to_bytes_factor)
 *         sound_settings.loop_start_pos = self._fix_sample_frame_pos(sound_settings.loop_start_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *         if sound_settings.loop_start_pos > sound_container.sample.size:             # <<<<<<<<<<<<<<
 *             sound_settings.loop_start_pos = 0
 * 
 */
  __pyx_t_1 = ((__pyx_v_sound_settings->loop_start_pos > __pyx_v_sound_container->sample.size) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":978
 *         sound_settings.loop_start_pos = self._fix_sample_frame_pos(sound_settings.loop_start_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *         if sound_settings.loop_start_pos > sound_container.sample.size:
 *             sound_settings.loop_start_pos = 0             # <<<<<<<<<<<<<<
 * 
 *         # Setup loop end position (if loop_end_at is None, set loop end to end of sound)
 */
    __pyx_v_sound_settings->loop_start_pos = 0;

    /* "mpfmc/core/audio/track_standard.pyx":977
 *         sound_settings.loop_start_pos = <Uint32>(sound_instance.loop_start_at * self.state.callback_data.seconds_to_bytes_factor)
 *         sound_settings.loop_start_pos = self._fix_sample_frame_pos(sound_settings.loop_start_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *         if sound_settings.loop_start_pos > sound_container.sample.size:             # <<<<<<<<<<<<<<
 *             sound_settings.loop_start_pos = 0
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":981
 * 
 *         # Setup loop end position (if loop_end_at is None, set loop end to end of sound)
 *         if sound_instance.loop_end_at is None:             # <<<<<<<<<<<<<<
 *             sound_settings.loop_end_pos = sound_container.sample.size
 *         else:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_loop_end_at); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = (__pyx_t_4 == Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "mpfmc/core/audio/track_standard.pyx":982
 *         # Setup loop end position (if loop_end_at is None, set loop end to end of sound)
 *         if sound_instance.loop_end_at is None:
 *             sound_settings.loop_end_pos = sound_container.sample.size             # <<<<<<<<<<<<<<
 *         else:
 *             sound_settings.loop_end_pos = <Uint32>(sound_instance.loop_end_at * self.state.callback_data.seconds_to_bytes_factor)
 */
    __pyx_t_7 = __pyx_v_sound_container->sample.size;
    __pyx_v_sound_settings->loop_end_pos = __pyx_t_7;

    /* "mpfmc/core/audio/track_standard.pyx":981
 * 
 *         # Setup loop end position (if loop_end_at is None, set loop end to end of sound)
 *         if sound_instance.loop_end_at is None:             # <<<<<<<<<<<<<<
 *             sound_settings.loop_end_pos = sound_container.sample.size
 *         else:
 */
    goto __pyx_L8;
  }

  /* "mpfmc/core/audio/track_standard.pyx":984
 *             sound_settings.loop_end_pos = sound_container.sample.size
 *         else:
 *             sound_settings.loop_end_pos = <Uint32>(sound_instance.loop_end_at * self.state.callback_data.seconds_to_bytes_factor)             # <<<<<<<<<<<<<<
 *             sound_settings.loop_end_pos = self._fix_sample_frame_pos(sound_settings.loop_end_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *             if sound_settings.loop_end_pos > sound_container.sample.size:
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_loop_end_at); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyInt_As_Uint32(__pyx_t_6); if (unlikely((__pyx_t_7 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_sound_settings->loop_end_pos = ((Uint32)__pyx_t_7);

    /* "mpfmc/core/audio/track_standard.pyx":985
 *         else:
 *             sound_settings.loop_end_pos = <Uint32>(sound_instance.loop_end_at * self.state.callback_data.seconds_to_bytes_factor)
 *             sound_settings.loop_end_pos = self._fix_sample_frame_pos(sound_settings.loop_end_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)             # <<<<<<<<<<<<<<
 *             if sound_settings.loop_end_pos > sound_container.sample.size:
 *                 sound_settings.loop_end_pos = sound_container.sample.size
 */
    __pyx_v_sound_settings->loop_end_pos = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_fix_sample_frame_pos(__pyx_v_self, __pyx_v_sound_settings->loop_end_pos, __pyx_v_self->__pyx_base.state->callback_data->bytes_per_sample, __pyx_v_self->__pyx_base.state->callback_data->channels);

    /* "mpfmc/core/audio/track_standard.pyx":986
 *             sound_settings.loop_end_pos = <Uint32>(sound_instance.loop_end_at * self.state.callback_data.seconds_to_bytes_factor)
 *             sound_settings.loop_end_pos = self._fix_sample_frame_pos(sound_settings.loop_end_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *             if sound_settings.loop_end_pos > sound_container.sample.size:             # <<<<<<<<<<<<<<
 *                 sound_settings.loop_end_pos = sound_container.sample.size
 * 
 */
    __pyx_t_3 = ((__pyx_v_sound_settings->loop_end_pos > __pyx_v_sound_container->sample.size) != 0);
    if (__pyx_t_3) {

      /* "mpfmc/core/audio/track_standard.pyx":987
 *             sound_settings.loop_end_pos = self._fix_sample_frame_pos(sound_settings.loop_end_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *             if sound_settings.loop_end_pos > sound_container.sample.size:
 *                 sound_settings.loop_end_pos = sound_container.sample.size             # <<<<<<<<<<<<<<
 * 
 *         sound_settings.current_loop = 0
 */
      __pyx_t_7 = __pyx_v_sound_container->sample.size;
      __pyx_v_sound_settings->loop_end_pos = __pyx_t_7;

      /* "mpfmc/core/audio/track_standard.pyx":986
 *             sound_settings.loop_end_pos = <Uint32>(sound_instance.loop_end_at * self.state.callback_data.seconds_to_bytes_factor)
 *             sound_settings.loop_end_pos = self._fix_sample_frame_pos(sound_settings.loop_end_pos, self.state.callback_data.bytes_per_sample, self.state.callback_data.channels)
 *             if sound_settings.loop_end_pos > sound_container.sample.size:             # <<<<<<<<<<<<<<
 *                 sound_settings.loop_end_pos = sound_container.sample.size
 * 
 */
    }
  }
  __pyx_L8:;

  /* "mpfmc/core/audio/track_standard.pyx":989
 *                 sound_settings.loop_end_pos = sound_container.sample.size
 * 
 *         sound_settings.current_loop = 0             # <<<<<<<<<<<<<<
 *         sound_settings.sound_id = sound_instance.sound_id
 *         sound_settings.sound_instance_id = sound_instance.id
 */
  __pyx_v_sound_settings->current_loop = 0;

  /* "mpfmc/core/audio/track_standard.pyx":990
 * 
 *         sound_settings.current_loop = 0
 *         sound_settings.sound_id = sound_instance.sound_id             # <<<<<<<<<<<<<<
 *         sound_settings.sound_instance_id = sound_instance.id
 *         sound_settings.sample = cython.address(sound_container.sample)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_PyInt_As_Uint64(__pyx_t_6); if (unlikely((__pyx_t_8 == ((Uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 990, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_sound_settings->sound_id = __pyx_t_8;

  /* "mpfmc/core/audio/track_standard.pyx":991
 *         sound_settings.current_loop = 0
 *         sound_settings.sound_id = sound_instance.sound_id
 *         sound_settings.sound_instance_id = sound_instance.id             # <<<<<<<<<<<<<<
 *         sound_settings.sample = cython.address(sound_container.sample)
 *         sound_settings.volume = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_PyInt_As_Uint64(__pyx_t_6); if (unlikely((__pyx_t_8 == ((Uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 991, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_sound_settings->sound_instance_id = __pyx_t_8;

  /* "mpfmc/core/audio/track_standard.pyx":992
 *         sound_settings.sound_id = sound_instance.sound_id
 *         sound_settings.sound_instance_id = sound_instance.id
 *         sound_settings.sample = cython.address(sound_container.sample)             # <<<<<<<<<<<<<<
 *         sound_settings.volume = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME)
 *         sound_settings.volume_left = sound_settings.volume
 */
  __pyx_v_sound_settings->sample = (&__pyx_v_sound_container->sample);

  /* "mpfmc/core/audio/track_standard.pyx":993
 *         sound_settings.sound_instance_id = sound_instance.id
 *         sound_settings.sample = cython.address(sound_container.sample)
 *         sound_settings.volume = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME)             # <<<<<<<<<<<<<<
 *         sound_settings.volume_left = sound_settings.volume
 *         sound_settings.volume_right = sound_settings.volume
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_volume); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_From_int(SDL_MIX_MAXVOLUME); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_Uint8(__pyx_t_4); if (unlikely((__pyx_t_9 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_sound_settings->volume = ((Uint8)__pyx_t_9);

  /* "mpfmc/core/audio/track_standard.pyx":994
 *         sound_settings.sample = cython.address(sound_container.sample)
 *         sound_settings.volume = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME)
 *         sound_settings.volume_left = sound_settings.volume             # <<<<<<<<<<<<<<
 *         sound_settings.volume_right = sound_settings.volume
 *         sound_settings.loops_remaining = sound_instance.loops
 */
  __pyx_t_9 = __pyx_v_sound_settings->volume;
  __pyx_v_sound_settings->volume_left = __pyx_t_9;

  /* "mpfmc/core/audio/track_standard.pyx":995
 *         sound_settings.volume = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME)
 *         sound_settings.volume_left = sound_settings.volume
 *         sound_settings.volume_right = sound_settings.volume             # <<<<<<<<<<<<<<
 *         sound_settings.loops_remaining = sound_instance.loops
 *         sound_settings.sound_priority = sound_instance.priority
 */
  __pyx_t_9 = __pyx_v_sound_settings->volume;
  __pyx_v_sound_settings->volume_right = __pyx_t_9;

  /* "mpfmc/core/audio/track_standard.pyx":996
 *         sound_settings.volume_left = sound_settings.volume
 *         sound_settings.volume_right = sound_settings.volume
 *         sound_settings.loops_remaining = sound_instance.loops             # <<<<<<<<<<<<<<
 *         sound_settings.sound_priority = sound_instance.priority
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_loops); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 996, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_sound_settings->loops_remaining = __pyx_t_10;

  /* "mpfmc/core/audio/track_standard.pyx":997
 *         sound_settings.volume_right = sound_settings.volume
 *         sound_settings.loops_remaining = sound_instance.loops
 *         sound_settings.sound_priority = sound_instance.priority             # <<<<<<<<<<<<<<
 * 
 *         # If the sound is not set to loop, adjust the loop end position to the end of the sound
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_priority); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 997, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_sound_settings->sound_priority = __pyx_t_10;

  /* "mpfmc/core/audio/track_standard.pyx":1000
 * 
 *         # If the sound is not set to loop, adjust the loop end position to the end of the sound
 *         if sound_settings.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *             sound_settings.loop_end_pos = sound_container.sample.size
 * 
 */
  __pyx_t_3 = ((__pyx_v_sound_settings->loops_remaining == 0) != 0);
  if (__pyx_t_3) {

    /* "mpfmc/core/audio/track_standard.pyx":1001
 *         # If the sound is not set to loop, adjust the loop end position to the end of the sound
 *         if sound_settings.loops_remaining == 0:
 *             sound_settings.loop_end_pos = sound_container.sample.size             # <<<<<<<<<<<<<<
 * 
 *         # Apply simple linear pan/balance setting
 */
    __pyx_t_7 = __pyx_v_sound_container->sample.size;
    __pyx_v_sound_settings->loop_end_pos = __pyx_t_7;

    /* "mpfmc/core/audio/track_standard.pyx":1000
 * 
 *         # If the sound is not set to loop, adjust the loop end position to the end of the sound
 *         if sound_settings.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *             sound_settings.loop_end_pos = sound_container.sample.size
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":1004
 * 
 *         # Apply simple linear pan/balance setting
 *         if self.state.callback_data.channels == 2:             # <<<<<<<<<<<<<<
 *             if sound_instance.pan < 0:
 *                 sound_settings.volume_left = sound_settings.volume
 */
  __pyx_t_3 = ((__pyx_v_self->__pyx_base.state->callback_data->channels == 2) != 0);
  if (__pyx_t_3) {

    /* "mpfmc/core/audio/track_standard.pyx":1005
 *         # Apply simple linear pan/balance setting
 *         if self.state.callback_data.channels == 2:
 *             if sound_instance.pan < 0:             # <<<<<<<<<<<<<<
 *                 sound_settings.volume_left = sound_settings.volume
 *                 sound_settings.volume_right = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME * in_out_quad(sound_instance.pan + 1.0))
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_pan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1005, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1005, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_3) {

      /* "mpfmc/core/audio/track_standard.pyx":1006
 *         if self.state.callback_data.channels == 2:
 *             if sound_instance.pan < 0:
 *                 sound_settings.volume_left = sound_settings.volume             # <<<<<<<<<<<<<<
 *                 sound_settings.volume_right = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME * in_out_quad(sound_instance.pan + 1.0))
 *             else:
 */
      __pyx_t_9 = __pyx_v_sound_settings->volume;
      __pyx_v_sound_settings->volume_left = __pyx_t_9;

      /* "mpfmc/core/audio/track_standard.pyx":1007
 *             if sound_instance.pan < 0:
 *                 sound_settings.volume_left = sound_settings.volume
 *                 sound_settings.volume_right = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME * in_out_quad(sound_instance.pan + 1.0))             # <<<<<<<<<<<<<<
 *             else:
 *                 sound_settings.volume_left = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME * in_out_quad(1.0 - sound_instance.pan))
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_volume); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyInt_From_int(SDL_MIX_MAXVOLUME); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_pan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyFloat_AddObjC(__pyx_t_4, __pyx_float_1_0, 1.0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_5); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyFloat_FromDouble(__pyx_f_5mpfmc_4core_5audio_6inline_in_out_quad(__pyx_t_11)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = __Pyx_PyInt_As_Uint8(__pyx_t_4); if (unlikely((__pyx_t_9 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_sound_settings->volume_right = ((Uint8)__pyx_t_9);

      /* "mpfmc/core/audio/track_standard.pyx":1005
 *         # Apply simple linear pan/balance setting
 *         if self.state.callback_data.channels == 2:
 *             if sound_instance.pan < 0:             # <<<<<<<<<<<<<<
 *                 sound_settings.volume_left = sound_settings.volume
 *                 sound_settings.volume_right = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME * in_out_quad(sound_instance.pan + 1.0))
 */
      goto __pyx_L12;
    }

    /* "mpfmc/core/audio/track_standard.pyx":1009
 *                 sound_settings.volume_right = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME * in_out_quad(sound_instance.pan + 1.0))
 *             else:
 *                 sound_settings.volume_left = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME * in_out_quad(1.0 - sound_instance.pan))             # <<<<<<<<<<<<<<
 *                 sound_settings.volume_right = sound_settings.volume
 * 
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_volume); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(SDL_MIX_MAXVOLUME); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_pan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyFloat_SubtractCObj(__pyx_float_1_0, __pyx_t_5, 1.0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_f_5mpfmc_4core_5audio_6inline_in_out_quad(__pyx_t_11)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = __Pyx_PyInt_As_Uint8(__pyx_t_5); if (unlikely((__pyx_t_9 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_sound_settings->volume_left = ((Uint8)__pyx_t_9);

      /* "mpfmc/core/audio/track_standard.pyx":1010
 *             else:
 *                 sound_settings.volume_left = <Uint8>(sound_instance.volume * SDL_MIX_MAXVOLUME * in_out_quad(1.0 - sound_instance.pan))
 *                 sound_settings.volume_right = sound_settings.volume             # <<<<<<<<<<<<<<
 * 
 *         # Fading (done at control rate; need to calculate the number of steps over which to fade in/out)
 */
      __pyx_t_9 = __pyx_v_sound_settings->volume;
      __pyx_v_sound_settings->volume_right = __pyx_t_9;
    }
    __pyx_L12:;

    /* "mpfmc/core/audio/track_standard.pyx":1004
 * 
 *         # Apply simple linear pan/balance setting
 *         if self.state.callback_data.channels == 2:             # <<<<<<<<<<<<<<
 *             if sound_instance.pan < 0:
 *                 sound_settings.volume_left = sound_settings.volume
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":1013
 * 
 *         # Fading (done at control rate; need to calculate the number of steps over which to fade in/out)
 *         sound_settings.fade_in_steps = sound_instance.fade_in * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point             # <<<<<<<<<<<<<<
 *         sound_settings.fade_out_steps = sound_instance.fade_out * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point
 *         sound_settings.fade_steps_remaining = sound_settings.fade_in_steps
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_fade_in); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_Uint16(__pyx_v_self->__pyx_base.state->callback_data->bytes_per_control_point); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_FloorDivide(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_Uint32(__pyx_t_5); if (unlikely((__pyx_t_7 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_sound_settings->fade_in_steps = __pyx_t_7;

  /* "mpfmc/core/audio/track_standard.pyx":1014
 *         # Fading (done at control rate; need to calculate the number of steps over which to fade in/out)
 *         sound_settings.fade_in_steps = sound_instance.fade_in * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point
 *         sound_settings.fade_out_steps = sound_instance.fade_out * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point             # <<<<<<<<<<<<<<
 *         sound_settings.fade_steps_remaining = sound_settings.fade_in_steps
 *         if sound_settings.fade_steps_remaining > 0:
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_fade_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_Uint16(__pyx_v_self->__pyx_base.state->callback_data->bytes_per_control_point); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_FloorDivide(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_Uint32(__pyx_t_5); if (unlikely((__pyx_t_7 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_sound_settings->fade_out_steps = __pyx_t_7;

  /* "mpfmc/core/audio/track_standard.pyx":1015
 *         sound_settings.fade_in_steps = sound_instance.fade_in * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point
 *         sound_settings.fade_out_steps = sound_instance.fade_out * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point
 *         sound_settings.fade_steps_remaining = sound_settings.fade_in_steps             # <<<<<<<<<<<<<<
 *         if sound_settings.fade_steps_remaining > 0:
 *             sound_settings.fading_status = fading_status_fading_in
 */
  __pyx_t_7 = __pyx_v_sound_settings->fade_in_steps;
  __pyx_v_sound_settings->fade_steps_remaining = __pyx_t_7;

  /* "mpfmc/core/audio/track_standard.pyx":1016
 *         sound_settings.fade_out_steps = sound_instance.fade_out * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point
 *         sound_settings.fade_steps_remaining = sound_settings.fade_in_steps
 *         if sound_settings.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *             sound_settings.fading_status = fading_status_fading_in
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_sound_settings->fade_steps_remaining > 0) != 0);
  if (__pyx_t_3) {

    /* "mpfmc/core/audio/track_standard.pyx":1017
 *         sound_settings.fade_steps_remaining = sound_settings.fade_in_steps
 *         if sound_settings.fade_steps_remaining > 0:
 *             sound_settings.fading_status = fading_status_fading_in             # <<<<<<<<<<<<<<
 *         else:
 *             sound_settings.fading_status = fading_status_not_fading
 */
    __pyx_v_sound_settings->fading_status = __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_in;

    /* "mpfmc/core/audio/track_standard.pyx":1016
 *         sound_settings.fade_out_steps = sound_instance.fade_out * self.state.callback_data.seconds_to_bytes_factor // self.state.callback_data.bytes_per_control_point
 *         sound_settings.fade_steps_remaining = sound_settings.fade_in_steps
 *         if sound_settings.fade_steps_remaining > 0:             # <<<<<<<<<<<<<<
 *             sound_settings.fading_status = fading_status_fading_in
 *         else:
 */
    goto __pyx_L13;
  }

  /* "mpfmc/core/audio/track_standard.pyx":1019
 *             sound_settings.fading_status = fading_status_fading_in
 *         else:
 *             sound_settings.fading_status = fading_status_not_fading             # <<<<<<<<<<<<<<
 * 
 *         # Markers
 */
  /*else*/ {
    __pyx_v_sound_settings->fading_status = __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_not_fading;
  }
  __pyx_L13:;

  /* "mpfmc/core/audio/track_standard.pyx":1022
 * 
 *         # Markers
 *         sound_settings.marker_count = sound_instance.marker_count             # <<<<<<<<<<<<<<
 *         g_array_set_size(sound_settings.markers, sound_settings.marker_count)
 *         for index in range(sound_instance.marker_count):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_marker_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = __Pyx_PyInt_As_Uint8(__pyx_t_5); if (unlikely((__pyx_t_9 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1022, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_sound_settings->marker_count = __pyx_t_9;

  /* "mpfmc/core/audio/track_standard.pyx":1023
 *         # Markers
 *         sound_settings.marker_count = sound_instance.marker_count
 *         g_array_set_size(sound_settings.markers, sound_settings.marker_count)             # <<<<<<<<<<<<<<
 *         for index in range(sound_instance.marker_count):
 *             g_array_insert_val_uint(sound_settings.markers,
 */
  (void)(g_array_set_size(__pyx_v_sound_settings->markers, __pyx_v_sound_settings->marker_count));

  /* "mpfmc/core/audio/track_standard.pyx":1024
 *         sound_settings.marker_count = sound_instance.marker_count
 *         g_array_set_size(sound_settings.markers, sound_settings.marker_count)
 *         for index in range(sound_instance.marker_count):             # <<<<<<<<<<<<<<
 *             g_array_insert_val_uint(sound_settings.markers,
 *                                     index,
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_marker_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_12 = 0;
    __pyx_t_13 = NULL;
  } else {
    __pyx_t_12 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1024, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1024, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_13)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1024, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1024, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1024, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1024, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_13(__pyx_t_5);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1024, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1026
 *         for index in range(sound_instance.marker_count):
 *             g_array_insert_val_uint(sound_settings.markers,
 *                                     index,             # <<<<<<<<<<<<<<
 *                                     <guint>(sound_instance.markers[index]['time'] * self.state.callback_data.seconds_to_bytes_factor))
 * 
 */
    __pyx_t_14 = __Pyx_PyInt_As_guint(__pyx_v_index); if (unlikely((__pyx_t_14 == ((guint)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1026, __pyx_L1_error)

    /* "mpfmc/core/audio/track_standard.pyx":1027
 *             g_array_insert_val_uint(sound_settings.markers,
 *                                     index,
 *                                     <guint>(sound_instance.markers[index]['time'] * self.state.callback_data.seconds_to_bytes_factor))             # <<<<<<<<<<<<<<
 * 
 *         # Set almost finished marker (calculate based on the end of the sound)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_markers); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_u_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_15 = PyNumber_Multiply(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_16 = __Pyx_PyInt_As_guint(__pyx_t_15); if (unlikely((__pyx_t_16 == ((guint)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1027, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1025
 *         g_array_set_size(sound_settings.markers, sound_settings.marker_count)
 *         for index in range(sound_instance.marker_count):
 *             g_array_insert_val_uint(sound_settings.markers,             # <<<<<<<<<<<<<<
 *                                     index,
 *                                     <guint>(sound_instance.markers[index]['time'] * self.state.callback_data.seconds_to_bytes_factor))
 */
    g_array_insert_val_uint(__pyx_v_sound_settings->markers, __pyx_t_14, ((guint)__pyx_t_16));

    /* "mpfmc/core/audio/track_standard.pyx":1024
 *         sound_settings.marker_count = sound_instance.marker_count
 *         g_array_set_size(sound_settings.markers, sound_settings.marker_count)
 *         for index in range(sound_instance.marker_count):             # <<<<<<<<<<<<<<
 *             g_array_insert_val_uint(sound_settings.markers,
 *                                     index,
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1030
 * 
 *         # Set almost finished marker (calculate based on the end of the sound)
 *         if sound_instance.about_to_finish_time is None:             # <<<<<<<<<<<<<<
 *             sound_settings.about_to_finish_marker = no_marker
 *         elif sound_instance.about_to_finish_time > sound_container.duration:
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_about_to_finish_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = (__pyx_t_5 == Py_None);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1031
 *         # Set almost finished marker (calculate based on the end of the sound)
 *         if sound_instance.about_to_finish_time is None:
 *             sound_settings.about_to_finish_marker = no_marker             # <<<<<<<<<<<<<<
 *         elif sound_instance.about_to_finish_time > sound_container.duration:
 *             sound_settings.about_to_finish_marker = 0
 */
    __pyx_v_sound_settings->about_to_finish_marker = __pyx_e_5mpfmc_4core_5audio_14track_standard_no_marker;

    /* "mpfmc/core/audio/track_standard.pyx":1030
 * 
 *         # Set almost finished marker (calculate based on the end of the sound)
 *         if sound_instance.about_to_finish_time is None:             # <<<<<<<<<<<<<<
 *             sound_settings.about_to_finish_marker = no_marker
 *         elif sound_instance.about_to_finish_time > sound_container.duration:
 */
    goto __pyx_L16;
  }

  /* "mpfmc/core/audio/track_standard.pyx":1032
 *         if sound_instance.about_to_finish_time is None:
 *             sound_settings.about_to_finish_marker = no_marker
 *         elif sound_instance.about_to_finish_time > sound_container.duration:             # <<<<<<<<<<<<<<
 *             sound_settings.about_to_finish_marker = 0
 *         else:
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_about_to_finish_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sound_container), __pyx_n_s_duration); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_15, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1032, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1032, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1033
 *             sound_settings.about_to_finish_marker = no_marker
 *         elif sound_instance.about_to_finish_time > sound_container.duration:
 *             sound_settings.about_to_finish_marker = 0             # <<<<<<<<<<<<<<
 *         else:
 *             sound_settings.about_to_finish_marker = (sound_container.duration - sound_instance.about_to_finish_time) * self.state.callback_data.seconds_to_bytes_factor
 */
    __pyx_v_sound_settings->about_to_finish_marker = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1032
 *         if sound_instance.about_to_finish_time is None:
 *             sound_settings.about_to_finish_marker = no_marker
 *         elif sound_instance.about_to_finish_time > sound_container.duration:             # <<<<<<<<<<<<<<
 *             sound_settings.about_to_finish_marker = 0
 *         else:
 */
    goto __pyx_L16;
  }

  /* "mpfmc/core/audio/track_standard.pyx":1035
 *             sound_settings.about_to_finish_marker = 0
 *         else:
 *             sound_settings.about_to_finish_marker = (sound_container.duration - sound_instance.about_to_finish_time) * self.state.callback_data.seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 * 
 *         # If the sound has ducking settings, apply them
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sound_container), __pyx_n_s_duration); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_about_to_finish_time); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_6, __pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_7 = __Pyx_PyInt_As_Uint32(__pyx_t_6); if (unlikely((__pyx_t_7 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_sound_settings->about_to_finish_marker = __pyx_t_7;
  }
  __pyx_L16:;

  /* "mpfmc/core/audio/track_standard.pyx":1038
 * 
 *         # 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 (samples per second), the number of audio channels, and the
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = (__pyx_t_6 != Py_None);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L18_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_track_bit_mask); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_NeObjC(__pyx_t_15, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_L18_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1042
 *             # account for the sample rate (samples per second), the number of audio channels, and the
 *             # number of bytes per sample (all samples are 16 bits)
 *             sound_settings.sound_has_ducking = True             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_stage = ducking_stage_delay
 *             sound_settings.ducking_settings.track_bit_mask = sound_instance.ducking.track_bit_mask
 */
    __pyx_v_sound_settings->sound_has_ducking = 1;

    /* "mpfmc/core/audio/track_standard.pyx":1043
 *             # number of bytes per sample (all samples are 16 bits)
 *             sound_settings.sound_has_ducking = True
 *             sound_settings.ducking_stage = ducking_stage_delay             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.track_bit_mask = sound_instance.ducking.track_bit_mask
 *             sound_settings.ducking_settings.attack_start_pos = sound_instance.ducking.delay * self.state.callback_data.seconds_to_bytes_factor
 */
    __pyx_v_sound_settings->ducking_stage = __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_delay;

    /* "mpfmc/core/audio/track_standard.pyx":1044
 *             sound_settings.sound_has_ducking = True
 *             sound_settings.ducking_stage = ducking_stage_delay
 *             sound_settings.ducking_settings.track_bit_mask = sound_instance.ducking.track_bit_mask             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.attack_start_pos = sound_instance.ducking.delay * self.state.callback_data.seconds_to_bytes_factor
 *             sound_settings.ducking_settings.attack_duration = sound_instance.ducking.attack * self.state.callback_data.seconds_to_bytes_factor
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_track_bit_mask); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_15); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_sound_settings->ducking_settings.track_bit_mask = __pyx_t_10;

    /* "mpfmc/core/audio/track_standard.pyx":1045
 *             sound_settings.ducking_stage = ducking_stage_delay
 *             sound_settings.ducking_settings.track_bit_mask = sound_instance.ducking.track_bit_mask
 *             sound_settings.ducking_settings.attack_start_pos = sound_instance.ducking.delay * self.state.callback_data.seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.attack_duration = sound_instance.ducking.attack * self.state.callback_data.seconds_to_bytes_factor
 *             sound_settings.ducking_settings.attenuation_volume = <Uint8>(sound_instance.ducking.attenuation * SDL_MIX_MAXVOLUME)
 */
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1045, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_delay); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1045, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1045, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1045, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_17 = __Pyx_PyInt_As_Sint32(__pyx_t_5); if (unlikely((__pyx_t_17 == ((Sint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1045, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_sound_settings->ducking_settings.attack_start_pos = __pyx_t_17;

    /* "mpfmc/core/audio/track_standard.pyx":1046
 *             sound_settings.ducking_settings.track_bit_mask = sound_instance.ducking.track_bit_mask
 *             sound_settings.ducking_settings.attack_start_pos = sound_instance.ducking.delay * self.state.callback_data.seconds_to_bytes_factor
 *             sound_settings.ducking_settings.attack_duration = sound_instance.ducking.attack * self.state.callback_data.seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.attenuation_volume = <Uint8>(sound_instance.ducking.attenuation * SDL_MIX_MAXVOLUME)
 *             sound_settings.ducking_settings.release_duration = sound_instance.ducking.release * self.state.callback_data.seconds_to_bytes_factor
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_attack); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_17 = __Pyx_PyInt_As_Sint32(__pyx_t_6); if (unlikely((__pyx_t_17 == ((Sint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_sound_settings->ducking_settings.attack_duration = __pyx_t_17;

    /* "mpfmc/core/audio/track_standard.pyx":1047
 *             sound_settings.ducking_settings.attack_start_pos = sound_instance.ducking.delay * self.state.callback_data.seconds_to_bytes_factor
 *             sound_settings.ducking_settings.attack_duration = sound_instance.ducking.attack * self.state.callback_data.seconds_to_bytes_factor
 *             sound_settings.ducking_settings.attenuation_volume = <Uint8>(sound_instance.ducking.attenuation * SDL_MIX_MAXVOLUME)             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.release_duration = sound_instance.ducking.release * self.state.callback_data.seconds_to_bytes_factor
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_attenuation); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyInt_From_int(SDL_MIX_MAXVOLUME); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_15 = PyNumber_Multiply(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9 = __Pyx_PyInt_As_Uint8(__pyx_t_15); if (unlikely((__pyx_t_9 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1047, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_sound_settings->ducking_settings.attenuation_volume = ((Uint8)__pyx_t_9);

    /* "mpfmc/core/audio/track_standard.pyx":1048
 *             sound_settings.ducking_settings.attack_duration = sound_instance.ducking.attack * self.state.callback_data.seconds_to_bytes_factor
 *             sound_settings.ducking_settings.attenuation_volume = <Uint8>(sound_instance.ducking.attenuation * SDL_MIX_MAXVOLUME)
 *             sound_settings.ducking_settings.release_duration = sound_instance.ducking.release * self.state.callback_data.seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 * 
 *             # Release point is relative to the end of the sound
 */
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_17 = __Pyx_PyInt_As_Sint32(__pyx_t_5); if (unlikely((__pyx_t_17 == ((Sint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1048, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_sound_settings->ducking_settings.release_duration = __pyx_t_17;

    /* "mpfmc/core/audio/track_standard.pyx":1051
 * 
 *             # Release point is relative to the end of the sound
 *             sound_settings.ducking_settings.release_start_pos = (sound_container.duration - sound_instance.ducking.release_point) * self.state.callback_data.seconds_to_bytes_factor             # <<<<<<<<<<<<<<
 *         else:
 *             # Sound does not have ducking, assign settings appropriately
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sound_container), __pyx_n_s_duration); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_ducking); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_release_point); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Subtract(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.state->callback_data->seconds_to_bytes_factor); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_15, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_17 = __Pyx_PyInt_As_Sint32(__pyx_t_5); if (unlikely((__pyx_t_17 == ((Sint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_sound_settings->ducking_settings.release_start_pos = __pyx_t_17;

    /* "mpfmc/core/audio/track_standard.pyx":1038
 * 
 *         # 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 (samples per second), the number of audio channels, and the
 */
    goto __pyx_L17;
  }

  /* "mpfmc/core/audio/track_standard.pyx":1054
 *         else:
 *             # Sound does not have ducking, assign settings appropriately
 *             sound_settings.sound_has_ducking = False             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_stage = ducking_stage_idle
 *             sound_settings.ducking_settings.track_bit_mask = 0
 */
  /*else*/ {
    __pyx_v_sound_settings->sound_has_ducking = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1055
 *             # Sound does not have ducking, assign settings appropriately
 *             sound_settings.sound_has_ducking = False
 *             sound_settings.ducking_stage = ducking_stage_idle             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.track_bit_mask = 0
 *             sound_settings.ducking_settings.attack_start_pos = 0
 */
    __pyx_v_sound_settings->ducking_stage = __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_idle;

    /* "mpfmc/core/audio/track_standard.pyx":1056
 *             sound_settings.sound_has_ducking = False
 *             sound_settings.ducking_stage = ducking_stage_idle
 *             sound_settings.ducking_settings.track_bit_mask = 0             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.attack_start_pos = 0
 *             sound_settings.ducking_settings.attack_duration = 0
 */
    __pyx_v_sound_settings->ducking_settings.track_bit_mask = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1057
 *             sound_settings.ducking_stage = ducking_stage_idle
 *             sound_settings.ducking_settings.track_bit_mask = 0
 *             sound_settings.ducking_settings.attack_start_pos = 0             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.attack_duration = 0
 *             sound_settings.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME
 */
    __pyx_v_sound_settings->ducking_settings.attack_start_pos = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1058
 *             sound_settings.ducking_settings.track_bit_mask = 0
 *             sound_settings.ducking_settings.attack_start_pos = 0
 *             sound_settings.ducking_settings.attack_duration = 0             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME
 *             sound_settings.ducking_settings.release_duration = 0
 */
    __pyx_v_sound_settings->ducking_settings.attack_duration = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1059
 *             sound_settings.ducking_settings.attack_start_pos = 0
 *             sound_settings.ducking_settings.attack_duration = 0
 *             sound_settings.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.release_duration = 0
 *             sound_settings.ducking_settings.release_start_pos = 0
 */
    __pyx_v_sound_settings->ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME;

    /* "mpfmc/core/audio/track_standard.pyx":1060
 *             sound_settings.ducking_settings.attack_duration = 0
 *             sound_settings.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME
 *             sound_settings.ducking_settings.release_duration = 0             # <<<<<<<<<<<<<<
 *             sound_settings.ducking_settings.release_start_pos = 0
 * 
 */
    __pyx_v_sound_settings->ducking_settings.release_duration = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1061
 *             sound_settings.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME
 *             sound_settings.ducking_settings.release_duration = 0
 *             sound_settings.ducking_settings.release_start_pos = 0             # <<<<<<<<<<<<<<
 * 
 *         # Special handling is needed to start streaming for the specified sound at the correct location
 */
    __pyx_v_sound_settings->ducking_settings.release_start_pos = 0;
  }
  __pyx_L17:;

  /* "mpfmc/core/audio/track_standard.pyx":1064
 * 
 *         # Special handling is needed to start streaming for the specified sound at the correct location
 *         if sound_container.sample.type == sound_type_streaming:             # <<<<<<<<<<<<<<
 *             # Seek to the specified start position
 *             gst_element_seek_simple(sound_container.sample.data.stream.pipeline,
 */
  __pyx_t_1 = ((__pyx_v_sound_container->sample.type == __pyx_e_5mpfmc_4core_5audio_10sound_file_sound_type_streaming) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1069
 *                                     GST_FORMAT_TIME,
 *                                     <GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),
 *                                     sound_instance.start_at * GST_SECOND)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = gst_element_set_state(sound_container.sample.data.stream.pipeline, GST_STATE_PLAYING)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_start_at); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_int(GST_SECOND); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_15 = PyNumber_Multiply(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_18 = __Pyx_PyInt_As_gint64(__pyx_t_15); if (unlikely((__pyx_t_18 == ((gint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1066
 *         if sound_container.sample.type == sound_type_streaming:
 *             # Seek to the specified start position
 *             gst_element_seek_simple(sound_container.sample.data.stream.pipeline,             # <<<<<<<<<<<<<<
 *                                     GST_FORMAT_TIME,
 *                                     <GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),
 */
    (void)(gst_element_seek_simple(__pyx_v_sound_container->sample.data.stream->pipeline, GST_FORMAT_TIME, ((GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT)), __pyx_t_18));

    /* "mpfmc/core/audio/track_standard.pyx":1070
 *                                     <GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),
 *                                     sound_instance.start_at * GST_SECOND)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = gst_element_set_state(sound_container.sample.data.stream.pipeline, GST_STATE_PLAYING)
 * 
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "mpfmc/core/audio/track_standard.pyx":1071
 *                                     sound_instance.start_at * GST_SECOND)
 *             with nogil:
 *                 ret = gst_element_set_state(sound_container.sample.data.stream.pipeline, GST_STATE_PLAYING)             # <<<<<<<<<<<<<<
 * 
 *     cdef _set_player_playing(self, SoundPlayer *player, object sound_instance):
 */
          __pyx_v_ret = gst_element_set_state(__pyx_v_sound_container->sample.data.stream->pipeline, GST_STATE_PLAYING);
        }

        /* "mpfmc/core/audio/track_standard.pyx":1070
 *                                     <GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),
 *                                     sound_instance.start_at * GST_SECOND)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = gst_element_set_state(sound_container.sample.data.stream.pipeline, GST_STATE_PLAYING)
 * 
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L23;
          }
          __pyx_L23:;
        }
    }

    /* "mpfmc/core/audio/track_standard.pyx":1064
 * 
 *         # Special handling is needed to start streaming for the specified sound at the correct location
 *         if sound_container.sample.type == sound_type_streaming:             # <<<<<<<<<<<<<<
 *             # Seek to the specified start position
 *             gst_element_seek_simple(sound_container.sample.data.stream.pipeline,
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":953
 *         return False
 * 
 *     cdef _set_player_sound_settings(self, SoundSettings *sound_settings, object sound_instance):             # <<<<<<<<<<<<<<
 *         """
 *         Set sound settings for the player from the sound instance.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._set_player_sound_settings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sound_container);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":1073
 *                 ret = gst_element_set_state(sound_container.sample.data.stream.pipeline, GST_STATE_PLAYING)
 * 
 *     cdef _set_player_playing(self, SoundPlayer *player, object sound_instance):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the player status and sound settings to begin playing the sound instance
 */

static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__set_player_playing(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *__pyx_v_player, PyObject *__pyx_v_sound_instance) {
  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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_player_playing", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1080
 *             sound_instance: The sound instance to begin playing
 *         """
 *         if player == NULL or sound_instance is None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_2 = ((__pyx_v_player == NULL) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_sound_instance == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1081
 *         """
 *         if player == NULL or sound_instance is None:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         # Setup the player to start playing the sound
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":1080
 *             sound_instance: The sound instance to begin playing
 *         """
 *         if player == NULL or sound_instance is None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":1084
 * 
 *         # Setup the player to start playing the sound
 *         player.status = player_playing             # <<<<<<<<<<<<<<
 *         self._set_player_sound_settings(cython.address(player.current), sound_instance)
 * 
 */
  __pyx_v_player->status = __pyx_e_5mpfmc_4core_5audio_14track_standard_player_playing;

  /* "mpfmc/core/audio/track_standard.pyx":1085
 *         # Setup the player to start playing the sound
 *         player.status = player_playing
 *         self._set_player_sound_settings(cython.address(player.current), sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         # Send sound started notification
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_player_sound_settings(__pyx_v_self, (&__pyx_v_player->current), __pyx_v_sound_instance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1088
 * 
 *         # Send sound started notification
 *         send_sound_started_notification(player.number, player.current.sound_id, player.current.sound_instance_id, self.state)             # <<<<<<<<<<<<<<
 * 
 *         self.log.debug("Sound %s is set to begin playback on playlist track (loops=%d)",
 */
  __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_started_notification(__pyx_v_player->number, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_self->__pyx_base.state);

  /* "mpfmc/core/audio/track_standard.pyx":1090
 *         send_sound_started_notification(player.number, player.current.sound_id, player.current.sound_instance_id, self.state)
 * 
 *         self.log.debug("Sound %s is set to begin playback on playlist track (loops=%d)",             # <<<<<<<<<<<<<<
 *                        sound_instance.name, sound_instance.loops)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "mpfmc/core/audio/track_standard.pyx":1091
 * 
 *         self.log.debug("Sound %s is set to begin playback on playlist track (loops=%d)",
 *                        sound_instance.name, sound_instance.loops)             # <<<<<<<<<<<<<<
 * 
 *     cdef _set_player_replacing(self, SoundPlayer *player, object sound_instance):
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_loops); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_kp_u_Sound_s_is_set_to_begin_playback_2, __pyx_t_6, __pyx_t_7};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_kp_u_Sound_s_is_set_to_begin_playback_2, __pyx_t_6, __pyx_t_7};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1090, __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_Sound_s_is_set_to_begin_playback_2);
    __Pyx_GIVEREF(__pyx_kp_u_Sound_s_is_set_to_begin_playback_2);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_kp_u_Sound_s_is_set_to_begin_playback_2);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_7);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1073
 *                 ret = gst_element_set_state(sound_container.sample.data.stream.pipeline, GST_STATE_PLAYING)
 * 
 *     cdef _set_player_playing(self, SoundPlayer *player, object sound_instance):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the player status and sound settings to begin playing the sound instance
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __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("mpfmc.core.audio.track_standard.TrackStandard._set_player_playing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":1093
 *                        sound_instance.name, sound_instance.loops)
 * 
 *     cdef _set_player_replacing(self, SoundPlayer *player, object sound_instance):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the player status and sound settings to replace the currently playing sound with the
 */

static PyObject *__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__set_player_replacing(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *__pyx_v_player, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Uint8 __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_player_replacing", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1101
 *             sound_instance: The sound instance to begin playing
 *         """
 *         if player == NULL or sound_instance is None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_2 = ((__pyx_v_player == NULL) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_sound_instance == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1102
 *         """
 *         if player == NULL or sound_instance is None:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         # Set current sound to fade out quickly
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":1101
 *             sound_instance: The sound instance to begin playing
 *         """
 *         if player == NULL or sound_instance is None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":1105
 * 
 *         # Set current sound to fade out quickly
 *         player.current.fade_out_steps = self.state.callback_data.quick_fade_steps             # <<<<<<<<<<<<<<
 *         player.current.fade_steps_remaining = self.state.callback_data.quick_fade_steps
 *         player.current.fading_status = fading_status_fading_out
 */
  __pyx_t_4 = __pyx_v_self->__pyx_base.state->callback_data->quick_fade_steps;
  __pyx_v_player->current.fade_out_steps = __pyx_t_4;

  /* "mpfmc/core/audio/track_standard.pyx":1106
 *         # Set current sound to fade out quickly
 *         player.current.fade_out_steps = self.state.callback_data.quick_fade_steps
 *         player.current.fade_steps_remaining = self.state.callback_data.quick_fade_steps             # <<<<<<<<<<<<<<
 *         player.current.fading_status = fading_status_fading_out
 * 
 */
  __pyx_t_4 = __pyx_v_self->__pyx_base.state->callback_data->quick_fade_steps;
  __pyx_v_player->current.fade_steps_remaining = __pyx_t_4;

  /* "mpfmc/core/audio/track_standard.pyx":1107
 *         player.current.fade_out_steps = self.state.callback_data.quick_fade_steps
 *         player.current.fade_steps_remaining = self.state.callback_data.quick_fade_steps
 *         player.current.fading_status = fading_status_fading_out             # <<<<<<<<<<<<<<
 * 
 *         # Set the next sound to play immediately after the current one fades out
 */
  __pyx_v_player->current.fading_status = __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_out;

  /* "mpfmc/core/audio/track_standard.pyx":1110
 * 
 *         # Set the next sound to play immediately after the current one fades out
 *         player.status = player_replacing             # <<<<<<<<<<<<<<
 *         self._set_player_sound_settings(cython.address(player.next), sound_instance)
 * 
 */
  __pyx_v_player->status = __pyx_e_5mpfmc_4core_5audio_14track_standard_player_replacing;

  /* "mpfmc/core/audio/track_standard.pyx":1111
 *         # Set the next sound to play immediately after the current one fades out
 *         player.status = player_replacing
 *         self._set_player_sound_settings(cython.address(player.next), sound_instance)             # <<<<<<<<<<<<<<
 * 
 *         # TODO: Figure out how to handle ducking when replacing an existing sound
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_player_sound_settings(__pyx_v_self, (&__pyx_v_player->next), __pyx_v_sound_instance); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1093
 *                        sound_instance.name, sound_instance.loops)
 * 
 *     cdef _set_player_replacing(self, SoundPlayer *player, object sound_instance):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the player status and sound settings to replace the currently playing sound with the
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard._set_player_replacing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":1115
 *         # TODO: Figure out how to handle ducking when replacing an existing sound
 * 
 *     cdef int _get_player_playing_sound_instance(self, sound_instance):             # <<<<<<<<<<<<<<
 *         """
 *         Return the player currently playing the specified sound instance
 */

static int __pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_player_playing_sound_instance(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_player_playing_sound_instance", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1125
 *             sound instance is not currently playing.
 *         """
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.type_state.sound_player_count):
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":1127
 *         SDL_LockAudio()
 * 
 *         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;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "mpfmc/core/audio/track_standard.pyx":1128
 * 
 *         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_UnlockAudio()
 */
    __pyx_t_5 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }

    /* "mpfmc/core/audio/track_standard.pyx":1129
 *         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_UnlockAudio()
 *                 return i
 */
    __pyx_t_6 = __Pyx_PyInt_From_Uint64((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1129, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1129, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;

    /* "mpfmc/core/audio/track_standard.pyx":1128
 * 
 *         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_UnlockAudio()
 */
    if (__pyx_t_4) {

      /* "mpfmc/core/audio/track_standard.pyx":1130
 *             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_UnlockAudio()             # <<<<<<<<<<<<<<
 *                 return i
 * 
 */
      SDL_UnlockAudio();

      /* "mpfmc/core/audio/track_standard.pyx":1131
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 SDL_UnlockAudio()
 *                 return i             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
      __pyx_r = __pyx_v_i;
      goto __pyx_L0;

      /* "mpfmc/core/audio/track_standard.pyx":1128
 * 
 *         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_UnlockAudio()
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":1133
 *                 return i
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *         return -1
 * 
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":1134
 * 
 *         SDL_UnlockAudio()
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     cdef Uint32 _fix_sample_frame_pos(self, Uint32 sample_pos, Uint8 bytes_per_sample, int channels):
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":1115
 *         # TODO: Figure out how to handle ducking when replacing an existing sound
 * 
 *     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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("mpfmc.core.audio.track_standard.TrackStandard._get_player_playing_sound_instance", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":1136
 *         return -1
 * 
 *     cdef Uint32 _fix_sample_frame_pos(self, Uint32 sample_pos, Uint8 bytes_per_sample, int channels):             # <<<<<<<<<<<<<<
 *         """
 *         Rounds up sample position to a sample frame boundary (audio distortion may occur if starting
 */

static Uint32 __pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__fix_sample_frame_pos(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, Uint32 __pyx_v_sample_pos, Uint8 __pyx_v_bytes_per_sample, int __pyx_v_channels) {
  int __pyx_v_bytes_per_sample_frame;
  Uint32 __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;
  Uint32 __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_fix_sample_frame_pos", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1149
 *             sample_pos rounded to the nearest sample frame boundary
 *         """
 *         cdef int bytes_per_sample_frame = bytes_per_sample * channels             # <<<<<<<<<<<<<<
 *         return bytes_per_sample_frame * ceil(sample_pos / bytes_per_sample_frame)
 * 
 */
  __pyx_v_bytes_per_sample_frame = (__pyx_v_bytes_per_sample * __pyx_v_channels);

  /* "mpfmc/core/audio/track_standard.pyx":1150
 *         """
 *         cdef int bytes_per_sample_frame = bytes_per_sample * channels
 *         return bytes_per_sample_frame * ceil(sample_pos / bytes_per_sample_frame)             # <<<<<<<<<<<<<<
 * 
 *     def get_playing_sound_instance_by_id(self, sound_instance_id):
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_bytes_per_sample_frame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ceil); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (unlikely(__pyx_v_bytes_per_sample_frame == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1150, __pyx_L1_error)
  }
  __pyx_t_4 = PyFloat_FromDouble((((double)__pyx_v_sample_pos) / ((double)__pyx_v_bytes_per_sample_frame))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyInt_As_Uint32(__pyx_t_3); if (unlikely((__pyx_t_6 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_6;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":1136
 *         return -1
 * 
 *     cdef Uint32 _fix_sample_frame_pos(self, Uint32 sample_pos, Uint8 bytes_per_sample, int channels):             # <<<<<<<<<<<<<<
 *         """
 *         Rounds up sample position to a sample frame boundary (audio distortion may occur if starting
 */

  /* 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_WriteUnraisable("mpfmc.core.audio.track_standard.TrackStandard._fix_sample_frame_pos", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":1152
 *         return bytes_per_sample_frame * ceil(sample_pos / bytes_per_sample_frame)
 * 
 *     def get_playing_sound_instance_by_id(self, sound_instance_id):             # <<<<<<<<<<<<<<
 *         if sound_instance_id in self._playing_instances_by_id:
 *             return self._playing_instances_by_id[sound_instance_id]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_47get_playing_sound_instance_by_id(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance_id); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_46get_playing_sound_instance_by_id[] = "TrackStandard.get_playing_sound_instance_by_id(self, sound_instance_id)";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_47get_playing_sound_instance_by_id(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance_id) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_playing_sound_instance_by_id (wrapper)", 0);
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_46get_playing_sound_instance_by_id(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v_sound_instance_id));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_46get_playing_sound_instance_by_id(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_playing_sound_instance_by_id", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1153
 * 
 *     def get_playing_sound_instance_by_id(self, sound_instance_id):
 *         if sound_instance_id in self._playing_instances_by_id:             # <<<<<<<<<<<<<<
 *             return self._playing_instances_by_id[sound_instance_id]
 *         else:
 */
  if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1153, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_sound_instance_id, __pyx_v_self->_playing_instances_by_id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1153, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mpfmc/core/audio/track_standard.pyx":1154
 *     def get_playing_sound_instance_by_id(self, sound_instance_id):
 *         if sound_instance_id in self._playing_instances_by_id:
 *             return self._playing_instances_by_id[sound_instance_id]             # <<<<<<<<<<<<<<
 *         else:
 *             return None
 */
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_self->_playing_instances_by_id == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1154, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_self->_playing_instances_by_id, __pyx_v_sound_instance_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":1153
 * 
 *     def get_playing_sound_instance_by_id(self, sound_instance_id):
 *         if sound_instance_id in self._playing_instances_by_id:             # <<<<<<<<<<<<<<
 *             return self._playing_instances_by_id[sound_instance_id]
 *         else:
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":1156
 *             return self._playing_instances_by_id[sound_instance_id]
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def get_status(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "mpfmc/core/audio/track_standard.pyx":1152
 *         return bytes_per_sample_frame * ceil(sample_pos / bytes_per_sample_frame)
 * 
 *     def get_playing_sound_instance_by_id(self, sound_instance_id):             # <<<<<<<<<<<<<<
 *         if sound_instance_id in self._playing_instances_by_id:
 *             return self._playing_instances_by_id[sound_instance_id]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.get_playing_sound_instance_by_id", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":1158
 *             return None
 * 
 *     def get_status(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current track status (status of all sound players on the track).
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_49get_status(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_48get_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_49get_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_48get_status(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_48get_status(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  int __pyx_t_4;
  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;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_status", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1166
 *             sound player.
 *         """
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 *         status = []
 *         for player in range(self.type_state.sound_player_count):
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":1167
 *         """
 *         SDL_LockAudio()
 *         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, 1167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_status = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1168
 *         SDL_LockAudio()
 *         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;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_player = __pyx_t_4;

    /* "mpfmc/core/audio/track_standard.pyx":1170
 *         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 = __Pyx_PyDict_NewPresized(13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_player); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_player, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1171
 *             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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard), __pyx_n_s_player_status_to_text); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyInt_From_int(((int)(__pyx_v_self->type_state->sound_players[__pyx_v_player]).status)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && 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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_status, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1172
 *                 "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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard), __pyx_n_s_player_fading_status_to_text); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyInt_From_int(((int)(__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.fading_status)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && 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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_fading_status, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1173
 *                 "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_5 = __Pyx_PyInt_From_Uint8((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.volume); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_volume, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1174
 *                 "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_5 = __Pyx_PyInt_From_Uint64((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_sound_id, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1175
 *                 "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_5 = __Pyx_PyInt_From_Uint64((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_instance_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_sound_instance_id, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1176
 *                 "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,
 *                 "current_loop": self.type_state.sound_players[player].current.current_loop,
 */
    __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_priority); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1176, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_priority, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1177
 *                 "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,             # <<<<<<<<<<<<<<
 *                 "current_loop": self.type_state.sound_players[player].current.current_loop,
 *                 "has_ducking": self.type_state.sound_players[player].current.sound_has_ducking,
 */
    __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.loops_remaining); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_loops, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1178
 *                 "priority": self.type_state.sound_players[player].current.sound_priority,
 *                 "loops": self.type_state.sound_players[player].current.loops_remaining,
 *                 "current_loop": self.type_state.sound_players[player].current.current_loop,             # <<<<<<<<<<<<<<
 *                 "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_5 = __Pyx_PyInt_From_int((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.current_loop); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_current_loop, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1179
 *                 "loops": self.type_state.sound_players[player].current.loops_remaining,
 *                 "current_loop": self.type_state.sound_players[player].current.current_loop,
 *                 "has_ducking": self.type_state.sound_players[player].current.sound_has_ducking,             # <<<<<<<<<<<<<<
 *                 "sample_pos": self.type_state.sound_players[player].current.sample_pos,
 *                 "loop_start_pos": self.type_state.sound_players[player].current.loop_start_pos,
 */
    __pyx_t_5 = __Pyx_PyBool_FromLong((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_has_ducking); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_has_ducking, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1180
 *                 "current_loop": self.type_state.sound_players[player].current.current_loop,
 *                 "has_ducking": self.type_state.sound_players[player].current.sound_has_ducking,
 *                 "sample_pos": self.type_state.sound_players[player].current.sample_pos,             # <<<<<<<<<<<<<<
 *                 "loop_start_pos": self.type_state.sound_players[player].current.loop_start_pos,
 *                 "loop_end_pos": self.type_state.sound_players[player].current.loop_end_pos
 */
    __pyx_t_5 = __Pyx_PyInt_From_Uint32((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sample_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_sample_pos, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1181
 *                 "has_ducking": self.type_state.sound_players[player].current.sound_has_ducking,
 *                 "sample_pos": self.type_state.sound_players[player].current.sample_pos,
 *                 "loop_start_pos": self.type_state.sound_players[player].current.loop_start_pos,             # <<<<<<<<<<<<<<
 *                 "loop_end_pos": self.type_state.sound_players[player].current.loop_end_pos
 *             })
 */
    __pyx_t_5 = __Pyx_PyInt_From_Uint32((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.loop_start_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_loop_start_pos, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1182
 *                 "sample_pos": self.type_state.sound_players[player].current.sample_pos,
 *                 "loop_start_pos": self.type_state.sound_players[player].current.loop_start_pos,
 *                 "loop_end_pos": self.type_state.sound_players[player].current.loop_end_pos             # <<<<<<<<<<<<<<
 *             })
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_From_Uint32((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.loop_end_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_loop_end_pos, __pyx_t_5) < 0) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1169
 *         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 == ((int)-1))) __PYX_ERR(0, 1169, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1185
 *             })
 * 
 *             self.log.debug("Status - Player %d: Status=%s, Sound=%d, SoundInstance=%d"             # <<<<<<<<<<<<<<
 *                            "Priority=%d, Loops=%d, SamplePos=%d",
 *                            player,
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.log, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "mpfmc/core/audio/track_standard.pyx":1187
 *             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_6 = __Pyx_PyInt_From_int(__pyx_v_player); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "mpfmc/core/audio/track_standard.pyx":1188
 *                            "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_5mpfmc_4core_5audio_14track_standard_TrackStandard), __pyx_n_s_player_status_to_text); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);

    /* "mpfmc/core/audio/track_standard.pyx":1189
 *                            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_10 = __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus((__pyx_v_self->type_state->sound_players[__pyx_v_player]).status); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_7 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_10);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1190
 *                            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_Uint64((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);

    /* "mpfmc/core/audio/track_standard.pyx":1191
 *                                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_10 = __Pyx_PyInt_From_Uint64((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_instance_id); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);

    /* "mpfmc/core/audio/track_standard.pyx":1192
 *                            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_11 = __Pyx_PyInt_From_int((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sound_priority); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);

    /* "mpfmc/core/audio/track_standard.pyx":1193
 *                            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_12 = __Pyx_PyInt_From_int((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.loops_remaining); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);

    /* "mpfmc/core/audio/track_standard.pyx":1194
 *                            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_UnlockAudio()
 */
    __pyx_t_13 = __Pyx_PyInt_From_Uint32((__pyx_v_self->type_state->sound_players[__pyx_v_player]).current.sample_pos); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1194, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_14 = NULL;
    __pyx_t_15 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_15 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[9] = {__pyx_t_14, __pyx_kp_u_Status_Player_d_Status_s_Sound_d, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 8+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1185, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[9] = {__pyx_t_14, __pyx_kp_u_Status_Player_d_Status_s_Sound_d, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 8+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1185, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(8+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (__pyx_t_14) {
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = 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_16, 0+__pyx_t_15, __pyx_kp_u_Status_Player_d_Status_s_Sound_d);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_15, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_15, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_15, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_16, 5+__pyx_t_15, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_16, 6+__pyx_t_15, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_16, 7+__pyx_t_15, __pyx_t_13);
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_10 = 0;
      __pyx_t_11 = 0;
      __pyx_t_12 = 0;
      __pyx_t_13 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "mpfmc/core/audio/track_standard.pyx":1196
 *                            self.type_state.sound_players[player].current.sample_pos)
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 * 
 *         return status
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":1198
 *         SDL_UnlockAudio()
 * 
 *         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;

  /* "mpfmc/core/audio/track_standard.pyx":1158
 *             return None
 * 
 *     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_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_14);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":1200
 *         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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_51get_sound_queue_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_50get_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_51get_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_50get_sound_queue_count(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_50get_sound_queue_count(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_sound_queue_count", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1206
 *             Integer number of sounds currently in the track sound queue.
 *         """
 *         return len(self._sound_queue)             # <<<<<<<<<<<<<<
 * 
 *     def get_sound_players_in_use_count(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->_sound_queue;
  __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, 1206, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1206, __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, 1206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":1200
 *         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_AddTraceback("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":1208
 *         return len(self._sound_queue)
 * 
 *     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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_53get_sound_players_in_use_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_52get_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_53get_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_52get_sound_players_in_use_count(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_52get_sound_players_in_use_count(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_sound_players_in_use_count", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1215
 *             Integer number of sound players currently in use on the track.
 *         """
 *         players_in_use_count = 0             # <<<<<<<<<<<<<<
 *         SDL_LockAudio()
 *         for i in range(self.type_state.sound_player_count):
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_players_in_use_count = __pyx_int_0;

  /* "mpfmc/core/audio/track_standard.pyx":1216
 *         """
 *         players_in_use_count = 0
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle:
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":1217
 *         players_in_use_count = 0
 *         SDL_LockAudio()
 *         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;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "mpfmc/core/audio/track_standard.pyx":1218
 *         SDL_LockAudio()
 *         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_UnlockAudio()
 */
    __pyx_t_4 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_4) {

      /* "mpfmc/core/audio/track_standard.pyx":1219
 *         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_UnlockAudio()
 *         return players_in_use_count
 */
      __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_players_in_use_count, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1219, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_players_in_use_count, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "mpfmc/core/audio/track_standard.pyx":1218
 *         SDL_LockAudio()
 *         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_UnlockAudio()
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":1220
 *             if self.type_state.sound_players[i].status != player_idle:
 *                 players_in_use_count += 1
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *         return players_in_use_count
 * 
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":1221
 *                 players_in_use_count += 1
 *         SDL_UnlockAudio()
 *         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;

  /* "mpfmc/core/audio/track_standard.pyx":1208
 *         return len(self._sound_queue)
 * 
 *     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_5);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":1223
 *         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_LockAudio()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_55sound_is_playing(PyObject *__pyx_v_self, PyObject *__pyx_v_sound); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_54sound_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_55sound_is_playing(PyObject *__pyx_v_self, PyObject *__pyx_v_sound) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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, 1223, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_54sound_is_playing(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_54sound_is_playing(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sound_is_playing", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1225
 *     def sound_is_playing(self, sound not None):
 *         """Returns whether or not the specified sound is currently playing on the track"""
 *         SDL_LockAudio()             # <<<<<<<<<<<<<<
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":1226
 *         """Returns whether or not the specified sound is currently playing on the track"""
 *         SDL_LockAudio()
 *         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;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "mpfmc/core/audio/track_standard.pyx":1227
 *         SDL_LockAudio()
 *         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_UnlockAudio()
 */
    __pyx_t_5 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }

    /* "mpfmc/core/audio/track_standard.pyx":1228
 *         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_UnlockAudio()
 *                 return True
 */
    __pyx_t_6 = __Pyx_PyInt_From_Uint64((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1228, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1228, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;

    /* "mpfmc/core/audio/track_standard.pyx":1227
 *         SDL_LockAudio()
 *         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_UnlockAudio()
 */
    if (__pyx_t_4) {

      /* "mpfmc/core/audio/track_standard.pyx":1229
 *             if self.type_state.sound_players[i].status != player_idle and \
 *                             self.type_state.sound_players[i].current.sound_id == sound.id:
 *                 SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
      SDL_UnlockAudio();

      /* "mpfmc/core/audio/track_standard.pyx":1230
 *                             self.type_state.sound_players[i].current.sound_id == sound.id:
 *                 SDL_UnlockAudio()
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      goto __pyx_L0;

      /* "mpfmc/core/audio/track_standard.pyx":1227
 *         SDL_LockAudio()
 *         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_UnlockAudio()
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":1232
 *                 return True
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":1233
 * 
 *         SDL_UnlockAudio()
 *         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;

  /* "mpfmc/core/audio/track_standard.pyx":1223
 *         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_LockAudio()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.sound_is_playing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":1235
 *         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_LockAudio()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_57sound_instance_is_playing(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_56sound_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_57sound_instance_is_playing(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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, 1235, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_56sound_instance_is_playing(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_56sound_instance_is_playing(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sound_instance_is_playing", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1237
 *     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_LockAudio()             # <<<<<<<<<<<<<<
 *         for i in range(self.type_state.sound_player_count):
 *             if self.type_state.sound_players[i].status != player_idle and \
 */
  SDL_LockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":1238
 *         """Returns whether or not the specified sound instance is currently playing on the track"""
 *         SDL_LockAudio()
 *         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;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "mpfmc/core/audio/track_standard.pyx":1239
 *         SDL_LockAudio()
 *         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_UnlockAudio()
 */
    __pyx_t_5 = (((__pyx_v_self->type_state->sound_players[__pyx_v_i]).status != __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }

    /* "mpfmc/core/audio/track_standard.pyx":1240
 *         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_UnlockAudio()
 *                 return True
 */
    __pyx_t_6 = __Pyx_PyInt_From_Uint64((__pyx_v_self->type_state->sound_players[__pyx_v_i]).current.sound_instance_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1240, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1240, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;

    /* "mpfmc/core/audio/track_standard.pyx":1239
 *         SDL_LockAudio()
 *         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_UnlockAudio()
 */
    if (__pyx_t_4) {

      /* "mpfmc/core/audio/track_standard.pyx":1241
 *             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_UnlockAudio()             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
      SDL_UnlockAudio();

      /* "mpfmc/core/audio/track_standard.pyx":1242
 *                             self.type_state.sound_players[i].current.sound_instance_id == sound_instance.id:
 *                 SDL_UnlockAudio()
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *         SDL_UnlockAudio()
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      goto __pyx_L0;

      /* "mpfmc/core/audio/track_standard.pyx":1239
 *         SDL_LockAudio()
 *         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_UnlockAudio()
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":1244
 *                 return True
 * 
 *         SDL_UnlockAudio()             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  SDL_UnlockAudio();

  /* "mpfmc/core/audio/track_standard.pyx":1245
 * 
 *         SDL_UnlockAudio()
 *         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;

  /* "mpfmc/core/audio/track_standard.pyx":1235
 *         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_LockAudio()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":1247
 *         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:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_59sound_is_in_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_58sound_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_59sound_is_in_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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, 1247, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_58sound_is_in_queue(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_58sound_is_in_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sound_is_in_queue", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1249
 *     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:             # <<<<<<<<<<<<<<
 *             if sound_instance.sound.id == sound.id:
 *                 return True
 */
  if (unlikely(__pyx_v_self->_sound_queue == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1249, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->_sound_queue; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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, 1249, __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, 1249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_sound_instance, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1250
 *         """Returns whether or not an instance of the specified sound is currently in the queue"""
 *         for sound_instance in self._sound_queue:
 *             if sound_instance.sound.id == sound.id:             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound_instance, __pyx_n_s_sound); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sound, __pyx_n_s_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1250, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1250, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {

      /* "mpfmc/core/audio/track_standard.pyx":1251
 *         for sound_instance in self._sound_queue:
 *             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;

      /* "mpfmc/core/audio/track_standard.pyx":1250
 *         """Returns whether or not an instance of the specified sound is currently in the queue"""
 *         for sound_instance in self._sound_queue:
 *             if sound_instance.sound.id == sound.id:             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":1249
 *     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:             # <<<<<<<<<<<<<<
 *             if sound_instance.sound.id == sound.id:
 *                 return True
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1253
 *                 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;

  /* "mpfmc/core/audio/track_standard.pyx":1247
 *         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:
 */

  /* function exit code */
  __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("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":1255
 *         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
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_61sound_instance_is_in_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_60sound_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_61sound_instance_is_in_queue(PyObject *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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, 1255, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_60sound_instance_is_in_queue(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_60sound_instance_is_in_queue(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, PyObject *__pyx_v_sound_instance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sound_instance_is_in_queue", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1257
 *     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             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_sound_instance, __pyx_v_self->_sound_queue, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1257, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":1255
 *         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
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":1260
 * 
 *     @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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_63player_status_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_62player_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_63player_status_to_text = {"player_status_to_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_63player_status_to_text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_62player_status_to_text};
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_63player_status_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_status;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__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, 1260, __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, 1260, __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, 1260, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.player_status_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_62player_status_to_text(__pyx_v_status);

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_62player_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("player_status_to_text", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1271
 *         """
 *         status_values = {
 *             player_idle: "idle",             # <<<<<<<<<<<<<<
 *             player_pending: "pending",
 *             player_replacing: "replacing",
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus(__pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1271, __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, 1271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1272
 *         status_values = {
 *             player_idle: "idle",
 *             player_pending: "pending",             # <<<<<<<<<<<<<<
 *             player_replacing: "replacing",
 *             player_playing: "playing",
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus(__pyx_e_5mpfmc_4core_5audio_14track_standard_player_pending); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1272, __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, 1271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1273
 *             player_idle: "idle",
 *             player_pending: "pending",
 *             player_replacing: "replacing",             # <<<<<<<<<<<<<<
 *             player_playing: "playing",
 *             player_finished: "finished",
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus(__pyx_e_5mpfmc_4core_5audio_14track_standard_player_replacing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1273, __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, 1271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1274
 *             player_pending: "pending",
 *             player_replacing: "replacing",
 *             player_playing: "playing",             # <<<<<<<<<<<<<<
 *             player_finished: "finished",
 *             player_stopping: "stopping",
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus(__pyx_e_5mpfmc_4core_5audio_14track_standard_player_playing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1274, __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, 1271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1275
 *             player_replacing: "replacing",
 *             player_playing: "playing",
 *             player_finished: "finished",             # <<<<<<<<<<<<<<
 *             player_stopping: "stopping",
 *         }
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus(__pyx_e_5mpfmc_4core_5audio_14track_standard_player_finished); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1275, __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, 1271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1276
 *             player_playing: "playing",
 *             player_finished: "finished",
 *             player_stopping: "stopping",             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus(__pyx_e_5mpfmc_4core_5audio_14track_standard_player_stopping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1276, __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, 1271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_status_values = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1279
 *         }
 * 
 *         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:*/ {

      /* "mpfmc/core/audio/track_standard.pyx":1280
 * 
 *         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, 1280, __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, 1280, __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;

      /* "mpfmc/core/audio/track_standard.pyx":1279
 *         }
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return status_values.get(status)
 *         except KeyError:
 */
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1281
 *         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("mpfmc.core.audio.track_standard.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, 1281, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);

      /* "mpfmc/core/audio/track_standard.pyx":1282
 *             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:;

    /* "mpfmc/core/audio/track_standard.pyx":1279
 *         }
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return status_values.get(status)
 *         except KeyError:
 */
    __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_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_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;
  }

  /* "mpfmc/core/audio/track_standard.pyx":1260
 * 
 *     @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("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":1285
 * 
 *     @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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_65player_fading_status_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_64player_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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_65player_fading_status_to_text = {"player_fading_status_to_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_65player_fading_status_to_text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_64player_fading_status_to_text};
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_65player_fading_status_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_fading_status;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__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, 1285, __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, 1285, __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, 1285, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_64player_fading_status_to_text(__pyx_v_fading_status);

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_64player_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("player_fading_status_to_text", 0);

  /* "mpfmc/core/audio/track_standard.pyx":1296
 *         """
 *         fading_status_values = {
 *             fading_status_not_fading: "not fading",             # <<<<<<<<<<<<<<
 *             fading_status_fading_in: "fade in",
 *             fading_status_fading_out: "fade out",
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus(__pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_not_fading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1296, __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, 1296, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1297
 *         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_5mpfmc_4core_5audio_14track_standard_FadingStatus(__pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_in); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1297, __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, 1296, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1298
 *             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_5mpfmc_4core_5audio_14track_standard_FadingStatus(__pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_out); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1298, __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, 1296, __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;

  /* "mpfmc/core/audio/track_standard.pyx":1301
 *         }
 * 
 *         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:*/ {

      /* "mpfmc/core/audio/track_standard.pyx":1302
 * 
 *         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, 1302, __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, 1302, __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;

      /* "mpfmc/core/audio/track_standard.pyx":1301
 *         }
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return fading_status_values.get(fading_status)
 *         except KeyError:
 */
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1303
 *         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("mpfmc.core.audio.track_standard.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, 1303, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);

      /* "mpfmc/core/audio/track_standard.pyx":1304
 *             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:;

    /* "mpfmc/core/audio/track_standard.pyx":1301
 *         }
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return fading_status_values.get(fading_status)
 *         except KeyError:
 */
    __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_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_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;
  }

  /* "mpfmc/core/audio/track_standard.pyx":1285
 * 
 *     @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("mpfmc.core.audio.track_standard.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;
}

/* "mpfmc/core/audio/track_standard.pyx":1318
 * 
 *     @staticmethod
 *     cdef void 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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_mix_playing_sounds(__pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track, Uint32 __pyx_v_buffer_length, __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData *__pyx_v_callback_data) {
  __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_target_track;
  __pyx_t_5mpfmc_4core_5audio_14track_standard_TrackStandardState *__pyx_v_standard_track;
  __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *__pyx_v_player;
  int __pyx_v_player_num;
  int __pyx_v_track_num;
  int __pyx_v_marker_id;
  int __pyx_v_end_of_sound;
  int __pyx_v_ducking_is_active;
  Uint32 __pyx_v_buffer_bytes_remaining;
  Uint32 __pyx_v_current_chunk_bytes;
  Uint32 __pyx_v_track_buffer_pos;
  Uint8 __pyx_v_control_point;
  float __pyx_v_progress;
  Uint8 __pyx_v_volume;
  CYTHON_UNUSED int __pyx_v_sound_finished;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  Uint16 __pyx_t_6;
  Uint32 __pyx_t_7;
  Uint32 __pyx_t_8;
  Uint8 __pyx_t_9;
  Uint8 __pyx_t_10;
  int __pyx_t_11;
  guint8 __pyx_t_12;
  guint8 __pyx_t_13;
  guint8 __pyx_t_14;
  guint __pyx_t_15;
  __pyx_t_5mpfmc_4core_5audio_10sound_file_SoundSample *__pyx_t_16;
  Uint64 __pyx_t_17;
  enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus __pyx_t_18;
  Sint32 __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1337
 *         cdef bint ducking_is_active
 * 
 *         if track == NULL or track.type_state == NULL:             # <<<<<<<<<<<<<<
 *             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_state == NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1338
 * 
 *         if track == NULL or track.type_state == NULL:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         standard_track = <TrackStandardState*>track.type_state
 */
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":1337
 *         cdef bint ducking_is_active
 * 
 *         if track == NULL or track.type_state == NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":1340
 *             return
 * 
 *         standard_track = <TrackStandardState*>track.type_state             # <<<<<<<<<<<<<<
 * 
 *         # Setup local variables
 */
  __pyx_v_standard_track = ((__pyx_t_5mpfmc_4core_5audio_14track_standard_TrackStandardState *)__pyx_v_track->type_state);

  /* "mpfmc/core/audio/track_standard.pyx":1350
 * 
 *         # Loop over track sound players
 *         for player_num in range(standard_track.sound_player_count):             # <<<<<<<<<<<<<<
 * 
 *             player = cython.address(standard_track.sound_players[player_num])
 */
  __pyx_t_3 = __pyx_v_standard_track->sound_player_count;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_player_num = __pyx_t_5;

    /* "mpfmc/core/audio/track_standard.pyx":1352
 *         for player_num in range(standard_track.sound_player_count):
 * 
 *             player = cython.address(standard_track.sound_players[player_num])             # <<<<<<<<<<<<<<
 * 
 *             # If the player is idle, there is nothing to do so move on to the next player
 */
    __pyx_v_player = (&(__pyx_v_standard_track->sound_players[__pyx_v_player_num]));

    /* "mpfmc/core/audio/track_standard.pyx":1355
 * 
 *             # If the player is idle, there is nothing to do so move on to the next player
 *             if player == NULL or player.status == player_idle:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_2 = ((__pyx_v_player == NULL) != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_player->status == __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "mpfmc/core/audio/track_standard.pyx":1356
 *             # If the player is idle, there is nothing to do so move on to the next player
 *             if player == NULL or player.status == player_idle:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             # Set flag indicating there is at least some activity on the track (it is active)
 */
      goto __pyx_L6_continue;

      /* "mpfmc/core/audio/track_standard.pyx":1355
 * 
 *             # If the player is idle, there is nothing to do so move on to the next player
 *             if player == NULL or player.status == player_idle:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":1359
 * 
 *             # Set flag indicating there is at least some activity on the track (it is active)
 *             track.active = True             # <<<<<<<<<<<<<<
 * 
 *             end_of_sound = False
 */
    __pyx_v_track->active = 1;

    /* "mpfmc/core/audio/track_standard.pyx":1361
 *             track.active = True
 * 
 *             end_of_sound = False             # <<<<<<<<<<<<<<
 *             track_buffer_pos = 0
 *             control_point = 0
 */
    __pyx_v_end_of_sound = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1362
 * 
 *             end_of_sound = False
 *             track_buffer_pos = 0             # <<<<<<<<<<<<<<
 *             control_point = 0
 *             buffer_bytes_remaining = buffer_length
 */
    __pyx_v_track_buffer_pos = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1363
 *             end_of_sound = False
 *             track_buffer_pos = 0
 *             control_point = 0             # <<<<<<<<<<<<<<
 *             buffer_bytes_remaining = buffer_length
 * 
 */
    __pyx_v_control_point = 0;

    /* "mpfmc/core/audio/track_standard.pyx":1364
 *             track_buffer_pos = 0
 *             control_point = 0
 *             buffer_bytes_remaining = buffer_length             # <<<<<<<<<<<<<<
 * 
 *             # Loop over output buffer at control rate
 */
    __pyx_v_buffer_bytes_remaining = __pyx_v_buffer_length;

    /* "mpfmc/core/audio/track_standard.pyx":1367
 * 
 *             # Loop over output buffer at control rate
 *             while buffer_bytes_remaining > 0:             # <<<<<<<<<<<<<<
 * 
 *                 # Determine the number of bytes to process in the current chunk
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_buffer_bytes_remaining > 0) != 0);
      if (!__pyx_t_1) break;

      /* "mpfmc/core/audio/track_standard.pyx":1370
 * 
 *                 # Determine the number of bytes to process in the current chunk
 *                 current_chunk_bytes = min(buffer_bytes_remaining, callback_data.bytes_per_control_point)             # <<<<<<<<<<<<<<
 * 
 *                 # Calculate volume of chunk (handle fading)
 */
      __pyx_t_6 = __pyx_v_callback_data->bytes_per_control_point;
      __pyx_t_7 = __pyx_v_buffer_bytes_remaining;
      if (((__pyx_t_6 < __pyx_t_7) != 0)) {
        __pyx_t_8 = __pyx_t_6;
      } else {
        __pyx_t_8 = __pyx_t_7;
      }
      __pyx_v_current_chunk_bytes = __pyx_t_8;

      /* "mpfmc/core/audio/track_standard.pyx":1373
 * 
 *                 # Calculate volume of chunk (handle fading)
 *                 if player.current.fading_status == fading_status_fading_in:             # <<<<<<<<<<<<<<
 *                     volume = <Uint8> (in_out_quad((player.current.fade_in_steps - player.current.fade_steps_remaining) / player.current.fade_in_steps) * player.current.volume)
 *                     player.current.fade_steps_remaining -= 1
 */
      switch (__pyx_v_player->current.fading_status) {
        case __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_in:

        /* "mpfmc/core/audio/track_standard.pyx":1374
 *                 # Calculate volume of chunk (handle fading)
 *                 if player.current.fading_status == fading_status_fading_in:
 *                     volume = <Uint8> (in_out_quad((player.current.fade_in_steps - player.current.fade_steps_remaining) / player.current.fade_in_steps) * player.current.volume)             # <<<<<<<<<<<<<<
 *                     player.current.fade_steps_remaining -= 1
 *                     if player.current.fade_steps_remaining == 0:
 */
        __pyx_t_8 = (__pyx_v_player->current.fade_in_steps - __pyx_v_player->current.fade_steps_remaining);
        if (unlikely(__pyx_v_player->current.fade_in_steps == 0)) {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
          #endif
          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
          #ifdef WITH_THREAD
          __Pyx_PyGILState_Release(__pyx_gilstate_save);
          #endif
          __PYX_ERR(0, 1374, __pyx_L1_error)
        }
        __pyx_v_volume = ((Uint8)(__pyx_f_5mpfmc_4core_5audio_6inline_in_out_quad((((double)__pyx_t_8) / ((double)__pyx_v_player->current.fade_in_steps))) * __pyx_v_player->current.volume));

        /* "mpfmc/core/audio/track_standard.pyx":1375
 *                 if player.current.fading_status == fading_status_fading_in:
 *                     volume = <Uint8> (in_out_quad((player.current.fade_in_steps - player.current.fade_steps_remaining) / player.current.fade_in_steps) * player.current.volume)
 *                     player.current.fade_steps_remaining -= 1             # <<<<<<<<<<<<<<
 *                     if player.current.fade_steps_remaining == 0:
 *                         player.current.fading_status = fading_status_not_fading
 */
        __pyx_v_player->current.fade_steps_remaining = (__pyx_v_player->current.fade_steps_remaining - 1);

        /* "mpfmc/core/audio/track_standard.pyx":1376
 *                     volume = <Uint8> (in_out_quad((player.current.fade_in_steps - player.current.fade_steps_remaining) / player.current.fade_in_steps) * player.current.volume)
 *                     player.current.fade_steps_remaining -= 1
 *                     if player.current.fade_steps_remaining == 0:             # <<<<<<<<<<<<<<
 *                         player.current.fading_status = fading_status_not_fading
 *                 elif player.current.fading_status == fading_status_fading_out:
 */
        __pyx_t_1 = ((__pyx_v_player->current.fade_steps_remaining == 0) != 0);
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1377
 *                     player.current.fade_steps_remaining -= 1
 *                     if player.current.fade_steps_remaining == 0:
 *                         player.current.fading_status = fading_status_not_fading             # <<<<<<<<<<<<<<
 *                 elif player.current.fading_status == fading_status_fading_out:
 *                     volume = <Uint8> (in_out_quad(player.current.fade_steps_remaining / player.current.fade_out_steps) * player.current.volume)
 */
          __pyx_v_player->current.fading_status = __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_not_fading;

          /* "mpfmc/core/audio/track_standard.pyx":1376
 *                     volume = <Uint8> (in_out_quad((player.current.fade_in_steps - player.current.fade_steps_remaining) / player.current.fade_in_steps) * player.current.volume)
 *                     player.current.fade_steps_remaining -= 1
 *                     if player.current.fade_steps_remaining == 0:             # <<<<<<<<<<<<<<
 *                         player.current.fading_status = fading_status_not_fading
 *                 elif player.current.fading_status == fading_status_fading_out:
 */
        }

        /* "mpfmc/core/audio/track_standard.pyx":1373
 * 
 *                 # Calculate volume of chunk (handle fading)
 *                 if player.current.fading_status == fading_status_fading_in:             # <<<<<<<<<<<<<<
 *                     volume = <Uint8> (in_out_quad((player.current.fade_in_steps - player.current.fade_steps_remaining) / player.current.fade_in_steps) * player.current.volume)
 *                     player.current.fade_steps_remaining -= 1
 */
        break;
        case __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_out:

        /* "mpfmc/core/audio/track_standard.pyx":1379
 *                         player.current.fading_status = fading_status_not_fading
 *                 elif player.current.fading_status == fading_status_fading_out:
 *                     volume = <Uint8> (in_out_quad(player.current.fade_steps_remaining / player.current.fade_out_steps) * player.current.volume)             # <<<<<<<<<<<<<<
 *                     player.current.fade_steps_remaining -= 1
 *                 else:
 */
        if (unlikely(__pyx_v_player->current.fade_out_steps == 0)) {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
          #endif
          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
          #ifdef WITH_THREAD
          __Pyx_PyGILState_Release(__pyx_gilstate_save);
          #endif
          __PYX_ERR(0, 1379, __pyx_L1_error)
        }
        __pyx_v_volume = ((Uint8)(__pyx_f_5mpfmc_4core_5audio_6inline_in_out_quad((((double)__pyx_v_player->current.fade_steps_remaining) / ((double)__pyx_v_player->current.fade_out_steps))) * __pyx_v_player->current.volume));

        /* "mpfmc/core/audio/track_standard.pyx":1380
 *                 elif player.current.fading_status == fading_status_fading_out:
 *                     volume = <Uint8> (in_out_quad(player.current.fade_steps_remaining / player.current.fade_out_steps) * player.current.volume)
 *                     player.current.fade_steps_remaining -= 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     volume = player.current.volume
 */
        __pyx_v_player->current.fade_steps_remaining = (__pyx_v_player->current.fade_steps_remaining - 1);

        /* "mpfmc/core/audio/track_standard.pyx":1378
 *                     if player.current.fade_steps_remaining == 0:
 *                         player.current.fading_status = fading_status_not_fading
 *                 elif player.current.fading_status == fading_status_fading_out:             # <<<<<<<<<<<<<<
 *                     volume = <Uint8> (in_out_quad(player.current.fade_steps_remaining / player.current.fade_out_steps) * player.current.volume)
 *                     player.current.fade_steps_remaining -= 1
 */
        break;
        default:

        /* "mpfmc/core/audio/track_standard.pyx":1382
 *                     player.current.fade_steps_remaining -= 1
 *                 else:
 *                     volume = player.current.volume             # <<<<<<<<<<<<<<
 * 
 *                 # Copy samples for chunk to output buffer and apply volume
 */
        __pyx_t_9 = __pyx_v_player->current.volume;
        __pyx_v_volume = __pyx_t_9;
        break;
      }

      /* "mpfmc/core/audio/track_standard.pyx":1385
 * 
 *                 # Copy samples for chunk to output buffer and apply volume
 *                 if player.current.sample.type == sound_type_memory:             # <<<<<<<<<<<<<<
 *                     end_of_sound = get_memory_sound_samples(cython.address(player.current), current_chunk_bytes,
 *                                                             track.buffer + track_buffer_pos, callback_data.channels,
 */
      switch (__pyx_v_player->current.sample->type) {
        case __pyx_e_5mpfmc_4core_5audio_10sound_file_sound_type_memory:

        /* "mpfmc/core/audio/track_standard.pyx":1386
 *                 # Copy samples for chunk to output buffer and apply volume
 *                 if player.current.sample.type == sound_type_memory:
 *                     end_of_sound = get_memory_sound_samples(cython.address(player.current), current_chunk_bytes,             # <<<<<<<<<<<<<<
 *                                                             track.buffer + track_buffer_pos, callback_data.channels,
 *                                                             volume, track, player_num)
 */
        __pyx_v_end_of_sound = __pyx_f_5mpfmc_4core_5audio_14track_standard_get_memory_sound_samples((&__pyx_v_player->current), __pyx_v_current_chunk_bytes, (__pyx_v_track->buffer + __pyx_v_track_buffer_pos), __pyx_v_callback_data->channels, __pyx_v_volume, __pyx_v_track, __pyx_v_player_num);

        /* "mpfmc/core/audio/track_standard.pyx":1385
 * 
 *                 # Copy samples for chunk to output buffer and apply volume
 *                 if player.current.sample.type == sound_type_memory:             # <<<<<<<<<<<<<<
 *                     end_of_sound = get_memory_sound_samples(cython.address(player.current), current_chunk_bytes,
 *                                                             track.buffer + track_buffer_pos, callback_data.channels,
 */
        break;
        case __pyx_e_5mpfmc_4core_5audio_10sound_file_sound_type_streaming:

        /* "mpfmc/core/audio/track_standard.pyx":1390
 *                                                             volume, track, player_num)
 *                 elif player.current.sample.type == sound_type_streaming:
 *                     end_of_sound = get_streaming_sound_samples(cython.address(player.current), current_chunk_bytes,             # <<<<<<<<<<<<<<
 *                                                                track.buffer + track_buffer_pos, callback_data.channels,
 *                                                                volume, track, player_num)
 */
        __pyx_v_end_of_sound = __pyx_f_5mpfmc_4core_5audio_14track_standard_get_streaming_sound_samples((&__pyx_v_player->current), __pyx_v_current_chunk_bytes, (__pyx_v_track->buffer + __pyx_v_track_buffer_pos), __pyx_v_callback_data->channels, __pyx_v_volume, __pyx_v_track, __pyx_v_player_num);

        /* "mpfmc/core/audio/track_standard.pyx":1389
 *                                                             track.buffer + track_buffer_pos, callback_data.channels,
 *                                                             volume, track, player_num)
 *                 elif player.current.sample.type == sound_type_streaming:             # <<<<<<<<<<<<<<
 *                     end_of_sound = get_streaming_sound_samples(cython.address(player.current), current_chunk_bytes,
 *                                                                track.buffer + track_buffer_pos, callback_data.channels,
 */
        break;
        default: break;
      }

      /* "mpfmc/core/audio/track_standard.pyx":1395
 * 
 *                 # Process sound ducking (if applicable)
 *                 if player.current.sound_has_ducking:             # <<<<<<<<<<<<<<
 *                     ducking_is_active = False
 * 
 */
      __pyx_t_1 = (__pyx_v_player->current.sound_has_ducking != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1396
 *                 # Process sound ducking (if applicable)
 *                 if player.current.sound_has_ducking:
 *                     ducking_is_active = False             # <<<<<<<<<<<<<<
 * 
 *                     # Determine control point ducking stage and calculate control point (test stages in reverse order)
 */
        __pyx_v_ducking_is_active = 0;

        /* "mpfmc/core/audio/track_standard.pyx":1399
 * 
 *                     # Determine control point ducking stage and calculate control point (test stages in reverse order)
 *                     if player.current.sample_pos >= player.current.ducking_settings.release_start_pos + player.current.ducking_settings.release_duration:             # <<<<<<<<<<<<<<
 *                         # Ducking finished
 *                         g_array_set_val_uint8(player.current.ducking_control_points, control_point, SDL_MIX_MAXVOLUME)
 */
        __pyx_t_1 = ((__pyx_v_player->current.sample_pos >= (__pyx_v_player->current.ducking_settings.release_start_pos + __pyx_v_player->current.ducking_settings.release_duration)) != 0);
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1401
 *                     if player.current.sample_pos >= player.current.ducking_settings.release_start_pos + player.current.ducking_settings.release_duration:
 *                         # Ducking finished
 *                         g_array_set_val_uint8(player.current.ducking_control_points, control_point, SDL_MIX_MAXVOLUME)             # <<<<<<<<<<<<<<
 * 
 *                     elif player.current.sample_pos >= player.current.ducking_settings.release_start_pos:
 */
          g_array_set_val_uint8(__pyx_v_player->current.ducking_control_points, __pyx_v_control_point, SDL_MIX_MAXVOLUME);

          /* "mpfmc/core/audio/track_standard.pyx":1399
 * 
 *                     # Determine control point ducking stage and calculate control point (test stages in reverse order)
 *                     if player.current.sample_pos >= player.current.ducking_settings.release_start_pos + player.current.ducking_settings.release_duration:             # <<<<<<<<<<<<<<
 *                         # Ducking finished
 *                         g_array_set_val_uint8(player.current.ducking_control_points, control_point, SDL_MIX_MAXVOLUME)
 */
          goto __pyx_L15;
        }

        /* "mpfmc/core/audio/track_standard.pyx":1403
 *                         g_array_set_val_uint8(player.current.ducking_control_points, control_point, SDL_MIX_MAXVOLUME)
 * 
 *                     elif player.current.sample_pos >= player.current.ducking_settings.release_start_pos:             # <<<<<<<<<<<<<<
 *                         # Ducking release stage
 *                         ducking_is_active = True
 */
        __pyx_t_1 = ((__pyx_v_player->current.sample_pos >= __pyx_v_player->current.ducking_settings.release_start_pos) != 0);
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1405
 *                     elif player.current.sample_pos >= player.current.ducking_settings.release_start_pos:
 *                         # Ducking release stage
 *                         ducking_is_active = True             # <<<<<<<<<<<<<<
 *                         progress = (player.current.sample_pos - player.current.ducking_settings.release_start_pos) / player.current.ducking_settings.release_duration
 *                         g_array_set_val_uint8(player.current.ducking_control_points,
 */
          __pyx_v_ducking_is_active = 1;

          /* "mpfmc/core/audio/track_standard.pyx":1406
 *                         # Ducking release stage
 *                         ducking_is_active = True
 *                         progress = (player.current.sample_pos - player.current.ducking_settings.release_start_pos) / player.current.ducking_settings.release_duration             # <<<<<<<<<<<<<<
 *                         g_array_set_val_uint8(player.current.ducking_control_points,
 *                                               control_point,
 */
          __pyx_t_8 = (__pyx_v_player->current.sample_pos - __pyx_v_player->current.ducking_settings.release_start_pos);
          if (unlikely(__pyx_v_player->current.ducking_settings.release_duration == 0)) {
            #ifdef WITH_THREAD
            PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
            #endif
            PyErr_SetString(PyExc_ZeroDivisionError, "float division");
            #ifdef WITH_THREAD
            __Pyx_PyGILState_Release(__pyx_gilstate_save);
            #endif
            __PYX_ERR(0, 1406, __pyx_L1_error)
          }
          __pyx_v_progress = (((double)__pyx_t_8) / ((double)__pyx_v_player->current.ducking_settings.release_duration));

          /* "mpfmc/core/audio/track_standard.pyx":1407
 *                         ducking_is_active = True
 *                         progress = (player.current.sample_pos - player.current.ducking_settings.release_start_pos) / player.current.ducking_settings.release_duration
 *                         g_array_set_val_uint8(player.current.ducking_control_points,             # <<<<<<<<<<<<<<
 *                                               control_point,
 *                                               lerpU8(in_out_quad(progress),
 */
          g_array_set_val_uint8(__pyx_v_player->current.ducking_control_points, __pyx_v_control_point, __pyx_f_5mpfmc_4core_5audio_6inline_lerpU8(__pyx_f_5mpfmc_4core_5audio_6inline_in_out_quad(__pyx_v_progress), __pyx_v_player->current.ducking_settings.attenuation_volume, SDL_MIX_MAXVOLUME));

          /* "mpfmc/core/audio/track_standard.pyx":1403
 *                         g_array_set_val_uint8(player.current.ducking_control_points, control_point, SDL_MIX_MAXVOLUME)
 * 
 *                     elif player.current.sample_pos >= player.current.ducking_settings.release_start_pos:             # <<<<<<<<<<<<<<
 *                         # Ducking release stage
 *                         ducking_is_active = True
 */
          goto __pyx_L15;
        }

        /* "mpfmc/core/audio/track_standard.pyx":1415
 *                                               )
 * 
 *                     elif player.current.sample_pos >= player.current.ducking_settings.attack_start_pos + player.current.ducking_settings.attack_duration:             # <<<<<<<<<<<<<<
 *                         # Ducking hold state
 *                         ducking_is_active = True
 */
        __pyx_t_1 = ((__pyx_v_player->current.sample_pos >= (__pyx_v_player->current.ducking_settings.attack_start_pos + __pyx_v_player->current.ducking_settings.attack_duration)) != 0);
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1417
 *                     elif player.current.sample_pos >= player.current.ducking_settings.attack_start_pos + player.current.ducking_settings.attack_duration:
 *                         # Ducking hold state
 *                         ducking_is_active = True             # <<<<<<<<<<<<<<
 *                         g_array_set_val_uint8(player.current.ducking_control_points, control_point, player.current.ducking_settings.attenuation_volume)
 * 
 */
          __pyx_v_ducking_is_active = 1;

          /* "mpfmc/core/audio/track_standard.pyx":1418
 *                         # Ducking hold state
 *                         ducking_is_active = True
 *                         g_array_set_val_uint8(player.current.ducking_control_points, control_point, player.current.ducking_settings.attenuation_volume)             # <<<<<<<<<<<<<<
 * 
 *                     elif player.current.sample_pos >= player.current.ducking_settings.attack_start_pos:
 */
          g_array_set_val_uint8(__pyx_v_player->current.ducking_control_points, __pyx_v_control_point, __pyx_v_player->current.ducking_settings.attenuation_volume);

          /* "mpfmc/core/audio/track_standard.pyx":1415
 *                                               )
 * 
 *                     elif player.current.sample_pos >= player.current.ducking_settings.attack_start_pos + player.current.ducking_settings.attack_duration:             # <<<<<<<<<<<<<<
 *                         # Ducking hold state
 *                         ducking_is_active = True
 */
          goto __pyx_L15;
        }

        /* "mpfmc/core/audio/track_standard.pyx":1420
 *                         g_array_set_val_uint8(player.current.ducking_control_points, control_point, player.current.ducking_settings.attenuation_volume)
 * 
 *                     elif player.current.sample_pos >= player.current.ducking_settings.attack_start_pos:             # <<<<<<<<<<<<<<
 *                         # Ducking attack stage
 *                         ducking_is_active = True
 */
        __pyx_t_1 = ((__pyx_v_player->current.sample_pos >= __pyx_v_player->current.ducking_settings.attack_start_pos) != 0);
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1422
 *                     elif player.current.sample_pos >= player.current.ducking_settings.attack_start_pos:
 *                         # Ducking attack stage
 *                         ducking_is_active = True             # <<<<<<<<<<<<<<
 *                         progress = (player.current.sample_pos - player.current.ducking_settings.attack_start_pos) / player.current.ducking_settings.attack_duration
 *                         g_array_set_val_uint8(player.current.ducking_control_points,
 */
          __pyx_v_ducking_is_active = 1;

          /* "mpfmc/core/audio/track_standard.pyx":1423
 *                         # Ducking attack stage
 *                         ducking_is_active = True
 *                         progress = (player.current.sample_pos - player.current.ducking_settings.attack_start_pos) / player.current.ducking_settings.attack_duration             # <<<<<<<<<<<<<<
 *                         g_array_set_val_uint8(player.current.ducking_control_points,
 *                                               control_point,
 */
          __pyx_t_8 = (__pyx_v_player->current.sample_pos - __pyx_v_player->current.ducking_settings.attack_start_pos);
          if (unlikely(__pyx_v_player->current.ducking_settings.attack_duration == 0)) {
            #ifdef WITH_THREAD
            PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
            #endif
            PyErr_SetString(PyExc_ZeroDivisionError, "float division");
            #ifdef WITH_THREAD
            __Pyx_PyGILState_Release(__pyx_gilstate_save);
            #endif
            __PYX_ERR(0, 1423, __pyx_L1_error)
          }
          __pyx_v_progress = (((double)__pyx_t_8) / ((double)__pyx_v_player->current.ducking_settings.attack_duration));

          /* "mpfmc/core/audio/track_standard.pyx":1424
 *                         ducking_is_active = True
 *                         progress = (player.current.sample_pos - player.current.ducking_settings.attack_start_pos) / player.current.ducking_settings.attack_duration
 *                         g_array_set_val_uint8(player.current.ducking_control_points,             # <<<<<<<<<<<<<<
 *                                               control_point,
 *                                               lerpU8(in_out_quad(progress),
 */
          g_array_set_val_uint8(__pyx_v_player->current.ducking_control_points, __pyx_v_control_point, __pyx_f_5mpfmc_4core_5audio_6inline_lerpU8(__pyx_f_5mpfmc_4core_5audio_6inline_in_out_quad(__pyx_v_progress), SDL_MIX_MAXVOLUME, __pyx_v_player->current.ducking_settings.attenuation_volume));

          /* "mpfmc/core/audio/track_standard.pyx":1420
 *                         g_array_set_val_uint8(player.current.ducking_control_points, control_point, player.current.ducking_settings.attenuation_volume)
 * 
 *                     elif player.current.sample_pos >= player.current.ducking_settings.attack_start_pos:             # <<<<<<<<<<<<<<
 *                         # Ducking attack stage
 *                         ducking_is_active = True
 */
          goto __pyx_L15;
        }

        /* "mpfmc/core/audio/track_standard.pyx":1434
 *                     else:
 *                         # Ducking delay stage
 *                         g_array_set_val_uint8(player.current.ducking_control_points,             # <<<<<<<<<<<<<<
 *                                               control_point,
 *                                               SDL_MIX_MAXVOLUME)
 */
        /*else*/ {

          /* "mpfmc/core/audio/track_standard.pyx":1436
 *                         g_array_set_val_uint8(player.current.ducking_control_points,
 *                                               control_point,
 *                                               SDL_MIX_MAXVOLUME)             # <<<<<<<<<<<<<<
 * 
 *                     # Apply ducking to target track(s) (when applicable)
 */
          g_array_set_val_uint8(__pyx_v_player->current.ducking_control_points, __pyx_v_control_point, SDL_MIX_MAXVOLUME);
        }
        __pyx_L15:;

        /* "mpfmc/core/audio/track_standard.pyx":1439
 * 
 *                     # Apply ducking to target track(s) (when applicable)
 *                     if ducking_is_active:             # <<<<<<<<<<<<<<
 *                         for track_num in range(callback_data.track_count):
 *                             target_track = <TrackState*>callback_data.tracks[track_num]
 */
        __pyx_t_1 = (__pyx_v_ducking_is_active != 0);
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1440
 *                     # Apply ducking to target track(s) (when applicable)
 *                     if ducking_is_active:
 *                         for track_num in range(callback_data.track_count):             # <<<<<<<<<<<<<<
 *                             target_track = <TrackState*>callback_data.tracks[track_num]
 *                             if (1 << track_num) & player.current.ducking_settings.track_bit_mask:
 */
          __pyx_t_9 = __pyx_v_callback_data->track_count;
          __pyx_t_10 = __pyx_t_9;
          for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
            __pyx_v_track_num = __pyx_t_11;

            /* "mpfmc/core/audio/track_standard.pyx":1441
 *                     if ducking_is_active:
 *                         for track_num in range(callback_data.track_count):
 *                             target_track = <TrackState*>callback_data.tracks[track_num]             # <<<<<<<<<<<<<<
 *                             if (1 << track_num) & player.current.ducking_settings.track_bit_mask:
 *                                 target_track.ducking_is_active = True
 */
            __pyx_v_target_track = ((__pyx_t_5mpfmc_4core_5audio_5track_TrackState *)(__pyx_v_callback_data->tracks[__pyx_v_track_num]));

            /* "mpfmc/core/audio/track_standard.pyx":1442
 *                         for track_num in range(callback_data.track_count):
 *                             target_track = <TrackState*>callback_data.tracks[track_num]
 *                             if (1 << track_num) & player.current.ducking_settings.track_bit_mask:             # <<<<<<<<<<<<<<
 *                                 target_track.ducking_is_active = True
 *                                 g_array_set_val_uint8(target_track.ducking_control_points,
 */
            __pyx_t_1 = (((1 << __pyx_v_track_num) & __pyx_v_player->current.ducking_settings.track_bit_mask) != 0);
            if (__pyx_t_1) {

              /* "mpfmc/core/audio/track_standard.pyx":1443
 *                             target_track = <TrackState*>callback_data.tracks[track_num]
 *                             if (1 << track_num) & player.current.ducking_settings.track_bit_mask:
 *                                 target_track.ducking_is_active = True             # <<<<<<<<<<<<<<
 *                                 g_array_set_val_uint8(target_track.ducking_control_points,
 *                                                       control_point,
 */
              __pyx_v_target_track->ducking_is_active = 1;

              /* "mpfmc/core/audio/track_standard.pyx":1450
 *                                                               target_track.ducking_control_points,
 *                                                               control_point),
 *                                                           g_array_index_uint8(player.current.ducking_control_points,             # <<<<<<<<<<<<<<
 *                                                                               control_point)
 *                                                       ))
 */
              __pyx_t_12 = g_array_index_uint8(__pyx_v_player->current.ducking_control_points, __pyx_v_control_point);

              /* "mpfmc/core/audio/track_standard.pyx":1447
 *                                                       control_point,
 *                                                       min(
 *                                                           g_array_index_uint8(             # <<<<<<<<<<<<<<
 *                                                               target_track.ducking_control_points,
 *                                                               control_point),
 */
              __pyx_t_13 = g_array_index_uint8(__pyx_v_target_track->ducking_control_points, __pyx_v_control_point);

              /* "mpfmc/core/audio/track_standard.pyx":1450
 *                                                               target_track.ducking_control_points,
 *                                                               control_point),
 *                                                           g_array_index_uint8(player.current.ducking_control_points,             # <<<<<<<<<<<<<<
 *                                                                               control_point)
 *                                                       ))
 */
              if (((__pyx_t_12 < __pyx_t_13) != 0)) {
                __pyx_t_14 = __pyx_t_12;
              } else {
                __pyx_t_14 = __pyx_t_13;
              }

              /* "mpfmc/core/audio/track_standard.pyx":1444
 *                             if (1 << track_num) & player.current.ducking_settings.track_bit_mask:
 *                                 target_track.ducking_is_active = True
 *                                 g_array_set_val_uint8(target_track.ducking_control_points,             # <<<<<<<<<<<<<<
 *                                                       control_point,
 *                                                       min(
 */
              g_array_set_val_uint8(__pyx_v_target_track->ducking_control_points, __pyx_v_control_point, __pyx_t_14);

              /* "mpfmc/core/audio/track_standard.pyx":1442
 *                         for track_num in range(callback_data.track_count):
 *                             target_track = <TrackState*>callback_data.tracks[track_num]
 *                             if (1 << track_num) & player.current.ducking_settings.track_bit_mask:             # <<<<<<<<<<<<<<
 *                                 target_track.ducking_is_active = True
 *                                 g_array_set_val_uint8(target_track.ducking_control_points,
 */
            }
          }

          /* "mpfmc/core/audio/track_standard.pyx":1439
 * 
 *                     # Apply ducking to target track(s) (when applicable)
 *                     if ducking_is_active:             # <<<<<<<<<<<<<<
 *                         for track_num in range(callback_data.track_count):
 *                             target_track = <TrackState*>callback_data.tracks[track_num]
 */
        }

        /* "mpfmc/core/audio/track_standard.pyx":1395
 * 
 *                 # Process sound ducking (if applicable)
 *                 if player.current.sound_has_ducking:             # <<<<<<<<<<<<<<
 *                     ducking_is_active = False
 * 
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":1463
 * 
 *                 # About to finish marker
 *                 if player.current.about_to_finish_marker != no_marker:             # <<<<<<<<<<<<<<
 *                     if player.current.sample_pos - current_chunk_bytes <= player.current.about_to_finish_marker < player.current.sample_pos:
 *                         # Marker is in window, send notification
 */
      __pyx_t_1 = ((__pyx_v_player->current.about_to_finish_marker != __pyx_e_5mpfmc_4core_5audio_14track_standard_no_marker) != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1464
 *                 # About to finish marker
 *                 if player.current.about_to_finish_marker != no_marker:
 *                     if player.current.sample_pos - current_chunk_bytes <= player.current.about_to_finish_marker < player.current.sample_pos:             # <<<<<<<<<<<<<<
 *                         # Marker is in window, send notification
 *                         send_sound_about_to_finish_notification(player_num,
 */
        __pyx_t_1 = ((__pyx_v_player->current.sample_pos - __pyx_v_current_chunk_bytes) <= __pyx_v_player->current.about_to_finish_marker);
        if (__pyx_t_1) {
          __pyx_t_1 = (__pyx_v_player->current.about_to_finish_marker < __pyx_v_player->current.sample_pos);
        }
        __pyx_t_2 = (__pyx_t_1 != 0);
        if (__pyx_t_2) {

          /* "mpfmc/core/audio/track_standard.pyx":1466
 *                     if player.current.sample_pos - current_chunk_bytes <= player.current.about_to_finish_marker < player.current.sample_pos:
 *                         # Marker is in window, send notification
 *                         send_sound_about_to_finish_notification(player_num,             # <<<<<<<<<<<<<<
 *                                                                 player.current.sound_id,
 *                                                                 player.current.sound_instance_id,
 */
          __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_about_to_finish_notification(__pyx_v_player_num, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_track);

          /* "mpfmc/core/audio/track_standard.pyx":1464
 *                 # About to finish marker
 *                 if player.current.about_to_finish_marker != no_marker:
 *                     if player.current.sample_pos - current_chunk_bytes <= player.current.about_to_finish_marker < player.current.sample_pos:             # <<<<<<<<<<<<<<
 *                         # Marker is in window, send notification
 *                         send_sound_about_to_finish_notification(player_num,
 */
        }

        /* "mpfmc/core/audio/track_standard.pyx":1471
 *                                                                 track)
 *                     # Special check if buffer wraps back around to the beginning of the sample
 *                     if not end_of_sound and player.current.sample_pos - current_chunk_bytes < 0 and player.current.about_to_finish_marker < player.current.sample_pos:             # <<<<<<<<<<<<<<
 *                         # Marker is in window, send notification
 *                         send_sound_about_to_finish_notification(player_num,
 */
        __pyx_t_1 = ((!(__pyx_v_end_of_sound != 0)) != 0);
        if (__pyx_t_1) {
        } else {
          __pyx_t_2 = __pyx_t_1;
          goto __pyx_L23_bool_binop_done;
        }
        __pyx_t_1 = (((__pyx_v_player->current.sample_pos - __pyx_v_current_chunk_bytes) < 0) != 0);
        if (__pyx_t_1) {
        } else {
          __pyx_t_2 = __pyx_t_1;
          goto __pyx_L23_bool_binop_done;
        }
        __pyx_t_1 = ((__pyx_v_player->current.about_to_finish_marker < __pyx_v_player->current.sample_pos) != 0);
        __pyx_t_2 = __pyx_t_1;
        __pyx_L23_bool_binop_done:;
        if (__pyx_t_2) {

          /* "mpfmc/core/audio/track_standard.pyx":1473
 *                     if not end_of_sound and player.current.sample_pos - current_chunk_bytes < 0 and player.current.about_to_finish_marker < player.current.sample_pos:
 *                         # Marker is in window, send notification
 *                         send_sound_about_to_finish_notification(player_num,             # <<<<<<<<<<<<<<
 *                                                                 player.current.sound_id,
 *                                                                 player.current.sound_instance_id,
 */
          __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_about_to_finish_notification(__pyx_v_player_num, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_track);

          /* "mpfmc/core/audio/track_standard.pyx":1471
 *                                                                 track)
 *                     # Special check if buffer wraps back around to the beginning of the sample
 *                     if not end_of_sound and player.current.sample_pos - current_chunk_bytes < 0 and player.current.about_to_finish_marker < player.current.sample_pos:             # <<<<<<<<<<<<<<
 *                         # Marker is in window, send notification
 *                         send_sound_about_to_finish_notification(player_num,
 */
        }

        /* "mpfmc/core/audio/track_standard.pyx":1463
 * 
 *                 # About to finish marker
 *                 if player.current.about_to_finish_marker != no_marker:             # <<<<<<<<<<<<<<
 *                     if player.current.sample_pos - current_chunk_bytes <= player.current.about_to_finish_marker < player.current.sample_pos:
 *                         # Marker is in window, send notification
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":1479
 * 
 *                 # User-defined markers
 *                 for marker_id in range(player.current.marker_count):             # <<<<<<<<<<<<<<
 *                     if player.current.sample_pos - current_chunk_bytes <= g_array_index_uint(player.current.markers, marker_id) < player.current.sample_pos:
 *                         # Marker is in window, send notification
 */
      __pyx_t_9 = __pyx_v_player->current.marker_count;
      __pyx_t_10 = __pyx_t_9;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
        __pyx_v_marker_id = __pyx_t_11;

        /* "mpfmc/core/audio/track_standard.pyx":1480
 *                 # User-defined markers
 *                 for marker_id in range(player.current.marker_count):
 *                     if player.current.sample_pos - current_chunk_bytes <= g_array_index_uint(player.current.markers, marker_id) < player.current.sample_pos:             # <<<<<<<<<<<<<<
 *                         # Marker is in window, send notification
 *                         send_sound_marker_notification(player_num,
 */
        __pyx_t_15 = g_array_index_uint(__pyx_v_player->current.markers, __pyx_v_marker_id);
        __pyx_t_2 = ((__pyx_v_player->current.sample_pos - __pyx_v_current_chunk_bytes) <= __pyx_t_15);
        if (__pyx_t_2) {
          __pyx_t_2 = (__pyx_t_15 < __pyx_v_player->current.sample_pos);
        }
        __pyx_t_1 = (__pyx_t_2 != 0);
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1482
 *                     if player.current.sample_pos - current_chunk_bytes <= g_array_index_uint(player.current.markers, marker_id) < player.current.sample_pos:
 *                         # Marker is in window, send notification
 *                         send_sound_marker_notification(player_num,             # <<<<<<<<<<<<<<
 *                                                        player.current.sound_id,
 *                                                        player.current.sound_instance_id,
 */
          __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_marker_notification(__pyx_v_player_num, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_track, __pyx_v_marker_id);

          /* "mpfmc/core/audio/track_standard.pyx":1480
 *                 # User-defined markers
 *                 for marker_id in range(player.current.marker_count):
 *                     if player.current.sample_pos - current_chunk_bytes <= g_array_index_uint(player.current.markers, marker_id) < player.current.sample_pos:             # <<<<<<<<<<<<<<
 *                         # Marker is in window, send notification
 *                         send_sound_marker_notification(player_num,
 */
        }

        /* "mpfmc/core/audio/track_standard.pyx":1488
 *                                                        marker_id)
 *                     # Special check if buffer wraps back around to the beginning of the sample
 *                     if not end_of_sound and player.current.sample_pos - current_chunk_bytes < 0 and g_array_index_uint(player.current.markers, marker_id) < player.current.sample_pos:             # <<<<<<<<<<<<<<
 *                         # Marker is in window, send notification
 *                         send_sound_marker_notification(player_num,
 */
        __pyx_t_2 = ((!(__pyx_v_end_of_sound != 0)) != 0);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L30_bool_binop_done;
        }
        __pyx_t_2 = (((__pyx_v_player->current.sample_pos - __pyx_v_current_chunk_bytes) < 0) != 0);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L30_bool_binop_done;
        }
        __pyx_t_2 = ((g_array_index_uint(__pyx_v_player->current.markers, __pyx_v_marker_id) < __pyx_v_player->current.sample_pos) != 0);
        __pyx_t_1 = __pyx_t_2;
        __pyx_L30_bool_binop_done:;
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1490
 *                     if not end_of_sound and player.current.sample_pos - current_chunk_bytes < 0 and g_array_index_uint(player.current.markers, marker_id) < player.current.sample_pos:
 *                         # Marker is in window, send notification
 *                         send_sound_marker_notification(player_num,             # <<<<<<<<<<<<<<
 *                                                        player.current.sound_id,
 *                                                        player.current.sound_instance_id,
 */
          __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_marker_notification(__pyx_v_player_num, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_track, __pyx_v_marker_id);

          /* "mpfmc/core/audio/track_standard.pyx":1488
 *                                                        marker_id)
 *                     # Special check if buffer wraps back around to the beginning of the sample
 *                     if not end_of_sound and player.current.sample_pos - current_chunk_bytes < 0 and g_array_index_uint(player.current.markers, marker_id) < player.current.sample_pos:             # <<<<<<<<<<<<<<
 *                         # Marker is in window, send notification
 *                         send_sound_marker_notification(player_num,
 */
        }
      }

      /* "mpfmc/core/audio/track_standard.pyx":1497
 * 
 *                 # Check if sound is finished due to a fade out completing
 *                 if player.current.fading_status == fading_status_fading_out and player.current.fade_steps_remaining == 0:             # <<<<<<<<<<<<<<
 *                     end_of_sound = True
 * 
 */
      __pyx_t_2 = ((__pyx_v_player->current.fading_status == __pyx_e_5mpfmc_4core_5audio_14track_standard_fading_status_fading_out) != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L34_bool_binop_done;
      }
      __pyx_t_2 = ((__pyx_v_player->current.fade_steps_remaining == 0) != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L34_bool_binop_done:;
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1498
 *                 # Check if sound is finished due to a fade out completing
 *                 if player.current.fading_status == fading_status_fading_out and player.current.fade_steps_remaining == 0:
 *                     end_of_sound = True             # <<<<<<<<<<<<<<
 * 
 *                 # Sound finished processing
 */
        __pyx_v_end_of_sound = 1;

        /* "mpfmc/core/audio/track_standard.pyx":1497
 * 
 *                 # Check if sound is finished due to a fade out completing
 *                 if player.current.fading_status == fading_status_fading_out and player.current.fade_steps_remaining == 0:             # <<<<<<<<<<<<<<
 *                     end_of_sound = True
 * 
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":1501
 * 
 *                 # Sound finished processing
 *                 if end_of_sound:             # <<<<<<<<<<<<<<
 *                     send_sound_stopped_notification(player_num, player.current.sound_id, player.current.sound_instance_id, track)
 * 
 */
      __pyx_t_1 = (__pyx_v_end_of_sound != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1502
 *                 # Sound finished processing
 *                 if end_of_sound:
 *                     send_sound_stopped_notification(player_num, player.current.sound_id, player.current.sound_instance_id, track)             # <<<<<<<<<<<<<<
 * 
 *                     # End of sound behavior depends upon player status
 */
        __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_stopped_notification(__pyx_v_player_num, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_track);

        /* "mpfmc/core/audio/track_standard.pyx":1505
 * 
 *                     # End of sound behavior depends upon player status
 *                     if player.status == player_replacing:             # <<<<<<<<<<<<<<
 *                         # Replacing the current sound with a new one: copy sound player settings from next sound to current
 *                         player.current.sample = player.next.sample
 */
        __pyx_t_1 = ((__pyx_v_player->status == __pyx_e_5mpfmc_4core_5audio_14track_standard_player_replacing) != 0);
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1507
 *                     if player.status == player_replacing:
 *                         # Replacing the current sound with a new one: copy sound player settings from next sound to current
 *                         player.current.sample = player.next.sample             # <<<<<<<<<<<<<<
 *                         player.current.sample_pos = player.next.sample_pos
 *                         player.current.loop_start_pos = player.next.loop_start_pos
 */
          __pyx_t_16 = __pyx_v_player->next.sample;
          __pyx_v_player->current.sample = __pyx_t_16;

          /* "mpfmc/core/audio/track_standard.pyx":1508
 *                         # Replacing the current sound with a new one: copy sound player settings from next sound to current
 *                         player.current.sample = player.next.sample
 *                         player.current.sample_pos = player.next.sample_pos             # <<<<<<<<<<<<<<
 *                         player.current.loop_start_pos = player.next.loop_start_pos
 *                         player.current.loop_end_pos = player.next.loop_end_pos
 */
          __pyx_t_8 = __pyx_v_player->next.sample_pos;
          __pyx_v_player->current.sample_pos = __pyx_t_8;

          /* "mpfmc/core/audio/track_standard.pyx":1509
 *                         player.current.sample = player.next.sample
 *                         player.current.sample_pos = player.next.sample_pos
 *                         player.current.loop_start_pos = player.next.loop_start_pos             # <<<<<<<<<<<<<<
 *                         player.current.loop_end_pos = player.next.loop_end_pos
 *                         player.current.current_loop = player.next.current_loop
 */
          __pyx_t_8 = __pyx_v_player->next.loop_start_pos;
          __pyx_v_player->current.loop_start_pos = __pyx_t_8;

          /* "mpfmc/core/audio/track_standard.pyx":1510
 *                         player.current.sample_pos = player.next.sample_pos
 *                         player.current.loop_start_pos = player.next.loop_start_pos
 *                         player.current.loop_end_pos = player.next.loop_end_pos             # <<<<<<<<<<<<<<
 *                         player.current.current_loop = player.next.current_loop
 *                         player.current.sound_id = player.next.sound_id
 */
          __pyx_t_8 = __pyx_v_player->next.loop_end_pos;
          __pyx_v_player->current.loop_end_pos = __pyx_t_8;

          /* "mpfmc/core/audio/track_standard.pyx":1511
 *                         player.current.loop_start_pos = player.next.loop_start_pos
 *                         player.current.loop_end_pos = player.next.loop_end_pos
 *                         player.current.current_loop = player.next.current_loop             # <<<<<<<<<<<<<<
 *                         player.current.sound_id = player.next.sound_id
 *                         player.current.sound_instance_id = player.next.sound_instance_id
 */
          __pyx_t_11 = __pyx_v_player->next.current_loop;
          __pyx_v_player->current.current_loop = __pyx_t_11;

          /* "mpfmc/core/audio/track_standard.pyx":1512
 *                         player.current.loop_end_pos = player.next.loop_end_pos
 *                         player.current.current_loop = player.next.current_loop
 *                         player.current.sound_id = player.next.sound_id             # <<<<<<<<<<<<<<
 *                         player.current.sound_instance_id = player.next.sound_instance_id
 *                         player.current.volume = player.next.volume
 */
          __pyx_t_17 = __pyx_v_player->next.sound_id;
          __pyx_v_player->current.sound_id = __pyx_t_17;

          /* "mpfmc/core/audio/track_standard.pyx":1513
 *                         player.current.current_loop = player.next.current_loop
 *                         player.current.sound_id = player.next.sound_id
 *                         player.current.sound_instance_id = player.next.sound_instance_id             # <<<<<<<<<<<<<<
 *                         player.current.volume = player.next.volume
 *                         player.current.loops_remaining = player.next.loops_remaining
 */
          __pyx_t_17 = __pyx_v_player->next.sound_instance_id;
          __pyx_v_player->current.sound_instance_id = __pyx_t_17;

          /* "mpfmc/core/audio/track_standard.pyx":1514
 *                         player.current.sound_id = player.next.sound_id
 *                         player.current.sound_instance_id = player.next.sound_instance_id
 *                         player.current.volume = player.next.volume             # <<<<<<<<<<<<<<
 *                         player.current.loops_remaining = player.next.loops_remaining
 *                         player.current.sound_priority = player.next.sound_priority
 */
          __pyx_t_9 = __pyx_v_player->next.volume;
          __pyx_v_player->current.volume = __pyx_t_9;

          /* "mpfmc/core/audio/track_standard.pyx":1515
 *                         player.current.sound_instance_id = player.next.sound_instance_id
 *                         player.current.volume = player.next.volume
 *                         player.current.loops_remaining = player.next.loops_remaining             # <<<<<<<<<<<<<<
 *                         player.current.sound_priority = player.next.sound_priority
 *                         player.current.fade_in_steps = player.next.fade_in_steps
 */
          __pyx_t_11 = __pyx_v_player->next.loops_remaining;
          __pyx_v_player->current.loops_remaining = __pyx_t_11;

          /* "mpfmc/core/audio/track_standard.pyx":1516
 *                         player.current.volume = player.next.volume
 *                         player.current.loops_remaining = player.next.loops_remaining
 *                         player.current.sound_priority = player.next.sound_priority             # <<<<<<<<<<<<<<
 *                         player.current.fade_in_steps = player.next.fade_in_steps
 *                         player.current.fade_out_steps = player.next.fade_out_steps
 */
          __pyx_t_11 = __pyx_v_player->next.sound_priority;
          __pyx_v_player->current.sound_priority = __pyx_t_11;

          /* "mpfmc/core/audio/track_standard.pyx":1517
 *                         player.current.loops_remaining = player.next.loops_remaining
 *                         player.current.sound_priority = player.next.sound_priority
 *                         player.current.fade_in_steps = player.next.fade_in_steps             # <<<<<<<<<<<<<<
 *                         player.current.fade_out_steps = player.next.fade_out_steps
 *                         player.current.fade_steps_remaining = player.next.fade_steps_remaining
 */
          __pyx_t_8 = __pyx_v_player->next.fade_in_steps;
          __pyx_v_player->current.fade_in_steps = __pyx_t_8;

          /* "mpfmc/core/audio/track_standard.pyx":1518
 *                         player.current.sound_priority = player.next.sound_priority
 *                         player.current.fade_in_steps = player.next.fade_in_steps
 *                         player.current.fade_out_steps = player.next.fade_out_steps             # <<<<<<<<<<<<<<
 *                         player.current.fade_steps_remaining = player.next.fade_steps_remaining
 *                         player.current.fading_status = player.next.fading_status
 */
          __pyx_t_8 = __pyx_v_player->next.fade_out_steps;
          __pyx_v_player->current.fade_out_steps = __pyx_t_8;

          /* "mpfmc/core/audio/track_standard.pyx":1519
 *                         player.current.fade_in_steps = player.next.fade_in_steps
 *                         player.current.fade_out_steps = player.next.fade_out_steps
 *                         player.current.fade_steps_remaining = player.next.fade_steps_remaining             # <<<<<<<<<<<<<<
 *                         player.current.fading_status = player.next.fading_status
 *                         player.current.about_to_finish_marker = player.next.about_to_finish_marker
 */
          __pyx_t_8 = __pyx_v_player->next.fade_steps_remaining;
          __pyx_v_player->current.fade_steps_remaining = __pyx_t_8;

          /* "mpfmc/core/audio/track_standard.pyx":1520
 *                         player.current.fade_out_steps = player.next.fade_out_steps
 *                         player.current.fade_steps_remaining = player.next.fade_steps_remaining
 *                         player.current.fading_status = player.next.fading_status             # <<<<<<<<<<<<<<
 *                         player.current.about_to_finish_marker = player.next.about_to_finish_marker
 * 
 */
          __pyx_t_18 = __pyx_v_player->next.fading_status;
          __pyx_v_player->current.fading_status = __pyx_t_18;

          /* "mpfmc/core/audio/track_standard.pyx":1521
 *                         player.current.fade_steps_remaining = player.next.fade_steps_remaining
 *                         player.current.fading_status = player.next.fading_status
 *                         player.current.about_to_finish_marker = player.next.about_to_finish_marker             # <<<<<<<<<<<<<<
 * 
 *                         player.current.marker_count = player.next.marker_count
 */
          __pyx_t_8 = __pyx_v_player->next.about_to_finish_marker;
          __pyx_v_player->current.about_to_finish_marker = __pyx_t_8;

          /* "mpfmc/core/audio/track_standard.pyx":1523
 *                         player.current.about_to_finish_marker = player.next.about_to_finish_marker
 * 
 *                         player.current.marker_count = player.next.marker_count             # <<<<<<<<<<<<<<
 *                         g_array_set_size(player.current.markers, player.current.marker_count)
 *                         for marker_id in range(player.next.marker_count):
 */
          __pyx_t_9 = __pyx_v_player->next.marker_count;
          __pyx_v_player->current.marker_count = __pyx_t_9;

          /* "mpfmc/core/audio/track_standard.pyx":1524
 * 
 *                         player.current.marker_count = player.next.marker_count
 *                         g_array_set_size(player.current.markers, player.current.marker_count)             # <<<<<<<<<<<<<<
 *                         for marker_id in range(player.next.marker_count):
 *                             g_array_insert_val_uint(player.current.markers,
 */
          (void)(g_array_set_size(__pyx_v_player->current.markers, __pyx_v_player->current.marker_count));

          /* "mpfmc/core/audio/track_standard.pyx":1525
 *                         player.current.marker_count = player.next.marker_count
 *                         g_array_set_size(player.current.markers, player.current.marker_count)
 *                         for marker_id in range(player.next.marker_count):             # <<<<<<<<<<<<<<
 *                             g_array_insert_val_uint(player.current.markers,
 *                                                     marker_id,
 */
          __pyx_t_9 = __pyx_v_player->next.marker_count;
          __pyx_t_10 = __pyx_t_9;
          for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
            __pyx_v_marker_id = __pyx_t_11;

            /* "mpfmc/core/audio/track_standard.pyx":1526
 *                         g_array_set_size(player.current.markers, player.current.marker_count)
 *                         for marker_id in range(player.next.marker_count):
 *                             g_array_insert_val_uint(player.current.markers,             # <<<<<<<<<<<<<<
 *                                                     marker_id,
 *                                                     g_array_index_uint(player.next.markers, marker_id))
 */
            g_array_insert_val_uint(__pyx_v_player->current.markers, __pyx_v_marker_id, g_array_index_uint(__pyx_v_player->next.markers, __pyx_v_marker_id));
          }

          /* "mpfmc/core/audio/track_standard.pyx":1530
 *                                                     g_array_index_uint(player.next.markers, marker_id))
 * 
 *                         if player.next.sound_has_ducking:             # <<<<<<<<<<<<<<
 *                             player.current.sound_has_ducking = True
 *                             player.current.ducking_stage = ducking_stage_delay
 */
          __pyx_t_1 = (__pyx_v_player->next.sound_has_ducking != 0);
          if (__pyx_t_1) {

            /* "mpfmc/core/audio/track_standard.pyx":1531
 * 
 *                         if player.next.sound_has_ducking:
 *                             player.current.sound_has_ducking = True             # <<<<<<<<<<<<<<
 *                             player.current.ducking_stage = ducking_stage_delay
 *                             player.current.ducking_settings.track_bit_mask = player.next.ducking_settings.track_bit_mask
 */
            __pyx_v_player->current.sound_has_ducking = 1;

            /* "mpfmc/core/audio/track_standard.pyx":1532
 *                         if player.next.sound_has_ducking:
 *                             player.current.sound_has_ducking = True
 *                             player.current.ducking_stage = ducking_stage_delay             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.track_bit_mask = player.next.ducking_settings.track_bit_mask
 *                             player.current.ducking_settings.attack_start_pos = player.next.ducking_settings.attack_start_pos
 */
            __pyx_v_player->current.ducking_stage = __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_delay;

            /* "mpfmc/core/audio/track_standard.pyx":1533
 *                             player.current.sound_has_ducking = True
 *                             player.current.ducking_stage = ducking_stage_delay
 *                             player.current.ducking_settings.track_bit_mask = player.next.ducking_settings.track_bit_mask             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.attack_start_pos = player.next.ducking_settings.attack_start_pos
 *                             player.current.ducking_settings.attack_duration = player.next.ducking_settings.attack_duration
 */
            __pyx_t_11 = __pyx_v_player->next.ducking_settings.track_bit_mask;
            __pyx_v_player->current.ducking_settings.track_bit_mask = __pyx_t_11;

            /* "mpfmc/core/audio/track_standard.pyx":1534
 *                             player.current.ducking_stage = ducking_stage_delay
 *                             player.current.ducking_settings.track_bit_mask = player.next.ducking_settings.track_bit_mask
 *                             player.current.ducking_settings.attack_start_pos = player.next.ducking_settings.attack_start_pos             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.attack_duration = player.next.ducking_settings.attack_duration
 *                             player.current.ducking_settings.attenuation_volume = player.next.ducking_settings.attenuation_volume
 */
            __pyx_t_19 = __pyx_v_player->next.ducking_settings.attack_start_pos;
            __pyx_v_player->current.ducking_settings.attack_start_pos = __pyx_t_19;

            /* "mpfmc/core/audio/track_standard.pyx":1535
 *                             player.current.ducking_settings.track_bit_mask = player.next.ducking_settings.track_bit_mask
 *                             player.current.ducking_settings.attack_start_pos = player.next.ducking_settings.attack_start_pos
 *                             player.current.ducking_settings.attack_duration = player.next.ducking_settings.attack_duration             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.attenuation_volume = player.next.ducking_settings.attenuation_volume
 *                             player.current.ducking_settings.release_start_pos = player.next.ducking_settings.release_start_pos
 */
            __pyx_t_19 = __pyx_v_player->next.ducking_settings.attack_duration;
            __pyx_v_player->current.ducking_settings.attack_duration = __pyx_t_19;

            /* "mpfmc/core/audio/track_standard.pyx":1536
 *                             player.current.ducking_settings.attack_start_pos = player.next.ducking_settings.attack_start_pos
 *                             player.current.ducking_settings.attack_duration = player.next.ducking_settings.attack_duration
 *                             player.current.ducking_settings.attenuation_volume = player.next.ducking_settings.attenuation_volume             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.release_start_pos = player.next.ducking_settings.release_start_pos
 *                             player.current.ducking_settings.release_duration = player.next.ducking_settings.release_duration
 */
            __pyx_t_9 = __pyx_v_player->next.ducking_settings.attenuation_volume;
            __pyx_v_player->current.ducking_settings.attenuation_volume = __pyx_t_9;

            /* "mpfmc/core/audio/track_standard.pyx":1537
 *                             player.current.ducking_settings.attack_duration = player.next.ducking_settings.attack_duration
 *                             player.current.ducking_settings.attenuation_volume = player.next.ducking_settings.attenuation_volume
 *                             player.current.ducking_settings.release_start_pos = player.next.ducking_settings.release_start_pos             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.release_duration = player.next.ducking_settings.release_duration
 *                         else:
 */
            __pyx_t_19 = __pyx_v_player->next.ducking_settings.release_start_pos;
            __pyx_v_player->current.ducking_settings.release_start_pos = __pyx_t_19;

            /* "mpfmc/core/audio/track_standard.pyx":1538
 *                             player.current.ducking_settings.attenuation_volume = player.next.ducking_settings.attenuation_volume
 *                             player.current.ducking_settings.release_start_pos = player.next.ducking_settings.release_start_pos
 *                             player.current.ducking_settings.release_duration = player.next.ducking_settings.release_duration             # <<<<<<<<<<<<<<
 *                         else:
 *                             player.current.sound_has_ducking = False
 */
            __pyx_t_19 = __pyx_v_player->next.ducking_settings.release_duration;
            __pyx_v_player->current.ducking_settings.release_duration = __pyx_t_19;

            /* "mpfmc/core/audio/track_standard.pyx":1530
 *                                                     g_array_index_uint(player.next.markers, marker_id))
 * 
 *                         if player.next.sound_has_ducking:             # <<<<<<<<<<<<<<
 *                             player.current.sound_has_ducking = True
 *                             player.current.ducking_stage = ducking_stage_delay
 */
            goto __pyx_L40;
          }

          /* "mpfmc/core/audio/track_standard.pyx":1540
 *                             player.current.ducking_settings.release_duration = player.next.ducking_settings.release_duration
 *                         else:
 *                             player.current.sound_has_ducking = False             # <<<<<<<<<<<<<<
 *                             player.current.ducking_stage = ducking_stage_idle
 *                             player.current.ducking_settings.track_bit_mask = 0
 */
          /*else*/ {
            __pyx_v_player->current.sound_has_ducking = 0;

            /* "mpfmc/core/audio/track_standard.pyx":1541
 *                         else:
 *                             player.current.sound_has_ducking = False
 *                             player.current.ducking_stage = ducking_stage_idle             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.track_bit_mask = 0
 *                             player.current.ducking_settings.attack_start_pos = 0
 */
            __pyx_v_player->current.ducking_stage = __pyx_e_5mpfmc_4core_5audio_14track_standard_ducking_stage_idle;

            /* "mpfmc/core/audio/track_standard.pyx":1542
 *                             player.current.sound_has_ducking = False
 *                             player.current.ducking_stage = ducking_stage_idle
 *                             player.current.ducking_settings.track_bit_mask = 0             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.attack_start_pos = 0
 *                             player.current.ducking_settings.attack_duration = 0
 */
            __pyx_v_player->current.ducking_settings.track_bit_mask = 0;

            /* "mpfmc/core/audio/track_standard.pyx":1543
 *                             player.current.ducking_stage = ducking_stage_idle
 *                             player.current.ducking_settings.track_bit_mask = 0
 *                             player.current.ducking_settings.attack_start_pos = 0             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.attack_duration = 0
 *                             player.current.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME
 */
            __pyx_v_player->current.ducking_settings.attack_start_pos = 0;

            /* "mpfmc/core/audio/track_standard.pyx":1544
 *                             player.current.ducking_settings.track_bit_mask = 0
 *                             player.current.ducking_settings.attack_start_pos = 0
 *                             player.current.ducking_settings.attack_duration = 0             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME
 *                             player.current.ducking_settings.release_start_pos = 0
 */
            __pyx_v_player->current.ducking_settings.attack_duration = 0;

            /* "mpfmc/core/audio/track_standard.pyx":1545
 *                             player.current.ducking_settings.attack_start_pos = 0
 *                             player.current.ducking_settings.attack_duration = 0
 *                             player.current.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.release_start_pos = 0
 *                             player.current.ducking_settings.release_duration = 0
 */
            __pyx_v_player->current.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME;

            /* "mpfmc/core/audio/track_standard.pyx":1546
 *                             player.current.ducking_settings.attack_duration = 0
 *                             player.current.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME
 *                             player.current.ducking_settings.release_start_pos = 0             # <<<<<<<<<<<<<<
 *                             player.current.ducking_settings.release_duration = 0
 * 
 */
            __pyx_v_player->current.ducking_settings.release_start_pos = 0;

            /* "mpfmc/core/audio/track_standard.pyx":1547
 *                             player.current.ducking_settings.attenuation_volume = SDL_MIX_MAXVOLUME
 *                             player.current.ducking_settings.release_start_pos = 0
 *                             player.current.ducking_settings.release_duration = 0             # <<<<<<<<<<<<<<
 * 
 *                         # Send sound started notification
 */
            __pyx_v_player->current.ducking_settings.release_duration = 0;
          }
          __pyx_L40:;

          /* "mpfmc/core/audio/track_standard.pyx":1550
 * 
 *                         # Send sound started notification
 *                         send_sound_started_notification(player_num, player.current.sound_id, player.current.sound_instance_id, track)             # <<<<<<<<<<<<<<
 *                         player.status = player_playing
 *                         sound_finished = False
 */
          __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_started_notification(__pyx_v_player_num, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_track);

          /* "mpfmc/core/audio/track_standard.pyx":1551
 *                         # Send sound started notification
 *                         send_sound_started_notification(player_num, player.current.sound_id, player.current.sound_instance_id, track)
 *                         player.status = player_playing             # <<<<<<<<<<<<<<
 *                         sound_finished = False
 *                     else:
 */
          __pyx_v_player->status = __pyx_e_5mpfmc_4core_5audio_14track_standard_player_playing;

          /* "mpfmc/core/audio/track_standard.pyx":1552
 *                         send_sound_started_notification(player_num, player.current.sound_id, player.current.sound_instance_id, track)
 *                         player.status = player_playing
 *                         sound_finished = False             # <<<<<<<<<<<<<<
 *                     else:
 *                         player.status = player_idle
 */
          __pyx_v_sound_finished = 0;

          /* "mpfmc/core/audio/track_standard.pyx":1505
 * 
 *                     # End of sound behavior depends upon player status
 *                     if player.status == player_replacing:             # <<<<<<<<<<<<<<
 *                         # Replacing the current sound with a new one: copy sound player settings from next sound to current
 *                         player.current.sample = player.next.sample
 */
          goto __pyx_L37;
        }

        /* "mpfmc/core/audio/track_standard.pyx":1554
 *                         sound_finished = False
 *                     else:
 *                         player.status = player_idle             # <<<<<<<<<<<<<<
 *                         break
 * 
 */
        /*else*/ {
          __pyx_v_player->status = __pyx_e_5mpfmc_4core_5audio_14track_standard_player_idle;

          /* "mpfmc/core/audio/track_standard.pyx":1555
 *                     else:
 *                         player.status = player_idle
 *                         break             # <<<<<<<<<<<<<<
 * 
 *                 # Move to next chunk
 */
          goto __pyx_L12_break;
        }
        __pyx_L37:;

        /* "mpfmc/core/audio/track_standard.pyx":1501
 * 
 *                 # Sound finished processing
 *                 if end_of_sound:             # <<<<<<<<<<<<<<
 *                     send_sound_stopped_notification(player_num, player.current.sound_id, player.current.sound_instance_id, track)
 * 
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":1558
 * 
 *                 # Move to next chunk
 *                 buffer_bytes_remaining -= current_chunk_bytes             # <<<<<<<<<<<<<<
 *                 track_buffer_pos += current_chunk_bytes
 *                 control_point += 1
 */
      __pyx_v_buffer_bytes_remaining = (__pyx_v_buffer_bytes_remaining - __pyx_v_current_chunk_bytes);

      /* "mpfmc/core/audio/track_standard.pyx":1559
 *                 # Move to next chunk
 *                 buffer_bytes_remaining -= current_chunk_bytes
 *                 track_buffer_pos += current_chunk_bytes             # <<<<<<<<<<<<<<
 *                 control_point += 1
 * 
 */
      __pyx_v_track_buffer_pos = (__pyx_v_track_buffer_pos + __pyx_v_current_chunk_bytes);

      /* "mpfmc/core/audio/track_standard.pyx":1560
 *                 buffer_bytes_remaining -= current_chunk_bytes
 *                 track_buffer_pos += current_chunk_bytes
 *                 control_point += 1             # <<<<<<<<<<<<<<
 * 
 * cdef bint get_memory_sound_samples(SoundSettings *sound, Uint32 length, Uint8 *output_buffer, int channels,
 */
      __pyx_v_control_point = (__pyx_v_control_point + 1);
    }
    __pyx_L12_break:;
    __pyx_L6_continue:;
  }

  /* "mpfmc/core/audio/track_standard.pyx":1318
 * 
 *     @staticmethod
 *     cdef void 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("mpfmc.core.audio.track_standard.TrackStandard.mix_playing_sounds", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
  __pyx_L0:;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_67__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_66__reduce_cython__[] = "TrackStandard.__reduce_cython__(self)";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_67__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_66__reduce_cython__(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_66__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_69__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_68__setstate_cython__[] = "TrackStandard.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_69__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_68__setstate_cython__(((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_5mpfmc_4core_5audio_14track_standard_13TrackStandard_68__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mpfmc.core.audio.track_standard.TrackStandard.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":1562
 *                 control_point += 1
 * 
 * cdef bint get_memory_sound_samples(SoundSettings *sound, Uint32 length, Uint8 *output_buffer, int channels,             # <<<<<<<<<<<<<<
 *                                    Uint8 volume, TrackState *track, int player_num) nogil:
 *     """
 */

static int __pyx_f_5mpfmc_4core_5audio_14track_standard_get_memory_sound_samples(__pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings *__pyx_v_sound, Uint32 __pyx_v_length, Uint8 *__pyx_v_output_buffer, int __pyx_v_channels, Uint8 __pyx_v_volume, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track, int __pyx_v_player_num) {
  Uint32 __pyx_v_samples_remaining_to_output;
  Uint32 __pyx_v_samples_remaining_in_sound;
  Uint32 __pyx_v_loop_end_pos;
  Uint32 __pyx_v_buffer_pos;
  Uint8 *__pyx_v_sound_buffer;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  Uint32 __pyx_t_3;
  gsize __pyx_t_4;

  /* "mpfmc/core/audio/track_standard.pyx":1580
 *         True if sound is finished, False otherwise
 *     """
 *     if sound == NULL or output_buffer == NULL:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_2 = ((__pyx_v_sound == NULL) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_output_buffer == NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1581
 *     """
 *     if sound == NULL or output_buffer == NULL:
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     cdef Uint32 samples_remaining_to_output = length
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":1580
 *         True if sound is finished, False otherwise
 *     """
 *     if sound == NULL or output_buffer == NULL:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":1583
 *         return True
 * 
 *     cdef Uint32 samples_remaining_to_output = length             # <<<<<<<<<<<<<<
 *     cdef Uint32 samples_remaining_in_sound
 *     cdef Uint32 loop_end_pos = sound.loop_end_pos
 */
  __pyx_v_samples_remaining_to_output = __pyx_v_length;

  /* "mpfmc/core/audio/track_standard.pyx":1585
 *     cdef Uint32 samples_remaining_to_output = length
 *     cdef Uint32 samples_remaining_in_sound
 *     cdef Uint32 loop_end_pos = sound.loop_end_pos             # <<<<<<<<<<<<<<
 *     cdef Uint32 buffer_pos = 0
 *     cdef Uint8 *sound_buffer = <Uint8*>sound.sample.data.memory.data
 */
  __pyx_t_3 = __pyx_v_sound->loop_end_pos;
  __pyx_v_loop_end_pos = __pyx_t_3;

  /* "mpfmc/core/audio/track_standard.pyx":1586
 *     cdef Uint32 samples_remaining_in_sound
 *     cdef Uint32 loop_end_pos = sound.loop_end_pos
 *     cdef Uint32 buffer_pos = 0             # <<<<<<<<<<<<<<
 *     cdef Uint8 *sound_buffer = <Uint8*>sound.sample.data.memory.data
 *     if sound_buffer == NULL:
 */
  __pyx_v_buffer_pos = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1587
 *     cdef Uint32 loop_end_pos = sound.loop_end_pos
 *     cdef Uint32 buffer_pos = 0
 *     cdef Uint8 *sound_buffer = <Uint8*>sound.sample.data.memory.data             # <<<<<<<<<<<<<<
 *     if sound_buffer == NULL:
 *         return True
 */
  __pyx_v_sound_buffer = ((Uint8 *)__pyx_v_sound->sample->data.memory->data);

  /* "mpfmc/core/audio/track_standard.pyx":1588
 *     cdef Uint32 buffer_pos = 0
 *     cdef Uint8 *sound_buffer = <Uint8*>sound.sample.data.memory.data
 *     if sound_buffer == NULL:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_1 = ((__pyx_v_sound_buffer == NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1589
 *     cdef Uint8 *sound_buffer = <Uint8*>sound.sample.data.memory.data
 *     if sound_buffer == NULL:
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     # Make sure the sound sample position is not starting after the end of the loop position. If so, adjust the
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":1588
 *     cdef Uint32 buffer_pos = 0
 *     cdef Uint8 *sound_buffer = <Uint8*>sound.sample.data.memory.data
 *     if sound_buffer == NULL:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":1595
 *     # the sound buffer and into other parts of memory creating noise). This should only ever happen if the sound
 *     # is started after the end of the loop position.
 *     if sound.sample_pos >= loop_end_pos:             # <<<<<<<<<<<<<<
 *         loop_end_pos = sound.sample.data.memory.size
 * 
 */
  __pyx_t_1 = ((__pyx_v_sound->sample_pos >= __pyx_v_loop_end_pos) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1596
 *     # is started after the end of the loop position.
 *     if sound.sample_pos >= loop_end_pos:
 *         loop_end_pos = sound.sample.data.memory.size             # <<<<<<<<<<<<<<
 * 
 *     # Loop while there are still samples remaining to be output
 */
    __pyx_t_4 = __pyx_v_sound->sample->data.memory->size;
    __pyx_v_loop_end_pos = __pyx_t_4;

    /* "mpfmc/core/audio/track_standard.pyx":1595
 *     # the sound buffer and into other parts of memory creating noise). This should only ever happen if the sound
 *     # is started after the end of the loop position.
 *     if sound.sample_pos >= loop_end_pos:             # <<<<<<<<<<<<<<
 *         loop_end_pos = sound.sample.data.memory.size
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":1599
 * 
 *     # Loop while there are still samples remaining to be output
 *     while samples_remaining_to_output > 0:             # <<<<<<<<<<<<<<
 * 
 *         # Determine how many samples are remaining in the sound buffer before the end of the sound (the
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_samples_remaining_to_output > 0) != 0);
    if (!__pyx_t_1) break;

    /* "mpfmc/core/audio/track_standard.pyx":1603
 *         # Determine how many samples are remaining in the sound buffer before the end of the sound (the
 *         # current loop position)
 *         samples_remaining_in_sound = loop_end_pos - sound.sample_pos             # <<<<<<<<<<<<<<
 * 
 *         # Determine if we are consuming the entire remaining sound buffer, or just a portion of it
 */
    __pyx_v_samples_remaining_in_sound = (__pyx_v_loop_end_pos - __pyx_v_sound->sample_pos);

    /* "mpfmc/core/audio/track_standard.pyx":1606
 * 
 *         # Determine if we are consuming the entire remaining sound buffer, or just a portion of it
 *         if samples_remaining_to_output < samples_remaining_in_sound:             # <<<<<<<<<<<<<<
 * 
 *             # We are not consuming the entire streaming buffer.  There will still be buffer data remaining for the next call.
 */
    __pyx_t_1 = ((__pyx_v_samples_remaining_to_output < __pyx_v_samples_remaining_in_sound) != 0);
    if (__pyx_t_1) {

      /* "mpfmc/core/audio/track_standard.pyx":1609
 * 
 *             # We are not consuming the entire streaming buffer.  There will still be buffer data remaining for the next call.
 *             if channels == 2 and False:             # <<<<<<<<<<<<<<
 *                 # disabled for now
 *                 Track.mix_audio_stereo(output_buffer + buffer_pos,
 */
      __pyx_t_2 = ((__pyx_v_channels == 2) != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_1 = 0;
      __pyx_L12_bool_binop_done:;
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1611
 *             if channels == 2 and False:
 *                 # disabled for now
 *                 Track.mix_audio_stereo(output_buffer + buffer_pos,             # <<<<<<<<<<<<<<
 *                                        <Uint8*>sound.sample.data.memory.data + sound.sample_pos,
 *                                        samples_remaining_to_output,
 */
        __pyx_vtabptr_5mpfmc_4core_5audio_5track_Track->mix_audio_stereo((__pyx_v_output_buffer + __pyx_v_buffer_pos), (((Uint8 *)__pyx_v_sound->sample->data.memory->data) + __pyx_v_sound->sample_pos), __pyx_v_samples_remaining_to_output, __pyx_v_sound->volume_left, __pyx_v_sound->volume_right);

        /* "mpfmc/core/audio/track_standard.pyx":1609
 * 
 *             # We are not consuming the entire streaming buffer.  There will still be buffer data remaining for the next call.
 *             if channels == 2 and False:             # <<<<<<<<<<<<<<
 *                 # disabled for now
 *                 Track.mix_audio_stereo(output_buffer + buffer_pos,
 */
        goto __pyx_L11;
      }

      /* "mpfmc/core/audio/track_standard.pyx":1617
 *                                        sound.volume_right)
 *             else:
 *                 SDL_MixAudioFormat(output_buffer + buffer_pos, <Uint8*>sound.sample.data.memory.data + sound.sample_pos, track.callback_data.format, samples_remaining_to_output, volume)             # <<<<<<<<<<<<<<
 * 
 *             # Update buffer position pointers
 */
      /*else*/ {
        SDL_MixAudioFormat((__pyx_v_output_buffer + __pyx_v_buffer_pos), (((Uint8 *)__pyx_v_sound->sample->data.memory->data) + __pyx_v_sound->sample_pos), __pyx_v_track->callback_data->format, __pyx_v_samples_remaining_to_output, __pyx_v_volume);
      }
      __pyx_L11:;

      /* "mpfmc/core/audio/track_standard.pyx":1620
 * 
 *             # Update buffer position pointers
 *             sound.sample_pos += samples_remaining_to_output             # <<<<<<<<<<<<<<
 * 
 *             # Sound is not finished, but the output buffer has been filled
 */
      __pyx_v_sound->sample_pos = (__pyx_v_sound->sample_pos + __pyx_v_samples_remaining_to_output);

      /* "mpfmc/core/audio/track_standard.pyx":1623
 * 
 *             # Sound is not finished, but the output buffer has been filled
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             # Entire sound buffer consumed. Mix in remaining samples
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "mpfmc/core/audio/track_standard.pyx":1606
 * 
 *         # Determine if we are consuming the entire remaining sound buffer, or just a portion of it
 *         if samples_remaining_to_output < samples_remaining_in_sound:             # <<<<<<<<<<<<<<
 * 
 *             # We are not consuming the entire streaming buffer.  There will still be buffer data remaining for the next call.
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":1626
 *         else:
 *             # Entire sound buffer consumed. Mix in remaining samples
 *             if channels == 2 and False:             # <<<<<<<<<<<<<<
 *                 # disabled for now
 *                 Track.mix_audio_stereo(output_buffer + buffer_pos,
 */
    /*else*/ {
      __pyx_t_2 = ((__pyx_v_channels == 2) != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L15_bool_binop_done;
      }
      __pyx_t_1 = 0;
      __pyx_L15_bool_binop_done:;
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1628
 *             if channels == 2 and False:
 *                 # disabled for now
 *                 Track.mix_audio_stereo(output_buffer + buffer_pos,             # <<<<<<<<<<<<<<
 *                                        <Uint8*>sound.sample.data.memory.data + sound.sample_pos,
 *                                        samples_remaining_to_output,
 */
        __pyx_vtabptr_5mpfmc_4core_5audio_5track_Track->mix_audio_stereo((__pyx_v_output_buffer + __pyx_v_buffer_pos), (((Uint8 *)__pyx_v_sound->sample->data.memory->data) + __pyx_v_sound->sample_pos), __pyx_v_samples_remaining_to_output, __pyx_v_sound->volume_left, __pyx_v_sound->volume_right);

        /* "mpfmc/core/audio/track_standard.pyx":1626
 *         else:
 *             # Entire sound buffer consumed. Mix in remaining samples
 *             if channels == 2 and False:             # <<<<<<<<<<<<<<
 *                 # disabled for now
 *                 Track.mix_audio_stereo(output_buffer + buffer_pos,
 */
        goto __pyx_L14;
      }

      /* "mpfmc/core/audio/track_standard.pyx":1634
 *                                        sound.volume_right)
 *             else:
 *                 SDL_MixAudioFormat(output_buffer + buffer_pos, <Uint8*>sound.sample.data.memory.data + sound.sample_pos, track.callback_data.format, samples_remaining_in_sound, volume)             # <<<<<<<<<<<<<<
 * 
 *             # Update buffer position pointers/samples remaining to place in the output buffer
 */
      /*else*/ {
        SDL_MixAudioFormat((__pyx_v_output_buffer + __pyx_v_buffer_pos), (((Uint8 *)__pyx_v_sound->sample->data.memory->data) + __pyx_v_sound->sample_pos), __pyx_v_track->callback_data->format, __pyx_v_samples_remaining_in_sound, __pyx_v_volume);
      }
      __pyx_L14:;

      /* "mpfmc/core/audio/track_standard.pyx":1637
 * 
 *             # Update buffer position pointers/samples remaining to place in the output buffer
 *             samples_remaining_to_output -= samples_remaining_in_sound             # <<<<<<<<<<<<<<
 *             sound.sample_pos += samples_remaining_in_sound
 *             buffer_pos += samples_remaining_in_sound
 */
      __pyx_v_samples_remaining_to_output = (__pyx_v_samples_remaining_to_output - __pyx_v_samples_remaining_in_sound);

      /* "mpfmc/core/audio/track_standard.pyx":1638
 *             # Update buffer position pointers/samples remaining to place in the output buffer
 *             samples_remaining_to_output -= samples_remaining_in_sound
 *             sound.sample_pos += samples_remaining_in_sound             # <<<<<<<<<<<<<<
 *             buffer_pos += samples_remaining_in_sound
 * 
 */
      __pyx_v_sound->sample_pos = (__pyx_v_sound->sample_pos + __pyx_v_samples_remaining_in_sound);

      /* "mpfmc/core/audio/track_standard.pyx":1639
 *             samples_remaining_to_output -= samples_remaining_in_sound
 *             sound.sample_pos += samples_remaining_in_sound
 *             buffer_pos += samples_remaining_in_sound             # <<<<<<<<<<<<<<
 * 
 *         # Check if we are at the end of the source sample buffer (loop if applicable)
 */
      __pyx_v_buffer_pos = (__pyx_v_buffer_pos + __pyx_v_samples_remaining_in_sound);
    }

    /* "mpfmc/core/audio/track_standard.pyx":1642
 * 
 *         # Check if we are at the end of the source sample buffer (loop if applicable)
 *         if sound.sample_pos >= loop_end_pos:             # <<<<<<<<<<<<<<
 *             if sound.loops_remaining > 0:
 *                 # At the end and still loops remaining, loop back to the beginning of the loop
 */
    __pyx_t_1 = ((__pyx_v_sound->sample_pos >= __pyx_v_loop_end_pos) != 0);
    if (__pyx_t_1) {

      /* "mpfmc/core/audio/track_standard.pyx":1643
 *         # Check if we are at the end of the source sample buffer (loop if applicable)
 *         if sound.sample_pos >= loop_end_pos:
 *             if sound.loops_remaining > 0:             # <<<<<<<<<<<<<<
 *                 # At the end and still loops remaining, loop back to the beginning of the loop
 *                 sound.loops_remaining -= 1
 */
      __pyx_t_1 = ((__pyx_v_sound->loops_remaining > 0) != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1645
 *             if sound.loops_remaining > 0:
 *                 # At the end and still loops remaining, loop back to the beginning of the loop
 *                 sound.loops_remaining -= 1             # <<<<<<<<<<<<<<
 *                 sound.sample_pos = sound.loop_start_pos
 *                 sound.current_loop += 1
 */
        __pyx_v_sound->loops_remaining = (__pyx_v_sound->loops_remaining - 1);

        /* "mpfmc/core/audio/track_standard.pyx":1646
 *                 # At the end and still loops remaining, loop back to the beginning of the loop
 *                 sound.loops_remaining -= 1
 *                 sound.sample_pos = sound.loop_start_pos             # <<<<<<<<<<<<<<
 *                 sound.current_loop += 1
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 */
        __pyx_t_3 = __pyx_v_sound->loop_start_pos;
        __pyx_v_sound->sample_pos = __pyx_t_3;

        /* "mpfmc/core/audio/track_standard.pyx":1647
 *                 sound.loops_remaining -= 1
 *                 sound.sample_pos = sound.loop_start_pos
 *                 sound.current_loop += 1             # <<<<<<<<<<<<<<
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 * 
 */
        __pyx_v_sound->current_loop = (__pyx_v_sound->current_loop + 1);

        /* "mpfmc/core/audio/track_standard.pyx":1648
 *                 sound.sample_pos = sound.loop_start_pos
 *                 sound.current_loop += 1
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)             # <<<<<<<<<<<<<<
 * 
 *                 # If the sound is on its last loop, set the loop end position to be the end of the sound
 */
        __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_looping_notification(__pyx_v_player_num, __pyx_v_sound->sound_id, __pyx_v_sound->sound_instance_id, __pyx_v_track);

        /* "mpfmc/core/audio/track_standard.pyx":1651
 * 
 *                 # If the sound is on its last loop, set the loop end position to be the end of the sound
 *                 if sound.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *                     sound.loop_end_pos = sound.sample.data.memory.size
 *                     loop_end_pos = sound.loop_end_pos
 */
        __pyx_t_1 = ((__pyx_v_sound->loops_remaining == 0) != 0);
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1652
 *                 # If the sound is on its last loop, set the loop end position to be the end of the sound
 *                 if sound.loops_remaining == 0:
 *                     sound.loop_end_pos = sound.sample.data.memory.size             # <<<<<<<<<<<<<<
 *                     loop_end_pos = sound.loop_end_pos
 * 
 */
          __pyx_t_4 = __pyx_v_sound->sample->data.memory->size;
          __pyx_v_sound->loop_end_pos = __pyx_t_4;

          /* "mpfmc/core/audio/track_standard.pyx":1653
 *                 if sound.loops_remaining == 0:
 *                     sound.loop_end_pos = sound.sample.data.memory.size
 *                     loop_end_pos = sound.loop_end_pos             # <<<<<<<<<<<<<<
 * 
 *             elif sound.loops_remaining == 0:
 */
          __pyx_t_3 = __pyx_v_sound->loop_end_pos;
          __pyx_v_loop_end_pos = __pyx_t_3;

          /* "mpfmc/core/audio/track_standard.pyx":1651
 * 
 *                 # If the sound is on its last loop, set the loop end position to be the end of the sound
 *                 if sound.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *                     sound.loop_end_pos = sound.sample.data.memory.size
 *                     loop_end_pos = sound.loop_end_pos
 */
        }

        /* "mpfmc/core/audio/track_standard.pyx":1643
 *         # Check if we are at the end of the source sample buffer (loop if applicable)
 *         if sound.sample_pos >= loop_end_pos:
 *             if sound.loops_remaining > 0:             # <<<<<<<<<<<<<<
 *                 # At the end and still loops remaining, loop back to the beginning of the loop
 *                 sound.loops_remaining -= 1
 */
        goto __pyx_L18;
      }

      /* "mpfmc/core/audio/track_standard.pyx":1655
 *                     loop_end_pos = sound.loop_end_pos
 * 
 *             elif sound.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *                 # At the end and not looping, the sample has finished playing (return True for end of sound)
 *                 return True
 */
      __pyx_t_1 = ((__pyx_v_sound->loops_remaining == 0) != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1657
 *             elif sound.loops_remaining == 0:
 *                 # At the end and not looping, the sample has finished playing (return True for end of sound)
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
        __pyx_r = 1;
        goto __pyx_L0;

        /* "mpfmc/core/audio/track_standard.pyx":1655
 *                     loop_end_pos = sound.loop_end_pos
 * 
 *             elif sound.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *                 # At the end and not looping, the sample has finished playing (return True for end of sound)
 *                 return True
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":1661
 *             else:
 *                 # Looping infinitely, loop back to the beginning of the loop
 *                 sound.sample_pos = sound.loop_start_pos             # <<<<<<<<<<<<<<
 *                 sound.current_loop += 1
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 */
      /*else*/ {
        __pyx_t_3 = __pyx_v_sound->loop_start_pos;
        __pyx_v_sound->sample_pos = __pyx_t_3;

        /* "mpfmc/core/audio/track_standard.pyx":1662
 *                 # Looping infinitely, loop back to the beginning of the loop
 *                 sound.sample_pos = sound.loop_start_pos
 *                 sound.current_loop += 1             # <<<<<<<<<<<<<<
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 * 
 */
        __pyx_v_sound->current_loop = (__pyx_v_sound->current_loop + 1);

        /* "mpfmc/core/audio/track_standard.pyx":1663
 *                 sound.sample_pos = sound.loop_start_pos
 *                 sound.current_loop += 1
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)             # <<<<<<<<<<<<<<
 * 
 *     return False
 */
        __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_looping_notification(__pyx_v_player_num, __pyx_v_sound->sound_id, __pyx_v_sound->sound_instance_id, __pyx_v_track);
      }
      __pyx_L18:;

      /* "mpfmc/core/audio/track_standard.pyx":1642
 * 
 *         # Check if we are at the end of the source sample buffer (loop if applicable)
 *         if sound.sample_pos >= loop_end_pos:             # <<<<<<<<<<<<<<
 *             if sound.loops_remaining > 0:
 *                 # At the end and still loops remaining, loop back to the beginning of the loop
 */
    }
  }

  /* "mpfmc/core/audio/track_standard.pyx":1665
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 * 
 *     return False             # <<<<<<<<<<<<<<
 * 
 * cdef bint get_streaming_sound_samples(SoundSettings *sound, Uint32 length, Uint8 *output_buffer, int channels,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":1562
 *                 control_point += 1
 * 
 * cdef bint get_memory_sound_samples(SoundSettings *sound, Uint32 length, Uint8 *output_buffer, int channels,             # <<<<<<<<<<<<<<
 *                                    Uint8 volume, TrackState *track, int player_num) nogil:
 *     """
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "mpfmc/core/audio/track_standard.pyx":1667
 *     return False
 * 
 * cdef bint get_streaming_sound_samples(SoundSettings *sound, Uint32 length, Uint8 *output_buffer, int channels,             # <<<<<<<<<<<<<<
 *                                       Uint8 volume, TrackState *track, int player_num) nogil:
 *     """
 */

static int __pyx_f_5mpfmc_4core_5audio_14track_standard_get_streaming_sound_samples(__pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings *__pyx_v_sound, Uint32 __pyx_v_length, Uint8 *__pyx_v_output_buffer, int __pyx_v_channels, Uint8 __pyx_v_volume, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track, int __pyx_v_player_num) {
  Uint32 __pyx_v_samples_remaining_to_output;
  Uint32 __pyx_v_samples_remaining_in_map;
  Uint32 __pyx_v_buffer_pos;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "mpfmc/core/audio/track_standard.pyx":1692
 *         end of stream (eos), or another buffer is pulled.
 *     """
 *     if sound == NULL or output_buffer == NULL or sound.sample.data.stream.pipeline == NULL:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_2 = ((__pyx_v_sound == NULL) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_output_buffer == NULL) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_sound->sample->data.stream->pipeline == NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/track_standard.pyx":1693
 *     """
 *     if sound == NULL or output_buffer == NULL or sound.sample.data.stream.pipeline == NULL:
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     cdef Uint32 samples_remaining_to_output = length
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "mpfmc/core/audio/track_standard.pyx":1692
 *         end of stream (eos), or another buffer is pulled.
 *     """
 *     if sound == NULL or output_buffer == NULL or sound.sample.data.stream.pipeline == NULL:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  }

  /* "mpfmc/core/audio/track_standard.pyx":1695
 *         return True
 * 
 *     cdef Uint32 samples_remaining_to_output = length             # <<<<<<<<<<<<<<
 *     cdef Uint32 samples_remaining_in_map
 *     cdef Uint32 buffer_pos = 0
 */
  __pyx_v_samples_remaining_to_output = __pyx_v_length;

  /* "mpfmc/core/audio/track_standard.pyx":1697
 *     cdef Uint32 samples_remaining_to_output = length
 *     cdef Uint32 samples_remaining_in_map
 *     cdef Uint32 buffer_pos = 0             # <<<<<<<<<<<<<<
 * 
 *     while samples_remaining_to_output > 0:
 */
  __pyx_v_buffer_pos = 0;

  /* "mpfmc/core/audio/track_standard.pyx":1699
 *     cdef Uint32 buffer_pos = 0
 * 
 *     while samples_remaining_to_output > 0:             # <<<<<<<<<<<<<<
 * 
 *         # Copy any samples remaining in the streaming buffer
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_samples_remaining_to_output > 0) != 0);
    if (!__pyx_t_1) break;

    /* "mpfmc/core/audio/track_standard.pyx":1702
 * 
 *         # Copy any samples remaining in the streaming buffer
 *         if sound.sample.data.stream.map_contains_valid_sample_data:             # <<<<<<<<<<<<<<
 *             samples_remaining_in_map = sound.sample.data.stream.map_info.size - sound.sample.data.stream.map_buffer_pos
 * 
 */
    __pyx_t_1 = (__pyx_v_sound->sample->data.stream->map_contains_valid_sample_data != 0);
    if (__pyx_t_1) {

      /* "mpfmc/core/audio/track_standard.pyx":1703
 *         # Copy any samples remaining in the streaming buffer
 *         if sound.sample.data.stream.map_contains_valid_sample_data:
 *             samples_remaining_in_map = sound.sample.data.stream.map_info.size - sound.sample.data.stream.map_buffer_pos             # <<<<<<<<<<<<<<
 * 
 *             # Determine if we are consuming the entire buffer of streaming samples, or just a portion of it
 */
      __pyx_v_samples_remaining_in_map = (__pyx_v_sound->sample->data.stream->map_info.size - __pyx_v_sound->sample->data.stream->map_buffer_pos);

      /* "mpfmc/core/audio/track_standard.pyx":1706
 * 
 *             # Determine if we are consuming the entire buffer of streaming samples, or just a portion of it
 *             if samples_remaining_to_output < samples_remaining_in_map:             # <<<<<<<<<<<<<<
 *                 # We are not consuming the entire streaming buffer.  There will still be buffer data remaining for the next call.
 *                 if channels == 2 and False:
 */
      __pyx_t_1 = ((__pyx_v_samples_remaining_to_output < __pyx_v_samples_remaining_in_map) != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1708
 *             if samples_remaining_to_output < samples_remaining_in_map:
 *                 # We are not consuming the entire streaming buffer.  There will still be buffer data remaining for the next call.
 *                 if channels == 2 and False:             # <<<<<<<<<<<<<<
 *                     # disabled for now
 *                     Track.mix_audio_stereo(output_buffer + buffer_pos,
 */
        __pyx_t_2 = ((__pyx_v_channels == 2) != 0);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L12_bool_binop_done;
        }
        __pyx_t_1 = 0;
        __pyx_L12_bool_binop_done:;
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1710
 *                 if channels == 2 and False:
 *                     # disabled for now
 *                     Track.mix_audio_stereo(output_buffer + buffer_pos,             # <<<<<<<<<<<<<<
 *                                            sound.sample.data.stream.map_info.data + sound.sample.data.stream.map_buffer_pos,
 *                                            samples_remaining_to_output,
 */
          __pyx_vtabptr_5mpfmc_4core_5audio_5track_Track->mix_audio_stereo((__pyx_v_output_buffer + __pyx_v_buffer_pos), (__pyx_v_sound->sample->data.stream->map_info.data + __pyx_v_sound->sample->data.stream->map_buffer_pos), __pyx_v_samples_remaining_to_output, __pyx_v_sound->volume_left, __pyx_v_sound->volume_right);

          /* "mpfmc/core/audio/track_standard.pyx":1708
 *             if samples_remaining_to_output < samples_remaining_in_map:
 *                 # We are not consuming the entire streaming buffer.  There will still be buffer data remaining for the next call.
 *                 if channels == 2 and False:             # <<<<<<<<<<<<<<
 *                     # disabled for now
 *                     Track.mix_audio_stereo(output_buffer + buffer_pos,
 */
          goto __pyx_L11;
        }

        /* "mpfmc/core/audio/track_standard.pyx":1716
 *                                            sound.volume_right)
 *                 else:
 *                     SDL_MixAudioFormat(output_buffer + buffer_pos,             # <<<<<<<<<<<<<<
 *                                        sound.sample.data.stream.map_info.data + sound.sample.data.stream.map_buffer_pos,
 *                                        track.callback_data.format, samples_remaining_to_output, volume)
 */
        /*else*/ {

          /* "mpfmc/core/audio/track_standard.pyx":1718
 *                     SDL_MixAudioFormat(output_buffer + buffer_pos,
 *                                        sound.sample.data.stream.map_info.data + sound.sample.data.stream.map_buffer_pos,
 *                                        track.callback_data.format, samples_remaining_to_output, volume)             # <<<<<<<<<<<<<<
 * 
 *                 # Update buffer position pointers
 */
          SDL_MixAudioFormat((__pyx_v_output_buffer + __pyx_v_buffer_pos), (__pyx_v_sound->sample->data.stream->map_info.data + __pyx_v_sound->sample->data.stream->map_buffer_pos), __pyx_v_track->callback_data->format, __pyx_v_samples_remaining_to_output, __pyx_v_volume);
        }
        __pyx_L11:;

        /* "mpfmc/core/audio/track_standard.pyx":1721
 * 
 *                 # Update buffer position pointers
 *                 sound.sample.data.stream.map_buffer_pos += samples_remaining_to_output             # <<<<<<<<<<<<<<
 *                 sound.sample_pos += samples_remaining_to_output
 * 
 */
        __pyx_v_sound->sample->data.stream->map_buffer_pos = (__pyx_v_sound->sample->data.stream->map_buffer_pos + __pyx_v_samples_remaining_to_output);

        /* "mpfmc/core/audio/track_standard.pyx":1722
 *                 # Update buffer position pointers
 *                 sound.sample.data.stream.map_buffer_pos += samples_remaining_to_output
 *                 sound.sample_pos += samples_remaining_to_output             # <<<<<<<<<<<<<<
 * 
 *                 # Sound is not finished, but the output buffer has been filled
 */
        __pyx_v_sound->sample_pos = (__pyx_v_sound->sample_pos + __pyx_v_samples_remaining_to_output);

        /* "mpfmc/core/audio/track_standard.pyx":1725
 * 
 *                 # Sound is not finished, but the output buffer has been filled
 *                 return False             # <<<<<<<<<<<<<<
 *             else:
 *                 # Entire buffer of leftover samples consumed.  Free the buffer resources to prepare for next call
 */
        __pyx_r = 0;
        goto __pyx_L0;

        /* "mpfmc/core/audio/track_standard.pyx":1706
 * 
 *             # Determine if we are consuming the entire buffer of streaming samples, or just a portion of it
 *             if samples_remaining_to_output < samples_remaining_in_map:             # <<<<<<<<<<<<<<
 *                 # We are not consuming the entire streaming buffer.  There will still be buffer data remaining for the next call.
 *                 if channels == 2 and False:
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":1728
 *             else:
 *                 # Entire buffer of leftover samples consumed.  Free the buffer resources to prepare for next call
 *                 if channels == 2 and False:             # <<<<<<<<<<<<<<
 *                     # disabled for now
 *                     Track.mix_audio_stereo(output_buffer + buffer_pos,
 */
      /*else*/ {
        __pyx_t_2 = ((__pyx_v_channels == 2) != 0);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L15_bool_binop_done;
        }
        __pyx_t_1 = 0;
        __pyx_L15_bool_binop_done:;
        if (__pyx_t_1) {

          /* "mpfmc/core/audio/track_standard.pyx":1730
 *                 if channels == 2 and False:
 *                     # disabled for now
 *                     Track.mix_audio_stereo(output_buffer + buffer_pos,             # <<<<<<<<<<<<<<
 *                                            sound.sample.data.stream.map_info.data + sound.sample.data.stream.map_buffer_pos,
 *                                            samples_remaining_to_output,
 */
          __pyx_vtabptr_5mpfmc_4core_5audio_5track_Track->mix_audio_stereo((__pyx_v_output_buffer + __pyx_v_buffer_pos), (__pyx_v_sound->sample->data.stream->map_info.data + __pyx_v_sound->sample->data.stream->map_buffer_pos), __pyx_v_samples_remaining_to_output, __pyx_v_sound->volume_left, __pyx_v_sound->volume_right);

          /* "mpfmc/core/audio/track_standard.pyx":1728
 *             else:
 *                 # Entire buffer of leftover samples consumed.  Free the buffer resources to prepare for next call
 *                 if channels == 2 and False:             # <<<<<<<<<<<<<<
 *                     # disabled for now
 *                     Track.mix_audio_stereo(output_buffer + buffer_pos,
 */
          goto __pyx_L14;
        }

        /* "mpfmc/core/audio/track_standard.pyx":1736
 *                                            sound.volume_right)
 *                 else:
 *                     SDL_MixAudioFormat(output_buffer + buffer_pos,             # <<<<<<<<<<<<<<
 *                                        sound.sample.data.stream.map_info.data + sound.sample.data.stream.map_buffer_pos,
 *                                        track.callback_data.format, samples_remaining_in_map, volume)
 */
        /*else*/ {

          /* "mpfmc/core/audio/track_standard.pyx":1738
 *                     SDL_MixAudioFormat(output_buffer + buffer_pos,
 *                                        sound.sample.data.stream.map_info.data + sound.sample.data.stream.map_buffer_pos,
 *                                        track.callback_data.format, samples_remaining_in_map, volume)             # <<<<<<<<<<<<<<
 * 
 *                 # Update buffer position pointers/samples remaining to place in the output buffer
 */
          SDL_MixAudioFormat((__pyx_v_output_buffer + __pyx_v_buffer_pos), (__pyx_v_sound->sample->data.stream->map_info.data + __pyx_v_sound->sample->data.stream->map_buffer_pos), __pyx_v_track->callback_data->format, __pyx_v_samples_remaining_in_map, __pyx_v_volume);
        }
        __pyx_L14:;

        /* "mpfmc/core/audio/track_standard.pyx":1741
 * 
 *                 # Update buffer position pointers/samples remaining to place in the output buffer
 *                 samples_remaining_to_output -= samples_remaining_in_map             # <<<<<<<<<<<<<<
 *                 sound.sample_pos += samples_remaining_in_map
 *                 buffer_pos += samples_remaining_in_map
 */
        __pyx_v_samples_remaining_to_output = (__pyx_v_samples_remaining_to_output - __pyx_v_samples_remaining_in_map);

        /* "mpfmc/core/audio/track_standard.pyx":1742
 *                 # Update buffer position pointers/samples remaining to place in the output buffer
 *                 samples_remaining_to_output -= samples_remaining_in_map
 *                 sound.sample_pos += samples_remaining_in_map             # <<<<<<<<<<<<<<
 *                 buffer_pos += samples_remaining_in_map
 * 
 */
        __pyx_v_sound->sample_pos = (__pyx_v_sound->sample_pos + __pyx_v_samples_remaining_in_map);

        /* "mpfmc/core/audio/track_standard.pyx":1743
 *                 samples_remaining_to_output -= samples_remaining_in_map
 *                 sound.sample_pos += samples_remaining_in_map
 *                 buffer_pos += samples_remaining_in_map             # <<<<<<<<<<<<<<
 * 
 *                 # Done with the streaming buffer, release references to it
 */
        __pyx_v_buffer_pos = (__pyx_v_buffer_pos + __pyx_v_samples_remaining_in_map);

        /* "mpfmc/core/audio/track_standard.pyx":1746
 * 
 *                 # Done with the streaming buffer, release references to it
 *                 gst_buffer_unmap(sound.sample.data.stream.buffer, &sound.sample.data.stream.map_info)             # <<<<<<<<<<<<<<
 *                 gst_sample_unref(sound.sample.data.stream.sample)
 * 
 */
        gst_buffer_unmap(__pyx_v_sound->sample->data.stream->buffer, (&__pyx_v_sound->sample->data.stream->map_info));

        /* "mpfmc/core/audio/track_standard.pyx":1747
 *                 # Done with the streaming buffer, release references to it
 *                 gst_buffer_unmap(sound.sample.data.stream.buffer, &sound.sample.data.stream.map_info)
 *                 gst_sample_unref(sound.sample.data.stream.sample)             # <<<<<<<<<<<<<<
 * 
 *                 sound.sample.data.stream.buffer = NULL
 */
        gst_sample_unref(__pyx_v_sound->sample->data.stream->sample);

        /* "mpfmc/core/audio/track_standard.pyx":1749
 *                 gst_sample_unref(sound.sample.data.stream.sample)
 * 
 *                 sound.sample.data.stream.buffer = NULL             # <<<<<<<<<<<<<<
 *                 sound.sample.data.stream.sample = NULL
 *                 sound.sample.data.stream.map_buffer_pos = 0
 */
        __pyx_v_sound->sample->data.stream->buffer = NULL;

        /* "mpfmc/core/audio/track_standard.pyx":1750
 * 
 *                 sound.sample.data.stream.buffer = NULL
 *                 sound.sample.data.stream.sample = NULL             # <<<<<<<<<<<<<<
 *                 sound.sample.data.stream.map_buffer_pos = 0
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 0
 */
        __pyx_v_sound->sample->data.stream->sample = NULL;

        /* "mpfmc/core/audio/track_standard.pyx":1751
 *                 sound.sample.data.stream.buffer = NULL
 *                 sound.sample.data.stream.sample = NULL
 *                 sound.sample.data.stream.map_buffer_pos = 0             # <<<<<<<<<<<<<<
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 0
 * 
 */
        __pyx_v_sound->sample->data.stream->map_buffer_pos = 0;

        /* "mpfmc/core/audio/track_standard.pyx":1752
 *                 sound.sample.data.stream.sample = NULL
 *                 sound.sample.data.stream.map_buffer_pos = 0
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 0             # <<<<<<<<<<<<<<
 * 
 *         # Check for eos (end of stream)
 */
        __pyx_v_sound->sample->data.stream->map_contains_valid_sample_data = 0;
      }

      /* "mpfmc/core/audio/track_standard.pyx":1702
 * 
 *         # Copy any samples remaining in the streaming buffer
 *         if sound.sample.data.stream.map_contains_valid_sample_data:             # <<<<<<<<<<<<<<
 *             samples_remaining_in_map = sound.sample.data.stream.map_info.size - sound.sample.data.stream.map_buffer_pos
 * 
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":1755
 * 
 *         # Check for eos (end of stream)
 *         if g_object_get_bool(sound.sample.data.stream.sink, "eos"):             # <<<<<<<<<<<<<<
 * 
 *             # At the end of the stream - check if sound should loop or end
 */
    __pyx_t_1 = (g_object_get_bool(__pyx_v_sound->sample->data.stream->sink, ((char *)"eos")) != 0);
    if (__pyx_t_1) {

      /* "mpfmc/core/audio/track_standard.pyx":1758
 * 
 *             # At the end of the stream - check if sound should loop or end
 *             if sound.loops_remaining > 0:             # <<<<<<<<<<<<<<
 *                 # At the end and still loops remaining, loop back to the beginning
 *                 sound.loops_remaining -= 1
 */
      __pyx_t_1 = ((__pyx_v_sound->loops_remaining > 0) != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1760
 *             if sound.loops_remaining > 0:
 *                 # At the end and still loops remaining, loop back to the beginning
 *                 sound.loops_remaining -= 1             # <<<<<<<<<<<<<<
 *                 sound.sample_pos = 0
 *                 sound.current_loop += 1
 */
        __pyx_v_sound->loops_remaining = (__pyx_v_sound->loops_remaining - 1);

        /* "mpfmc/core/audio/track_standard.pyx":1761
 *                 # At the end and still loops remaining, loop back to the beginning
 *                 sound.loops_remaining -= 1
 *                 sound.sample_pos = 0             # <<<<<<<<<<<<<<
 *                 sound.current_loop += 1
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 */
        __pyx_v_sound->sample_pos = 0;

        /* "mpfmc/core/audio/track_standard.pyx":1762
 *                 sound.loops_remaining -= 1
 *                 sound.sample_pos = 0
 *                 sound.current_loop += 1             # <<<<<<<<<<<<<<
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 * 
 */
        __pyx_v_sound->current_loop = (__pyx_v_sound->current_loop + 1);

        /* "mpfmc/core/audio/track_standard.pyx":1763
 *                 sound.sample_pos = 0
 *                 sound.current_loop += 1
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)             # <<<<<<<<<<<<<<
 * 
 *             elif sound.loops_remaining == 0:
 */
        __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_looping_notification(__pyx_v_player_num, __pyx_v_sound->sound_id, __pyx_v_sound->sound_instance_id, __pyx_v_track);

        /* "mpfmc/core/audio/track_standard.pyx":1758
 * 
 *             # At the end of the stream - check if sound should loop or end
 *             if sound.loops_remaining > 0:             # <<<<<<<<<<<<<<
 *                 # At the end and still loops remaining, loop back to the beginning
 *                 sound.loops_remaining -= 1
 */
        goto __pyx_L18;
      }

      /* "mpfmc/core/audio/track_standard.pyx":1765
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 * 
 *             elif sound.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *                 # At the end and not looping, the sample has finished playing (return True for end of sound)
 *                 return True
 */
      __pyx_t_1 = ((__pyx_v_sound->loops_remaining == 0) != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1767
 *             elif sound.loops_remaining == 0:
 *                 # At the end and not looping, the sample has finished playing (return True for end of sound)
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
        __pyx_r = 1;
        goto __pyx_L0;

        /* "mpfmc/core/audio/track_standard.pyx":1765
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 * 
 *             elif sound.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *                 # At the end and not looping, the sample has finished playing (return True for end of sound)
 *                 return True
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":1771
 *             else:
 *                 # Looping infinitely, loop back to the beginning
 *                 sound.sample_pos = 0             # <<<<<<<<<<<<<<
 *                 sound.current_loop += 1
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 */
      /*else*/ {
        __pyx_v_sound->sample_pos = 0;

        /* "mpfmc/core/audio/track_standard.pyx":1772
 *                 # Looping infinitely, loop back to the beginning
 *                 sound.sample_pos = 0
 *                 sound.current_loop += 1             # <<<<<<<<<<<<<<
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)
 * 
 */
        __pyx_v_sound->current_loop = (__pyx_v_sound->current_loop + 1);

        /* "mpfmc/core/audio/track_standard.pyx":1773
 *                 sound.sample_pos = 0
 *                 sound.current_loop += 1
 *                 send_sound_looping_notification(player_num, sound.sound_id, sound.sound_instance_id, track)             # <<<<<<<<<<<<<<
 * 
 *             # Seek back to the beginning of the sound's source file
 */
        __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_looping_notification(__pyx_v_player_num, __pyx_v_sound->sound_id, __pyx_v_sound->sound_instance_id, __pyx_v_track);
      }
      __pyx_L18:;

      /* "mpfmc/core/audio/track_standard.pyx":1776
 * 
 *             # Seek back to the beginning of the sound's source file
 *             gst_element_seek_simple(sound.sample.data.stream.pipeline, GST_FORMAT_TIME, <GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), 0)             # <<<<<<<<<<<<<<
 * 
 *         # Retrieve the next buffer from the streaming pipeline
 */
      (void)(gst_element_seek_simple(__pyx_v_sound->sample->data.stream->pipeline, GST_FORMAT_TIME, ((GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT)), 0));

      /* "mpfmc/core/audio/track_standard.pyx":1755
 * 
 *         # Check for eos (end of stream)
 *         if g_object_get_bool(sound.sample.data.stream.sink, "eos"):             # <<<<<<<<<<<<<<
 * 
 *             # At the end of the stream - check if sound should loop or end
 */
    }

    /* "mpfmc/core/audio/track_standard.pyx":1779
 * 
 *         # Retrieve the next buffer from the streaming pipeline
 *         sound.sample.data.stream.sample = c_appsink_pull_sample(sound.sample.data.stream.sink)             # <<<<<<<<<<<<<<
 * 
 *         if sound.sample.data.stream.sample == NULL:
 */
    __pyx_v_sound->sample->data.stream->sample = c_appsink_pull_sample(__pyx_v_sound->sample->data.stream->sink);

    /* "mpfmc/core/audio/track_standard.pyx":1781
 *         sound.sample.data.stream.sample = c_appsink_pull_sample(sound.sample.data.stream.sink)
 * 
 *         if sound.sample.data.stream.sample == NULL:             # <<<<<<<<<<<<<<
 *             sound.sample.data.stream.null_buffer_count += 1
 * 
 */
    __pyx_t_1 = ((__pyx_v_sound->sample->data.stream->sample == NULL) != 0);
    if (__pyx_t_1) {

      /* "mpfmc/core/audio/track_standard.pyx":1782
 * 
 *         if sound.sample.data.stream.sample == NULL:
 *             sound.sample.data.stream.null_buffer_count += 1             # <<<<<<<<<<<<<<
 * 
 *             # If we've received too many consecutive null buffers, end the sound
 */
      __pyx_v_sound->sample->data.stream->null_buffer_count = (__pyx_v_sound->sample->data.stream->null_buffer_count + 1);

      /* "mpfmc/core/audio/track_standard.pyx":1785
 * 
 *             # If we've received too many consecutive null buffers, end the sound
 *             if sound.sample.data.stream.null_buffer_count > CONSECUTIVE_NULL_STREAMING_BUFFER_LIMIT:             # <<<<<<<<<<<<<<
 *                 return True
 *         else:
 */
      __pyx_t_1 = ((__pyx_v_sound->sample->data.stream->null_buffer_count > 2) != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1786
 *             # If we've received too many consecutive null buffers, end the sound
 *             if sound.sample.data.stream.null_buffer_count > CONSECUTIVE_NULL_STREAMING_BUFFER_LIMIT:
 *                 return True             # <<<<<<<<<<<<<<
 *         else:
 *             sound.sample.data.stream.null_buffer_count = 0
 */
        __pyx_r = 1;
        goto __pyx_L0;

        /* "mpfmc/core/audio/track_standard.pyx":1785
 * 
 *             # If we've received too many consecutive null buffers, end the sound
 *             if sound.sample.data.stream.null_buffer_count > CONSECUTIVE_NULL_STREAMING_BUFFER_LIMIT:             # <<<<<<<<<<<<<<
 *                 return True
 *         else:
 */
      }

      /* "mpfmc/core/audio/track_standard.pyx":1781
 *         sound.sample.data.stream.sample = c_appsink_pull_sample(sound.sample.data.stream.sink)
 * 
 *         if sound.sample.data.stream.sample == NULL:             # <<<<<<<<<<<<<<
 *             sound.sample.data.stream.null_buffer_count += 1
 * 
 */
      goto __pyx_L19;
    }

    /* "mpfmc/core/audio/track_standard.pyx":1788
 *                 return True
 *         else:
 *             sound.sample.data.stream.null_buffer_count = 0             # <<<<<<<<<<<<<<
 *             sound.sample.data.stream.buffer = gst_sample_get_buffer(sound.sample.data.stream.sample)
 * 
 */
    /*else*/ {
      __pyx_v_sound->sample->data.stream->null_buffer_count = 0;

      /* "mpfmc/core/audio/track_standard.pyx":1789
 *         else:
 *             sound.sample.data.stream.null_buffer_count = 0
 *             sound.sample.data.stream.buffer = gst_sample_get_buffer(sound.sample.data.stream.sample)             # <<<<<<<<<<<<<<
 * 
 *             if gst_buffer_map(sound.sample.data.stream.buffer, &sound.sample.data.stream.map_info, GST_MAP_READ):
 */
      __pyx_v_sound->sample->data.stream->buffer = gst_sample_get_buffer(__pyx_v_sound->sample->data.stream->sample);

      /* "mpfmc/core/audio/track_standard.pyx":1791
 *             sound.sample.data.stream.buffer = gst_sample_get_buffer(sound.sample.data.stream.sample)
 * 
 *             if gst_buffer_map(sound.sample.data.stream.buffer, &sound.sample.data.stream.map_info, GST_MAP_READ):             # <<<<<<<<<<<<<<
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 1
 *                 sound.sample.data.stream.map_buffer_pos = 0
 */
      __pyx_t_1 = (gst_buffer_map(__pyx_v_sound->sample->data.stream->buffer, (&__pyx_v_sound->sample->data.stream->map_info), GST_MAP_READ) != 0);
      if (__pyx_t_1) {

        /* "mpfmc/core/audio/track_standard.pyx":1792
 * 
 *             if gst_buffer_map(sound.sample.data.stream.buffer, &sound.sample.data.stream.map_info, GST_MAP_READ):
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 1             # <<<<<<<<<<<<<<
 *                 sound.sample.data.stream.map_buffer_pos = 0
 *             else:
 */
        __pyx_v_sound->sample->data.stream->map_contains_valid_sample_data = 1;

        /* "mpfmc/core/audio/track_standard.pyx":1793
 *             if gst_buffer_map(sound.sample.data.stream.buffer, &sound.sample.data.stream.map_info, GST_MAP_READ):
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 1
 *                 sound.sample.data.stream.map_buffer_pos = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 0
 */
        __pyx_v_sound->sample->data.stream->map_buffer_pos = 0;

        /* "mpfmc/core/audio/track_standard.pyx":1791
 *             sound.sample.data.stream.buffer = gst_sample_get_buffer(sound.sample.data.stream.sample)
 * 
 *             if gst_buffer_map(sound.sample.data.stream.buffer, &sound.sample.data.stream.map_info, GST_MAP_READ):             # <<<<<<<<<<<<<<
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 1
 *                 sound.sample.data.stream.map_buffer_pos = 0
 */
        goto __pyx_L21;
      }

      /* "mpfmc/core/audio/track_standard.pyx":1795
 *                 sound.sample.data.stream.map_buffer_pos = 0
 *             else:
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 0             # <<<<<<<<<<<<<<
 *                 sound.sample.data.stream.map_buffer_pos = 0
 *                 gst_sample_unref(sound.sample.data.stream.sample)
 */
      /*else*/ {
        __pyx_v_sound->sample->data.stream->map_contains_valid_sample_data = 0;

        /* "mpfmc/core/audio/track_standard.pyx":1796
 *             else:
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 0
 *                 sound.sample.data.stream.map_buffer_pos = 0             # <<<<<<<<<<<<<<
 *                 gst_sample_unref(sound.sample.data.stream.sample)
 *                 sound.sample.data.stream.sample = NULL
 */
        __pyx_v_sound->sample->data.stream->map_buffer_pos = 0;

        /* "mpfmc/core/audio/track_standard.pyx":1797
 *                 sound.sample.data.stream.map_contains_valid_sample_data = 0
 *                 sound.sample.data.stream.map_buffer_pos = 0
 *                 gst_sample_unref(sound.sample.data.stream.sample)             # <<<<<<<<<<<<<<
 *                 sound.sample.data.stream.sample = NULL
 * 
 */
        gst_sample_unref(__pyx_v_sound->sample->data.stream->sample);

        /* "mpfmc/core/audio/track_standard.pyx":1798
 *                 sound.sample.data.stream.map_buffer_pos = 0
 *                 gst_sample_unref(sound.sample.data.stream.sample)
 *                 sound.sample.data.stream.sample = NULL             # <<<<<<<<<<<<<<
 * 
 *     # The sound has not finished playing, but the output buffer has been filled
 */
        __pyx_v_sound->sample->data.stream->sample = NULL;
      }
      __pyx_L21:;
    }
    __pyx_L19:;
  }

  /* "mpfmc/core/audio/track_standard.pyx":1801
 * 
 *     # The sound has not finished playing, but the output buffer has been filled
 *     return False             # <<<<<<<<<<<<<<
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "mpfmc/core/audio/track_standard.pyx":1667
 *     return False
 * 
 * cdef bint get_streaming_sound_samples(SoundSettings *sound, Uint32 length, Uint8 *output_buffer, int channels,             # <<<<<<<<<<<<<<
 *                                       Uint8 volume, TrackState *track, int player_num) nogil:
 *     """
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "mpfmc/core/audio/inline.pxd":7
 * # ---------------------------------------------------------------------------
 * 
 * cdef inline Uint8 lerpU8(float progress, Uint8 a, Uint8 b) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Linearly interpolate between 2 8-bit values.
 */

static CYTHON_INLINE Uint8 __pyx_f_5mpfmc_4core_5audio_6inline_lerpU8(float __pyx_v_progress, Uint8 __pyx_v_a, Uint8 __pyx_v_b) {
  Uint8 __pyx_r;

  /* "mpfmc/core/audio/inline.pxd":18
 *         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;

  /* "mpfmc/core/audio/inline.pxd":7
 * # ---------------------------------------------------------------------------
 * 
 * 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;
}

/* "mpfmc/core/audio/inline.pxd":20
 *     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_5mpfmc_4core_5audio_6inline_in_out_quad(float __pyx_v_progress) {
  float __pyx_v_p;
  float __pyx_r;
  int __pyx_t_1;

  /* "mpfmc/core/audio/inline.pxd":30
 *     """
 *     cdef float p
 *     p = progress * 2             # <<<<<<<<<<<<<<
 *     if p < 1:
 *         return 0.5 * p * p
 */
  __pyx_v_p = (__pyx_v_progress * 2.0);

  /* "mpfmc/core/audio/inline.pxd":31
 *     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) {

    /* "mpfmc/core/audio/inline.pxd":32
 *     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;

    /* "mpfmc/core/audio/inline.pxd":31
 *     cdef float p
 *     p = progress * 2
 *     if p < 1:             # <<<<<<<<<<<<<<
 *         return 0.5 * p * p
 *     p -= 1.0
 */
  }

  /* "mpfmc/core/audio/inline.pxd":33
 *     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);

  /* "mpfmc/core/audio/inline.pxd":34
 *         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 - 2.0)) - 1.0));
  goto __pyx_L0;

  /* "mpfmc/core/audio/inline.pxd":20
 *     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;
}

/* "mpfmc/core/audio/notification_message.pxd":52
 * # ---------------------------------------------------------------------------
 * 
 * cdef inline NotificationMessageContainer *_create_notification_message() nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Creates a new notification message.
 */

static CYTHON_INLINE __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message(void) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_r;

  /* "mpfmc/core/audio/notification_message.pxd":57
 *     :return: A pointer to the new notification message.
 *     """
 *     return <NotificationMessageContainer*>g_slice_alloc0(sizeof(NotificationMessageContainer))             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_started_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,
 */
  __pyx_r = ((__pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *)g_slice_alloc0((sizeof(__pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer))));
  goto __pyx_L0;

  /* "mpfmc/core/audio/notification_message.pxd":52
 * # ---------------------------------------------------------------------------
 * 
 * cdef inline NotificationMessageContainer *_create_notification_message() nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Creates a new notification message.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "mpfmc/core/audio/notification_message.pxd":59
 *     return <NotificationMessageContainer*>g_slice_alloc0(sizeof(NotificationMessageContainer))
 * 
 * cdef inline void send_sound_started_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,             # <<<<<<<<<<<<<<
 *                                                  TrackState *track) nogil:
 *     """
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_started_notification(int __pyx_v_player, Uint64 __pyx_v_sound_id, Uint64 __pyx_v_sound_instance_id, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message;
  int __pyx_t_1;

  /* "mpfmc/core/audio/notification_message.pxd":69
 *         track: The TrackState pointer
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()             # <<<<<<<<<<<<<<
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_started
 */
  __pyx_v_notification_message = __pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message();

  /* "mpfmc/core/audio/notification_message.pxd":70
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_started
 *         notification_message.player = player
 */
  __pyx_t_1 = ((__pyx_v_notification_message != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/notification_message.pxd":71
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_started             # <<<<<<<<<<<<<<
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id
 */
    __pyx_v_notification_message->message = __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_started;

    /* "mpfmc/core/audio/notification_message.pxd":72
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_started
 *         notification_message.player = player             # <<<<<<<<<<<<<<
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id
 */
    __pyx_v_notification_message->player = __pyx_v_player;

    /* "mpfmc/core/audio/notification_message.pxd":73
 *         notification_message.message = notification_sound_started
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_message.sound_instance_id = sound_instance_id
 * 
 */
    __pyx_v_notification_message->sound_id = __pyx_v_sound_id;

    /* "mpfmc/core/audio/notification_message.pxd":74
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id             # <<<<<<<<<<<<<<
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
    __pyx_v_notification_message->sound_instance_id = __pyx_v_sound_instance_id;

    /* "mpfmc/core/audio/notification_message.pxd":76
 *         notification_message.sound_instance_id = sound_instance_id
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_stopped_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,
 */
    __pyx_v_track->notification_messages = g_slist_prepend(__pyx_v_track->notification_messages, __pyx_v_notification_message);

    /* "mpfmc/core/audio/notification_message.pxd":70
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_started
 *         notification_message.player = player
 */
  }

  /* "mpfmc/core/audio/notification_message.pxd":59
 *     return <NotificationMessageContainer*>g_slice_alloc0(sizeof(NotificationMessageContainer))
 * 
 * cdef inline void send_sound_started_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,             # <<<<<<<<<<<<<<
 *                                                  TrackState *track) nogil:
 *     """
 */

  /* function exit code */
}

/* "mpfmc/core/audio/notification_message.pxd":78
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_stopped_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,             # <<<<<<<<<<<<<<
 *                                                  TrackState *track) nogil:
 *     """
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_stopped_notification(int __pyx_v_player, Uint64 __pyx_v_sound_id, Uint64 __pyx_v_sound_instance_id, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message;
  int __pyx_t_1;

  /* "mpfmc/core/audio/notification_message.pxd":88
 *         track: The TrackState pointer
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()             # <<<<<<<<<<<<<<
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_stopped
 */
  __pyx_v_notification_message = __pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message();

  /* "mpfmc/core/audio/notification_message.pxd":89
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_stopped
 *         notification_message.player = player
 */
  __pyx_t_1 = ((__pyx_v_notification_message != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/notification_message.pxd":90
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_stopped             # <<<<<<<<<<<<<<
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id
 */
    __pyx_v_notification_message->message = __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_stopped;

    /* "mpfmc/core/audio/notification_message.pxd":91
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_stopped
 *         notification_message.player = player             # <<<<<<<<<<<<<<
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id
 */
    __pyx_v_notification_message->player = __pyx_v_player;

    /* "mpfmc/core/audio/notification_message.pxd":92
 *         notification_message.message = notification_sound_stopped
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_message.sound_instance_id = sound_instance_id
 * 
 */
    __pyx_v_notification_message->sound_id = __pyx_v_sound_id;

    /* "mpfmc/core/audio/notification_message.pxd":93
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id             # <<<<<<<<<<<<<<
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
    __pyx_v_notification_message->sound_instance_id = __pyx_v_sound_instance_id;

    /* "mpfmc/core/audio/notification_message.pxd":95
 *         notification_message.sound_instance_id = sound_instance_id
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_looping_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,
 */
    __pyx_v_track->notification_messages = g_slist_prepend(__pyx_v_track->notification_messages, __pyx_v_notification_message);

    /* "mpfmc/core/audio/notification_message.pxd":89
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_stopped
 *         notification_message.player = player
 */
  }

  /* "mpfmc/core/audio/notification_message.pxd":78
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_stopped_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,             # <<<<<<<<<<<<<<
 *                                                  TrackState *track) nogil:
 *     """
 */

  /* function exit code */
}

/* "mpfmc/core/audio/notification_message.pxd":97
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_looping_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,             # <<<<<<<<<<<<<<
 *                                                  TrackState *track) nogil:
 *     """
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_looping_notification(int __pyx_v_player, Uint64 __pyx_v_sound_id, Uint64 __pyx_v_sound_instance_id, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message;
  int __pyx_t_1;

  /* "mpfmc/core/audio/notification_message.pxd":107
 *         track: The TrackState pointer
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()             # <<<<<<<<<<<<<<
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_looping
 */
  __pyx_v_notification_message = __pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message();

  /* "mpfmc/core/audio/notification_message.pxd":108
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_looping
 *         notification_message.player = player
 */
  __pyx_t_1 = ((__pyx_v_notification_message != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/notification_message.pxd":109
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_looping             # <<<<<<<<<<<<<<
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id
 */
    __pyx_v_notification_message->message = __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_looping;

    /* "mpfmc/core/audio/notification_message.pxd":110
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_looping
 *         notification_message.player = player             # <<<<<<<<<<<<<<
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id
 */
    __pyx_v_notification_message->player = __pyx_v_player;

    /* "mpfmc/core/audio/notification_message.pxd":111
 *         notification_message.message = notification_sound_looping
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_message.sound_instance_id = sound_instance_id
 * 
 */
    __pyx_v_notification_message->sound_id = __pyx_v_sound_id;

    /* "mpfmc/core/audio/notification_message.pxd":112
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id             # <<<<<<<<<<<<<<
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
    __pyx_v_notification_message->sound_instance_id = __pyx_v_sound_instance_id;

    /* "mpfmc/core/audio/notification_message.pxd":114
 *         notification_message.sound_instance_id = sound_instance_id
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_about_to_finish_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,
 */
    __pyx_v_track->notification_messages = g_slist_prepend(__pyx_v_track->notification_messages, __pyx_v_notification_message);

    /* "mpfmc/core/audio/notification_message.pxd":108
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_looping
 *         notification_message.player = player
 */
  }

  /* "mpfmc/core/audio/notification_message.pxd":97
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_looping_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,             # <<<<<<<<<<<<<<
 *                                                  TrackState *track) nogil:
 *     """
 */

  /* function exit code */
}

/* "mpfmc/core/audio/notification_message.pxd":116
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_about_to_finish_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,             # <<<<<<<<<<<<<<
 *                                                          TrackState *track) nogil:
 *     """
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_about_to_finish_notification(int __pyx_v_player, Uint64 __pyx_v_sound_id, Uint64 __pyx_v_sound_instance_id, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message;
  int __pyx_t_1;

  /* "mpfmc/core/audio/notification_message.pxd":126
 *         track: The TrackState pointer
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()             # <<<<<<<<<<<<<<
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_about_to_finish
 */
  __pyx_v_notification_message = __pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message();

  /* "mpfmc/core/audio/notification_message.pxd":127
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_about_to_finish
 *         notification_message.player = player
 */
  __pyx_t_1 = ((__pyx_v_notification_message != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/notification_message.pxd":128
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_about_to_finish             # <<<<<<<<<<<<<<
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id
 */
    __pyx_v_notification_message->message = __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_about_to_finish;

    /* "mpfmc/core/audio/notification_message.pxd":129
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_about_to_finish
 *         notification_message.player = player             # <<<<<<<<<<<<<<
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id
 */
    __pyx_v_notification_message->player = __pyx_v_player;

    /* "mpfmc/core/audio/notification_message.pxd":130
 *         notification_message.message = notification_sound_about_to_finish
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_message.sound_instance_id = sound_instance_id
 * 
 */
    __pyx_v_notification_message->sound_id = __pyx_v_sound_id;

    /* "mpfmc/core/audio/notification_message.pxd":131
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id             # <<<<<<<<<<<<<<
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
    __pyx_v_notification_message->sound_instance_id = __pyx_v_sound_instance_id;

    /* "mpfmc/core/audio/notification_message.pxd":133
 *         notification_message.sound_instance_id = sound_instance_id
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_marker_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,
 */
    __pyx_v_track->notification_messages = g_slist_prepend(__pyx_v_track->notification_messages, __pyx_v_notification_message);

    /* "mpfmc/core/audio/notification_message.pxd":127
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_about_to_finish
 *         notification_message.player = player
 */
  }

  /* "mpfmc/core/audio/notification_message.pxd":116
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_about_to_finish_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,             # <<<<<<<<<<<<<<
 *                                                          TrackState *track) nogil:
 *     """
 */

  /* function exit code */
}

/* "mpfmc/core/audio/notification_message.pxd":135
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_marker_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,             # <<<<<<<<<<<<<<
 *                                                 TrackState *track,
 *                                                 int marker_id) nogil:
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_marker_notification(int __pyx_v_player, Uint64 __pyx_v_sound_id, Uint64 __pyx_v_sound_instance_id, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track, int __pyx_v_marker_id) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message;
  int __pyx_t_1;

  /* "mpfmc/core/audio/notification_message.pxd":147
 *         marker_id: The id of the marker being sent for the specified sound
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()             # <<<<<<<<<<<<<<
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_marker
 */
  __pyx_v_notification_message = __pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message();

  /* "mpfmc/core/audio/notification_message.pxd":148
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_marker
 *         notification_message.player = player
 */
  __pyx_t_1 = ((__pyx_v_notification_message != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/notification_message.pxd":149
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_marker             # <<<<<<<<<<<<<<
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id
 */
    __pyx_v_notification_message->message = __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_marker;

    /* "mpfmc/core/audio/notification_message.pxd":150
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_marker
 *         notification_message.player = player             # <<<<<<<<<<<<<<
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id
 */
    __pyx_v_notification_message->player = __pyx_v_player;

    /* "mpfmc/core/audio/notification_message.pxd":151
 *         notification_message.message = notification_sound_marker
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_message.sound_instance_id = sound_instance_id
 *         notification_message.data.marker.id = marker_id
 */
    __pyx_v_notification_message->sound_id = __pyx_v_sound_id;

    /* "mpfmc/core/audio/notification_message.pxd":152
 *         notification_message.player = player
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id             # <<<<<<<<<<<<<<
 *         notification_message.data.marker.id = marker_id
 * 
 */
    __pyx_v_notification_message->sound_instance_id = __pyx_v_sound_instance_id;

    /* "mpfmc/core/audio/notification_message.pxd":153
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = sound_instance_id
 *         notification_message.data.marker.id = marker_id             # <<<<<<<<<<<<<<
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
    __pyx_v_notification_message->data.marker.id = __pyx_v_marker_id;

    /* "mpfmc/core/audio/notification_message.pxd":155
 *         notification_message.data.marker.id = marker_id
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_track_stopped_notification(TrackState *track) nogil:
 */
    __pyx_v_track->notification_messages = g_slist_prepend(__pyx_v_track->notification_messages, __pyx_v_notification_message);

    /* "mpfmc/core/audio/notification_message.pxd":148
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_marker
 *         notification_message.player = player
 */
  }

  /* "mpfmc/core/audio/notification_message.pxd":135
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_marker_notification(int player, Uint64 sound_id, Uint64 sound_instance_id,             # <<<<<<<<<<<<<<
 *                                                 TrackState *track,
 *                                                 int marker_id) nogil:
 */

  /* function exit code */
}

/* "mpfmc/core/audio/notification_message.pxd":157
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_track_stopped_notification(TrackState *track) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Sends a track stopped notification
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_track_stopped_notification(__pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message;
  int __pyx_t_1;

  /* "mpfmc/core/audio/notification_message.pxd":163
 *         track: The TrackState pointer
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()             # <<<<<<<<<<<<<<
 *     if notification_message != NULL:
 *         notification_message.message = notification_track_stopped
 */
  __pyx_v_notification_message = __pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message();

  /* "mpfmc/core/audio/notification_message.pxd":164
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_track_stopped
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
  __pyx_t_1 = ((__pyx_v_notification_message != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/notification_message.pxd":165
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:
 *         notification_message.message = notification_track_stopped             # <<<<<<<<<<<<<<
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 */
    __pyx_v_notification_message->message = __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_track_stopped;

    /* "mpfmc/core/audio/notification_message.pxd":166
 *     if notification_message != NULL:
 *         notification_message.message = notification_track_stopped
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_track_paused_notification(TrackState *track) nogil:
 */
    __pyx_v_track->notification_messages = g_slist_prepend(__pyx_v_track->notification_messages, __pyx_v_notification_message);

    /* "mpfmc/core/audio/notification_message.pxd":164
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_track_stopped
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
  }

  /* "mpfmc/core/audio/notification_message.pxd":157
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_track_stopped_notification(TrackState *track) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Sends a track stopped notification
 */

  /* function exit code */
}

/* "mpfmc/core/audio/notification_message.pxd":168
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_track_paused_notification(TrackState *track) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Sends a track paused notification
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_track_paused_notification(__pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message;
  int __pyx_t_1;

  /* "mpfmc/core/audio/notification_message.pxd":174
 *         track: The TrackState pointer
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()             # <<<<<<<<<<<<<<
 *     if notification_message != NULL:
 *         notification_message.message = notification_track_paused
 */
  __pyx_v_notification_message = __pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message();

  /* "mpfmc/core/audio/notification_message.pxd":175
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_track_paused
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
  __pyx_t_1 = ((__pyx_v_notification_message != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/notification_message.pxd":176
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:
 *         notification_message.message = notification_track_paused             # <<<<<<<<<<<<<<
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 */
    __pyx_v_notification_message->message = __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_track_paused;

    /* "mpfmc/core/audio/notification_message.pxd":177
 *     if notification_message != NULL:
 *         notification_message.message = notification_track_paused
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_loop_set_started_notification(int sound_loop_set_id, Uint64 sound_id, gpointer player, TrackState *track) nogil:
 */
    __pyx_v_track->notification_messages = g_slist_prepend(__pyx_v_track->notification_messages, __pyx_v_notification_message);

    /* "mpfmc/core/audio/notification_message.pxd":175
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_track_paused
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
  }

  /* "mpfmc/core/audio/notification_message.pxd":168
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_track_paused_notification(TrackState *track) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Sends a track paused notification
 */

  /* function exit code */
}

/* "mpfmc/core/audio/notification_message.pxd":179
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_loop_set_started_notification(int sound_loop_set_id, Uint64 sound_id, gpointer player, TrackState *track) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Sends a sound_loop_set started notification
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_loop_set_started_notification(int __pyx_v_sound_loop_set_id, Uint64 __pyx_v_sound_id, gpointer __pyx_v_player, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message;
  int __pyx_t_1;

  /* "mpfmc/core/audio/notification_message.pxd":188
 *         track: The TrackState pointer
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()             # <<<<<<<<<<<<<<
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_loop_set_started
 */
  __pyx_v_notification_message = __pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message();

  /* "mpfmc/core/audio/notification_message.pxd":189
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_loop_set_started
 *         notification_message.player = 0
 */
  __pyx_t_1 = ((__pyx_v_notification_message != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/notification_message.pxd":190
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_loop_set_started             # <<<<<<<<<<<<<<
 *         notification_message.player = 0
 *         notification_message.sound_id = sound_id
 */
    __pyx_v_notification_message->message = __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_loop_set_started;

    /* "mpfmc/core/audio/notification_message.pxd":191
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_loop_set_started
 *         notification_message.player = 0             # <<<<<<<<<<<<<<
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = 0
 */
    __pyx_v_notification_message->player = 0;

    /* "mpfmc/core/audio/notification_message.pxd":192
 *         notification_message.message = notification_sound_loop_set_started
 *         notification_message.player = 0
 *         notification_message.sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_message.sound_instance_id = 0
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id
 */
    __pyx_v_notification_message->sound_id = __pyx_v_sound_id;

    /* "mpfmc/core/audio/notification_message.pxd":193
 *         notification_message.player = 0
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = 0             # <<<<<<<<<<<<<<
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id
 *         notification_message.data.sound_loop_set.player = player
 */
    __pyx_v_notification_message->sound_instance_id = 0;

    /* "mpfmc/core/audio/notification_message.pxd":194
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = 0
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id             # <<<<<<<<<<<<<<
 *         notification_message.data.sound_loop_set.player = player
 * 
 */
    __pyx_v_notification_message->data.sound_loop_set.id = __pyx_v_sound_loop_set_id;

    /* "mpfmc/core/audio/notification_message.pxd":195
 *         notification_message.sound_instance_id = 0
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id
 *         notification_message.data.sound_loop_set.player = player             # <<<<<<<<<<<<<<
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
    __pyx_v_notification_message->data.sound_loop_set.player = __pyx_v_player;

    /* "mpfmc/core/audio/notification_message.pxd":197
 *         notification_message.data.sound_loop_set.player = player
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_loop_set_stopped_notification(int sound_loop_set_id, Uint64 sound_id, gpointer player, TrackState *track) nogil:
 */
    __pyx_v_track->notification_messages = g_slist_prepend(__pyx_v_track->notification_messages, __pyx_v_notification_message);

    /* "mpfmc/core/audio/notification_message.pxd":189
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_loop_set_started
 *         notification_message.player = 0
 */
  }

  /* "mpfmc/core/audio/notification_message.pxd":179
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_loop_set_started_notification(int sound_loop_set_id, Uint64 sound_id, gpointer player, TrackState *track) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Sends a sound_loop_set started notification
 */

  /* function exit code */
}

/* "mpfmc/core/audio/notification_message.pxd":199
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_loop_set_stopped_notification(int sound_loop_set_id, Uint64 sound_id, gpointer player, TrackState *track) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Sends a sound_loop_set stopped notification
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_loop_set_stopped_notification(int __pyx_v_sound_loop_set_id, Uint64 __pyx_v_sound_id, gpointer __pyx_v_player, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message;
  int __pyx_t_1;

  /* "mpfmc/core/audio/notification_message.pxd":208
 *         track: The TrackState pointer
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()             # <<<<<<<<<<<<<<
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_loop_set_stopped
 */
  __pyx_v_notification_message = __pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message();

  /* "mpfmc/core/audio/notification_message.pxd":209
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_loop_set_stopped
 *         notification_message.player = 0
 */
  __pyx_t_1 = ((__pyx_v_notification_message != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/notification_message.pxd":210
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_loop_set_stopped             # <<<<<<<<<<<<<<
 *         notification_message.player = 0
 *         notification_message.sound_id = sound_id
 */
    __pyx_v_notification_message->message = __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_loop_set_stopped;

    /* "mpfmc/core/audio/notification_message.pxd":211
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_loop_set_stopped
 *         notification_message.player = 0             # <<<<<<<<<<<<<<
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = 0
 */
    __pyx_v_notification_message->player = 0;

    /* "mpfmc/core/audio/notification_message.pxd":212
 *         notification_message.message = notification_sound_loop_set_stopped
 *         notification_message.player = 0
 *         notification_message.sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_message.sound_instance_id = 0
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id
 */
    __pyx_v_notification_message->sound_id = __pyx_v_sound_id;

    /* "mpfmc/core/audio/notification_message.pxd":213
 *         notification_message.player = 0
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = 0             # <<<<<<<<<<<<<<
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id
 *         notification_message.data.sound_loop_set.player = player
 */
    __pyx_v_notification_message->sound_instance_id = 0;

    /* "mpfmc/core/audio/notification_message.pxd":214
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = 0
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id             # <<<<<<<<<<<<<<
 *         notification_message.data.sound_loop_set.player = player
 * 
 */
    __pyx_v_notification_message->data.sound_loop_set.id = __pyx_v_sound_loop_set_id;

    /* "mpfmc/core/audio/notification_message.pxd":215
 *         notification_message.sound_instance_id = 0
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id
 *         notification_message.data.sound_loop_set.player = player             # <<<<<<<<<<<<<<
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
    __pyx_v_notification_message->data.sound_loop_set.player = __pyx_v_player;

    /* "mpfmc/core/audio/notification_message.pxd":217
 *         notification_message.data.sound_loop_set.player = player
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void send_sound_loop_set_looping_notification(int sound_loop_set_id, Uint64 sound_id, gpointer player, TrackState *track) nogil:
 */
    __pyx_v_track->notification_messages = g_slist_prepend(__pyx_v_track->notification_messages, __pyx_v_notification_message);

    /* "mpfmc/core/audio/notification_message.pxd":209
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_loop_set_stopped
 *         notification_message.player = 0
 */
  }

  /* "mpfmc/core/audio/notification_message.pxd":199
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_loop_set_stopped_notification(int sound_loop_set_id, Uint64 sound_id, gpointer player, TrackState *track) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Sends a sound_loop_set stopped notification
 */

  /* function exit code */
}

/* "mpfmc/core/audio/notification_message.pxd":219
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_loop_set_looping_notification(int sound_loop_set_id, Uint64 sound_id, gpointer player, TrackState *track) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Sends a sound_loop_set looping notification
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_loop_set_looping_notification(int __pyx_v_sound_loop_set_id, Uint64 __pyx_v_sound_id, gpointer __pyx_v_player, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track) {
  __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *__pyx_v_notification_message;
  int __pyx_t_1;

  /* "mpfmc/core/audio/notification_message.pxd":228
 *         track: The TrackState pointer
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()             # <<<<<<<<<<<<<<
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_loop_set_looping
 */
  __pyx_v_notification_message = __pyx_f_5mpfmc_4core_5audio_20notification_message__create_notification_message();

  /* "mpfmc/core/audio/notification_message.pxd":229
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_loop_set_looping
 *         notification_message.player = 0
 */
  __pyx_t_1 = ((__pyx_v_notification_message != NULL) != 0);
  if (__pyx_t_1) {

    /* "mpfmc/core/audio/notification_message.pxd":230
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_loop_set_looping             # <<<<<<<<<<<<<<
 *         notification_message.player = 0
 *         notification_message.sound_id = sound_id
 */
    __pyx_v_notification_message->message = __pyx_e_5mpfmc_4core_5audio_20notification_message_notification_sound_loop_set_looping;

    /* "mpfmc/core/audio/notification_message.pxd":231
 *     if notification_message != NULL:
 *         notification_message.message = notification_sound_loop_set_looping
 *         notification_message.player = 0             # <<<<<<<<<<<<<<
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = 0
 */
    __pyx_v_notification_message->player = 0;

    /* "mpfmc/core/audio/notification_message.pxd":232
 *         notification_message.message = notification_sound_loop_set_looping
 *         notification_message.player = 0
 *         notification_message.sound_id = sound_id             # <<<<<<<<<<<<<<
 *         notification_message.sound_instance_id = 0
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id
 */
    __pyx_v_notification_message->sound_id = __pyx_v_sound_id;

    /* "mpfmc/core/audio/notification_message.pxd":233
 *         notification_message.player = 0
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = 0             # <<<<<<<<<<<<<<
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id
 *         notification_message.data.sound_loop_set.player = player
 */
    __pyx_v_notification_message->sound_instance_id = 0;

    /* "mpfmc/core/audio/notification_message.pxd":234
 *         notification_message.sound_id = sound_id
 *         notification_message.sound_instance_id = 0
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id             # <<<<<<<<<<<<<<
 *         notification_message.data.sound_loop_set.player = player
 * 
 */
    __pyx_v_notification_message->data.sound_loop_set.id = __pyx_v_sound_loop_set_id;

    /* "mpfmc/core/audio/notification_message.pxd":235
 *         notification_message.sound_instance_id = 0
 *         notification_message.data.sound_loop_set.id = sound_loop_set_id
 *         notification_message.data.sound_loop_set.player = player             # <<<<<<<<<<<<<<
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 */
    __pyx_v_notification_message->data.sound_loop_set.player = __pyx_v_player;

    /* "mpfmc/core/audio/notification_message.pxd":237
 *         notification_message.data.sound_loop_set.player = player
 * 
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)             # <<<<<<<<<<<<<<
 * 
 */
    __pyx_v_track->notification_messages = g_slist_prepend(__pyx_v_track->notification_messages, __pyx_v_notification_message);

    /* "mpfmc/core/audio/notification_message.pxd":229
 *     """
 *     cdef NotificationMessageContainer *notification_message = _create_notification_message()
 *     if notification_message != NULL:             # <<<<<<<<<<<<<<
 *         notification_message.message = notification_sound_loop_set_looping
 *         notification_message.player = 0
 */
  }

  /* "mpfmc/core/audio/notification_message.pxd":219
 *         track.notification_messages = g_slist_prepend(track.notification_messages, notification_message)
 * 
 * cdef inline void send_sound_loop_set_looping_notification(int sound_loop_set_id, Uint64 sound_id, gpointer player, TrackState *track) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Sends a sound_loop_set looping notification
 */

  /* function exit code */
}

/* "mpfmc/core/audio/track_standard.pxd":128
 *                                       Uint8 volume, TrackState *track, int player_num) nogil
 * 
 * cdef inline void end_of_sound_processing(SoundPlayer* player,             # <<<<<<<<<<<<<<
 *                                          TrackState *track) nogil:
 *     """
 */

static CYTHON_INLINE void __pyx_f_5mpfmc_4core_5audio_14track_standard_end_of_sound_processing(__pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *__pyx_v_player, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *__pyx_v_track) {
  int __pyx_t_1;

  /* "mpfmc/core/audio/track_standard.pxd":139
 *     """
 *     # 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) {

    /* "mpfmc/core/audio/track_standard.pxd":141
 *     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);

    /* "mpfmc/core/audio/track_standard.pxd":142
 *         # 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.number,
 */
    __pyx_v_player->current.sample_pos = 0;

    /* "mpfmc/core/audio/track_standard.pxd":143
 *         player.current.loops_remaining -= 1
 *         player.current.sample_pos = 0
 *         player.current.current_loop += 1             # <<<<<<<<<<<<<<
 *         send_sound_looping_notification(player.number,
 *                                  player.current.sound_id, player.current.sound_instance_id,
 */
    __pyx_v_player->current.current_loop = (__pyx_v_player->current.current_loop + 1);

    /* "mpfmc/core/audio/track_standard.pxd":144
 *         player.current.sample_pos = 0
 *         player.current.current_loop += 1
 *         send_sound_looping_notification(player.number,             # <<<<<<<<<<<<<<
 *                                  player.current.sound_id, player.current.sound_instance_id,
 *                                  track)
 */
    __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_looping_notification(__pyx_v_player->number, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_track);

    /* "mpfmc/core/audio/track_standard.pxd":139
 *     """
 *     # 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;
  }

  /* "mpfmc/core/audio/track_standard.pxd":148
 *                                  track)
 * 
 *     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) {

    /* "mpfmc/core/audio/track_standard.pxd":150
 *     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_5mpfmc_4core_5audio_14track_standard_player_finished;

    /* "mpfmc/core/audio/track_standard.pxd":148
 *                                  track)
 * 
 *     elif player.current.loops_remaining == 0:             # <<<<<<<<<<<<<<
 *         # At the end and not looping, the sample has finished playing
 *         player.status = player_finished
 */
    goto __pyx_L3;
  }

  /* "mpfmc/core/audio/track_standard.pxd":154
 *     else:
 *         # Looping infinitely, loop back to the beginning
 *         player.current.sample_pos = 0             # <<<<<<<<<<<<<<
 *         player.current.current_loop += 1
 *         send_sound_looping_notification(player.number,
 */
  /*else*/ {
    __pyx_v_player->current.sample_pos = 0;

    /* "mpfmc/core/audio/track_standard.pxd":155
 *         # Looping infinitely, loop back to the beginning
 *         player.current.sample_pos = 0
 *         player.current.current_loop += 1             # <<<<<<<<<<<<<<
 *         send_sound_looping_notification(player.number,
 *                                  player.current.sound_id, player.current.sound_instance_id,
 */
    __pyx_v_player->current.current_loop = (__pyx_v_player->current.current_loop + 1);

    /* "mpfmc/core/audio/track_standard.pxd":156
 *         player.current.sample_pos = 0
 *         player.current.current_loop += 1
 *         send_sound_looping_notification(player.number,             # <<<<<<<<<<<<<<
 *                                  player.current.sound_id, player.current.sound_instance_id,
 *                                  track)
 */
    __pyx_f_5mpfmc_4core_5audio_20notification_message_send_sound_looping_notification(__pyx_v_player->number, __pyx_v_player->current.sound_id, __pyx_v_player->current.sound_instance_id, __pyx_v_track);
  }
  __pyx_L3:;

  /* "mpfmc/core/audio/track_standard.pxd":128
 *                                       Uint8 volume, TrackState *track, int player_num) nogil
 * 
 * cdef inline void end_of_sound_processing(SoundPlayer* player,             # <<<<<<<<<<<<<<
 *                                          TrackState *track) nogil:
 *     """
 */

  /* function exit code */
}
static struct __pyx_vtabstruct_5mpfmc_4core_5audio_14track_standard_TrackStandard __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard;

static PyObject *__pyx_tp_new_5mpfmc_4core_5audio_14track_standard_TrackStandard(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *p;
  PyObject *o = __pyx_ptype_5mpfmc_4core_5audio_5track_Track->tp_new(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5mpfmc_4core_5audio_5track_Track*)__pyx_vtabptr_5mpfmc_4core_5audio_14track_standard_TrackStandard;
  p->_sound_queue = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_playing_instances_by_id = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5mpfmc_4core_5audio_14track_standard_TrackStandard(PyObject *o) {
  struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *p = (struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && 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);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_sound_queue);
  Py_CLEAR(p->_playing_instances_by_id);
  PyObject_GC_Track(o);
  if (likely(__pyx_ptype_5mpfmc_4core_5audio_5track_Track)) __pyx_ptype_5mpfmc_4core_5audio_5track_Track->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_5mpfmc_4core_5audio_14track_standard_TrackStandard);
}

static int __pyx_tp_traverse_5mpfmc_4core_5audio_14track_standard_TrackStandard(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *p = (struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)o;
  e = ((likely(__pyx_ptype_5mpfmc_4core_5audio_5track_Track)) ? ((__pyx_ptype_5mpfmc_4core_5audio_5track_Track->tp_traverse) ? __pyx_ptype_5mpfmc_4core_5audio_5track_Track->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5mpfmc_4core_5audio_14track_standard_TrackStandard)); if (e) return e;
  if (p->_sound_queue) {
    e = (*v)(p->_sound_queue, a); if (e) return e;
  }
  if (p->_playing_instances_by_id) {
    e = (*v)(p->_playing_instances_by_id, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5mpfmc_4core_5audio_14track_standard_TrackStandard(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *p = (struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *)o;
  if (likely(__pyx_ptype_5mpfmc_4core_5audio_5track_Track)) { if (__pyx_ptype_5mpfmc_4core_5audio_5track_Track->tp_clear) __pyx_ptype_5mpfmc_4core_5audio_5track_Track->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5mpfmc_4core_5audio_14track_standard_TrackStandard);
  tmp = ((PyObject*)p->_sound_queue);
  p->_sound_queue = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_playing_instances_by_id);
  p->_playing_instances_by_id = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5mpfmc_4core_5audio_14track_standard_13TrackStandard_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_4type_1__get__(o);
}

static PyObject *__pyx_getprop_5mpfmc_4core_5audio_14track_standard_13TrackStandard_supports_in_memory_sounds(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25supports_in_memory_sounds_1__get__(o);
}

static PyObject *__pyx_getprop_5mpfmc_4core_5audio_14track_standard_13TrackStandard_supports_streaming_sounds(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25supports_streaming_sounds_1__get__(o);
}

static PyObject *__pyx_getprop_5mpfmc_4core_5audio_14track_standard_13TrackStandard_max_simultaneous_sounds(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_23max_simultaneous_sounds_1__get__(o);
}

static PyMethodDef __pyx_methods_5mpfmc_4core_5audio_14track_standard_TrackStandard[] = {
  {"process", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_7process, METH_NOARGS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_6process},
  {"_get_next_sound", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_9_get_next_sound, METH_NOARGS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_8_get_next_sound},
  {"_remove_sound_from_queue", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_11_remove_sound_from_queue, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_10_remove_sound_from_queue},
  {"_remove_sound_instance_from_queue", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_13_remove_sound_instance_from_queue, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_12_remove_sound_instance_from_queue},
  {"_remove_all_sounds_with_context_from_queue", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_15_remove_all_sounds_with_context_from_queue, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_14_remove_all_sounds_with_context_from_queue},
  {"_remove_all_sounds_with_key_from_queue", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_17_remove_all_sounds_with_key_from_queue, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_16_remove_all_sounds_with_key_from_queue},
  {"_remove_all_sounds_from_queue", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_19_remove_all_sounds_from_queue, METH_NOARGS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_18_remove_all_sounds_from_queue},
  {"_get_oldest_playing_sound_instance", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_21_get_oldest_playing_sound_instance, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_20_get_oldest_playing_sound_instance},
  {"_get_newest_playing_sound_instance", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_23_get_newest_playing_sound_instance, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_22_get_newest_playing_sound_instance},
  {"play_sound", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_25play_sound, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_24play_sound},
  {"_replace_sound_instance", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_27_replace_sound_instance, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_26_replace_sound_instance},
  {"_queue_sound", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_29_queue_sound, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_28_queue_sound},
  {"_get_sound_instances_for_sound", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_31_get_sound_instances_for_sound, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_30_get_sound_instances_for_sound},
  {"stop_sound", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_33stop_sound, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_32stop_sound},
  {"stop_sound_instance", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_35stop_sound_instance, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_34stop_sound_instance},
  {"stop_sound_looping", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_37stop_sound_looping, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_36stop_sound_looping},
  {"stop_sound_instance_looping", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_39stop_sound_instance_looping, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_38stop_sound_instance_looping},
  {"clear_context", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_41clear_context, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_40clear_context},
  {"_reset_state", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_43_reset_state, METH_NOARGS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_42_reset_state},
  {"stop_all_sounds", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_45stop_all_sounds, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_44stop_all_sounds},
  {"get_playing_sound_instance_by_id", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_47get_playing_sound_instance_by_id, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_46get_playing_sound_instance_by_id},
  {"get_status", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_49get_status, METH_NOARGS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_48get_status},
  {"get_sound_queue_count", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_51get_sound_queue_count, METH_NOARGS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_50get_sound_queue_count},
  {"get_sound_players_in_use_count", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_53get_sound_players_in_use_count, METH_NOARGS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_52get_sound_players_in_use_count},
  {"sound_is_playing", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_55sound_is_playing, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_54sound_is_playing},
  {"sound_instance_is_playing", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_57sound_instance_is_playing, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_56sound_instance_is_playing},
  {"sound_is_in_queue", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_59sound_is_in_queue, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_58sound_is_in_queue},
  {"sound_instance_is_in_queue", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_61sound_instance_is_in_queue, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_60sound_instance_is_in_queue},
  {"player_status_to_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_63player_status_to_text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_62player_status_to_text},
  {"player_fading_status_to_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_65player_fading_status_to_text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_64player_fading_status_to_text},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_67__reduce_cython__, METH_NOARGS, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_66__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_69__setstate_cython__, METH_O, __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard_68__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5mpfmc_4core_5audio_14track_standard_TrackStandard[] = {
  {(char *)"type", __pyx_getprop_5mpfmc_4core_5audio_14track_standard_13TrackStandard_type, 0, (char *)0, 0},
  {(char *)"supports_in_memory_sounds", __pyx_getprop_5mpfmc_4core_5audio_14track_standard_13TrackStandard_supports_in_memory_sounds, 0, (char *)"Return whether or not track accepts in-memory sounds", 0},
  {(char *)"supports_streaming_sounds", __pyx_getprop_5mpfmc_4core_5audio_14track_standard_13TrackStandard_supports_streaming_sounds, 0, (char *)"Return whether or not track accepts streaming sounds", 0},
  {(char *)"max_simultaneous_sounds", __pyx_getprop_5mpfmc_4core_5audio_14track_standard_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_5mpfmc_4core_5audio_14track_standard_TrackStandard = {
  PyVarObject_HEAD_INIT(0, 0)
  "mpfmc.core.audio.track_standard.TrackStandard", /*tp_name*/
  sizeof(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5mpfmc_4core_5audio_14track_standard_TrackStandard, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  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_5mpfmc_4core_5audio_14track_standard_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(mc, audio_callback_data, unicode name, int track_num, int buffer_size, int max_simultaneous_sounds=MAX_SIMULTANEOUS_SOUNDS_DEFAULT, float volume=1.0)\n\n    Track class\n    ", /*tp_doc*/
  __pyx_tp_traverse_5mpfmc_4core_5audio_14track_standard_TrackStandard, /*tp_traverse*/
  __pyx_tp_clear_5mpfmc_4core_5audio_14track_standard_TrackStandard, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5mpfmc_4core_5audio_14track_standard_TrackStandard, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5mpfmc_4core_5audio_14track_standard_TrackStandard, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5mpfmc_4core_5audio_14track_standard_13TrackStandard_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5mpfmc_4core_5audio_14track_standard_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
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_track_standard(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_track_standard},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "track_standard",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__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_sound_players_are_currently, __pyx_k_All_sound_players_are_currently, sizeof(__pyx_k_All_sound_players_are_currently), 0, 1, 0, 0},
  {&__pyx_n_s_AudioException, __pyx_k_AudioException, sizeof(__pyx_k_AudioException), 0, 0, 1, 1},
  {&__pyx_kp_u_Clearing_context_s, __pyx_k_Clearing_context_s, sizeof(__pyx_k_Clearing_context_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Created_Track_d_s_with_the_follo, __pyx_k_Created_Track_d_s_with_the_follo, sizeof(__pyx_k_Created_Track_d_s_with_the_follo), 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_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_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__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_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_pending_sound_with_cont, __pyx_k_Removing_pending_sound_with_cont, sizeof(__pyx_k_Removing_pending_sound_with_cont), 0, 1, 0, 0},
  {&__pyx_kp_u_Removing_pending_sound_with_key, __pyx_k_Removing_pending_sound_with_key, sizeof(__pyx_k_Removing_pending_sound_with_key), 0, 1, 0, 0},
  {&__pyx_kp_u_Removing_sound_instance_s_from_p, __pyx_k_Removing_sound_instance_s_from_p, sizeof(__pyx_k_Removing_sound_instance_s_from_p), 0, 1, 0, 0},
  {&__pyx_kp_u_Resetting_track_state_sounds_wil, __pyx_k_Resetting_track_state_sounds_wil, sizeof(__pyx_k_Resetting_track_state_sounds_wil), 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_kp_u_Skip_clearing_context_s_playlist, __pyx_k_Skip_clearing_context_s_playlist, sizeof(__pyx_k_Skip_clearing_context_s_playlist), 0, 1, 0, 0},
  {&__pyx_n_s_SoundInstance, __pyx_k_SoundInstance, sizeof(__pyx_k_SoundInstance), 0, 0, 1, 1},
  {&__pyx_n_s_SoundStealingMethod, __pyx_k_SoundStealingMethod, sizeof(__pyx_k_SoundStealingMethod), 0, 0, 1, 1},
  {&__pyx_kp_u_Sound_s_has_reached_the_maximum, __pyx_k_Sound_s_has_reached_the_maximum, sizeof(__pyx_k_Sound_s_has_reached_the_maximum), 0, 1, 0, 0},
  {&__pyx_kp_u_Sound_s_has_reached_the_maximum_2, __pyx_k_Sound_s_has_reached_the_maximum_2, sizeof(__pyx_k_Sound_s_has_reached_the_maximum_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Sound_s_has_reached_the_maximum_3, __pyx_k_Sound_s_has_reached_the_maximum_3, sizeof(__pyx_k_Sound_s_has_reached_the_maximum_3), 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_Sound_s_is_set_to_begin_playback_2, __pyx_k_Sound_s_is_set_to_begin_playback_2, sizeof(__pyx_k_Sound_s_is_set_to_begin_playback_2), 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_Track, __pyx_k_Track, sizeof(__pyx_k_Track), 0, 1, 0, 0},
  {&__pyx_kp_u_TrackStandard, __pyx_k_TrackStandard, sizeof(__pyx_k_TrackStandard), 0, 1, 0, 0},
  {&__pyx_n_s_TrackStandard_2, __pyx_k_TrackStandard_2, sizeof(__pyx_k_TrackStandard_2), 0, 0, 1, 1},
  {&__pyx_kp_u_Track_Standard, __pyx_k_Track_Standard, sizeof(__pyx_k_Track_Standard), 0, 1, 0, 0},
  {&__pyx_kp_u_Track_play_sound_encountered_an, __pyx_k_Track_play_sound_encountered_an, sizeof(__pyx_k_Track_play_sound_encountered_an), 0, 1, 0, 0},
  {&__pyx_kp_u_Track_s_play_sound_encountered_a, __pyx_k_Track_s_play_sound_encountered_a, sizeof(__pyx_k_Track_s_play_sound_encountered_a), 0, 1, 0, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__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_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_about_to_finish_time, __pyx_k_about_to_finish_time, sizeof(__pyx_k_about_to_finish_time), 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_s_audio_interface, __pyx_k_audio_interface, sizeof(__pyx_k_audio_interface), 0, 0, 1, 1},
  {&__pyx_n_s_buffer_size, __pyx_k_buffer_size, sizeof(__pyx_k_buffer_size), 0, 0, 1, 1},
  {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1},
  {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_container, __pyx_k_container, sizeof(__pyx_k_container), 0, 0, 1, 1},
  {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_u_current_loop, __pyx_k_current_loop, sizeof(__pyx_k_current_loop), 0, 1, 0, 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_ducking, __pyx_k_ducking, sizeof(__pyx_k_ducking), 0, 0, 1, 1},
  {&__pyx_n_s_duration, __pyx_k_duration, sizeof(__pyx_k_duration), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_events_when_paused, __pyx_k_events_when_paused, sizeof(__pyx_k_events_when_paused), 0, 0, 1, 1},
  {&__pyx_n_s_events_when_stopped, __pyx_k_events_when_stopped, sizeof(__pyx_k_events_when_stopped), 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_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_u_finished, __pyx_k_finished, sizeof(__pyx_k_finished), 0, 1, 0, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 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_newest_playing_sound_instan, __pyx_k_get_newest_playing_sound_instan, sizeof(__pyx_k_get_newest_playing_sound_instan), 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_oldest_playing_sound_instan, __pyx_k_get_oldest_playing_sound_instan, sizeof(__pyx_k_get_oldest_playing_sound_instan), 0, 0, 1, 1},
  {&__pyx_n_s_get_playlist_controller, __pyx_k_get_playlist_controller, sizeof(__pyx_k_get_playlist_controller), 0, 0, 1, 1},
  {&__pyx_n_s_get_sound_instances_for_sound, __pyx_k_get_sound_instances_for_sound, sizeof(__pyx_k_get_sound_instances_for_sound), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 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_heapify, __pyx_k_heapify, sizeof(__pyx_k_heapify), 0, 0, 1, 1},
  {&__pyx_n_s_heappop, __pyx_k_heappop, sizeof(__pyx_k_heappop), 0, 0, 1, 1},
  {&__pyx_n_s_heappush, __pyx_k_heappush, sizeof(__pyx_k_heappush), 0, 0, 1, 1},
  {&__pyx_n_s_heapq, __pyx_k_heapq, sizeof(__pyx_k_heapq), 0, 0, 1, 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_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_n_s_load, __pyx_k_load, sizeof(__pyx_k_load), 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_loop_end_at, __pyx_k_loop_end_at, sizeof(__pyx_k_loop_end_at), 0, 0, 1, 1},
  {&__pyx_n_u_loop_end_pos, __pyx_k_loop_end_pos, sizeof(__pyx_k_loop_end_pos), 0, 1, 0, 1},
  {&__pyx_n_s_loop_start_at, __pyx_k_loop_start_at, sizeof(__pyx_k_loop_start_at), 0, 0, 1, 1},
  {&__pyx_n_u_loop_start_pos, __pyx_k_loop_start_pos, sizeof(__pyx_k_loop_start_pos), 0, 1, 0, 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_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_mpfmc_assets_sound, __pyx_k_mpfmc_assets_sound, sizeof(__pyx_k_mpfmc_assets_sound), 0, 0, 1, 1},
  {&__pyx_n_s_mpfmc_core_audio_audio_exception, __pyx_k_mpfmc_core_audio_audio_exception, sizeof(__pyx_k_mpfmc_core_audio_audio_exception), 0, 0, 1, 1},
  {&__pyx_kp_s_mpfmc_core_audio_track_standard, __pyx_k_mpfmc_core_audio_track_standard, sizeof(__pyx_k_mpfmc_core_audio_track_standard), 0, 0, 1, 0},
  {&__pyx_n_s_mpfmc_core_audio_track_standard_2, __pyx_k_mpfmc_core_audio_track_standard_2, sizeof(__pyx_k_mpfmc_core_audio_track_standard_2), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_newest, __pyx_k_newest, sizeof(__pyx_k_newest), 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_number, __pyx_k_number, sizeof(__pyx_k_number), 0, 0, 1, 1},
  {&__pyx_n_s_old_instance, __pyx_k_old_instance, sizeof(__pyx_k_old_instance), 0, 0, 1, 1},
  {&__pyx_n_s_oldest, __pyx_k_oldest, sizeof(__pyx_k_oldest), 0, 0, 1, 1},
  {&__pyx_n_s_pan, __pyx_k_pan, sizeof(__pyx_k_pan), 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_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_kp_u_play_sound_on_sound_player_s_tr, __pyx_k_play_sound_on_sound_player_s_tr, sizeof(__pyx_k_play_sound_on_sound_player_s_tr), 0, 1, 0, 0},
  {&__pyx_kp_u_play_sound_s_track_is_not_curren, __pyx_k_play_sound_s_track_is_not_curren, sizeof(__pyx_k_play_sound_s_track_is_not_curren), 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_post_mc_native_event, __pyx_k_post_mc_native_event, sizeof(__pyx_k_post_mc_native_event), 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_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 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_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 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, __pyx_k_remove, sizeof(__pyx_k_remove), 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_all_sounds_with_context, __pyx_k_remove_all_sounds_with_context, sizeof(__pyx_k_remove_all_sounds_with_context), 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_n_s_remove_sound_instance_from_queu, __pyx_k_remove_sound_instance_from_queu, sizeof(__pyx_k_remove_sound_instance_from_queu), 0, 0, 1, 1},
  {&__pyx_n_s_replace_sound_instance, __pyx_k_replace_sound_instance, sizeof(__pyx_k_replace_sound_instance), 0, 0, 1, 1},
  {&__pyx_kp_u_replace_sound_instance_Could_not, __pyx_k_replace_sound_instance_Could_not, sizeof(__pyx_k_replace_sound_instance_Could_not), 0, 1, 0, 0},
  {&__pyx_kp_u_replace_sound_instance_Preparing, __pyx_k_replace_sound_instance_Preparing, sizeof(__pyx_k_replace_sound_instance_Preparing), 0, 1, 0, 0},
  {&__pyx_n_u_replacing, __pyx_k_replacing, sizeof(__pyx_k_replacing), 0, 1, 0, 1},
  {&__pyx_n_s_reset_state, __pyx_k_reset_state, sizeof(__pyx_k_reset_state), 0, 0, 1, 1},
  {&__pyx_n_u_sample_pos, __pyx_k_sample_pos, sizeof(__pyx_k_sample_pos), 0, 1, 0, 1},
  {&__pyx_kp_s_self_state_self_type_state_canno, __pyx_k_self_state_self_type_state_canno, sizeof(__pyx_k_self_state_self_type_state_canno), 0, 0, 1, 0},
  {&__pyx_n_s_set_about_to_finish, __pyx_k_set_about_to_finish, sizeof(__pyx_k_set_about_to_finish), 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_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_settings, __pyx_k_settings, sizeof(__pyx_k_settings), 0, 0, 1, 1},
  {&__pyx_n_s_simultaneous_limit, __pyx_k_simultaneous_limit, sizeof(__pyx_k_simultaneous_limit), 0, 0, 1, 1},
  {&__pyx_n_s_sound, __pyx_k_sound, sizeof(__pyx_k_sound), 0, 0, 1, 1},
  {&__pyx_n_s_sound_id, __pyx_k_sound_id, sizeof(__pyx_k_sound_id), 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_instance_is_in_queue, __pyx_k_sound_instance_is_in_queue, sizeof(__pyx_k_sound_instance_is_in_queue), 0, 0, 1, 1},
  {&__pyx_n_s_sound_system, __pyx_k_sound_system, sizeof(__pyx_k_sound_system), 0, 0, 1, 1},
  {&__pyx_n_u_standard, __pyx_k_standard, sizeof(__pyx_k_standard), 0, 1, 0, 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_stealing_method, __pyx_k_stealing_method, sizeof(__pyx_k_stealing_method), 0, 0, 1, 1},
  {&__pyx_n_s_stop_on_mode_end, __pyx_k_stop_on_mode_end, sizeof(__pyx_k_stop_on_mode_end), 0, 0, 1, 1},
  {&__pyx_n_s_stop_sound_instance, __pyx_k_stop_sound_instance, sizeof(__pyx_k_stop_sound_instance), 0, 0, 1, 1},
  {&__pyx_n_s_stop_sound_instance_looping, __pyx_k_stop_sound_instance_looping, sizeof(__pyx_k_stop_sound_instance_looping), 0, 0, 1, 1},
  {&__pyx_n_u_stopping, __pyx_k_stopping, sizeof(__pyx_k_stopping), 0, 1, 0, 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_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_timestamp, __pyx_k_timestamp, sizeof(__pyx_k_timestamp), 0, 0, 1, 1},
  {&__pyx_n_s_track, __pyx_k_track, sizeof(__pyx_k_track), 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_values, __pyx_k_values, sizeof(__pyx_k_values), 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},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 1259, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 54, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 89, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 376, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 1281, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_self_state_self_type_state_canno); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "(tree fragment)":4
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.state,self.type_state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_self_state_self_type_state_canno); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "mpfmc/core/audio/track_standard.pyx":1260
 * 
 *     @staticmethod
 *     def player_status_to_text(int status):             # <<<<<<<<<<<<<<
 *         """
 *         Converts a sound player status value into an equivalent text string.  Used for testing
 */
  __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_status, __pyx_n_s_status_values); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);
  __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mpfmc_core_audio_track_standard, __pyx_n_s_player_status_to_text, 1260, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 1260, __pyx_L1_error)

  /* "mpfmc/core/audio/track_standard.pyx":1285
 * 
 *     @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__6 = PyTuple_Pack(2, __pyx_n_s_fading_status, __pyx_n_s_fading_status_values); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);
  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mpfmc_core_audio_track_standard, __pyx_n_s_player_fading_status_to_text, 1285, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_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)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("get_memory_sound_samples", (void (*)(void))__pyx_f_5mpfmc_4core_5audio_14track_standard_get_memory_sound_samples, "int (__pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings *, Uint32, Uint8 *, int, Uint8, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("get_streaming_sound_samples", (void (*)(void))__pyx_f_5mpfmc_4core_5audio_14track_standard_get_streaming_sound_samples, "int (__pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings *, Uint32, Uint8 *, int, Uint8, __pyx_t_5mpfmc_4core_5audio_5track_TrackState *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_t_1 = PyImport_ImportModule("mpfmc.core.audio.track"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5mpfmc_4core_5audio_5track_Track = __Pyx_ImportType(__pyx_t_1, "mpfmc.core.audio.track", "Track", sizeof(struct __pyx_obj_5mpfmc_4core_5audio_5track_Track), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5mpfmc_4core_5audio_5track_Track) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_vtabptr_5mpfmc_4core_5audio_5track_Track = (struct __pyx_vtabstruct_5mpfmc_4core_5audio_5track_Track*)__Pyx_GetVtable(__pyx_ptype_5mpfmc_4core_5audio_5track_Track->tp_dict); if (unlikely(!__pyx_vtabptr_5mpfmc_4core_5audio_5track_Track)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_vtabptr_5mpfmc_4core_5audio_14track_standard_TrackStandard = &__pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard.__pyx_base = *__pyx_vtabptr_5mpfmc_4core_5audio_5track_Track;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard._get_playing_sound_count = (int (*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, Uint64))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_playing_sound_count;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard._get_playing_sound_instances = (PyObject *(*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, Uint64))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_playing_sound_instances;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard._get_idle_sound_player = (int (*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_idle_sound_player;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard.process_notification_message = (PyObject *(*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessageContainer *))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard_process_notification_message;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard._get_sound_player_with_lowest_priority = (PyObject *(*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_sound_player_with_lowest_priority;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard._play_sound_on_sound_player = (int (*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, PyObject *, int, struct __pyx_opt_args_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player *__pyx_optional_args))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__play_sound_on_sound_player;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard._set_player_sound_settings = (PyObject *(*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundSettings *, PyObject *))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__set_player_sound_settings;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard._set_player_playing = (PyObject *(*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *, PyObject *))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__set_player_playing;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard._set_player_replacing = (PyObject *(*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayer *, PyObject *))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__set_player_replacing;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard._get_player_playing_sound_instance = (int (*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, PyObject *))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__get_player_playing_sound_instance;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard._fix_sample_frame_pos = (Uint32 (*)(struct __pyx_obj_5mpfmc_4core_5audio_14track_standard_TrackStandard *, Uint32, Uint8, int))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard__fix_sample_frame_pos;
  __pyx_vtable_5mpfmc_4core_5audio_14track_standard_TrackStandard.mix_playing_sounds = (void (*)(__pyx_t_5mpfmc_4core_5audio_5track_TrackState *, Uint32, __pyx_t_5mpfmc_4core_5audio_4sdl2_AudioCallbackData *))__pyx_f_5mpfmc_4core_5audio_14track_standard_13TrackStandard_mix_playing_sounds;
  __pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard.tp_base = __pyx_ptype_5mpfmc_4core_5audio_5track_Track;
  if (PyType_Ready(&__pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard.tp_dictoffset && __pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 33, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_5mpfmc_4core_5audio_14track_standard_13TrackStandard___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_5mpfmc_4core_5audio_14track_standard_13TrackStandard___init__.doc = __pyx_doc_5mpfmc_4core_5audio_14track_standard_13TrackStandard___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5mpfmc_4core_5audio_14track_standard_13TrackStandard___init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard.tp_dict, __pyx_vtabptr_5mpfmc_4core_5audio_14track_standard_TrackStandard) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TrackStandard_2, (PyObject *)&__pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
  __pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard = &__pyx_type_5mpfmc_4core_5audio_14track_standard_TrackStandard;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule("mpfmc.core.audio.sound_file"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5mpfmc_4core_5audio_10sound_file_SoundFile = __Pyx_ImportType(__pyx_t_1, "mpfmc.core.audio.sound_file", "SoundFile", sizeof(struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5mpfmc_4core_5audio_10sound_file_SoundFile) __PYX_ERR(2, 34, __pyx_L1_error)
  __pyx_ptype_5mpfmc_4core_5audio_10sound_file_SoundMemoryFile = __Pyx_ImportType(__pyx_t_1, "mpfmc.core.audio.sound_file", "SoundMemoryFile", sizeof(struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundMemoryFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5mpfmc_4core_5audio_10sound_file_SoundMemoryFile) __PYX_ERR(2, 42, __pyx_L1_error)
  __pyx_ptype_5mpfmc_4core_5audio_10sound_file_SoundStreamingFile = __Pyx_ImportType(__pyx_t_1, "mpfmc.core.audio.sound_file", "SoundStreamingFile", sizeof(struct __pyx_obj_5mpfmc_4core_5audio_10sound_file_SoundStreamingFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5mpfmc_4core_5audio_10sound_file_SoundStreamingFile) __PYX_ERR(2, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC inittrack_standard(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC inittrack_standard(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_track_standard(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_track_standard(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_track_standard(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'track_standard' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #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("__Pyx_PyMODINIT_FUNC PyInit_track_standard(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __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_AsyncGen_USED
  if (__pyx_AsyncGen_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 CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("track_standard", __pyx_methods, 0, 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)
  #endif
  __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)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  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_mpfmc__core__audio__track_standard) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __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, "mpfmc.core.audio.track_standard")) {
      if (unlikely(PyDict_SetItemString(modules, "mpfmc.core.audio.track_standard", __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 type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_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

  /* "mpfmc/core/audio/track_standard.pyx":6
 * from cpython.mem cimport PyMem_Malloc, PyMem_Realloc, PyMem_Free
 * import cython
 * import logging             # <<<<<<<<<<<<<<
 * import time
 * from math import ceil
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":7
 * import cython
 * import logging
 * import time             # <<<<<<<<<<<<<<
 * from math import ceil
 * from heapq import heappush, heappop, heapify
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":8
 * import logging
 * import time
 * from math import ceil             # <<<<<<<<<<<<<<
 * from heapq import heappush, heappop, heapify
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ceil);
  __Pyx_GIVEREF(__pyx_n_s_ceil);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ceil);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_math, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __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_ceil); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ceil, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":9
 * import time
 * from math import ceil
 * from heapq import heappush, heappop, heapify             # <<<<<<<<<<<<<<
 * 
 * from mpfmc.assets.sound import SoundInstance, SoundStealingMethod
 */
  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_heappush);
  __Pyx_GIVEREF(__pyx_n_s_heappush);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_heappush);
  __Pyx_INCREF(__pyx_n_s_heappop);
  __Pyx_GIVEREF(__pyx_n_s_heappop);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_heappop);
  __Pyx_INCREF(__pyx_n_s_heapify);
  __Pyx_GIVEREF(__pyx_n_s_heapify);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_heapify);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_heapq, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __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_heappush); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_heappush, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_heappop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_heappop, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_heapify); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_heapify, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":11
 * from heapq import heappush, heappop, heapify
 * 
 * from mpfmc.assets.sound import SoundInstance, SoundStealingMethod             # <<<<<<<<<<<<<<
 * from mpfmc.core.audio.sdl2 cimport *
 * from mpfmc.core.audio.gstreamer cimport *
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_SoundInstance);
  __Pyx_GIVEREF(__pyx_n_s_SoundInstance);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_SoundInstance);
  __Pyx_INCREF(__pyx_n_s_SoundStealingMethod);
  __Pyx_GIVEREF(__pyx_n_s_SoundStealingMethod);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_SoundStealingMethod);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mpfmc_assets_sound, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __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_SoundInstance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SoundInstance, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SoundStealingMethod); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SoundStealingMethod, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":18
 * from mpfmc.core.audio.notification_message cimport *
 * from mpfmc.core.audio.track_standard cimport *
 * from mpfmc.core.audio.audio_exception import AudioException             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_AudioException);
  __Pyx_GIVEREF(__pyx_n_s_AudioException);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_AudioException);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_mpfmc_core_audio_audio_exception, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __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_AudioException); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_AudioException, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mpfmc/core/audio/track_standard.pyx":39
 * 
 *     def __init__(self, object mc, object audio_callback_data, str name, int track_num, int buffer_size,
 *                  int max_simultaneous_sounds=MAX_SIMULTANEOUS_SOUNDS_DEFAULT,             # <<<<<<<<<<<<<<
 *                  float volume=1.0):
 *         """
 */
  __pyx_k_ = __pyx_e_5mpfmc_4core_5audio_5track_MAX_SIMULTANEOUS_SOUNDS_DEFAULT;

  /* "mpfmc/core/audio/track_standard.pyx":1260
 * 
 *     @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_5mpfmc_4core_5audio_14track_standard_13TrackStandard_63player_status_to_text, NULL, __pyx_n_s_mpfmc_core_audio_track_standard_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard->tp_dict, __pyx_n_s_player_status_to_text, __pyx_t_1) < 0) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard);

  /* "mpfmc/core/audio/track_standard.pyx":1259
 *         return sound_instance in self._sound_queue
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def player_status_to_text(int status):
 *         """
 */
  __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard, __pyx_n_s_player_status_to_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard->tp_dict, __pyx_n_s_player_status_to_text, __pyx_t_2) < 0) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard);

  /* "mpfmc/core/audio/track_standard.pyx":1285
 * 
 *     @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_2 = PyCFunction_NewEx(&__pyx_mdef_5mpfmc_4core_5audio_14track_standard_13TrackStandard_65player_fading_status_to_text, NULL, __pyx_n_s_mpfmc_core_audio_track_standard_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard->tp_dict, __pyx_n_s_player_fading_status_to_text, __pyx_t_2) < 0) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard);

  /* "mpfmc/core/audio/track_standard.pyx":1284
 *             return "unknown"
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def player_fading_status_to_text(int fading_status):
 *         """
 */
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard, __pyx_n_s_player_fading_status_to_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard->tp_dict, __pyx_n_s_player_fading_status_to_text, __pyx_t_1) < 0) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_5mpfmc_4core_5audio_14track_standard_TrackStandard);

  /* "mpfmc/core/audio/track_standard.pyx":1
 * #!python             # <<<<<<<<<<<<<<
 * #cython: embedsignature=True, language_level=3
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); 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;

  /* "mpfmc/core/audio/track_standard.pxd":128
 *                                       Uint8 volume, TrackState *track, int player_num) nogil
 * 
 * cdef inline void end_of_sound_processing(SoundPlayer* player,             # <<<<<<<<<<<<<<
 *                                          TrackState *track) nogil:
 *     """
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init mpfmc.core.audio.track_standard", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init mpfmc.core.audio.track_standard");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #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(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
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);
}
#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;
}

/* 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);
}

/* 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_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
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(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
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(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;
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* 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

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* 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) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    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

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#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

/* DictGetItem */
#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()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
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 (cause) {
        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 = __Pyx_PyThreadState_Current;
        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

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    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;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    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;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
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;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetItemInt */
static 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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(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(__Pyx_is_valid_index(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));
}

/* SliceTupleAndList */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyList_New(0);
    dest = PyList_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyListObject*)src)->ob_item + start,
        ((PyListObject*)dest)->ob_item,
        length);
    return dest;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyTuple_New(0);
    dest = PyTuple_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyTupleObject*)src)->ob_item + start,
        ((PyTupleObject*)dest)->ob_item,
        length);
    return dest;
}
#endif

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
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);
}
#endif

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_FALSE;
    }
    #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
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_TRUE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_TRUE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal != 0) 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_NE));
}

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long 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
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) 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));
}

/* GetException */
#if CYTHON_FAST_THREAD_STATE
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_FAST_THREAD_STATE
    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_FAST_THREAD_STATE
    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_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    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;
    #endif
    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;
}

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    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;
    #endif
    *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

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod0 */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_values */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_values, d);
    else
        return PyDict_Values(d);
}

/* 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
}

/* 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(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
    }
        
        PyFPE_START_PROTECT("add", return NULL)
        result = a + b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* PyFloatBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double a = floatval;
    double b, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: b = 0.0; break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
    }
        
        PyFPE_START_PROTECT("subtract", return NULL)
        result = a - b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* ObjectGetItem */
    #if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* PyIntBinop */
    #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #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
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        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;
#ifdef HAVE_LONG_LONG
                    } 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;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } 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;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } 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;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } 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;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } 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;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                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;
#ifdef HAVE_LONG_LONG
                    } 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;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #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

/* CallUnboundCMethod1 */
    #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
            if (PY_VERSION_HEX >= 0x030700A0) {
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            } else {
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            }
        } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        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);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* CallUnboundCMethod2 */
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    if (likely(cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
            return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
            #else
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
            #endif
        }
        #if PY_VERSION_HEX >= 0x030700A0
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
        #endif
    }
    return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(3);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 1, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 2, arg2);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(3, self, arg1, arg2);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* 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);
    if ((1));
#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);
    }
#endif
    else {
        if (default_value == Py_None)
            value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
        else
            value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
    }
    return value;
}

/* CallNextTpDealloc */
    static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_dealloc != current_tp_dealloc)
        type = type->tp_base;
    while (type && type->tp_dealloc == current_tp_dealloc)
        type = type->tp_base;
    if (type)
        type->tp_dealloc(obj);
}

/* CallNextTpTraverse */
    static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_traverse != current_tp_traverse)
        type = type->tp_base;
    while (type && type->tp_traverse == current_tp_traverse)
        type = type->tp_base;
    if (type && type->tp_traverse)
        return type->tp_traverse(obj, v, a);
    return 0;
}

/* CallNextTpClear */
    static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_clear != current_tp_clear)
        type = type->tp_base;
    while (type && type->tp_clear == current_tp_clear)
        type = type->tp_base;
    if (type && type->tp_clear)
        type->tp_clear(obj);
}

/* TypeImport */
    #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
    static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* PyObject_GenericGetAttrNoDict */
    #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
    #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* 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;
}

/* PyObjectGetAttrStrNoError */
    static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
}

/* SetupReduce */
    static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
            if (likely(reduce_cython)) {
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* 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_MAJOR_VERSION < 3
    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 ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    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;
}

/* GetNameInClass */
    static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
    PyObject *result;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    __Pyx_GetModuleGlobalNameUncached(result, name);
    return result;
}
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
    PyObject *result;
    result = __Pyx_PyObject_GetAttrStr(nmspace, name);
    if (!result) {
        result = __Pyx_GetGlobalNameAfterAttributeLookup(name);
    }
    return result;
}

/* CLineInTraceback */
    #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* 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;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    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(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, 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) ((int) 0 - (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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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_enum____pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage(enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage value) {
    const enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage neg_one = (enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage) ((enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage) 0 - (enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage) 1), const_zero = (enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5mpfmc_4core_5audio_20notification_message_NotificationMessage),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint64(Uint64 value) {
    const Uint64 neg_one = (Uint64) ((Uint64) 0 - (Uint64) 1), const_zero = (Uint64) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Uint64) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Uint64) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Uint64) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(Uint64) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Uint64) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(Uint64),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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_Uint16(Uint16 value) {
    const Uint16 neg_one = (Uint16) ((Uint16) 0 - (Uint16) 1), const_zero = (Uint16) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Uint16) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Uint16) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Uint16) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(Uint16) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Uint16) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(Uint16),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint8(Uint8 value) {
    const Uint8 neg_one = (Uint8) ((Uint8) 0 - (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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Uint8) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(Uint8) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Uint8) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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_Uint32(Uint32 value) {
    const Uint32 neg_one = (Uint32) ((Uint32) 0 - (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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Uint32) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(Uint32) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Uint32) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(Uint32),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus value) {
    const enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus neg_one = (enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus) ((enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus) 0 - (enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus) 1), const_zero = (enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_SoundPlayerStatus),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus value) {
    const enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus neg_one = (enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus) ((enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus) 0 - (enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus) 1), const_zero = (enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5mpfmc_4core_5audio_14track_standard_FadingStatus),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
    static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } 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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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 Uint64 __Pyx_PyInt_As_Uint64(PyObject *x) {
    const Uint64 neg_one = (Uint64) ((Uint64) 0 - (Uint64) 1), const_zero = (Uint64) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(Uint64) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(Uint64, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (Uint64) 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 (Uint64) 0;
                case  1: __PYX_VERIFY_RETURN_INT(Uint64, digit, digits[0])
                case 2:
                    if (8 * sizeof(Uint64) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint64) >= 2 * PyLong_SHIFT) {
                            return (Uint64) (((((Uint64)digits[1]) << PyLong_SHIFT) | (Uint64)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(Uint64) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint64) >= 3 * PyLong_SHIFT) {
                            return (Uint64) (((((((Uint64)digits[2]) << PyLong_SHIFT) | (Uint64)digits[1]) << PyLong_SHIFT) | (Uint64)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(Uint64) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint64, 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(Uint64) >= 4 * PyLong_SHIFT) {
                            return (Uint64) (((((((((Uint64)digits[3]) << PyLong_SHIFT) | (Uint64)digits[2]) << PyLong_SHIFT) | (Uint64)digits[1]) << PyLong_SHIFT) | (Uint64)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 (Uint64) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(Uint64) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint64, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(Uint64) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint64, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (Uint64) 0;
                case -1: __PYX_VERIFY_RETURN_INT(Uint64, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(Uint64,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(Uint64) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint64, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint64) - 1 > 2 * PyLong_SHIFT) {
                            return (Uint64) (((Uint64)-1)*(((((Uint64)digits[1]) << PyLong_SHIFT) | (Uint64)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(Uint64) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint64) - 1 > 2 * PyLong_SHIFT) {
                            return (Uint64) ((((((Uint64)digits[1]) << PyLong_SHIFT) | (Uint64)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(Uint64) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint64, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint64) - 1 > 3 * PyLong_SHIFT) {
                            return (Uint64) (((Uint64)-1)*(((((((Uint64)digits[2]) << PyLong_SHIFT) | (Uint64)digits[1]) << PyLong_SHIFT) | (Uint64)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(Uint64) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Uint64) - 1 > 3 * PyLong_SHIFT) {
                            return (Uint64) ((((((((Uint64)digits[2]) << PyLong_SHIFT) | (Uint64)digits[1]) << PyLong_SHIFT) | (Uint64)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(Uint64) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint64, 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(Uint64) - 1 > 4 * PyLong_SHIFT) {
                            return (Uint64) (((Uint64)-1)*(((((((((Uint64)digits[3]) << PyLong_SHIFT) | (Uint64)digits[2]) << PyLong_SHIFT) | (Uint64)digits[1]) << PyLong_SHIFT) | (Uint64)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(Uint64) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Uint64, 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(Uint64) - 1 > 4 * PyLong_SHIFT) {
                            return (Uint64) ((((((((((Uint64)digits[3]) << PyLong_SHIFT) | (Uint64)digits[2]) << PyLong_SHIFT) | (Uint64)digits[1]) << PyLong_SHIFT) | (Uint64)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(Uint64) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint64, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(Uint64) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint64, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            Uint64 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 (Uint64) -1;
        }
    } else {
        Uint64 val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (Uint64) -1;
        val = __Pyx_PyInt_As_Uint64(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to Uint64");
    return (Uint64) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to Uint64");
    return (Uint64) -1;
}

/* CIntFromPy */
    static CYTHON_INLINE Uint32 __Pyx_PyInt_As_Uint32(PyObject *x) {
    const Uint32 neg_one = (Uint32) ((Uint32) 0 - (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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(Uint32) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } 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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(Uint32) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint32, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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) ((Uint8) 0 - (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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(Uint8) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint8, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } 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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(Uint8) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Uint8, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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 guint __Pyx_PyInt_As_guint(PyObject *x) {
    const guint neg_one = (guint) ((guint) 0 - (guint) 1), const_zero = (guint) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(guint) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(guint, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (guint) 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 (guint) 0;
                case  1: __PYX_VERIFY_RETURN_INT(guint, digit, digits[0])
                case 2:
                    if (8 * sizeof(guint) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(guint, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(guint) >= 2 * PyLong_SHIFT) {
                            return (guint) (((((guint)digits[1]) << PyLong_SHIFT) | (guint)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(guint) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(guint, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(guint) >= 3 * PyLong_SHIFT) {
                            return (guint) (((((((guint)digits[2]) << PyLong_SHIFT) | (guint)digits[1]) << PyLong_SHIFT) | (guint)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(guint) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(guint, 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(guint) >= 4 * PyLong_SHIFT) {
                            return (guint) (((((((((guint)digits[3]) << PyLong_SHIFT) | (guint)digits[2]) << PyLong_SHIFT) | (guint)digits[1]) << PyLong_SHIFT) | (guint)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 (guint) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(guint) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(guint, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(guint) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(guint, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (guint) 0;
                case -1: __PYX_VERIFY_RETURN_INT(guint, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(guint,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(guint) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(guint, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(guint) - 1 > 2 * PyLong_SHIFT) {
                            return (guint) (((guint)-1)*(((((guint)digits[1]) << PyLong_SHIFT) | (guint)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(guint) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(guint, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(guint) - 1 > 2 * PyLong_SHIFT) {
                            return (guint) ((((((guint)digits[1]) << PyLong_SHIFT) | (guint)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(guint) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(guint, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(guint) - 1 > 3 * PyLong_SHIFT) {
                            return (guint) (((guint)-1)*(((((((guint)digits[2]) << PyLong_SHIFT) | (guint)digits[1]) << PyLong_SHIFT) | (guint)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(guint) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(guint, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(guint) - 1 > 3 * PyLong_SHIFT) {
                            return (guint) ((((((((guint)digits[2]) << PyLong_SHIFT) | (guint)digits[1]) << PyLong_SHIFT) | (guint)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(guint) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(guint, 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(guint) - 1 > 4 * PyLong_SHIFT) {
                            return (guint) (((guint)-1)*(((((((((guint)digits[3]) << PyLong_SHIFT) | (guint)digits[2]) << PyLong_SHIFT) | (guint)digits[1]) << PyLong_SHIFT) | (guint)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(guint) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(guint, 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(guint) - 1 > 4 * PyLong_SHIFT) {
                            return (guint) ((((((((((guint)digits[3]) << PyLong_SHIFT) | (guint)digits[2]) << PyLong_SHIFT) | (guint)digits[1]) << PyLong_SHIFT) | (guint)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(guint) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(guint, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(guint) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(guint, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            guint 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 (guint) -1;
        }
    } else {
        guint val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (guint) -1;
        val = __Pyx_PyInt_As_guint(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to guint");
    return (guint) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to guint");
    return (guint) -1;
}

/* CIntFromPy */
    static CYTHON_INLINE Sint32 __Pyx_PyInt_As_Sint32(PyObject *x) {
    const Sint32 neg_one = (Sint32) ((Sint32) 0 - (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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(Sint32) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Sint32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } 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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(Sint32) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Sint32, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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;
}

/* CIntFromPy */
    static CYTHON_INLINE gint64 __Pyx_PyInt_As_gint64(PyObject *x) {
    const gint64 neg_one = (gint64) ((gint64) 0 - (gint64) 1), const_zero = (gint64) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(gint64) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(gint64, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (gint64) 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 (gint64) 0;
                case  1: __PYX_VERIFY_RETURN_INT(gint64, digit, digits[0])
                case 2:
                    if (8 * sizeof(gint64) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(gint64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(gint64) >= 2 * PyLong_SHIFT) {
                            return (gint64) (((((gint64)digits[1]) << PyLong_SHIFT) | (gint64)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(gint64) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(gint64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(gint64) >= 3 * PyLong_SHIFT) {
                            return (gint64) (((((((gint64)digits[2]) << PyLong_SHIFT) | (gint64)digits[1]) << PyLong_SHIFT) | (gint64)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(gint64) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(gint64, 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(gint64) >= 4 * PyLong_SHIFT) {
                            return (gint64) (((((((((gint64)digits[3]) << PyLong_SHIFT) | (gint64)digits[2]) << PyLong_SHIFT) | (gint64)digits[1]) << PyLong_SHIFT) | (gint64)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 (gint64) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(gint64) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(gint64, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(gint64) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(gint64, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (gint64) 0;
                case -1: __PYX_VERIFY_RETURN_INT(gint64, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(gint64,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(gint64) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(gint64, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(gint64) - 1 > 2 * PyLong_SHIFT) {
                            return (gint64) (((gint64)-1)*(((((gint64)digits[1]) << PyLong_SHIFT) | (gint64)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(gint64) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(gint64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(gint64) - 1 > 2 * PyLong_SHIFT) {
                            return (gint64) ((((((gint64)digits[1]) << PyLong_SHIFT) | (gint64)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(gint64) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(gint64, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(gint64) - 1 > 3 * PyLong_SHIFT) {
                            return (gint64) (((gint64)-1)*(((((((gint64)digits[2]) << PyLong_SHIFT) | (gint64)digits[1]) << PyLong_SHIFT) | (gint64)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(gint64) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(gint64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(gint64) - 1 > 3 * PyLong_SHIFT) {
                            return (gint64) ((((((((gint64)digits[2]) << PyLong_SHIFT) | (gint64)digits[1]) << PyLong_SHIFT) | (gint64)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(gint64) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(gint64, 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(gint64) - 1 > 4 * PyLong_SHIFT) {
                            return (gint64) (((gint64)-1)*(((((((((gint64)digits[3]) << PyLong_SHIFT) | (gint64)digits[2]) << PyLong_SHIFT) | (gint64)digits[1]) << PyLong_SHIFT) | (gint64)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(gint64) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(gint64, 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(gint64) - 1 > 4 * PyLong_SHIFT) {
                            return (gint64) ((((((((((gint64)digits[3]) << PyLong_SHIFT) | (gint64)digits[2]) << PyLong_SHIFT) | (gint64)digits[1]) << PyLong_SHIFT) | (gint64)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(gint64) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(gint64, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(gint64) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(gint64, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            gint64 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 (gint64) -1;
        }
    } else {
        gint64 val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (gint64) -1;
        val = __Pyx_PyInt_As_gint64(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to gint64");
    return (gint64) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to gint64");
    return (gint64) -1;
}

/* CIntFromPy */
    static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } 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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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;
}

/* FastTypeChecks */
    #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* 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;
}

/* FunctionExport */
    static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* 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;
        if (PyObject_Hash(*t->p) == -1)
            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 const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    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
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(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
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __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)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } 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 int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  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(b);
  }
#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_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
