Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e62ceac

Browse files
committed
Added SndRecord and (classic only) SndRecordToFile.
1 parent 5bb8f78 commit e62ceac

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

Mac/Modules/snd/_Sndmodule.c

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,52 @@ static PyObject *Snd_SPBVersion(PyObject *_self, PyObject *_args)
961961
return _res;
962962
}
963963

964+
static PyObject *Snd_SndRecord(PyObject *_self, PyObject *_args)
965+
{
966+
PyObject *_res = NULL;
967+
OSErr _err;
968+
Point corner;
969+
OSType quality;
970+
SndListHandle sndHandle;
971+
if (!PyArg_ParseTuple(_args, "O&O&",
972+
PyMac_GetPoint, &corner,
973+
PyMac_GetOSType, &quality))
974+
return NULL;
975+
_err = SndRecord((ModalFilterUPP)0,
976+
corner,
977+
quality,
978+
&sndHandle);
979+
if (_err != noErr) return PyMac_Error(_err);
980+
_res = Py_BuildValue("O&",
981+
ResObj_New, sndHandle);
982+
return _res;
983+
}
984+
985+
#if !TARGET_API_MAC_CARBON
986+
987+
static PyObject *Snd_SndRecordToFile(PyObject *_self, PyObject *_args)
988+
{
989+
PyObject *_res = NULL;
990+
OSErr _err;
991+
Point corner;
992+
OSType quality;
993+
short fRefNum;
994+
if (!PyArg_ParseTuple(_args, "O&O&h",
995+
PyMac_GetPoint, &corner,
996+
PyMac_GetOSType, &quality,
997+
&fRefNum))
998+
return NULL;
999+
_err = SndRecordToFile((ModalFilterUPP)0,
1000+
corner,
1001+
quality,
1002+
fRefNum);
1003+
if (_err != noErr) return PyMac_Error(_err);
1004+
Py_INCREF(Py_None);
1005+
_res = Py_None;
1006+
return _res;
1007+
}
1008+
#endif
1009+
9641010
static PyObject *Snd_SPBSignInDevice(PyObject *_self, PyObject *_args)
9651011
{
9661012
PyObject *_res = NULL;
@@ -1309,6 +1355,13 @@ static PyMethodDef Snd_methods[] = {
13091355
"(OSType compressionType) -> (Str255 compressionName)"},
13101356
{"SPBVersion", (PyCFunction)Snd_SPBVersion, 1,
13111357
"() -> (NumVersion _rv)"},
1358+
{"SndRecord", (PyCFunction)Snd_SndRecord, 1,
1359+
"(Point corner, OSType quality) -> (SndListHandle sndHandle)"},
1360+
1361+
#if !TARGET_API_MAC_CARBON
1362+
{"SndRecordToFile", (PyCFunction)Snd_SndRecordToFile, 1,
1363+
"(Point corner, OSType quality, short fRefNum) -> None"},
1364+
#endif
13121365
{"SPBSignInDevice", (PyCFunction)Snd_SPBSignInDevice, 1,
13131366
"(short deviceRefNum, Str255 deviceName) -> None"},
13141367
{"SPBSignOutDevice", (PyCFunction)Snd_SPBSignOutDevice, 1,

0 commit comments

Comments
 (0)