示例#1
0
void tralala_paintStrncatPanel(char *dst, long argc, t_atom *argv)
{
    long k = 0;
    char *p = NULL;
    
    if (!(atom_gettext(argc - 1, argv + 1, &k, &p, OBEX_UTIL_ATOM_GETTEXT_SYM_NO_QUOTE))) {
        strncat_zero(dst, p, TLL_STRING_SIZE);
        strncat_zero(dst, "\n", TLL_STRING_SIZE);
        sysmem_freeptr(p);
    }
}
示例#2
0
void hub_getstate(t_hub *x)
{
	subscriberList*		subscriber = x->subscriber;	// head of the linked list
	subscriberIterator	i;
	t_subscriber*		t;
	char*				text = NULL;
	long				textsize = 0;

	if(!x->textEditor)
		x->textEditor = (t_object*)object_new(_sym_nobox, _sym_jed, x, 0);
	
	if(!x->textSize){
		x->textSize = 4096;
		x->text = (char*)malloc(sizeof(char) * x->textSize);
	}
	x->text[0] = 0;
	
	critical_enter(0);
	for(i = subscriber->begin(); i != subscriber->end(); ++i) {
		t = *i;
		if(t->type == jps_subscribe_parameter){
			long	ac = NULL; 
			t_atom* av = NULL;
			
			object_attr_getvalueof(t->object, jps_value, &ac, &av);		// get
			atom_gettext(ac, av, &textsize, &text, 0);
			
			// this is a really lame way to do this...
			if(strlen(x->text) > (x->textSize - 1024)){
				x->textSize += 4096;
				x->text = (char*)realloc(x->text, x->textSize);
			}
			
			strncat_zero(x->text, x->osc_name->s_name, x->textSize);
			strncat_zero(x->text, "/", x->textSize);
			strncat_zero(x->text, t->name->s_name, x->textSize);
			strncat_zero(x->text, " ", x->textSize);
			strncat_zero(x->text, text, x->textSize);
			strncat_zero(x->text, "\n", x->textSize);

			sysmem_freeptr(text);
			text = NULL;
			textsize = 0;
		}
	}
	critical_exit(0);
	
	object_method(x->textEditor, _sym_settext, x->text, _sym_utf_8);
	object_attr_setchar(x->textEditor, gensym("scratch"), 1); 
	object_attr_setsym(x->textEditor, _sym_title, gensym("jamoma module state"));
	
	sysmem_freeptr(text);
}
示例#3
0
t_max_err jcom_core_attr_setdescription(t_jcom_core_subscriber_extended *x, void *attr, long argc, t_atom *argv)
{
	char*	text = NULL;
	long	textsize = 0;
	
	atom_gettext(argc, argv, &textsize, &text, OBEX_UTIL_ATOM_GETTEXT_SYM_NO_QUOTE);
	if (text && textsize) {
		x->attr_description = SymbolGen(text);
		sysmem_freeptr(text);
	}
	return MAX_ERR_NONE;
}
示例#4
0
t_max_err paramui_setDescription(t_paramui *x, void *attr, long argc, t_atom *argv)
{
	long	textsize = 0;
	char	*text = NULL;

	if (argc) {
		atom_gettext(argc, argv, &textsize, &text, 0);
		x->attr_description = gensym(text);
		sysmem_freeptr(text);
	}
	object_attr_setsym(x->obj_parameter, gensym("description"), x->attr_description);
	return MAX_ERR_NONE;
}
示例#5
0
void threadpool_taskcomplete(t_threadpool *x, t_symbol *s, long ac, t_atom *av)
{	
	long textsize=0;
	char *tmpstr=NULL; 
	// our completion method will be called from our bakground thread
	// we cannot output to a patcher from this thread (ILLEGAL)
	// so we must defer or schedule output to the patcher
	
	atom_gettext(ac,av,&textsize,&tmpstr,0);
	post("threadpool background task (%s) completed in thread %x",tmpstr,systhread_self());
	post("deferring output to the main thread");
	
	defer_low(x,(method)threadpool_taskoutput,gensym("taskoutput"),ac,av);
	//schedule_delay(x,(method)threadpool_taskoutput,gensym("taskoutput"),ac,av);

	if (tmpstr)
		sysmem_freeptr(tmpstr);
}
示例#6
0
void threadpool_dotask(t_threadpool *x, t_symbol *s, long ac, t_atom *av)
{	
	long i;
	double f=0.74;
	double start = systimer_gettime();
	double end;
	long textsize=0;
	char *tmpstr=NULL; 
	
	atom_gettext(ac,av,&textsize,&tmpstr,0);
	
	post("threadpool starting background task (%s)",tmpstr);	
	
	for (i=0;i<100000000;i++) {
		f = sqrt(sin(f)*sin(f) + cos(f)*cos(f));
	}
	
	end = systimer_gettime();
	post("threadpool finished background task (%s) result=%f time=%f",tmpstr,f,end-start);	

	if (tmpstr)
		sysmem_freeptr(tmpstr);
}