Beispiel #1
0
void al_sourceiv( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {

	if (NULL == alSourceiv) mogl_glunsupported("alSourceiv");
	alSourceiv((ALuint)mxGetScalar(prhs[0]),
		(ALenum)mxGetScalar(prhs[1]),
		(const ALint*)mxGetData(prhs[2]));

}
Beispiel #2
0
value lime_al_sourceiv (value source, value param, value values) {

    int *data = val_array_int (values);

    if (data) {

        alSourceiv (val_int (source), val_int (param), data);

    }

    return alloc_null ();

}
Beispiel #3
0
	void lime_al_sourceiv (int source, int param, value values) {
		
		if (val_is_null (values) == false) {
			
			int size = val_array_size (values);
			ALint* data = new ALint[size];
			
			for (int i = 0; i < size; ++i) {
				
				data[i] = (ALint)val_int( val_array_i (values, i) );
				
			}
			
			alSourceiv (source, param, data);
			
			delete[] data;
			
		}
		
	}
Beispiel #4
0
ALvoid CDECL wine_alSourceiv(ALuint sid, ALenum param, const ALint* values)
{
    alSourceiv(sid, param, values);
}
Beispiel #5
0
/* Sources methods */
static PyObject*
_sources_setprop (PyObject *self, PyObject *args)
{
    long bufnum;
    ALenum param;
    PyObject *values;
    char *type;
    PropType ptype = INVALID;

    if (!CONTEXT_IS_CURRENT (((PySources*)self)->context))
    {
        PyErr_SetString (PyExc_PyGameError, "source context is not current");
        return NULL;
    }

    if (!PyArg_ParseTuple (args, "llO|s:set_prop", &bufnum, &param, &values,
                           &type))
        return NULL;

    if (type)
    {
        ptype = GetPropTypeFromStr (type);
        if (ptype == INVALID)
        {
            PyErr_SetString (PyExc_RuntimeError,
                             "passing a sequence requires passing a type specifier");
            return NULL;
        }
    }

    if (PySequence_Check (values))
    {
        Py_ssize_t size, cnt;
        if (!type)
        {
            PyErr_SetString (PyExc_RuntimeError,
                             "passing a sequence requires passing a type specifier");
            return NULL;
        }
        if (ptype == INT || ptype == FLOAT)
        {
            PyErr_SetString (PyExc_TypeError,
                             "cannot use single value type and sequence together");
            return NULL;
        }

        size = PySequence_Size (values);
        switch (ptype)
        {
        case INT3:
        case INTARRAY:
        {
            ALint *vals;
            int tmp;
            if (ptype == INT3 && size < 3)
            {
                PyErr_SetString (PyExc_ValueError,
                                 "sequence too small for 'i3'");
                return NULL;
            }
            vals = PyMem_New (ALint, size);
            if (!vals)
                return NULL;
            for (cnt = 0; cnt < size; cnt++)
            {
                if (!IntFromSeqIndex (values, cnt, &tmp))
                {
                    PyMem_Free (vals);
                    return NULL;
                }
                vals[cnt] = (ALint) tmp;
            }

            CLEAR_ALERROR_STATE ();
            if (ptype == INT3)
                alSource3i ((ALuint)bufnum, param, vals[0], vals[1], vals[2]);
            else
                alSourceiv ((ALuint)bufnum, param, vals);
            PyMem_Free (vals);
            /* Error will be set at the end */
            break;
        }
        case FLOAT3:
        case FLOATARRAY:
        {
            ALfloat *vals;
            double tmp;
            if (ptype == FLOAT3 && size < 3)
            {
                PyErr_SetString (PyExc_ValueError,
                                 "sequence too small for 'f3'");
                return NULL;
            }
            vals = PyMem_New (ALfloat, size);
            if (!vals)
                return NULL;
            for (cnt = 0; cnt < size; cnt++)
            {
                if (!DoubleFromSeqIndex (values, cnt, &tmp))
                {
                    PyMem_Free (vals);
                    return NULL;
                }
                vals[cnt] = (ALfloat) tmp;
            }

            CLEAR_ALERROR_STATE ();
            if (ptype == FLOAT3)
                alSource3f ((ALuint)bufnum, param, vals[0], vals[1], vals[2]);
            else
                alSourcefv ((ALuint)bufnum, param, vals);
            PyMem_Free (vals);
            /* Error will be set at the end */
            break;
        }
        default:
            PyErr_SetString (PyExc_TypeError, "unsupported value");
            return NULL;
        }
    }
    else
    {
        int ival = 0;
        double fval = 0;

        if (!type)
        {
            if (IntFromObj (values, &ival))
                ptype = INT;
            else
                PyErr_Clear ();
            if (DoubleFromObj (values, &fval))
                ptype = FLOAT;
            else
            {
                PyErr_Clear ();
                PyErr_SetString (PyExc_TypeError, "unsupported value");
                return NULL;
            }
        }

        switch (ptype)
        {
        case INT:
            if (!IntFromObj (values, &ival))
                return NULL;
            CLEAR_ALERROR_STATE ();
            alSourcei ((ALuint)bufnum, param, (ALint) ival);
            break;
        case FLOAT:
            if (!DoubleFromObj (values, &fval))
                return NULL;
            CLEAR_ALERROR_STATE ();
            alSourcef ((ALuint)bufnum, param, (ALfloat) fval);
            break;
        default:
            PyErr_SetString (PyExc_TypeError, "value type mismatch");
            return NULL;
        }
    }

    if (SetALErrorException (alGetError (), 0))
        return NULL;
    Py_RETURN_NONE;
}
Beispiel #6
0
//*****************************************************************************
// alSourceiv
//*****************************************************************************
//
ALAPI ALvoid ALAPIENTRY alSourceiv(ALuint sourceName, ALenum param, const ALint* values)
{
    AL_VOID_FXN(alSourceiv(sourceName, param, values));
}