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