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