Пример #1
0
JNIEXPORT jint JNICALL Java_com_example_audiotest_module_NSWrapper_nsProcess
  (JNIEnv *env, jobject thiz, jshortArray speechFrame, jshortArray speechFrameHB, jshortArray outputFrame, jshortArray outputFrameHB, jint sampleCount)
{
	int status = -1;
	jshort* speech_frame = (*env)->GetShortArrayElements(env, speechFrame, NULL);
	jshort* speech_frame_h = NULL;
	if(NULL != speechFrameHB){
		speech_frame_h = (*env)->GetShortArrayElements(env, speechFrameHB, NULL);
	}
	jshort* output_frame = (*env)->GetShortArrayElements(env, outputFrame, NULL);
	jshort* output_frame_h = NULL;
	if(NULL != outputFrameHB){
		output_frame_h = (*env)->GetShortArrayElements(env, outputFrameHB, NULL);
	}

	pthread_mutex_lock(&ns_process_lock);
	status = ns_process(speech_frame, speech_frame_h, output_frame, output_frame_h, sampleCount);
	pthread_mutex_unlock(&ns_process_lock);

	(*env)->ReleaseShortArrayElements(env, speechFrame, speech_frame, 0);
	if(NULL != speechFrameHB){
		(*env)->ReleaseShortArrayElements(env, speechFrameHB, speech_frame_h, 0);
	}
	(*env)->ReleaseShortArrayElements(env, outputFrame, output_frame, 0);
	if(NULL != outputFrameHB){
		(*env)->ReleaseShortArrayElements(env, outputFrameHB, output_frame_h, 0);
	}
	return status;
}
Пример #2
0
static void
hs_givehelp(struct Luser *lptr, int ac, char **av)

{
	struct Luser *serviceptr;

	if (!irccmp(av[0], "HELP"))
	{
		if (ac >= 2)
			GiveHelp(n_HelpServ, lptr->nick, av[1], NODCC);
		else
			GiveHelp(n_HelpServ, lptr->nick, NULL, NODCC);
	}
	else
	{
		char  str[MAXLINE + 1];

		if (!(serviceptr = GetService(av[0])))
		{
			/*
			 * this shouldn't happen unless they entered a partial
			 * service nick, and the abbreviation code allowed it
			 * to go through
			 */
			notice(n_HelpServ, lptr->nick,
			       "[\002%s\002] is an invalid service nickname",
			       av[0]);
			return;
		}

		if (ac < 2)
			strlcpy(str, "HELP", sizeof(str));
		else if (ac >= 3)
		{
			ircsprintf(str, "HELP %s %s", av[1], av[2]);
		}
		else
		{
			ircsprintf(str, "HELP %s", av[1]);
		}

		if (serviceptr == Me.osptr)
			os_process(lptr->nick, str, NODCC);

#ifdef NICKSERVICES

		if (serviceptr == Me.nsptr)
			ns_process(lptr->nick, str);

#ifdef CHANNELSERVICES

		if (serviceptr == Me.csptr)
			cs_process(lptr->nick, str);
#endif

#ifdef MEMOSERVICES

		if (serviceptr == Me.msptr)
			ms_process(lptr->nick, str);
#endif

#endif /* NICKSERVICES */

#ifdef STATSERVICES

		if (serviceptr == Me.ssptr)
			ss_process(lptr->nick, str);

#endif /* STATSERVICES */

#ifdef SEENSERVICES

		if (serviceptr == Me.esptr)
			es_process(lptr->nick, str);

#endif /* SEENSERVICES */

#ifdef GLOBALSERVICES

		if (serviceptr == Me.gsptr)
			gs_process(lptr->nick, str);

#endif /* GLOBALSERVICES */

	} /* else */
} /* hs_givehelp() */