1970 static PyObject *
1971 pa_is_format_supported(PyObject *self, PyObject *args,
1972 PyObject *kwargs)
1973 {
1974 /* pass in rate, channel, width */
1975 static char *kwlist[] = {
1976 "sample_rate",
1977 "input_device",
1978 "input_channels",
1979 "input_format",
1980 "output_device",
1981 "output_channels",
1982 "output_format",
1983 NULL
1984 };
1985
1986 int input_device, input_channels;
1987 int output_device, output_channels;
1988 float sample_rate;
1989 PaStreamParameters inputParams;
1990 PaStreamParameters outputParams;
1991 PaSampleFormat input_format, output_format;
1992 PaError error;
1993
1994 input_device = input_channels =
1995 output_device = output_channels = -1;
1996
1997 input_format = output_format = -1;
1998
1999 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "f|iikiik", kwlist,
when PyArg_ParseTupleAndKeywords() succeeds
taking False path
2000 &sample_rate,
2001 &input_device,
2002 &input_channels,
2003 &input_format,
2004 &output_device,
2005 &output_channels,
2006 &output_format))
2007 return NULL;
2008
2009 if (!(input_device < 0)) {
when considering range: 0 <= value <= 0x7fffffff
taking True path
2010 inputParams.device = input_device;
2011 inputParams.channelCount = input_channels;
2012 inputParams.sampleFormat = input_format;
2013 inputParams.suggestedLatency = 0;
2014 inputParams.hostApiSpecificStreamInfo = NULL;
2015 }
2016
2017 if (!(output_device < 0)) {
when considering range: -0x80000000 <= value <= -1
taking False path
2018 outputParams.device = output_device;
2019 outputParams.channelCount = output_channels;
2020 outputParams.sampleFormat = output_format;
2021 outputParams.suggestedLatency = 0;
2022 outputParams.hostApiSpecificStreamInfo = NULL;
2023 }
2024
2025 error = Pa_IsFormatSupported((input_device < 0) ? NULL : &inputParams,
taking False path
taking True path
2026 (output_device < 0) ? NULL : &outputParams,
2027 sample_rate);
2028
2029 if (error == paFormatIsSupported) {
when considering range: -0x80000000 <= value <= -1
taking False path
2030 Py_INCREF(Py_True);
2031 return Py_True;
2032 } else {
2033 PyErr_SetObject(PyExc_ValueError,
when Py_BuildValue() succeeds
calling PyErr_SetObject()
new ref from call to Py_BuildValue was allocated at: PyErr_SetObject(PyExc_ValueError,
ob_refcnt is now refs: 1 owned
ob_refcnt is now refs: 1 owned, 1 borrowed
2034 Py_BuildValue("(s,i)",
2035 Pa_GetErrorText(error),
2036 error));
2037 return NULL;
2038 }
2039 }