Exemple #1
0
JNIEXPORT jint JNICALL Java_org_puredata_core_PdBase_process__I_3S_3S
(JNIEnv *env, jclass cls, jint ticks,
    jshortArray inBuffer, jshortArray outBuffer) {
  if (!inBuffer || !outBuffer) return -10;
  short *pIn = (*env)->GetShortArrayElements(env, inBuffer, NULL);
  short *pOut = (*env)->GetShortArrayElements(env, outBuffer, NULL);
  pthread_mutex_lock(&mutex);
  jint err = libpd_process_short((int) ticks, pIn, pOut);
  pthread_mutex_unlock(&mutex);
  (*env)->ReleaseShortArrayElements(env, inBuffer, pIn, 0);
  (*env)->ReleaseShortArrayElements(env, outBuffer, pOut, 0);
  return err;
}
int
adin_read(SP16 * buf, int sampnum)
{	
	int cnt, bufsize;
	bufsize = sampnum * sizeof(SP16);
	
	if (bufsize > BUFSIZE) bufsize = BUFSIZE;
	
	SP16 inbuf[bufsize];
	
	
	if (pa_simple_read(r, inbuf, bufsize, &errorpa) < 0) {
		printf("Error: adin_pulseaudio: pa_simple_read() failed: %s\n", pa_strerror(errorpa));
		return (-2);
	}
	
	libpd_process_short(4, inbuf, buf);

	cnt = bufsize / sizeof(SP16);
	return(cnt);
}
Exemple #3
0
bool PdBase::processShort(int ticks, short* inBuffer, short* outBuffer) {
    return libpd_process_short(ticks, inBuffer, outBuffer) == 0;
}
Exemple #4
0
bool PdBase::processShort(int ticks, const short* inBuffer, short* outBuffer) {
    _LOCK();
    bool ret = libpd_process_short(ticks, inBuffer, outBuffer) == 0;
    _UNLOCK();
    return ret;
}