Skip to content

Commit e626e93

Browse files
committed
_audio: use METH_O when possible
1 parent e58aace commit e626e93

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src_c/_base_audio.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ pg_audio_is_audio_device_playback(PyObject *module, PyObject *arg)
9191
}
9292

9393
static PyObject *
94-
pg_audio_get_audio_device_name(PyObject *module, PyObject *const *args,
95-
Py_ssize_t nargs)
94+
pg_audio_get_audio_device_name(PyObject *module, PyObject *arg)
9695
{
97-
// assert nargs == 1
98-
// assert type(args[0]) == AudioDeviceState
99-
SDL_AudioDeviceID devid = ((PGAudioDeviceStateObject *)args[0])->devid;
96+
// SDL_GetAudioDeviceName
97+
// arg: PGAudioDeviceStateObject
98+
99+
SDL_AudioDeviceID devid = ((PGAudioDeviceStateObject *)arg)->devid;
100100
const char *name = SDL_GetAudioDeviceName(devid);
101101
if (name == NULL) {
102102
return RAISE(pgExc_SDLError, SDL_GetError());
@@ -932,13 +932,12 @@ pg_audio_get_default_recording_device_state(PyObject *module, PyObject *_null)
932932
}
933933

934934
static PyObject *
935-
pg_audio_get_silence_value_for_format(PyObject *module, PyObject *const *args,
936-
Py_ssize_t nargs)
935+
pg_audio_get_silence_value_for_format(PyObject *module, PyObject *arg)
937936
{
938937
// SDL_GetSilenceValueForFormat
939938
// format: int
940939

941-
int format_num = PyLong_AsInt(args[0]);
940+
int format_num = PyLong_AsInt(arg);
942941
if (format_num == -1 && PyErr_Occurred()) {
943942
return NULL;
944943
}
@@ -970,13 +969,13 @@ static PyMethodDef audio_methods[] = {
970969

971970
// format utility (the one)
972971
{"get_silence_value_for_format",
973-
(PyCFunction)pg_audio_get_silence_value_for_format, METH_FASTCALL, NULL},
972+
(PyCFunction)pg_audio_get_silence_value_for_format, METH_O, NULL},
974973

975974
// AudioDevice utilities
976975
{"is_audio_device_playback",
977976
(PyCFunction)pg_audio_is_audio_device_playback, METH_O, NULL},
978977
{"get_audio_device_name", (PyCFunction)pg_audio_get_audio_device_name,
979-
METH_FASTCALL, NULL},
978+
METH_O, NULL},
980979
{"get_audio_device_channel_map",
981980
(PyCFunction)pg_audio_get_audio_device_channel_map, METH_O, NULL},
982981
{"open_audio_device", (PyCFunction)pg_audio_open_audio_device,

0 commit comments

Comments
 (0)