Exemplo n.º 1
0
void WrappedInputClass_new(TTPtr self, AtomCount argc, AtomPtr argv)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
 	long						attrstart = attr_args_offset(argc, argv);			// support normal arguments
	TTString					sInstance;
	TTValue						v;
	
	// Prepare extra data
	x->extra = (t_extra*)malloc(sizeof(t_extra));
	
	// Get input instance symbol
	if (attrstart && argv) {
		
		jamoma_ttvalue_from_Atom(v, _sym_nothing, attrstart, argv);
		
		v.toString();
		sInstance = TTString(v[0]);
		EXTRA->instance = TTSymbol(sInstance.data());
	}
	else
		EXTRA->instance = kTTSymEmpty;
		
	// Create Input Object and one outlet
	x->outlets = (TTHandle)sysmem_newptr(sizeof(TTPtr));
		
#ifdef JCOM_IN_TILDE

	jamoma_input_create_audio((ObjectPtr)x, &x->wrappedObject);
	 
	dsp_setup((t_pxobject *)x, 1);	
	x->obj.z_misc = Z_NO_INPLACE | Z_PUT_FIRST;
	
	outlet_new((t_pxobject *)x, "signal");
	
	// Prepare memory to store internal datas
	x->internals = new TTHash();
	
	// Prepare extra data for envelope tracking
	EXTRA->clock = NULL;
	EXTRA->pollInterval = 0;	// not active by default
	EXTRA->meter = 0.;
	EXTRA->peak = 0.;

#else
	
	jamoma_input_create((ObjectPtr)x, &x->wrappedObject);
	
	x->outlets[0] = outlet_new(x, 0L);
	
#endif
	
	// handle attribute args
	attr_args_process(x, argc, argv);

	// The following must be deferred because we have to interrogate our box,
	// and our box is not yet valid until we have finished instantiating the object.
	// Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6)
	defer_low((ObjectPtr)x, (method)in_subscribe, NULL, 0, NULL);
}
Exemplo n.º 2
0
void WrappedOutputClass_new(TTPtr self, long argc, t_atom* argv)
{
    WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
    long						attrstart = attr_args_offset(argc, argv);			// support normal arguments
    TTString					sInstance;
    TTValue						v;

    // Prepare extra data
    x->extra = (t_extra*)malloc(sizeof(t_extra));

    // Get input instance symbol
    if (attrstart && argv) {

        jamoma_ttvalue_from_Atom(v, _sym_nothing, attrstart, argv);

        v.toString();
        sInstance = TTString(v[0]);
        EXTRA->instance = TTSymbol(sInstance.data());
    }
    else
        EXTRA->instance = kTTSymEmpty;

    // Create Input Object and one outlet
    x->outlets = (TTHandle)sysmem_newptr(sizeof(TTPtr));

#ifdef J_OUT_TILDE
    jamoma_output_create_audio((t_object*)x, x->wrappedObject);

    dsp_setup((t_pxobject *)x, 1);
    x->obj.z_misc = Z_NO_INPLACE | Z_PUT_FIRST;

    outlet_new((t_pxobject *)x, "signal");

#endif

#ifdef J_OUT_MULTI
    jamoma_output_create_audio((t_object*)x, x->wrappedObject);

    x->outlets[0] = outlet_new(x, 0L);
#endif

#ifndef J_OUT_TILDE
#ifndef J_OUT_MULTI
    jamoma_output_create((t_object*)x, x->wrappedObject);

    x->outlets[0] = outlet_new((t_object*)x, 0L);
#endif
#endif

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

    // The following must be deferred because we have to interrogate our box,
    // and our box is not yet valid until we have finished instantiating the object.
    // Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6)
    // out_subscribe(x);
//	defer_low((t_object*)x, (method)out_subscribe, NULL, 0, NULL);
}
Exemplo n.º 3
0
void addAttributeToXml(TTObjectPtr param, XMLNode xmlNode, TTSymbolPtr attrName)
{
	TTValue		v, vDescr;
	TTString	s;
	TTSymbolPtr descr;

	// get the Value of an attribute and format to string
	v.clear();
	param->getAttributeValue(attrName, v);

	param->getAttributeValue(kTTSym_description, vDescr);
	vDescr.get(0, &descr);
 
	if (attrName == kTTSym_type && descr == TTSymbol("filepath")) {
		xmlNode.addAttribute_(attrName->getCString(), "filepath");
	} else {
		v.toString();
		v.get(0, s);
		// add this attribute in xml tree
		xmlNode.addAttribute_(attrName->getCString(), s.data());
	}
}
Exemplo n.º 4
0
TTErr TTData::WriteAsText(const TTValue& inputValue, TTValue& outputValue)
{
    TTObject o = inputValue[0];
	TTTextHandlerPtr aTextHandler = (TTTextHandlerPtr)o.instance();
    if (!aTextHandler)
		return kTTErrGeneric;
    
	TTString		*buffer;
	TTValue			toString;
	TTString		line;

	buffer = aTextHandler->mWriter;
	
	// Type
	*buffer += "\t\t\t<td class =\"instructionType\">";
	*buffer += this->mType.c_str();
	*buffer += "</td>";

	// range/bounds
	toString = this->mRangeBounds;
	toString.toString();
	line = TTString(toString[0]);
	
	if ( (this->mType == kTTSym_integer) || (this->mType == kTTSym_boolean) || (this->mType == kTTSym_decimal) || (this->mType == kTTSym_generic) ) {
		*buffer +="\t\t\t<td class =\"instructionRangeBounds\">";
		*buffer +=line.data();
		*buffer += "</td>";
	}
	else
		*buffer += "\t\t\t<td class = \"instructionRangeBounds\"> N/A </td>";

	// clipmode
	*buffer += "\t\t\t<td class =\"instructionRangeClipmode\">";
	*buffer += this->mRangeClipmode.c_str();
	*buffer += "</td>";
    
	// ramp/drive
	*buffer += "\t\t\t<td class =\"instructionRampDrive\">";
	*buffer += this->mRampDrive.c_str();
	*buffer += "</td>";
#ifndef TT_NO_DSP	
	// ramp/function
	*buffer += "\t\t\t<td class =\"instructionRampFunction\">";
	*buffer += this->mRampFunction.c_str();
	*buffer += "</td>";
#endif
	// dataspace
	*buffer += "\t\t\t<td class =\"instructionDataspace\">";
	*buffer += this->mDataspace.c_str();
	*buffer += "</td>";
	
	// dataspace/unit
	*buffer += "\t\t\t<td class =\"instructionDataspaceUnit\">";
	*buffer += this->mDataspaceUnit.c_str();
	*buffer += "</td>";
	
	// repetitions/filter
	toString = this->mRepetitionsFilter;
	toString.toString();
	line = TTString(toString[0]);
	*buffer += "\t\t\t<td class =\"instructionRepetitionsFilter\">";
	*buffer += line.data();
	*buffer += "</td>";
	
	// description
	*buffer += "\t\t\t<td class =\"instructionDescription\">";
	*buffer += this->mDescription.c_str();
	*buffer += "</td>";
	return kTTErrNone;
}