mirror of https://github.com/sipwise/sems.git
git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@395 8eb893ce-cfd4-0310-b710-fb5ebe64c474sayer/1.4-spce2.6
parent
8bc40b2f64
commit
7bebf15237
@ -0,0 +1,14 @@
|
||||
|
||||
NAME=mix_announce
|
||||
VERSION=0.0.1
|
||||
|
||||
PYTHON_VERSION=2.4
|
||||
|
||||
LIBDIR=
|
||||
|
||||
COREPATH=../../../core
|
||||
IVRPATH=../../ivr
|
||||
|
||||
# general python app Makefile
|
||||
include $(IVRPATH)/Makefile.ivr_application
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
announcement=../apps/voicemail/wav/default_en.wav
|
||||
beep=../apps/voicemail/wav/beep.wav
|
||||
@ -0,0 +1,2 @@
|
||||
import compileall
|
||||
compileall.main()
|
||||
@ -0,0 +1,131 @@
|
||||
#include "IvrAudioMixIn.h"
|
||||
#include "IvrAudio.h"
|
||||
|
||||
#include "log.h"
|
||||
|
||||
static PyObject* IvrAudioMixIn_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
DBG("---------- IvrAudioMixIn_alloc -----------\n");
|
||||
IvrAudioMixIn *self;
|
||||
|
||||
self = (IvrAudioMixIn *)type->tp_alloc(type, 0);
|
||||
|
||||
if (self != NULL) {
|
||||
self->mix = NULL;
|
||||
}
|
||||
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
static void IvrAudioMixIn_dealloc(IvrAudioMixIn* self)
|
||||
{
|
||||
DBG("---------- IvrAudioMixIn_dealloc -----------\n");
|
||||
if (self->mix) {
|
||||
delete self->mix;
|
||||
self->mix = NULL;
|
||||
}
|
||||
|
||||
self->ob_type->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
|
||||
static PyObject* IvrAudioMixIn_init(IvrAudioMixIn* self, PyObject* args)
|
||||
{
|
||||
AmAudioFile* a = NULL;
|
||||
AmAudioFile* b = NULL;
|
||||
int s;
|
||||
double l;
|
||||
|
||||
PyObject *o_a, *o_b;
|
||||
|
||||
if(!PyArg_ParseTuple(args,"OOid", &o_a, &o_b, &s, &l))
|
||||
return NULL;
|
||||
|
||||
if (o_a == Py_None) {
|
||||
PyErr_SetString(PyExc_TypeError,"Argument 1 is None (need IvrAudioFile)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (o_b == Py_None) {
|
||||
PyErr_SetString(PyExc_TypeError,"Argument 2 is None (need IvrAudioFile)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!PyObject_TypeCheck(o_a,&IvrAudioFileType)){
|
||||
PyErr_SetString(PyExc_TypeError,"Argument 1 is no IvrAudioFile");
|
||||
return NULL;
|
||||
}
|
||||
a = ((IvrAudioFile*)o_a)->af;
|
||||
|
||||
|
||||
if(!PyObject_TypeCheck(o_b,&IvrAudioFileType)){
|
||||
PyErr_SetString(PyExc_TypeError,"Argument 2 is no IvrAudioFile");
|
||||
return NULL;
|
||||
}
|
||||
b = ((IvrAudioFile*)o_b)->af;
|
||||
|
||||
if (NULL !=self->mix) {
|
||||
delete self->mix;
|
||||
}
|
||||
|
||||
self->mix = new AmAudioMixIn(a, b, s, l);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyMethodDef IvrAudioMixIn_methods[] = {
|
||||
{"init", (PyCFunction)IvrAudioMixIn_init, METH_VARARGS,
|
||||
"open the mixin with two audio files, interval and level"
|
||||
},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
|
||||
static PyGetSetDef IvrAudioMixIn_getseters[] = {
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
PyTypeObject IvrAudioMixInType = {
|
||||
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0, /*ob_size*/
|
||||
"ivr.IvrAudioMixIn", /*tp_name*/
|
||||
sizeof(IvrAudioMixIn), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
(destructor)IvrAudioMixIn_dealloc, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
0, /*tp_getattr*/
|
||||
0, /*tp_setattr*/
|
||||
0, /*tp_compare*/
|
||||
0, /*tp_repr*/
|
||||
0, /*tp_as_number*/
|
||||
0, /*tp_as_sequence*/
|
||||
0, /*tp_as_mapping*/
|
||||
0, /*tp_hash */
|
||||
0, /*tp_call*/
|
||||
0, /*tp_str*/
|
||||
0, /*tp_getattro*/
|
||||
0, /*tp_setattro*/
|
||||
0, /*tp_as_buffer*/
|
||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
|
||||
"An audio file", /*tp_doc*/
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
IvrAudioMixIn_methods, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
IvrAudioMixIn_getseters, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
0, /* tp_descr_get */
|
||||
0, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
IvrAudioMixIn_new, /* tp_new */
|
||||
};
|
||||
@ -0,0 +1,20 @@
|
||||
#ifndef IvrAudioMixIn_h
|
||||
#define IvrAudioMixIn_h
|
||||
|
||||
// Python stuff
|
||||
#include <Python.h>
|
||||
#include <structmember.h>
|
||||
|
||||
#include "AmAudioMixIn.h"
|
||||
|
||||
// Data definition
|
||||
typedef struct {
|
||||
|
||||
PyObject_HEAD
|
||||
AmAudioMixIn* mix;
|
||||
|
||||
} IvrAudioMixIn;
|
||||
|
||||
extern PyTypeObject IvrAudioMixInType;
|
||||
|
||||
#endif
|
||||
Loading…
Reference in new issue