Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1 | |
| 2 | /* =========================== Module Snd =========================== */ |
| 3 | |
| 4 | #include "Python.h" |
| 5 | |
| 6 | |
| 7 | |
| 8 | #define SystemSevenOrLater 1 |
| 9 | |
| 10 | #include "macglue.h" |
| 11 | #include <Memory.h> |
| 12 | #include <Dialogs.h> |
| 13 | #include <Menus.h> |
| 14 | #include <Controls.h> |
| 15 | |
| 16 | extern PyObject *ResObj_New(Handle); |
| 17 | extern int ResObj_Convert(PyObject *, Handle *); |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 18 | extern PyObject *OptResObj_New(Handle); |
| 19 | extern int OptResObj_Convert(PyObject *, Handle *); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 20 | |
| 21 | extern PyObject *WinObj_New(WindowPtr); |
| 22 | extern int WinObj_Convert(PyObject *, WindowPtr *); |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 23 | extern PyTypeObject Window_Type; |
| 24 | #define WinObj_Check(x) ((x)->ob_type == &Window_Type) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 25 | |
| 26 | extern PyObject *DlgObj_New(DialogPtr); |
| 27 | extern int DlgObj_Convert(PyObject *, DialogPtr *); |
| 28 | extern PyTypeObject Dialog_Type; |
| 29 | #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) |
| 30 | |
| 31 | extern PyObject *MenuObj_New(MenuHandle); |
| 32 | extern int MenuObj_Convert(PyObject *, MenuHandle *); |
| 33 | |
| 34 | extern PyObject *CtlObj_New(ControlHandle); |
| 35 | extern int CtlObj_Convert(PyObject *, ControlHandle *); |
| 36 | |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 37 | extern PyObject *GrafObj_New(GrafPtr); |
| 38 | extern int GrafObj_Convert(PyObject *, GrafPtr *); |
| 39 | |
| 40 | extern PyObject *BMObj_New(BitMapPtr); |
| 41 | extern int BMObj_Convert(PyObject *, BitMapPtr *); |
| 42 | |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 43 | extern PyObject *WinObj_WhichWindow(WindowPtr); |
| 44 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 45 | #include <Sound.h> |
| 46 | |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 47 | #ifndef HAVE_UNIVERSAL_HEADERS |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 48 | #define SndCallBackUPP ProcPtr |
Guido van Rossum | 6fc5aec | 1995-02-19 23:32:59 +0000 | [diff] [blame] | 49 | #define NewSndCallBackProc(x) ((SndCallBackProcPtr)(x)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 50 | #define SndListHandle Handle |
| 51 | #endif |
| 52 | |
| 53 | #include <OSUtils.h> /* for Set(Current)A5 */ |
| 54 | |
| 55 | /* Create a SndCommand object (an (int, int, int) tuple) */ |
| 56 | static PyObject * |
| 57 | SndCmd_New(SndCommand *pc) |
| 58 | { |
| 59 | return Py_BuildValue("hhl", pc->cmd, pc->param1, pc->param2); |
| 60 | } |
| 61 | |
| 62 | /* Convert a SndCommand argument */ |
| 63 | static int |
| 64 | SndCmd_Convert(PyObject *v, SndCommand *pc) |
| 65 | { |
| 66 | int len; |
| 67 | pc->param1 = 0; |
| 68 | pc->param2 = 0; |
| 69 | if (PyTuple_Check(v)) { |
| 70 | if (PyArg_ParseTuple(v, "h|hl", &pc->cmd, &pc->param1, &pc->param2)) |
| 71 | return 1; |
| 72 | PyErr_Clear(); |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 73 | return PyArg_ParseTuple(v, "Hhs#", &pc->cmd, &pc->param1, &pc->param2, &len); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 74 | } |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 75 | return PyArg_Parse(v, "H", &pc->cmd); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 76 | } |
| 77 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 78 | static pascal void SndCh_UserRoutine(SndChannelPtr chan, SndCommand *cmd); /* Forward */ |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 79 | static pascal void SPB_completion(SPBPtr my_spb); /* Forward */ |
| 80 | static pascal void SPB_interrupt(SPBPtr my_spb); /* Forward */ |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 81 | |
| 82 | static PyObject *Snd_Error; |
| 83 | |
| 84 | /* --------------------- Object type SndChannel --------------------- */ |
| 85 | |
| 86 | staticforward PyTypeObject SndChannel_Type; |
| 87 | |
| 88 | #define SndCh_Check(x) ((x)->ob_type == &SndChannel_Type) |
| 89 | |
| 90 | typedef struct SndChannelObject { |
| 91 | PyObject_HEAD |
| 92 | SndChannelPtr ob_itself; |
| 93 | /* Members used to implement callbacks: */ |
| 94 | PyObject *ob_callback; |
| 95 | long ob_A5; |
| 96 | SndCommand ob_cmd; |
| 97 | } SndChannelObject; |
| 98 | |
| 99 | static PyObject *SndCh_New(itself) |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 100 | SndChannelPtr itself; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 101 | { |
| 102 | SndChannelObject *it; |
| 103 | it = PyObject_NEW(SndChannelObject, &SndChannel_Type); |
| 104 | if (it == NULL) return NULL; |
| 105 | it->ob_itself = itself; |
| 106 | it->ob_callback = NULL; |
| 107 | it->ob_A5 = SetCurrentA5(); |
| 108 | return (PyObject *)it; |
| 109 | } |
| 110 | static SndCh_Convert(v, p_itself) |
| 111 | PyObject *v; |
| 112 | SndChannelPtr *p_itself; |
| 113 | { |
| 114 | if (!SndCh_Check(v)) |
| 115 | { |
| 116 | PyErr_SetString(PyExc_TypeError, "SndChannel required"); |
| 117 | return 0; |
| 118 | } |
| 119 | *p_itself = ((SndChannelObject *)v)->ob_itself; |
| 120 | return 1; |
| 121 | } |
| 122 | |
| 123 | static void SndCh_dealloc(self) |
| 124 | SndChannelObject *self; |
| 125 | { |
| 126 | SndDisposeChannel(self->ob_itself, 1); |
| 127 | Py_XDECREF(self->ob_callback); |
| 128 | PyMem_DEL(self); |
| 129 | } |
| 130 | |
| 131 | static PyObject *SndCh_SndDoCommand(_self, _args) |
| 132 | SndChannelObject *_self; |
| 133 | PyObject *_args; |
| 134 | { |
| 135 | PyObject *_res = NULL; |
| 136 | OSErr _err; |
| 137 | SndCommand cmd; |
| 138 | Boolean noWait; |
| 139 | if (!PyArg_ParseTuple(_args, "O&b", |
| 140 | SndCmd_Convert, &cmd, |
| 141 | &noWait)) |
| 142 | return NULL; |
| 143 | _err = SndDoCommand(_self->ob_itself, |
| 144 | &cmd, |
| 145 | noWait); |
| 146 | if (_err != noErr) return PyMac_Error(_err); |
| 147 | Py_INCREF(Py_None); |
| 148 | _res = Py_None; |
| 149 | return _res; |
| 150 | } |
| 151 | |
| 152 | static PyObject *SndCh_SndDoImmediate(_self, _args) |
| 153 | SndChannelObject *_self; |
| 154 | PyObject *_args; |
| 155 | { |
| 156 | PyObject *_res = NULL; |
| 157 | OSErr _err; |
| 158 | SndCommand cmd; |
| 159 | if (!PyArg_ParseTuple(_args, "O&", |
| 160 | SndCmd_Convert, &cmd)) |
| 161 | return NULL; |
| 162 | _err = SndDoImmediate(_self->ob_itself, |
| 163 | &cmd); |
| 164 | if (_err != noErr) return PyMac_Error(_err); |
| 165 | Py_INCREF(Py_None); |
| 166 | _res = Py_None; |
| 167 | return _res; |
| 168 | } |
| 169 | |
| 170 | static PyObject *SndCh_SndPlay(_self, _args) |
| 171 | SndChannelObject *_self; |
| 172 | PyObject *_args; |
| 173 | { |
| 174 | PyObject *_res = NULL; |
| 175 | OSErr _err; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 176 | SndListHandle sndHandle; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 177 | Boolean async; |
| 178 | if (!PyArg_ParseTuple(_args, "O&b", |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 179 | ResObj_Convert, &sndHandle, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 180 | &async)) |
| 181 | return NULL; |
| 182 | _err = SndPlay(_self->ob_itself, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 183 | sndHandle, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 184 | async); |
| 185 | if (_err != noErr) return PyMac_Error(_err); |
| 186 | Py_INCREF(Py_None); |
| 187 | _res = Py_None; |
| 188 | return _res; |
| 189 | } |
| 190 | |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 191 | #ifndef TARGET_API_MAC_CARBON |
| 192 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 193 | static PyObject *SndCh_SndStartFilePlay(_self, _args) |
| 194 | SndChannelObject *_self; |
| 195 | PyObject *_args; |
| 196 | { |
| 197 | PyObject *_res = NULL; |
| 198 | OSErr _err; |
| 199 | short fRefNum; |
| 200 | short resNum; |
| 201 | long bufferSize; |
| 202 | Boolean async; |
| 203 | if (!PyArg_ParseTuple(_args, "hhlb", |
| 204 | &fRefNum, |
| 205 | &resNum, |
| 206 | &bufferSize, |
| 207 | &async)) |
| 208 | return NULL; |
| 209 | _err = SndStartFilePlay(_self->ob_itself, |
| 210 | fRefNum, |
| 211 | resNum, |
| 212 | bufferSize, |
| 213 | 0, |
| 214 | 0, |
| 215 | 0, |
| 216 | async); |
| 217 | if (_err != noErr) return PyMac_Error(_err); |
| 218 | Py_INCREF(Py_None); |
| 219 | _res = Py_None; |
| 220 | return _res; |
| 221 | } |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 222 | #endif |
| 223 | |
| 224 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 225 | |
| 226 | static PyObject *SndCh_SndPauseFilePlay(_self, _args) |
| 227 | SndChannelObject *_self; |
| 228 | PyObject *_args; |
| 229 | { |
| 230 | PyObject *_res = NULL; |
| 231 | OSErr _err; |
| 232 | if (!PyArg_ParseTuple(_args, "")) |
| 233 | return NULL; |
| 234 | _err = SndPauseFilePlay(_self->ob_itself); |
| 235 | if (_err != noErr) return PyMac_Error(_err); |
| 236 | Py_INCREF(Py_None); |
| 237 | _res = Py_None; |
| 238 | return _res; |
| 239 | } |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 240 | #endif |
| 241 | |
| 242 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 243 | |
| 244 | static PyObject *SndCh_SndStopFilePlay(_self, _args) |
| 245 | SndChannelObject *_self; |
| 246 | PyObject *_args; |
| 247 | { |
| 248 | PyObject *_res = NULL; |
| 249 | OSErr _err; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 250 | Boolean quietNow; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 251 | if (!PyArg_ParseTuple(_args, "b", |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 252 | &quietNow)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 253 | return NULL; |
| 254 | _err = SndStopFilePlay(_self->ob_itself, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 255 | quietNow); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 256 | if (_err != noErr) return PyMac_Error(_err); |
| 257 | Py_INCREF(Py_None); |
| 258 | _res = Py_None; |
| 259 | return _res; |
| 260 | } |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 261 | #endif |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 262 | |
| 263 | static PyObject *SndCh_SndChannelStatus(_self, _args) |
| 264 | SndChannelObject *_self; |
| 265 | PyObject *_args; |
| 266 | { |
| 267 | PyObject *_res = NULL; |
| 268 | OSErr _err; |
| 269 | short theLength; |
| 270 | SCStatus theStatus__out__; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 271 | if (!PyArg_ParseTuple(_args, "h", |
| 272 | &theLength)) |
| 273 | return NULL; |
| 274 | _err = SndChannelStatus(_self->ob_itself, |
| 275 | theLength, |
| 276 | &theStatus__out__); |
| 277 | if (_err != noErr) return PyMac_Error(_err); |
| 278 | _res = Py_BuildValue("s#", |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 279 | (char *)&theStatus__out__, (int)sizeof(SCStatus)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 280 | theStatus__error__: ; |
| 281 | return _res; |
| 282 | } |
| 283 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 284 | static PyObject *SndCh_SndGetInfo(_self, _args) |
| 285 | SndChannelObject *_self; |
| 286 | PyObject *_args; |
| 287 | { |
| 288 | PyObject *_res = NULL; |
| 289 | OSErr _err; |
| 290 | OSType selector; |
| 291 | void * infoPtr; |
| 292 | if (!PyArg_ParseTuple(_args, "O&w", |
| 293 | PyMac_GetOSType, &selector, |
| 294 | &infoPtr)) |
| 295 | return NULL; |
| 296 | _err = SndGetInfo(_self->ob_itself, |
| 297 | selector, |
| 298 | infoPtr); |
| 299 | if (_err != noErr) return PyMac_Error(_err); |
| 300 | Py_INCREF(Py_None); |
| 301 | _res = Py_None; |
| 302 | return _res; |
| 303 | } |
| 304 | |
| 305 | static PyObject *SndCh_SndSetInfo(_self, _args) |
| 306 | SndChannelObject *_self; |
| 307 | PyObject *_args; |
| 308 | { |
| 309 | PyObject *_res = NULL; |
| 310 | OSErr _err; |
| 311 | OSType selector; |
| 312 | void * infoPtr; |
| 313 | if (!PyArg_ParseTuple(_args, "O&w", |
| 314 | PyMac_GetOSType, &selector, |
| 315 | &infoPtr)) |
| 316 | return NULL; |
| 317 | _err = SndSetInfo(_self->ob_itself, |
| 318 | selector, |
| 319 | infoPtr); |
| 320 | if (_err != noErr) return PyMac_Error(_err); |
| 321 | Py_INCREF(Py_None); |
| 322 | _res = Py_None; |
| 323 | return _res; |
| 324 | } |
| 325 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 326 | static PyMethodDef SndCh_methods[] = { |
| 327 | {"SndDoCommand", (PyCFunction)SndCh_SndDoCommand, 1, |
| 328 | "(SndCommand cmd, Boolean noWait) -> None"}, |
| 329 | {"SndDoImmediate", (PyCFunction)SndCh_SndDoImmediate, 1, |
| 330 | "(SndCommand cmd) -> None"}, |
| 331 | {"SndPlay", (PyCFunction)SndCh_SndPlay, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 332 | "(SndListHandle sndHandle, Boolean async) -> None"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 333 | |
| 334 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 335 | {"SndStartFilePlay", (PyCFunction)SndCh_SndStartFilePlay, 1, |
| 336 | "(short fRefNum, short resNum, long bufferSize, Boolean async) -> None"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 337 | #endif |
| 338 | |
| 339 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 340 | {"SndPauseFilePlay", (PyCFunction)SndCh_SndPauseFilePlay, 1, |
| 341 | "() -> None"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 342 | #endif |
| 343 | |
| 344 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 345 | {"SndStopFilePlay", (PyCFunction)SndCh_SndStopFilePlay, 1, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 346 | "(Boolean quietNow) -> None"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 347 | #endif |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 348 | {"SndChannelStatus", (PyCFunction)SndCh_SndChannelStatus, 1, |
| 349 | "(short theLength) -> (SCStatus theStatus)"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 350 | {"SndGetInfo", (PyCFunction)SndCh_SndGetInfo, 1, |
| 351 | "(OSType selector, void * infoPtr) -> None"}, |
| 352 | {"SndSetInfo", (PyCFunction)SndCh_SndSetInfo, 1, |
| 353 | "(OSType selector, void * infoPtr) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 354 | {NULL, NULL, 0} |
| 355 | }; |
| 356 | |
| 357 | static PyMethodChain SndCh_chain = { SndCh_methods, NULL }; |
| 358 | |
| 359 | static PyObject *SndCh_getattr(self, name) |
| 360 | SndChannelObject *self; |
| 361 | char *name; |
| 362 | { |
| 363 | return Py_FindMethodInChain(&SndCh_chain, (PyObject *)self, name); |
| 364 | } |
| 365 | |
| 366 | #define SndCh_setattr NULL |
| 367 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 368 | #define SndCh_compare NULL |
| 369 | |
| 370 | #define SndCh_repr NULL |
| 371 | |
| 372 | #define SndCh_hash NULL |
| 373 | |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 374 | staticforward PyTypeObject SndChannel_Type = { |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 375 | PyObject_HEAD_INIT(&PyType_Type) |
| 376 | 0, /*ob_size*/ |
| 377 | "SndChannel", /*tp_name*/ |
| 378 | sizeof(SndChannelObject), /*tp_basicsize*/ |
| 379 | 0, /*tp_itemsize*/ |
| 380 | /* methods */ |
| 381 | (destructor) SndCh_dealloc, /*tp_dealloc*/ |
| 382 | 0, /*tp_print*/ |
| 383 | (getattrfunc) SndCh_getattr, /*tp_getattr*/ |
| 384 | (setattrfunc) SndCh_setattr, /*tp_setattr*/ |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 385 | (cmpfunc) SndCh_compare, /*tp_compare*/ |
| 386 | (reprfunc) SndCh_repr, /*tp_repr*/ |
| 387 | (PyNumberMethods *)0, /* tp_as_number */ |
| 388 | (PySequenceMethods *)0, /* tp_as_sequence */ |
| 389 | (PyMappingMethods *)0, /* tp_as_mapping */ |
| 390 | (hashfunc) SndCh_hash, /*tp_hash*/ |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 391 | }; |
| 392 | |
| 393 | /* ------------------- End object type SndChannel ------------------- */ |
| 394 | |
| 395 | |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 396 | /* ------------------------ Object type SPB ------------------------- */ |
| 397 | |
| 398 | staticforward PyTypeObject SPB_Type; |
| 399 | |
| 400 | #define SPBObj_Check(x) ((x)->ob_type == &SPB_Type) |
| 401 | |
| 402 | typedef struct SPBObject { |
| 403 | PyObject_HEAD |
| 404 | /* Members used to implement callbacks: */ |
| 405 | PyObject *ob_completion; |
| 406 | PyObject *ob_interrupt; |
| 407 | PyObject *ob_thiscallback; |
| 408 | long ob_A5; |
| 409 | SPB ob_spb; |
| 410 | } SPBObject; |
| 411 | |
| 412 | static PyObject *SPBObj_New() |
| 413 | { |
| 414 | SPBObject *it; |
| 415 | it = PyObject_NEW(SPBObject, &SPB_Type); |
| 416 | if (it == NULL) return NULL; |
| 417 | it->ob_completion = NULL; |
| 418 | it->ob_interrupt = NULL; |
| 419 | it->ob_thiscallback = NULL; |
| 420 | it->ob_A5 = SetCurrentA5(); |
| 421 | memset((char *)&it->ob_spb, 0, sizeof(it->ob_spb)); |
| 422 | it->ob_spb.userLong = (long)it; |
| 423 | return (PyObject *)it; |
| 424 | } |
| 425 | static SPBObj_Convert(v, p_itself) |
| 426 | PyObject *v; |
| 427 | SPBPtr *p_itself; |
| 428 | { |
| 429 | if (!SPBObj_Check(v)) |
| 430 | { |
| 431 | PyErr_SetString(PyExc_TypeError, "SPB required"); |
| 432 | return 0; |
| 433 | } |
| 434 | *p_itself = &((SPBObject *)v)->ob_spb; |
| 435 | return 1; |
| 436 | } |
| 437 | |
| 438 | static void SPBObj_dealloc(self) |
| 439 | SPBObject *self; |
| 440 | { |
| 441 | /* Cleanup of self->ob_itself goes here */ |
| 442 | self->ob_spb.userLong = 0; |
| 443 | self->ob_thiscallback = 0; |
| 444 | Py_XDECREF(self->ob_completion); |
| 445 | Py_XDECREF(self->ob_interrupt); |
| 446 | PyMem_DEL(self); |
| 447 | } |
| 448 | |
| 449 | static PyMethodDef SPBObj_methods[] = { |
| 450 | {NULL, NULL, 0} |
| 451 | }; |
| 452 | |
| 453 | static PyMethodChain SPBObj_chain = { SPBObj_methods, NULL }; |
| 454 | |
| 455 | static PyObject *SPBObj_getattr(self, name) |
| 456 | SPBObject *self; |
| 457 | char *name; |
| 458 | { |
| 459 | |
| 460 | if (strcmp(name, "inRefNum") == 0) |
| 461 | return Py_BuildValue("l", self->ob_spb.inRefNum); |
| 462 | else if (strcmp(name, "count") == 0) |
| 463 | return Py_BuildValue("l", self->ob_spb.count); |
| 464 | else if (strcmp(name, "milliseconds") == 0) |
| 465 | return Py_BuildValue("l", self->ob_spb.milliseconds); |
| 466 | else if (strcmp(name, "error") == 0) |
| 467 | return Py_BuildValue("h", self->ob_spb.error); |
| 468 | return Py_FindMethodInChain(&SPBObj_chain, (PyObject *)self, name); |
| 469 | } |
| 470 | |
| 471 | static int SPBObj_setattr(self, name, value) |
| 472 | SPBObject *self; |
| 473 | char *name; |
| 474 | PyObject *value; |
| 475 | { |
| 476 | |
Jack Jansen | a239a92 | 1998-04-15 14:08:28 +0000 | [diff] [blame] | 477 | int rv = 0; |
| 478 | |
| 479 | if (strcmp(name, "inRefNum") == 0) |
| 480 | rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum); |
| 481 | else if (strcmp(name, "count") == 0) |
| 482 | rv = PyArg_Parse(value, "l", &self->ob_spb.count); |
| 483 | else if (strcmp(name, "milliseconds") == 0) |
| 484 | rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds); |
| 485 | else if (strcmp(name, "buffer") == 0) |
| 486 | rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); |
| 487 | else if (strcmp(name, "completionRoutine") == 0) { |
| 488 | self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion); |
| 489 | self->ob_completion = value; |
| 490 | Py_INCREF(value); |
| 491 | rv = 1; |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 492 | #ifndef TARGET_API_MAC_CARBON_NOTYET |
Jack Jansen | a239a92 | 1998-04-15 14:08:28 +0000 | [diff] [blame] | 493 | } else if (strcmp(name, "interruptRoutine") == 0) { |
| 494 | self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt); |
| 495 | self->ob_interrupt = value; |
| 496 | Py_INCREF(value); |
| 497 | rv = 1; |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 498 | #endif |
Jack Jansen | a239a92 | 1998-04-15 14:08:28 +0000 | [diff] [blame] | 499 | } |
| 500 | if ( rv ) return 0; |
| 501 | else return -1; |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 502 | } |
| 503 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 504 | #define SPBObj_compare NULL |
| 505 | |
| 506 | #define SPBObj_repr NULL |
| 507 | |
| 508 | #define SPBObj_hash NULL |
| 509 | |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 510 | staticforward PyTypeObject SPB_Type = { |
| 511 | PyObject_HEAD_INIT(&PyType_Type) |
| 512 | 0, /*ob_size*/ |
| 513 | "SPB", /*tp_name*/ |
| 514 | sizeof(SPBObject), /*tp_basicsize*/ |
| 515 | 0, /*tp_itemsize*/ |
| 516 | /* methods */ |
| 517 | (destructor) SPBObj_dealloc, /*tp_dealloc*/ |
| 518 | 0, /*tp_print*/ |
| 519 | (getattrfunc) SPBObj_getattr, /*tp_getattr*/ |
| 520 | (setattrfunc) SPBObj_setattr, /*tp_setattr*/ |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 521 | (cmpfunc) SPBObj_compare, /*tp_compare*/ |
| 522 | (reprfunc) SPBObj_repr, /*tp_repr*/ |
| 523 | (PyNumberMethods *)0, /* tp_as_number */ |
| 524 | (PySequenceMethods *)0, /* tp_as_sequence */ |
| 525 | (PyMappingMethods *)0, /* tp_as_mapping */ |
| 526 | (hashfunc) SPBObj_hash, /*tp_hash*/ |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 527 | }; |
| 528 | |
| 529 | /* ---------------------- End object type SPB ----------------------- */ |
| 530 | |
| 531 | |
| 532 | static PyObject *Snd_SPB(_self, _args) |
| 533 | PyObject *_self; |
| 534 | PyObject *_args; |
| 535 | { |
| 536 | PyObject *_res = NULL; |
| 537 | return SPBObj_New(); |
| 538 | } |
| 539 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 540 | static PyObject *Snd_SysBeep(_self, _args) |
| 541 | PyObject *_self; |
| 542 | PyObject *_args; |
| 543 | { |
| 544 | PyObject *_res = NULL; |
| 545 | short duration; |
| 546 | if (!PyArg_ParseTuple(_args, "h", |
| 547 | &duration)) |
| 548 | return NULL; |
| 549 | SysBeep(duration); |
| 550 | Py_INCREF(Py_None); |
| 551 | _res = Py_None; |
| 552 | return _res; |
| 553 | } |
| 554 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 555 | static PyObject *Snd_SndNewChannel(_self, _args) |
| 556 | PyObject *_self; |
| 557 | PyObject *_args; |
| 558 | { |
| 559 | PyObject *_res = NULL; |
| 560 | OSErr _err; |
| 561 | SndChannelPtr chan = 0; |
| 562 | short synth; |
| 563 | long init; |
| 564 | PyObject* userRoutine; |
| 565 | if (!PyArg_ParseTuple(_args, "hlO", |
| 566 | &synth, |
| 567 | &init, |
| 568 | &userRoutine)) |
| 569 | return NULL; |
Guido van Rossum | 0818a4c | 1995-02-05 16:53:45 +0000 | [diff] [blame] | 570 | if (userRoutine != Py_None && !PyCallable_Check(userRoutine)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 571 | { |
| 572 | PyErr_SetString(PyExc_TypeError, "callback must be callable"); |
| 573 | goto userRoutine__error__; |
| 574 | } |
| 575 | _err = SndNewChannel(&chan, |
| 576 | synth, |
| 577 | init, |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 578 | NewSndCallBackProc(SndCh_UserRoutine)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 579 | if (_err != noErr) return PyMac_Error(_err); |
| 580 | _res = Py_BuildValue("O&", |
| 581 | SndCh_New, chan); |
| 582 | if (_res != NULL && userRoutine != Py_None) |
| 583 | { |
| 584 | SndChannelObject *p = (SndChannelObject *)_res; |
| 585 | p->ob_itself->userInfo = (long)p; |
| 586 | Py_INCREF(userRoutine); |
| 587 | p->ob_callback = userRoutine; |
| 588 | } |
| 589 | userRoutine__error__: ; |
| 590 | return _res; |
| 591 | } |
| 592 | |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 593 | #ifndef TARGET_API_MAC_CARBON |
| 594 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 595 | static PyObject *Snd_SndControl(_self, _args) |
| 596 | PyObject *_self; |
| 597 | PyObject *_args; |
| 598 | { |
| 599 | PyObject *_res = NULL; |
| 600 | OSErr _err; |
| 601 | short id; |
| 602 | SndCommand cmd; |
| 603 | if (!PyArg_ParseTuple(_args, "h", |
| 604 | &id)) |
| 605 | return NULL; |
| 606 | _err = SndControl(id, |
| 607 | &cmd); |
| 608 | if (_err != noErr) return PyMac_Error(_err); |
| 609 | _res = Py_BuildValue("O&", |
| 610 | SndCmd_New, &cmd); |
| 611 | return _res; |
| 612 | } |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 613 | #endif |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 614 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 615 | static PyObject *Snd_SndSoundManagerVersion(_self, _args) |
| 616 | PyObject *_self; |
| 617 | PyObject *_args; |
| 618 | { |
| 619 | PyObject *_res = NULL; |
Jack Jansen | 5674e4e | 1996-08-01 15:26:05 +0000 | [diff] [blame] | 620 | NumVersion _rv; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 621 | if (!PyArg_ParseTuple(_args, "")) |
| 622 | return NULL; |
| 623 | _rv = SndSoundManagerVersion(); |
Jack Jansen | 5674e4e | 1996-08-01 15:26:05 +0000 | [diff] [blame] | 624 | _res = Py_BuildValue("O&", |
| 625 | PyMac_BuildNumVersion, _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 626 | return _res; |
| 627 | } |
| 628 | |
| 629 | static PyObject *Snd_SndManagerStatus(_self, _args) |
| 630 | PyObject *_self; |
| 631 | PyObject *_args; |
| 632 | { |
| 633 | PyObject *_res = NULL; |
| 634 | OSErr _err; |
| 635 | short theLength; |
| 636 | SMStatus theStatus__out__; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 637 | if (!PyArg_ParseTuple(_args, "h", |
| 638 | &theLength)) |
| 639 | return NULL; |
| 640 | _err = SndManagerStatus(theLength, |
| 641 | &theStatus__out__); |
| 642 | if (_err != noErr) return PyMac_Error(_err); |
| 643 | _res = Py_BuildValue("s#", |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 644 | (char *)&theStatus__out__, (int)sizeof(SMStatus)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 645 | theStatus__error__: ; |
| 646 | return _res; |
| 647 | } |
| 648 | |
| 649 | static PyObject *Snd_SndGetSysBeepState(_self, _args) |
| 650 | PyObject *_self; |
| 651 | PyObject *_args; |
| 652 | { |
| 653 | PyObject *_res = NULL; |
| 654 | short sysBeepState; |
| 655 | if (!PyArg_ParseTuple(_args, "")) |
| 656 | return NULL; |
| 657 | SndGetSysBeepState(&sysBeepState); |
| 658 | _res = Py_BuildValue("h", |
| 659 | sysBeepState); |
| 660 | return _res; |
| 661 | } |
| 662 | |
| 663 | static PyObject *Snd_SndSetSysBeepState(_self, _args) |
| 664 | PyObject *_self; |
| 665 | PyObject *_args; |
| 666 | { |
| 667 | PyObject *_res = NULL; |
| 668 | OSErr _err; |
| 669 | short sysBeepState; |
| 670 | if (!PyArg_ParseTuple(_args, "h", |
| 671 | &sysBeepState)) |
| 672 | return NULL; |
| 673 | _err = SndSetSysBeepState(sysBeepState); |
| 674 | if (_err != noErr) return PyMac_Error(_err); |
| 675 | Py_INCREF(Py_None); |
| 676 | _res = Py_None; |
| 677 | return _res; |
| 678 | } |
| 679 | |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 680 | #ifndef TARGET_API_MAC_CARBON |
| 681 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 682 | static PyObject *Snd_MACEVersion(_self, _args) |
| 683 | PyObject *_self; |
| 684 | PyObject *_args; |
| 685 | { |
| 686 | PyObject *_res = NULL; |
Jack Jansen | 5674e4e | 1996-08-01 15:26:05 +0000 | [diff] [blame] | 687 | NumVersion _rv; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 688 | if (!PyArg_ParseTuple(_args, "")) |
| 689 | return NULL; |
| 690 | _rv = MACEVersion(); |
Jack Jansen | 5674e4e | 1996-08-01 15:26:05 +0000 | [diff] [blame] | 691 | _res = Py_BuildValue("O&", |
| 692 | PyMac_BuildNumVersion, _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 693 | return _res; |
| 694 | } |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 695 | #endif |
| 696 | |
| 697 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 698 | |
| 699 | static PyObject *Snd_Comp3to1(_self, _args) |
| 700 | PyObject *_self; |
| 701 | PyObject *_args; |
| 702 | { |
| 703 | PyObject *_res = NULL; |
| 704 | char *buffer__in__; |
| 705 | char *buffer__out__; |
| 706 | long buffer__len__; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 707 | int buffer__in_len__; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 708 | StateBlock *state__in__; |
| 709 | StateBlock state__out__; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 710 | int state__in_len__; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 711 | unsigned long numChannels; |
| 712 | unsigned long whichChannel; |
| 713 | if (!PyArg_ParseTuple(_args, "s#s#ll", |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 714 | &buffer__in__, &buffer__in_len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 715 | (char **)&state__in__, &state__in_len__, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 716 | &numChannels, |
| 717 | &whichChannel)) |
| 718 | return NULL; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 719 | if ((buffer__out__ = malloc(buffer__in_len__)) == NULL) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 720 | { |
| 721 | PyErr_NoMemory(); |
| 722 | goto buffer__error__; |
| 723 | } |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 724 | buffer__len__ = buffer__in_len__; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 725 | if (state__in_len__ != sizeof(StateBlock)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 726 | { |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 727 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)"); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 728 | goto state__error__; |
| 729 | } |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 730 | Comp3to1(buffer__in__, buffer__out__, (long)buffer__len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 731 | state__in__, &state__out__, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 732 | numChannels, |
| 733 | whichChannel); |
| 734 | _res = Py_BuildValue("s#s#", |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 735 | buffer__out__, (int)buffer__len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 736 | (char *)&state__out__, (int)sizeof(StateBlock)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 737 | state__error__: ; |
| 738 | free(buffer__out__); |
| 739 | buffer__error__: ; |
| 740 | return _res; |
| 741 | } |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 742 | #endif |
| 743 | |
| 744 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 745 | |
| 746 | static PyObject *Snd_Exp1to3(_self, _args) |
| 747 | PyObject *_self; |
| 748 | PyObject *_args; |
| 749 | { |
| 750 | PyObject *_res = NULL; |
| 751 | char *buffer__in__; |
| 752 | char *buffer__out__; |
| 753 | long buffer__len__; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 754 | int buffer__in_len__; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 755 | StateBlock *state__in__; |
| 756 | StateBlock state__out__; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 757 | int state__in_len__; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 758 | unsigned long numChannels; |
| 759 | unsigned long whichChannel; |
| 760 | if (!PyArg_ParseTuple(_args, "s#s#ll", |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 761 | &buffer__in__, &buffer__in_len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 762 | (char **)&state__in__, &state__in_len__, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 763 | &numChannels, |
| 764 | &whichChannel)) |
| 765 | return NULL; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 766 | if ((buffer__out__ = malloc(buffer__in_len__)) == NULL) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 767 | { |
| 768 | PyErr_NoMemory(); |
| 769 | goto buffer__error__; |
| 770 | } |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 771 | buffer__len__ = buffer__in_len__; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 772 | if (state__in_len__ != sizeof(StateBlock)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 773 | { |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 774 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)"); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 775 | goto state__error__; |
| 776 | } |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 777 | Exp1to3(buffer__in__, buffer__out__, (long)buffer__len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 778 | state__in__, &state__out__, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 779 | numChannels, |
| 780 | whichChannel); |
| 781 | _res = Py_BuildValue("s#s#", |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 782 | buffer__out__, (int)buffer__len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 783 | (char *)&state__out__, (int)sizeof(StateBlock)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 784 | state__error__: ; |
| 785 | free(buffer__out__); |
| 786 | buffer__error__: ; |
| 787 | return _res; |
| 788 | } |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 789 | #endif |
| 790 | |
| 791 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 792 | |
| 793 | static PyObject *Snd_Comp6to1(_self, _args) |
| 794 | PyObject *_self; |
| 795 | PyObject *_args; |
| 796 | { |
| 797 | PyObject *_res = NULL; |
| 798 | char *buffer__in__; |
| 799 | char *buffer__out__; |
| 800 | long buffer__len__; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 801 | int buffer__in_len__; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 802 | StateBlock *state__in__; |
| 803 | StateBlock state__out__; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 804 | int state__in_len__; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 805 | unsigned long numChannels; |
| 806 | unsigned long whichChannel; |
| 807 | if (!PyArg_ParseTuple(_args, "s#s#ll", |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 808 | &buffer__in__, &buffer__in_len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 809 | (char **)&state__in__, &state__in_len__, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 810 | &numChannels, |
| 811 | &whichChannel)) |
| 812 | return NULL; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 813 | if ((buffer__out__ = malloc(buffer__in_len__)) == NULL) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 814 | { |
| 815 | PyErr_NoMemory(); |
| 816 | goto buffer__error__; |
| 817 | } |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 818 | buffer__len__ = buffer__in_len__; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 819 | if (state__in_len__ != sizeof(StateBlock)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 820 | { |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 821 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)"); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 822 | goto state__error__; |
| 823 | } |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 824 | Comp6to1(buffer__in__, buffer__out__, (long)buffer__len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 825 | state__in__, &state__out__, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 826 | numChannels, |
| 827 | whichChannel); |
| 828 | _res = Py_BuildValue("s#s#", |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 829 | buffer__out__, (int)buffer__len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 830 | (char *)&state__out__, (int)sizeof(StateBlock)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 831 | state__error__: ; |
| 832 | free(buffer__out__); |
| 833 | buffer__error__: ; |
| 834 | return _res; |
| 835 | } |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 836 | #endif |
| 837 | |
| 838 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 839 | |
| 840 | static PyObject *Snd_Exp1to6(_self, _args) |
| 841 | PyObject *_self; |
| 842 | PyObject *_args; |
| 843 | { |
| 844 | PyObject *_res = NULL; |
| 845 | char *buffer__in__; |
| 846 | char *buffer__out__; |
| 847 | long buffer__len__; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 848 | int buffer__in_len__; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 849 | StateBlock *state__in__; |
| 850 | StateBlock state__out__; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 851 | int state__in_len__; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 852 | unsigned long numChannels; |
| 853 | unsigned long whichChannel; |
| 854 | if (!PyArg_ParseTuple(_args, "s#s#ll", |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 855 | &buffer__in__, &buffer__in_len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 856 | (char **)&state__in__, &state__in_len__, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 857 | &numChannels, |
| 858 | &whichChannel)) |
| 859 | return NULL; |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 860 | if ((buffer__out__ = malloc(buffer__in_len__)) == NULL) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 861 | { |
| 862 | PyErr_NoMemory(); |
| 863 | goto buffer__error__; |
| 864 | } |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 865 | buffer__len__ = buffer__in_len__; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 866 | if (state__in_len__ != sizeof(StateBlock)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 867 | { |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 868 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)"); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 869 | goto state__error__; |
| 870 | } |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 871 | Exp1to6(buffer__in__, buffer__out__, (long)buffer__len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 872 | state__in__, &state__out__, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 873 | numChannels, |
| 874 | whichChannel); |
| 875 | _res = Py_BuildValue("s#s#", |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 876 | buffer__out__, (int)buffer__len__, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 877 | (char *)&state__out__, (int)sizeof(StateBlock)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 878 | state__error__: ; |
| 879 | free(buffer__out__); |
| 880 | buffer__error__: ; |
| 881 | return _res; |
| 882 | } |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 883 | #endif |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 884 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 885 | static PyObject *Snd_GetSysBeepVolume(_self, _args) |
| 886 | PyObject *_self; |
| 887 | PyObject *_args; |
| 888 | { |
| 889 | PyObject *_res = NULL; |
| 890 | OSErr _err; |
| 891 | long level; |
| 892 | if (!PyArg_ParseTuple(_args, "")) |
| 893 | return NULL; |
| 894 | _err = GetSysBeepVolume(&level); |
| 895 | if (_err != noErr) return PyMac_Error(_err); |
| 896 | _res = Py_BuildValue("l", |
| 897 | level); |
| 898 | return _res; |
| 899 | } |
| 900 | |
| 901 | static PyObject *Snd_SetSysBeepVolume(_self, _args) |
| 902 | PyObject *_self; |
| 903 | PyObject *_args; |
| 904 | { |
| 905 | PyObject *_res = NULL; |
| 906 | OSErr _err; |
| 907 | long level; |
| 908 | if (!PyArg_ParseTuple(_args, "l", |
| 909 | &level)) |
| 910 | return NULL; |
| 911 | _err = SetSysBeepVolume(level); |
| 912 | if (_err != noErr) return PyMac_Error(_err); |
| 913 | Py_INCREF(Py_None); |
| 914 | _res = Py_None; |
| 915 | return _res; |
| 916 | } |
| 917 | |
| 918 | static PyObject *Snd_GetDefaultOutputVolume(_self, _args) |
| 919 | PyObject *_self; |
| 920 | PyObject *_args; |
| 921 | { |
| 922 | PyObject *_res = NULL; |
| 923 | OSErr _err; |
| 924 | long level; |
| 925 | if (!PyArg_ParseTuple(_args, "")) |
| 926 | return NULL; |
| 927 | _err = GetDefaultOutputVolume(&level); |
| 928 | if (_err != noErr) return PyMac_Error(_err); |
| 929 | _res = Py_BuildValue("l", |
| 930 | level); |
| 931 | return _res; |
| 932 | } |
| 933 | |
| 934 | static PyObject *Snd_SetDefaultOutputVolume(_self, _args) |
| 935 | PyObject *_self; |
| 936 | PyObject *_args; |
| 937 | { |
| 938 | PyObject *_res = NULL; |
| 939 | OSErr _err; |
| 940 | long level; |
| 941 | if (!PyArg_ParseTuple(_args, "l", |
| 942 | &level)) |
| 943 | return NULL; |
| 944 | _err = SetDefaultOutputVolume(level); |
| 945 | if (_err != noErr) return PyMac_Error(_err); |
| 946 | Py_INCREF(Py_None); |
| 947 | _res = Py_None; |
| 948 | return _res; |
| 949 | } |
| 950 | |
| 951 | static PyObject *Snd_GetSoundHeaderOffset(_self, _args) |
| 952 | PyObject *_self; |
| 953 | PyObject *_args; |
| 954 | { |
| 955 | PyObject *_res = NULL; |
| 956 | OSErr _err; |
| 957 | SndListHandle sndHandle; |
| 958 | long offset; |
| 959 | if (!PyArg_ParseTuple(_args, "O&", |
| 960 | ResObj_Convert, &sndHandle)) |
| 961 | return NULL; |
| 962 | _err = GetSoundHeaderOffset(sndHandle, |
| 963 | &offset); |
| 964 | if (_err != noErr) return PyMac_Error(_err); |
| 965 | _res = Py_BuildValue("l", |
| 966 | offset); |
| 967 | return _res; |
| 968 | } |
| 969 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 970 | static PyObject *Snd_GetCompressionInfo(_self, _args) |
| 971 | PyObject *_self; |
| 972 | PyObject *_args; |
| 973 | { |
| 974 | PyObject *_res = NULL; |
| 975 | OSErr _err; |
| 976 | short compressionID; |
| 977 | OSType format; |
| 978 | short numChannels; |
| 979 | short sampleSize; |
| 980 | CompressionInfo cp__out__; |
| 981 | if (!PyArg_ParseTuple(_args, "hO&hh", |
| 982 | &compressionID, |
| 983 | PyMac_GetOSType, &format, |
| 984 | &numChannels, |
| 985 | &sampleSize)) |
| 986 | return NULL; |
| 987 | _err = GetCompressionInfo(compressionID, |
| 988 | format, |
| 989 | numChannels, |
| 990 | sampleSize, |
| 991 | &cp__out__); |
| 992 | if (_err != noErr) return PyMac_Error(_err); |
| 993 | _res = Py_BuildValue("s#", |
| 994 | (char *)&cp__out__, (int)sizeof(CompressionInfo)); |
| 995 | cp__error__: ; |
| 996 | return _res; |
| 997 | } |
| 998 | |
| 999 | static PyObject *Snd_SetSoundPreference(_self, _args) |
| 1000 | PyObject *_self; |
| 1001 | PyObject *_args; |
| 1002 | { |
| 1003 | PyObject *_res = NULL; |
| 1004 | OSErr _err; |
| 1005 | OSType theType; |
| 1006 | Str255 name; |
| 1007 | Handle settings; |
| 1008 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1009 | PyMac_GetOSType, &theType, |
| 1010 | ResObj_Convert, &settings)) |
| 1011 | return NULL; |
| 1012 | _err = SetSoundPreference(theType, |
| 1013 | name, |
| 1014 | settings); |
| 1015 | if (_err != noErr) return PyMac_Error(_err); |
| 1016 | _res = Py_BuildValue("O&", |
| 1017 | PyMac_BuildStr255, name); |
| 1018 | return _res; |
| 1019 | } |
| 1020 | |
| 1021 | static PyObject *Snd_GetSoundPreference(_self, _args) |
| 1022 | PyObject *_self; |
| 1023 | PyObject *_args; |
| 1024 | { |
| 1025 | PyObject *_res = NULL; |
| 1026 | OSErr _err; |
| 1027 | OSType theType; |
| 1028 | Str255 name; |
| 1029 | Handle settings; |
| 1030 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1031 | PyMac_GetOSType, &theType, |
| 1032 | ResObj_Convert, &settings)) |
| 1033 | return NULL; |
| 1034 | _err = GetSoundPreference(theType, |
| 1035 | name, |
| 1036 | settings); |
| 1037 | if (_err != noErr) return PyMac_Error(_err); |
| 1038 | _res = Py_BuildValue("O&", |
| 1039 | PyMac_BuildStr255, name); |
| 1040 | return _res; |
| 1041 | } |
| 1042 | |
| 1043 | static PyObject *Snd_GetCompressionName(_self, _args) |
| 1044 | PyObject *_self; |
| 1045 | PyObject *_args; |
| 1046 | { |
| 1047 | PyObject *_res = NULL; |
| 1048 | OSErr _err; |
| 1049 | OSType compressionType; |
| 1050 | Str255 compressionName; |
| 1051 | if (!PyArg_ParseTuple(_args, "O&", |
| 1052 | PyMac_GetOSType, &compressionType)) |
| 1053 | return NULL; |
| 1054 | _err = GetCompressionName(compressionType, |
| 1055 | compressionName); |
| 1056 | if (_err != noErr) return PyMac_Error(_err); |
| 1057 | _res = Py_BuildValue("O&", |
| 1058 | PyMac_BuildStr255, compressionName); |
| 1059 | return _res; |
| 1060 | } |
| 1061 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1062 | static PyObject *Snd_SPBVersion(_self, _args) |
| 1063 | PyObject *_self; |
| 1064 | PyObject *_args; |
| 1065 | { |
| 1066 | PyObject *_res = NULL; |
| 1067 | NumVersion _rv; |
| 1068 | if (!PyArg_ParseTuple(_args, "")) |
| 1069 | return NULL; |
| 1070 | _rv = SPBVersion(); |
| 1071 | _res = Py_BuildValue("O&", |
| 1072 | PyMac_BuildNumVersion, _rv); |
| 1073 | return _res; |
| 1074 | } |
| 1075 | |
| 1076 | static PyObject *Snd_SPBSignInDevice(_self, _args) |
| 1077 | PyObject *_self; |
| 1078 | PyObject *_args; |
| 1079 | { |
| 1080 | PyObject *_res = NULL; |
| 1081 | OSErr _err; |
| 1082 | short deviceRefNum; |
| 1083 | Str255 deviceName; |
| 1084 | if (!PyArg_ParseTuple(_args, "hO&", |
| 1085 | &deviceRefNum, |
| 1086 | PyMac_GetStr255, deviceName)) |
| 1087 | return NULL; |
| 1088 | _err = SPBSignInDevice(deviceRefNum, |
| 1089 | deviceName); |
| 1090 | if (_err != noErr) return PyMac_Error(_err); |
| 1091 | Py_INCREF(Py_None); |
| 1092 | _res = Py_None; |
| 1093 | return _res; |
| 1094 | } |
| 1095 | |
| 1096 | static PyObject *Snd_SPBSignOutDevice(_self, _args) |
| 1097 | PyObject *_self; |
| 1098 | PyObject *_args; |
| 1099 | { |
| 1100 | PyObject *_res = NULL; |
| 1101 | OSErr _err; |
| 1102 | short deviceRefNum; |
| 1103 | if (!PyArg_ParseTuple(_args, "h", |
| 1104 | &deviceRefNum)) |
| 1105 | return NULL; |
| 1106 | _err = SPBSignOutDevice(deviceRefNum); |
| 1107 | if (_err != noErr) return PyMac_Error(_err); |
| 1108 | Py_INCREF(Py_None); |
| 1109 | _res = Py_None; |
| 1110 | return _res; |
| 1111 | } |
| 1112 | |
| 1113 | static PyObject *Snd_SPBGetIndexedDevice(_self, _args) |
| 1114 | PyObject *_self; |
| 1115 | PyObject *_args; |
| 1116 | { |
| 1117 | PyObject *_res = NULL; |
| 1118 | OSErr _err; |
| 1119 | short count; |
| 1120 | Str255 deviceName; |
| 1121 | Handle deviceIconHandle; |
| 1122 | if (!PyArg_ParseTuple(_args, "h", |
| 1123 | &count)) |
| 1124 | return NULL; |
| 1125 | _err = SPBGetIndexedDevice(count, |
| 1126 | deviceName, |
| 1127 | &deviceIconHandle); |
| 1128 | if (_err != noErr) return PyMac_Error(_err); |
| 1129 | _res = Py_BuildValue("O&O&", |
| 1130 | PyMac_BuildStr255, deviceName, |
| 1131 | ResObj_New, deviceIconHandle); |
| 1132 | return _res; |
| 1133 | } |
| 1134 | |
| 1135 | static PyObject *Snd_SPBOpenDevice(_self, _args) |
| 1136 | PyObject *_self; |
| 1137 | PyObject *_args; |
| 1138 | { |
| 1139 | PyObject *_res = NULL; |
| 1140 | OSErr _err; |
| 1141 | Str255 deviceName; |
| 1142 | short permission; |
| 1143 | long inRefNum; |
| 1144 | if (!PyArg_ParseTuple(_args, "O&h", |
| 1145 | PyMac_GetStr255, deviceName, |
| 1146 | &permission)) |
| 1147 | return NULL; |
| 1148 | _err = SPBOpenDevice(deviceName, |
| 1149 | permission, |
| 1150 | &inRefNum); |
| 1151 | if (_err != noErr) return PyMac_Error(_err); |
| 1152 | _res = Py_BuildValue("l", |
| 1153 | inRefNum); |
| 1154 | return _res; |
| 1155 | } |
| 1156 | |
| 1157 | static PyObject *Snd_SPBCloseDevice(_self, _args) |
| 1158 | PyObject *_self; |
| 1159 | PyObject *_args; |
| 1160 | { |
| 1161 | PyObject *_res = NULL; |
| 1162 | OSErr _err; |
| 1163 | long inRefNum; |
| 1164 | if (!PyArg_ParseTuple(_args, "l", |
| 1165 | &inRefNum)) |
| 1166 | return NULL; |
| 1167 | _err = SPBCloseDevice(inRefNum); |
| 1168 | if (_err != noErr) return PyMac_Error(_err); |
| 1169 | Py_INCREF(Py_None); |
| 1170 | _res = Py_None; |
| 1171 | return _res; |
| 1172 | } |
| 1173 | |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 1174 | static PyObject *Snd_SPBRecord(_self, _args) |
| 1175 | PyObject *_self; |
| 1176 | PyObject *_args; |
| 1177 | { |
| 1178 | PyObject *_res = NULL; |
| 1179 | OSErr _err; |
| 1180 | SPBPtr inParamPtr; |
| 1181 | Boolean asynchFlag; |
| 1182 | if (!PyArg_ParseTuple(_args, "O&b", |
| 1183 | SPBObj_Convert, &inParamPtr, |
| 1184 | &asynchFlag)) |
| 1185 | return NULL; |
| 1186 | _err = SPBRecord(inParamPtr, |
| 1187 | asynchFlag); |
| 1188 | if (_err != noErr) return PyMac_Error(_err); |
| 1189 | Py_INCREF(Py_None); |
| 1190 | _res = Py_None; |
| 1191 | return _res; |
| 1192 | } |
| 1193 | |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1194 | #ifndef TARGET_API_MAC_CARBON |
| 1195 | |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 1196 | static PyObject *Snd_SPBRecordToFile(_self, _args) |
| 1197 | PyObject *_self; |
| 1198 | PyObject *_args; |
| 1199 | { |
| 1200 | PyObject *_res = NULL; |
| 1201 | OSErr _err; |
| 1202 | short fRefNum; |
| 1203 | SPBPtr inParamPtr; |
| 1204 | Boolean asynchFlag; |
| 1205 | if (!PyArg_ParseTuple(_args, "hO&b", |
| 1206 | &fRefNum, |
| 1207 | SPBObj_Convert, &inParamPtr, |
| 1208 | &asynchFlag)) |
| 1209 | return NULL; |
| 1210 | _err = SPBRecordToFile(fRefNum, |
| 1211 | inParamPtr, |
| 1212 | asynchFlag); |
| 1213 | if (_err != noErr) return PyMac_Error(_err); |
| 1214 | Py_INCREF(Py_None); |
| 1215 | _res = Py_None; |
| 1216 | return _res; |
| 1217 | } |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1218 | #endif |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 1219 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1220 | static PyObject *Snd_SPBPauseRecording(_self, _args) |
| 1221 | PyObject *_self; |
| 1222 | PyObject *_args; |
| 1223 | { |
| 1224 | PyObject *_res = NULL; |
| 1225 | OSErr _err; |
| 1226 | long inRefNum; |
| 1227 | if (!PyArg_ParseTuple(_args, "l", |
| 1228 | &inRefNum)) |
| 1229 | return NULL; |
| 1230 | _err = SPBPauseRecording(inRefNum); |
| 1231 | if (_err != noErr) return PyMac_Error(_err); |
| 1232 | Py_INCREF(Py_None); |
| 1233 | _res = Py_None; |
| 1234 | return _res; |
| 1235 | } |
| 1236 | |
| 1237 | static PyObject *Snd_SPBResumeRecording(_self, _args) |
| 1238 | PyObject *_self; |
| 1239 | PyObject *_args; |
| 1240 | { |
| 1241 | PyObject *_res = NULL; |
| 1242 | OSErr _err; |
| 1243 | long inRefNum; |
| 1244 | if (!PyArg_ParseTuple(_args, "l", |
| 1245 | &inRefNum)) |
| 1246 | return NULL; |
| 1247 | _err = SPBResumeRecording(inRefNum); |
| 1248 | if (_err != noErr) return PyMac_Error(_err); |
| 1249 | Py_INCREF(Py_None); |
| 1250 | _res = Py_None; |
| 1251 | return _res; |
| 1252 | } |
| 1253 | |
| 1254 | static PyObject *Snd_SPBStopRecording(_self, _args) |
| 1255 | PyObject *_self; |
| 1256 | PyObject *_args; |
| 1257 | { |
| 1258 | PyObject *_res = NULL; |
| 1259 | OSErr _err; |
| 1260 | long inRefNum; |
| 1261 | if (!PyArg_ParseTuple(_args, "l", |
| 1262 | &inRefNum)) |
| 1263 | return NULL; |
| 1264 | _err = SPBStopRecording(inRefNum); |
| 1265 | if (_err != noErr) return PyMac_Error(_err); |
| 1266 | Py_INCREF(Py_None); |
| 1267 | _res = Py_None; |
| 1268 | return _res; |
| 1269 | } |
| 1270 | |
| 1271 | static PyObject *Snd_SPBGetRecordingStatus(_self, _args) |
| 1272 | PyObject *_self; |
| 1273 | PyObject *_args; |
| 1274 | { |
| 1275 | PyObject *_res = NULL; |
| 1276 | OSErr _err; |
| 1277 | long inRefNum; |
| 1278 | short recordingStatus; |
| 1279 | short meterLevel; |
| 1280 | unsigned long totalSamplesToRecord; |
| 1281 | unsigned long numberOfSamplesRecorded; |
| 1282 | unsigned long totalMsecsToRecord; |
| 1283 | unsigned long numberOfMsecsRecorded; |
| 1284 | if (!PyArg_ParseTuple(_args, "l", |
| 1285 | &inRefNum)) |
| 1286 | return NULL; |
| 1287 | _err = SPBGetRecordingStatus(inRefNum, |
| 1288 | &recordingStatus, |
| 1289 | &meterLevel, |
| 1290 | &totalSamplesToRecord, |
| 1291 | &numberOfSamplesRecorded, |
| 1292 | &totalMsecsToRecord, |
| 1293 | &numberOfMsecsRecorded); |
| 1294 | if (_err != noErr) return PyMac_Error(_err); |
| 1295 | _res = Py_BuildValue("hhllll", |
| 1296 | recordingStatus, |
| 1297 | meterLevel, |
| 1298 | totalSamplesToRecord, |
| 1299 | numberOfSamplesRecorded, |
| 1300 | totalMsecsToRecord, |
| 1301 | numberOfMsecsRecorded); |
| 1302 | return _res; |
| 1303 | } |
| 1304 | |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 1305 | static PyObject *Snd_SPBGetDeviceInfo(_self, _args) |
| 1306 | PyObject *_self; |
| 1307 | PyObject *_args; |
| 1308 | { |
| 1309 | PyObject *_res = NULL; |
| 1310 | OSErr _err; |
| 1311 | long inRefNum; |
| 1312 | OSType infoType; |
| 1313 | void * infoData; |
| 1314 | if (!PyArg_ParseTuple(_args, "lO&w", |
| 1315 | &inRefNum, |
| 1316 | PyMac_GetOSType, &infoType, |
| 1317 | &infoData)) |
| 1318 | return NULL; |
| 1319 | _err = SPBGetDeviceInfo(inRefNum, |
| 1320 | infoType, |
| 1321 | infoData); |
| 1322 | if (_err != noErr) return PyMac_Error(_err); |
| 1323 | Py_INCREF(Py_None); |
| 1324 | _res = Py_None; |
| 1325 | return _res; |
| 1326 | } |
| 1327 | |
| 1328 | static PyObject *Snd_SPBSetDeviceInfo(_self, _args) |
| 1329 | PyObject *_self; |
| 1330 | PyObject *_args; |
| 1331 | { |
| 1332 | PyObject *_res = NULL; |
| 1333 | OSErr _err; |
| 1334 | long inRefNum; |
| 1335 | OSType infoType; |
| 1336 | void * infoData; |
| 1337 | if (!PyArg_ParseTuple(_args, "lO&w", |
| 1338 | &inRefNum, |
| 1339 | PyMac_GetOSType, &infoType, |
| 1340 | &infoData)) |
| 1341 | return NULL; |
| 1342 | _err = SPBSetDeviceInfo(inRefNum, |
| 1343 | infoType, |
| 1344 | infoData); |
| 1345 | if (_err != noErr) return PyMac_Error(_err); |
| 1346 | Py_INCREF(Py_None); |
| 1347 | _res = Py_None; |
| 1348 | return _res; |
| 1349 | } |
| 1350 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1351 | static PyObject *Snd_SPBMillisecondsToBytes(_self, _args) |
| 1352 | PyObject *_self; |
| 1353 | PyObject *_args; |
| 1354 | { |
| 1355 | PyObject *_res = NULL; |
| 1356 | OSErr _err; |
| 1357 | long inRefNum; |
| 1358 | long milliseconds; |
| 1359 | if (!PyArg_ParseTuple(_args, "l", |
| 1360 | &inRefNum)) |
| 1361 | return NULL; |
| 1362 | _err = SPBMillisecondsToBytes(inRefNum, |
| 1363 | &milliseconds); |
| 1364 | if (_err != noErr) return PyMac_Error(_err); |
| 1365 | _res = Py_BuildValue("l", |
| 1366 | milliseconds); |
| 1367 | return _res; |
| 1368 | } |
| 1369 | |
| 1370 | static PyObject *Snd_SPBBytesToMilliseconds(_self, _args) |
| 1371 | PyObject *_self; |
| 1372 | PyObject *_args; |
| 1373 | { |
| 1374 | PyObject *_res = NULL; |
| 1375 | OSErr _err; |
| 1376 | long inRefNum; |
| 1377 | long byteCount; |
| 1378 | if (!PyArg_ParseTuple(_args, "l", |
| 1379 | &inRefNum)) |
| 1380 | return NULL; |
| 1381 | _err = SPBBytesToMilliseconds(inRefNum, |
| 1382 | &byteCount); |
| 1383 | if (_err != noErr) return PyMac_Error(_err); |
| 1384 | _res = Py_BuildValue("l", |
| 1385 | byteCount); |
| 1386 | return _res; |
| 1387 | } |
| 1388 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1389 | static PyMethodDef Snd_methods[] = { |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 1390 | {"SPB", (PyCFunction)Snd_SPB, 1, |
| 1391 | NULL}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1392 | {"SysBeep", (PyCFunction)Snd_SysBeep, 1, |
| 1393 | "(short duration) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1394 | {"SndNewChannel", (PyCFunction)Snd_SndNewChannel, 1, |
| 1395 | "(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1396 | |
| 1397 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1398 | {"SndControl", (PyCFunction)Snd_SndControl, 1, |
| 1399 | "(short id) -> (SndCommand cmd)"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1400 | #endif |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1401 | {"SndSoundManagerVersion", (PyCFunction)Snd_SndSoundManagerVersion, 1, |
Jack Jansen | 5674e4e | 1996-08-01 15:26:05 +0000 | [diff] [blame] | 1402 | "() -> (NumVersion _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1403 | {"SndManagerStatus", (PyCFunction)Snd_SndManagerStatus, 1, |
| 1404 | "(short theLength) -> (SMStatus theStatus)"}, |
| 1405 | {"SndGetSysBeepState", (PyCFunction)Snd_SndGetSysBeepState, 1, |
| 1406 | "() -> (short sysBeepState)"}, |
| 1407 | {"SndSetSysBeepState", (PyCFunction)Snd_SndSetSysBeepState, 1, |
| 1408 | "(short sysBeepState) -> None"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1409 | |
| 1410 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1411 | {"MACEVersion", (PyCFunction)Snd_MACEVersion, 1, |
Jack Jansen | 5674e4e | 1996-08-01 15:26:05 +0000 | [diff] [blame] | 1412 | "() -> (NumVersion _rv)"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1413 | #endif |
| 1414 | |
| 1415 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1416 | {"Comp3to1", (PyCFunction)Snd_Comp3to1, 1, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 1417 | "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1418 | #endif |
| 1419 | |
| 1420 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1421 | {"Exp1to3", (PyCFunction)Snd_Exp1to3, 1, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 1422 | "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1423 | #endif |
| 1424 | |
| 1425 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1426 | {"Comp6to1", (PyCFunction)Snd_Comp6to1, 1, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 1427 | "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1428 | #endif |
| 1429 | |
| 1430 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1431 | {"Exp1to6", (PyCFunction)Snd_Exp1to6, 1, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 1432 | "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1433 | #endif |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 1434 | {"GetSysBeepVolume", (PyCFunction)Snd_GetSysBeepVolume, 1, |
| 1435 | "() -> (long level)"}, |
| 1436 | {"SetSysBeepVolume", (PyCFunction)Snd_SetSysBeepVolume, 1, |
| 1437 | "(long level) -> None"}, |
| 1438 | {"GetDefaultOutputVolume", (PyCFunction)Snd_GetDefaultOutputVolume, 1, |
| 1439 | "() -> (long level)"}, |
| 1440 | {"SetDefaultOutputVolume", (PyCFunction)Snd_SetDefaultOutputVolume, 1, |
| 1441 | "(long level) -> None"}, |
| 1442 | {"GetSoundHeaderOffset", (PyCFunction)Snd_GetSoundHeaderOffset, 1, |
| 1443 | "(SndListHandle sndHandle) -> (long offset)"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1444 | {"GetCompressionInfo", (PyCFunction)Snd_GetCompressionInfo, 1, |
| 1445 | "(short compressionID, OSType format, short numChannels, short sampleSize) -> (CompressionInfo cp)"}, |
| 1446 | {"SetSoundPreference", (PyCFunction)Snd_SetSoundPreference, 1, |
| 1447 | "(OSType theType, Handle settings) -> (Str255 name)"}, |
| 1448 | {"GetSoundPreference", (PyCFunction)Snd_GetSoundPreference, 1, |
| 1449 | "(OSType theType, Handle settings) -> (Str255 name)"}, |
| 1450 | {"GetCompressionName", (PyCFunction)Snd_GetCompressionName, 1, |
| 1451 | "(OSType compressionType) -> (Str255 compressionName)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1452 | {"SPBVersion", (PyCFunction)Snd_SPBVersion, 1, |
| 1453 | "() -> (NumVersion _rv)"}, |
| 1454 | {"SPBSignInDevice", (PyCFunction)Snd_SPBSignInDevice, 1, |
| 1455 | "(short deviceRefNum, Str255 deviceName) -> None"}, |
| 1456 | {"SPBSignOutDevice", (PyCFunction)Snd_SPBSignOutDevice, 1, |
| 1457 | "(short deviceRefNum) -> None"}, |
| 1458 | {"SPBGetIndexedDevice", (PyCFunction)Snd_SPBGetIndexedDevice, 1, |
| 1459 | "(short count) -> (Str255 deviceName, Handle deviceIconHandle)"}, |
| 1460 | {"SPBOpenDevice", (PyCFunction)Snd_SPBOpenDevice, 1, |
| 1461 | "(Str255 deviceName, short permission) -> (long inRefNum)"}, |
| 1462 | {"SPBCloseDevice", (PyCFunction)Snd_SPBCloseDevice, 1, |
| 1463 | "(long inRefNum) -> None"}, |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 1464 | {"SPBRecord", (PyCFunction)Snd_SPBRecord, 1, |
| 1465 | "(SPBPtr inParamPtr, Boolean asynchFlag) -> None"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1466 | |
| 1467 | #ifndef TARGET_API_MAC_CARBON |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 1468 | {"SPBRecordToFile", (PyCFunction)Snd_SPBRecordToFile, 1, |
| 1469 | "(short fRefNum, SPBPtr inParamPtr, Boolean asynchFlag) -> None"}, |
Jack Jansen | 8d929ae | 2000-06-21 22:07:06 +0000 | [diff] [blame] | 1470 | #endif |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1471 | {"SPBPauseRecording", (PyCFunction)Snd_SPBPauseRecording, 1, |
| 1472 | "(long inRefNum) -> None"}, |
| 1473 | {"SPBResumeRecording", (PyCFunction)Snd_SPBResumeRecording, 1, |
| 1474 | "(long inRefNum) -> None"}, |
| 1475 | {"SPBStopRecording", (PyCFunction)Snd_SPBStopRecording, 1, |
| 1476 | "(long inRefNum) -> None"}, |
| 1477 | {"SPBGetRecordingStatus", (PyCFunction)Snd_SPBGetRecordingStatus, 1, |
| 1478 | "(long inRefNum) -> (short recordingStatus, short meterLevel, unsigned long totalSamplesToRecord, unsigned long numberOfSamplesRecorded, unsigned long totalMsecsToRecord, unsigned long numberOfMsecsRecorded)"}, |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 1479 | {"SPBGetDeviceInfo", (PyCFunction)Snd_SPBGetDeviceInfo, 1, |
| 1480 | "(long inRefNum, OSType infoType, void * infoData) -> None"}, |
| 1481 | {"SPBSetDeviceInfo", (PyCFunction)Snd_SPBSetDeviceInfo, 1, |
| 1482 | "(long inRefNum, OSType infoType, void * infoData) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1483 | {"SPBMillisecondsToBytes", (PyCFunction)Snd_SPBMillisecondsToBytes, 1, |
| 1484 | "(long inRefNum) -> (long milliseconds)"}, |
| 1485 | {"SPBBytesToMilliseconds", (PyCFunction)Snd_SPBBytesToMilliseconds, 1, |
| 1486 | "(long inRefNum) -> (long byteCount)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1487 | {NULL, NULL, 0} |
| 1488 | }; |
| 1489 | |
| 1490 | |
| 1491 | |
| 1492 | /* Routine passed to Py_AddPendingCall -- call the Python callback */ |
| 1493 | static int |
| 1494 | SndCh_CallCallBack(arg) |
| 1495 | void *arg; |
| 1496 | { |
| 1497 | SndChannelObject *p = (SndChannelObject *)arg; |
| 1498 | PyObject *args; |
| 1499 | PyObject *res; |
| 1500 | args = Py_BuildValue("(O(hhl))", |
| 1501 | p, p->ob_cmd.cmd, p->ob_cmd.param1, p->ob_cmd.param2); |
| 1502 | res = PyEval_CallObject(p->ob_callback, args); |
| 1503 | Py_DECREF(args); |
| 1504 | if (res == NULL) |
| 1505 | return -1; |
| 1506 | Py_DECREF(res); |
| 1507 | return 0; |
| 1508 | } |
| 1509 | |
| 1510 | /* Routine passed to NewSndChannel -- schedule a call to SndCh_CallCallBack */ |
| 1511 | static pascal void |
| 1512 | SndCh_UserRoutine(SndChannelPtr chan, SndCommand *cmd) |
| 1513 | { |
| 1514 | SndChannelObject *p = (SndChannelObject *)(chan->userInfo); |
| 1515 | if (p->ob_callback != NULL) { |
| 1516 | long A5 = SetA5(p->ob_A5); |
| 1517 | p->ob_cmd = *cmd; |
| 1518 | Py_AddPendingCall(SndCh_CallCallBack, (void *)p); |
| 1519 | SetA5(A5); |
| 1520 | } |
| 1521 | } |
| 1522 | |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 1523 | /* SPB callbacks - Schedule callbacks to Python */ |
| 1524 | static int |
| 1525 | SPB_CallCallBack(arg) |
| 1526 | void *arg; |
| 1527 | { |
| 1528 | SPBObject *p = (SPBObject *)arg; |
| 1529 | PyObject *args; |
| 1530 | PyObject *res; |
| 1531 | |
| 1532 | if ( p->ob_thiscallback == 0 ) return 0; |
| 1533 | args = Py_BuildValue("(O)", p); |
| 1534 | res = PyEval_CallObject(p->ob_thiscallback, args); |
| 1535 | p->ob_thiscallback = 0; |
| 1536 | Py_DECREF(args); |
| 1537 | if (res == NULL) |
| 1538 | return -1; |
| 1539 | Py_DECREF(res); |
| 1540 | return 0; |
| 1541 | } |
| 1542 | |
| 1543 | static pascal void |
| 1544 | SPB_completion(SPBPtr my_spb) |
| 1545 | { |
| 1546 | SPBObject *p = (SPBObject *)(my_spb->userLong); |
| 1547 | |
| 1548 | if (p && p->ob_completion) { |
| 1549 | long A5 = SetA5(p->ob_A5); |
| 1550 | p->ob_thiscallback = p->ob_completion; /* Hope we cannot get two at the same time */ |
| 1551 | Py_AddPendingCall(SPB_CallCallBack, (void *)p); |
| 1552 | SetA5(A5); |
| 1553 | } |
| 1554 | } |
| 1555 | |
| 1556 | static pascal void |
| 1557 | SPB_interrupt(SPBPtr my_spb) |
| 1558 | { |
| 1559 | SPBObject *p = (SPBObject *)(my_spb->userLong); |
| 1560 | |
| 1561 | if (p && p->ob_interrupt) { |
| 1562 | long A5 = SetA5(p->ob_A5); |
| 1563 | p->ob_thiscallback = p->ob_interrupt; /* Hope we cannot get two at the same time */ |
| 1564 | Py_AddPendingCall(SPB_CallCallBack, (void *)p); |
| 1565 | SetA5(A5); |
| 1566 | } |
| 1567 | } |
| 1568 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1569 | |
| 1570 | void initSnd() |
| 1571 | { |
| 1572 | PyObject *m; |
| 1573 | PyObject *d; |
| 1574 | |
| 1575 | |
| 1576 | |
| 1577 | |
| 1578 | |
| 1579 | m = Py_InitModule("Snd", Snd_methods); |
| 1580 | d = PyModule_GetDict(m); |
| 1581 | Snd_Error = PyMac_GetOSErrException(); |
| 1582 | if (Snd_Error == NULL || |
| 1583 | PyDict_SetItemString(d, "Error", Snd_Error) != 0) |
| 1584 | Py_FatalError("can't initialize Snd.Error"); |
Jack Jansen | a755e68 | 1997-09-20 17:40:22 +0000 | [diff] [blame] | 1585 | SndChannel_Type.ob_type = &PyType_Type; |
| 1586 | Py_INCREF(&SndChannel_Type); |
| 1587 | if (PyDict_SetItemString(d, "SndChannelType", (PyObject *)&SndChannel_Type) != 0) |
| 1588 | Py_FatalError("can't initialize SndChannelType"); |
Jack Jansen | 52b38b7 | 1998-02-25 15:47:51 +0000 | [diff] [blame] | 1589 | SPB_Type.ob_type = &PyType_Type; |
| 1590 | Py_INCREF(&SPB_Type); |
| 1591 | if (PyDict_SetItemString(d, "SPBType", (PyObject *)&SPB_Type) != 0) |
| 1592 | Py_FatalError("can't initialize SPBType"); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1593 | } |
| 1594 | |
| 1595 | /* ========================= End module Snd ========================= */ |
| 1596 | |