diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2002-02-27 23:18:00 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2002-02-27 23:18:00 (GMT) |
commit | 39247ac9b91365ccbde4eea34f863e7202a016d0 (patch) | |
tree | 0b6074e6b5d954fcf700391c6122417131016155 /Mac | |
parent | a9ad6e4a92e48dc1b1784c77e92d93f84f01084f (diff) | |
download | cpython-39247ac9b91365ccbde4eea34f863e7202a016d0.zip cpython-39247ac9b91365ccbde4eea34f863e7202a016d0.tar.gz cpython-39247ac9b91365ccbde4eea34f863e7202a016d0.tar.bz2 |
Backport of 1.7:
Added SndRecord and (classic only) SndRecordToFile.
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Modules/snd/_Sndmodule.c | 53 | ||||
-rw-r--r-- | Mac/Modules/snd/sndscan.py | 2 | ||||
-rw-r--r-- | Mac/Modules/snd/sndsupport.py | 1 |
3 files changed, 55 insertions, 1 deletions
diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c index dc2f5da..69c8bfe 100644 --- a/Mac/Modules/snd/_Sndmodule.c +++ b/Mac/Modules/snd/_Sndmodule.c @@ -961,6 +961,52 @@ static PyObject *Snd_SPBVersion(PyObject *_self, PyObject *_args) return _res; } +static PyObject *Snd_SndRecord(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSErr _err; + Point corner; + OSType quality; + SndListHandle sndHandle; + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetPoint, &corner, + PyMac_GetOSType, &quality)) + return NULL; + _err = SndRecord((ModalFilterUPP)0, + corner, + quality, + &sndHandle); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, sndHandle); + return _res; +} + +#if !TARGET_API_MAC_CARBON + +static PyObject *Snd_SndRecordToFile(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSErr _err; + Point corner; + OSType quality; + short fRefNum; + if (!PyArg_ParseTuple(_args, "O&O&h", + PyMac_GetPoint, &corner, + PyMac_GetOSType, &quality, + &fRefNum)) + return NULL; + _err = SndRecordToFile((ModalFilterUPP)0, + corner, + quality, + fRefNum); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + static PyObject *Snd_SPBSignInDevice(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1309,6 +1355,13 @@ static PyMethodDef Snd_methods[] = { "(OSType compressionType) -> (Str255 compressionName)"}, {"SPBVersion", (PyCFunction)Snd_SPBVersion, 1, "() -> (NumVersion _rv)"}, + {"SndRecord", (PyCFunction)Snd_SndRecord, 1, + "(Point corner, OSType quality) -> (SndListHandle sndHandle)"}, + +#if !TARGET_API_MAC_CARBON + {"SndRecordToFile", (PyCFunction)Snd_SndRecordToFile, 1, + "(Point corner, OSType quality, short fRefNum) -> None"}, +#endif {"SPBSignInDevice", (PyCFunction)Snd_SPBSignInDevice, 1, "(short deviceRefNum, Str255 deviceName) -> None"}, {"SPBSignOutDevice", (PyCFunction)Snd_SPBSignOutDevice, 1, diff --git a/Mac/Modules/snd/sndscan.py b/Mac/Modules/snd/sndscan.py index 1873c19..560e2fd 100644 --- a/Mac/Modules/snd/sndscan.py +++ b/Mac/Modules/snd/sndscan.py @@ -64,6 +64,7 @@ class SoundScanner(Scanner): 'SndStopFilePlay', 'SndStartFilePlay', 'SndPauseFilePlay', + 'SndRecordToFile', ])] def makeblacklisttypes(self): @@ -78,7 +79,6 @@ class SoundScanner(Scanner): "SoundComponentData", "SoundComponentData_ptr", "SoundConverter", - "ModalFilterUPP", ] def makerepairinstructions(self): diff --git a/Mac/Modules/snd/sndsupport.py b/Mac/Modules/snd/sndsupport.py index 91f3bb6..47c17ce 100644 --- a/Mac/Modules/snd/sndsupport.py +++ b/Mac/Modules/snd/sndsupport.py @@ -45,6 +45,7 @@ SndCommand = OpaqueType('SndCommand', 'SndCmd') SndCommand_ptr = OpaqueType('SndCommand', 'SndCmd') SndListHandle = OpaqueByValueType("SndListHandle", "ResObj") SPBPtr = OpaqueByValueType("SPBPtr", "SPBObj") +ModalFilterUPP = FakeType("(ModalFilterUPP)0") # # NOTE: the following is pretty dangerous. For void pointers we pass buffer addresses |