@@ -1460,6 +1460,58 @@ mixer_find_channel(PyObject *self, PyObject *args, PyObject *kwargs)
14601460 return pgChannel_New (chan );
14611461}
14621462
1463+ static PyObject *
1464+ mixer_set_soundfont (PyObject * self , PyObject * args )
1465+ {
1466+ int paths_set ;
1467+ PyObject * path = Py_None ;
1468+ const char * string_path = "" ;
1469+
1470+ if (!PyArg_ParseTuple (args , "|O" , & path )) {
1471+ return NULL ;
1472+ }
1473+
1474+ MIXER_INIT_CHECK ();
1475+
1476+ if (PyUnicode_Check (path )) {
1477+ string_path = PyUnicode_AsUTF8 (path );
1478+ }
1479+ else if (!Py_IsNone (path )) {
1480+ PyErr_SetString (PyExc_TypeError ,
1481+ "Must pass string or None to set_soundfont" );
1482+ return NULL ;
1483+ }
1484+
1485+ if (strlen (string_path ) == 0 ) {
1486+ paths_set = Mix_SetSoundFonts (NULL );
1487+ }
1488+ else {
1489+ paths_set = Mix_SetSoundFonts (string_path );
1490+ }
1491+
1492+ if (paths_set == 0 ) {
1493+ return RAISE (pgExc_SDLError , SDL_GetError ());
1494+ }
1495+
1496+ Py_RETURN_NONE ;
1497+ }
1498+
1499+ static PyObject *
1500+ mixer_get_soundfont (PyObject * self , PyObject * _null )
1501+ {
1502+ const char * paths ;
1503+
1504+ MIXER_INIT_CHECK ();
1505+
1506+ paths = Mix_GetSoundFonts ();
1507+
1508+ if (paths ) {
1509+ return PyUnicode_FromString (paths );
1510+ }
1511+
1512+ Py_RETURN_NONE ;
1513+ }
1514+
14631515static PyObject *
14641516mixer_fadeout (PyObject * self , PyObject * args )
14651517{
@@ -1895,6 +1947,10 @@ static PyMethodDef _mixer_methods[] = {
18951947 {"get_busy" , (PyCFunction )get_busy , METH_NOARGS , DOC_MIXER_GETBUSY },
18961948 {"find_channel" , (PyCFunction )mixer_find_channel ,
18971949 METH_VARARGS | METH_KEYWORDS , DOC_MIXER_FINDCHANNEL },
1950+ {"set_soundfont" , (PyCFunction )mixer_set_soundfont , METH_VARARGS ,
1951+ DOC_MIXER_SETSOUNDFONT },
1952+ {"get_soundfont" , (PyCFunction )mixer_get_soundfont , METH_NOARGS ,
1953+ DOC_MIXER_GETSOUNDFONT },
18981954 {"fadeout" , mixer_fadeout , METH_VARARGS , DOC_MIXER_FADEOUT },
18991955 {"stop" , (PyCFunction )mixer_stop , METH_NOARGS , DOC_MIXER_STOP },
19001956 {"pause" , (PyCFunction )mixer_pause , METH_NOARGS , DOC_MIXER_PAUSE },
0 commit comments