- %name(SoundFromData) wxSound(const wxMemoryBuffer& data) {
- return new wxSound((int)data.GetDataLen(), (wxByte*)data.GetData());
+ %RenameCtor(SoundFromData, wxSound(PyObject* data))
+ {
+ unsigned char* buffer; int size;
+ wxSound *sound = NULL;
+
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
+ if (!PyArg_Parse(data, "t#", &buffer, &size))
+ goto done;
+ sound = new wxSound(size, buffer);
+ done:
+ wxPyEndBlockThreads(blocked);
+ return sound;