コード例 #1
0
ファイル: routing.c プロジェクト: cryptix/Gruppe42
/* - Params */
void setParam(unit *u, paramType type, paramOption option, float val) { /* sets value of a param to static value */
	float **p, **pLoc;
	int i;

	p = getParamAddress(u, type, option, 0); /* get pointer to the value. if unit is global there is only one, if local we only need the first one here */

	if (!isGlobalParam(p)) { /* create a new static value, if value is no */
		*p = addGlobalParam();
	}

	if (u->scope == usLOCAL) { /* if unit is local, set all values of inner units to the same value */
		for (i = 1; i < voiceCount; i++) {
			pLoc = getParamAddress(u, type, option, i); /* get pointer to the value to set */
			*pLoc = *p;
		}
	}

	**p = val; /* cahnge content of the value to specified value */
}
コード例 #2
0
SWIGEXPORT jstring JNICALL Java_com_dsp_1faust_dsp_1faustJNI_getParamAddress(JNIEnv *jenv, jclass jcls, jint jarg1) {
    jstring jresult = 0 ;
    int arg1 ;
    char *result = 0 ;

    (void)jenv;
    (void)jcls;
    arg1 = (int)jarg1;
    result = (char *)getParamAddress(arg1);
    if (result) jresult = jenv->NewStringUTF((const char *)result);
    return jresult;
}
コード例 #3
0
ファイル: routing.c プロジェクト: cryptix/Gruppe42
void routeParam(unit *u, paramType type, paramOption option, unit *src) { /* routes value of a param to another unit */
	float **p, *pSrc;
	int i;

	/* TODO: delete gParam if it was one before */

	if (u->scope == usGLOBAL) { /* unit to route is global -> src-unit has to be global too */
		if (src->scope == usGLOBAL) {
			p = getParamAddress(u, type, option, 0); /* get pointer to the value to route TODO: error if value doesn't exist */
			pSrc = getValAddress(src, 0); /* get output of src-unit */

			*p = pSrc; /* route! */
		} /* error if src-unit is local */
	} else {
		for (i = 0; i < voiceCount; i++) { /* route value for every inner unit of local unit */
			p = getParamAddress(u, type, option, i);
			pSrc = getValAddress(src, ((src->scope == usGLOBAL) ? 0 : i)); /* if src is global, all values are routed to the same value */

			*p = pSrc;
		}
	}
}