[Pythonmac-SIG] Recording audio on Mac

Lucio Torre lucio.torre at gmail.com
Sat Mar 24 16:46:52 CET 2007


Hi,

I want to record audio on mac. Ive seen that the function SPBRecord
does what i need.
(http://developer.apple.com/documentation/QuickTime/INMAC/SOUND/imsoundinput.19.htm)

This function is wrapped in the Carbon.Snd python library. My problem
is that i need to pass a SPBOjb parameter and im unable to create an
object of that kind.

Checking the source i see that the only reference i find to SPBObj_New
is in the Snd_SPB function, wich is referenced as SPB in the module.

static PyObject *Snd_SPB(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	_res = SPBObj_New(); return _res;
}


static PyMethodDef Snd_methods[] = {
  	{"SPB", (PyCFunction)Snd_SPB, 1,
	 PyDoc_STR(NULL)},
...
}

But when i try to create a SPB in python i get:

>>> import Carbon.Snd as snd
>>> snd.SPB()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: cannot create '_Snd.SPB' instances
>>>

Looking around in the code i see that:

void init_Snd(void)
{
	PyObject *m;
	m = Py_InitModule("_Snd", Snd_methods);
...
       PyModule_AddObject(m, "SPB", (PyObject *)&SPB_Type);
...
}

Is this overriding the other definition? I think so, from doing:

>>> type(snd.SPB)
<type 'type'>
>>>

How i am supposed to create a SPB object? I even tried using snd.SPB
as a base class but it would not work. Any ideas?

Lucio


More information about the Pythonmac-SIG mailing list