void *max_jit_gl_videoplane_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_gl_videoplane *x;
	void *jit_ob;
	long attrstart;
	t_symbol *dest_name_sym = _jit_sym_nothing;

	if (x = (t_max_jit_gl_videoplane *)max_jit_obex_new(max_jit_gl_videoplane_class, gensym("jit_gl_videoplane")))
	{
		//get normal args
		attrstart = max_jit_attr_args_offset(argc,argv);
		if (attrstart&&argv)
		{
			jit_atom_arg_getsym(&dest_name_sym, 0, attrstart, argv);
		}

		if (jit_ob = jit_object_new(gensym("jit_gl_videoplane"), dest_name_sym))
		{
			max_jit_obex_jitob_set(x, jit_ob);
			max_jit_obex_dumpout_set(x, outlet_new(x,NULL));
			max_jit_attr_args(x, argc, argv);

			// attach the jit object's ob3d to a new outlet for sending drawing messages.
			max_jit_ob3d_attach(x, jit_ob, outlet_new(x, "jit_matrix"));
		}
		else
		{
			jit_object_error((t_object *)x,"jit.gl.videoplane: could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 2
0
void *max_hoa_gl_scope_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_hoa_gl_scope* x = NULL;
	t_jit_object *jit_ob = NULL;
	long attrstart;
	t_symbol *dest_name_sym = _jit_sym_nothing;
	t_atom_long order = 1;

	if ((x = (t_max_hoa_gl_scope *)max_jit_object_alloc(max_hoa_gl_scope_class, gensym("hoa_gl_scope"))))
	{
		// get first normal arg, the destination name
		attrstart = max_jit_attr_args_offset(argc,argv);
		
		if (argc >= 1 && argv)
		{
			if (atom_gettype(argv) == A_LONG)
			{
				order = jit_atom_getlong(argv);
			}
			if (argc >= 2)
			{
				jit_atom_arg_getsym(&dest_name_sym, 1, attrstart, argv);
			}
		}
		
		jit_ob = (t_jit_object*)jit_object_new(gensym("hoa_gl_scope"), dest_name_sym, x);

		// instantiate Jitter object with dest_name arg
		//if ((jit_ob = (t_jit_object*)jit_object_new(gensym("hoa_gl_scope"), dest_name_sym)))
		if (jit_ob)
		{
			// set internal jitter object instance
			max_jit_obex_jitob_set(x, jit_ob);
			
			x->f_scope = new Hoa3D::Scope(order, 100, 199);
			dsp_setup((t_pxobject *)x, x->f_scope->getNumberOfHarmonics());
			
			x->f_signals = new double[x->f_scope->getNumberOfHarmonics() * SYS_MAXBLKSIZE];
			x->f_index = 0;
			
			max_jit_attr_args(x, argc, argv);
		} 
		else 
		{
			error("hoa.gl.scope3D~: could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 3
0
void *max_jit_unpack_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_unpack *x;
	void *o,*m,*p,*mop;
	t_jit_matrix_info info;
	long i;

	if (x=(t_max_jit_unpack *)max_jit_obex_new(max_jit_unpack_class,gensym("jit_unpack"))) {
		if (o=jit_object_new(gensym("jit_unpack"))) {
			max_jit_obex_jitob_set(x,o);
			max_jit_obex_dumpout_set(x,outlet_new(x,NULL));
			max_jit_mop_setup(x);
			max_jit_mop_inputs(x);
			
			if (argc&&(i=jit_atom_getlong(argv))) {
				CLIP(i,1,JIT_MATRIX_MAX_PLANECOUNT);
			} else {
				i=4;
			}
			
			x->outlets = i;
			max_jit_mop_variable_addoutputs(x,i);
			
			while (i) {
				p=max_jit_mop_getoutput(x,i);
				jit_attr_setlong(p,gensym("minplanecount"),1);
				jit_attr_setlong(p,gensym("maxplanecount"),1);
				i--;
			}
		
			max_jit_mop_outputs(x);
			max_jit_mop_matrix_args(x,argc,argv);
			//set adapt true if only plane argument(should come after matrix_args call)
			if ((max_jit_attr_args_offset(argc,argv)<=1) &&
				(mop=max_jit_obex_adornment_get(x,_jit_sym_jit_mop)))
			{		
				jit_attr_setlong(mop,_jit_sym_adapt,1);
			}
			
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.unpack: could not allocate object");
			freeobject(x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 4
0
void *max_jit_peek_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_peek *x;
	long attrstart,i;
	t_atom a;

	if (x = (t_max_jit_peek *)max_jit_obex_new(max_jit_peek_class,NULL)) { //only max object, no jit object
		for (i=0; i<=JIT_MATRIX_MAX_DIMCOUNT+1; i++)
			x->vectors[i] = NULL;

		x->matrix_name = _jit_sym_nothing;
		x->dimcount = 2;
		x->plane = 0;
		x->interp = 0;
		x->normalize = 0;

		x->inperform = 0;
		x->mvalid = 0;
		x->mdata = 0;

		attrstart = max_jit_attr_args_offset(argc,argv);
		if (attrstart&&argv) {
			t_atom_long al;
			jit_atom_arg_getsym(&x->matrix_name, 0, attrstart, argv);
			if (!jit_atom_arg_getlong(&al, 1, attrstart, argv)) {
				C74_ASSERT_FITS_LONG(al);
				x->dimcount = (long) al;
			}
			if (!jit_atom_arg_getlong(&al, 2, attrstart, argv)) {
				C74_ASSERT_FITS_LONG(al);
				x->plane = (long) al;
			}
			jit_atom_setsym(&a,x->matrix_name);
			max_jit_peek_matrix_name(x,NULL,1,&a);
		}

		CLIP_ASSIGN(x->dimcount,0,JIT_MATRIX_MAX_DIMCOUNT);
		CLIP_ASSIGN(x->dimcount,0,32); //maximum signal inputs

		max_jit_attr_args(x,argc,argv); //handle attribute args

		dsp_setup((t_pxobject *)x,x->dimcount);
		max_jit_obex_dumpout_set(x, outlet_new(x,0L)); //general purpose outlet(rightmost)
		outlet_new((t_object *)x, "signal"); //signal output
	}
	return (x);
}
Exemplo n.º 5
0
void *max_jit_gl_spout_receiver_new(t_symbol *s, long argc, t_atom *argv)
{
	UNREFERENCED_PARAMETER(s);

	t_max_jit_gl_spout_receiver *x;
	void *jit_ob;
	long attrstart;
	t_symbol *dest_name_sym = _jit_sym_nothing;

	if ((x = (t_max_jit_gl_spout_receiver *)max_jit_object_alloc(max_jit_gl_spout_receiver_class, gensym("jit_gl_spout_receiver"))))
	{
		// get first normal arg, the destination name
		attrstart = max_jit_attr_args_offset((short)argc,argv);
		if (attrstart&&argv) {
			jit_atom_arg_getsym(&dest_name_sym, 0, attrstart, argv);

		}
		
		// instantiate Jitter object with dest_name arg
		if ((jit_ob = jit_object_new(gensym("jit_gl_spout_receiver"), dest_name_sym))) {

			// set internal jitter object instance
			max_jit_obex_jitob_set(x, jit_ob);
			
			// process attribute arguments 
			max_jit_attr_args(x, (short)argc, argv);		

			// add a general purpose outlet (rightmost)
			x->dumpout = outlet_new(x,NULL);
			max_jit_obex_dumpout_set(x, x->dumpout);

			// Texture outlet
			x->texout = outlet_new(x, "jit_gl_texture");

			// For first sender detection
			x->b_Started = false;

		} 
		else {
			error("jit_gl_spout_receiver : could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 6
0
void *max_jit_coerce_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_coerce *x;
	void *o,*m,*mop,*p;
	t_jit_matrix_info info;
	long attrstart;
	t_atom_long planecount=4;
	t_symbol *type=_jit_sym_char;

	if (x=(t_max_jit_coerce *)max_jit_obex_new(max_jit_coerce_class,gensym("jit_coerce"))) {
		if (o=jit_object_new(gensym("jit_coerce"))) {
			max_jit_obex_jitob_set(x,o);
			max_jit_obex_dumpout_set(x,outlet_new(x,NULL));
			max_jit_mop_setup(x);
			max_jit_mop_inputs(x);
			max_jit_mop_outputs(x);
			mop=max_jit_obex_adornment_get(x,_jit_sym_jit_mop);
			jit_attr_setlong(mop,gensym("adapt"),0);
			jit_attr_setlong(mop,gensym("caninplace"),0);
			jit_attr_setlong(mop,gensym("outputmode"),1);
			//make the output matrix a data reference w/NULL data pointer
			attrstart = max_jit_attr_args_offset(argc,argv);
			if (attrstart&&argv) {
				jit_atom_arg_getlong(&planecount, 0, attrstart, argv);
				jit_atom_arg_getsym(&type, 1, attrstart, argv);
				jit_attr_setlong(o,_jit_sym_planecount,planecount);
				jit_attr_setsym(o,_jit_sym_type,type);
			}
			m = max_jit_mop_getoutput(x,1);
			jit_object_method(m,_jit_sym_getinfo,&info);
			jit_object_method(m,gensym("freedata"));
			info.flags = JIT_MATRIX_DATA_REFERENCE;
			info.size = 0;
			p = NULL;
			jit_object_method(m,_jit_sym_setinfo_ex,&info);
			jit_object_method(m,_jit_sym_data,p);
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.coerce: could not allocate object");
			freeobject((t_object *) x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 7
0
void *max_jit_gl_spoutsender_new(t_symbol *s, long argc, t_atom *argv)
{
	// Sender
	t_max_jit_gl_spoutsender *x;
	void *jit_ob;
	long attrstart;
	t_symbol *dest_name_sym = _jit_sym_nothing;

	if ((x = (t_max_jit_gl_spoutsender *)max_jit_object_alloc(max_jit_gl_spoutsender_class, gensym("jit_gl_spoutsender"))))
	{
		// get first normal arg, the destination name
		attrstart = max_jit_attr_args_offset((SHORT)argc, argv);
		if (attrstart&&argv) 
		{
			jit_atom_arg_getsym(&dest_name_sym, 0, attrstart, argv);
		}
		
		// instantiate Jitter object with dest_name arg
		if ((jit_ob = jit_object_new(gensym("jit_gl_spoutsender"), dest_name_sym)))
		{
			// set internal jitter object instance
			max_jit_obex_jitob_set(x, jit_ob);
			
			// add a general purpose outlet (rightmost)
			max_jit_obex_dumpout_set(x, outlet_new(x,NULL));
			
			// process attribute arguments 
			max_jit_attr_args(x, (SHORT)argc, argv);
			
			// create new proxy inlet.
			max_jit_obex_proxy_new(x, 0);
		} 
		else {
			error("jit.gl.spout_sender: could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}


	return (x);
}
Exemplo n.º 8
0
void *max_jit_gl_cube_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_gl_cube *x;
	void *jit_ob;
	long attrstart;
	t_symbol *dest_name_sym = _jit_sym_nothing;

	if (x = (t_max_jit_gl_cube *)max_jit_obex_new(max_jit_gl_cube_class, gensym("jit_gl_cube"))) 
	{
		//get normal args
		attrstart = max_jit_attr_args_offset(argc,argv);
		if (attrstart&&argv) 
		{
			jit_atom_arg_getsym(&dest_name_sym, 0, attrstart, argv);
		}

		if (jit_ob = jit_object_new(gensym("jit_gl_cube"), dest_name_sym)) 
		{
			max_jit_obex_jitob_set(x, jit_ob);
			max_jit_obex_dumpout_set(x, outlet_new(x,NULL));
			
			// get attribute args. 
			// typical but not strictly necessary because this sample object has no attributes.
			max_jit_attr_args(x, argc, argv);		
			
			// attach the jit object's ob3d to a new outlet for sending drawing messages.	
			// this outlet is used in matrixoutput mode.
			max_jit_ob3d_attach(x, jit_ob, outlet_new(x, "jit_matrix"));
		} 
		else 
		{
			error("jit.gl.cube: could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}
	return (x);
}