void TTDataRampCallback(void *o, TTUInt32 n, TTFloat64 *rampedArray) { TTDataPtr aData = (TTDataPtr)o; TTValue rampedValue; TTBoolean isRunning; TTUInt16 i; rampedValue.resize(n); for (i = 0; i < n; i++) rampedValue[i] = rampedArray[i]; /******************* TL: Commenting out as these processes need to be moved to the typed methods // TODO: This need to be moved to the typed method for @type integer // Why is it truncated rather than rounded? if (aData->mType == kTTSym_integer) rampedValue.truncate(); // TODO: This also need to be moved to the typed methods if (aData->mRepetitionsFilter) if (aData->mValue == rampedValue) return; *******************/ // Set internal value - this calls the appropriate typed setter method in TTDataTypedMethods.cpp aData->setAttributeValue(kTTSym_value, rampedValue); // Update the ramp status attribute aData->mRamper.get(kTTSym_running, isRunning); if (aData->mRampStatus != isRunning) { aData->mRampStatus = isRunning; // Stop the ramp if (!aData->mRampStatus) aData->mRamper.send(kTTSym_Stop); aData->notifyObservers(kTTSym_rampStatus, aData->mRampStatus); } }
void in_subscribe(TTPtr self) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; TTAddress inputAddress; TTAddress outputAddress; TTValue v, args; TTNodePtr returnedNode = NULL; TTNodePtr returnedContextNode = NULL; TTAddress returnedAddress, parentAddress; TTDataPtr aData; TTString formatDescription, sInstance; SymbolPtr inDescription; inputAddress = TTAddress("in").appendInstance(EXTRA->instance); // if the subscription is successful if (!jamoma_subscriber_create((ObjectPtr)x, x->wrappedObject, inputAddress, &x->subscriberObject, returnedAddress, &returnedNode, &returnedContextNode)) { // get patcher x->patcherPtr = jamoma_patcher_get((ObjectPtr)x); // update instance symbol in case of duplicate instance EXTRA->instance = returnedAddress.getInstance(); // observe /parent/out address in order to link/unlink with an Input object below returnedNode->getParent()->getAddress(parentAddress); outputAddress = parentAddress.appendAddress(TTAddress("out")).appendInstance(EXTRA->instance); x->wrappedObject->setAttributeValue(TTSymbol("outputAddress"), outputAddress); #ifdef JCOM_IN_TILDE // make internal data to return amplitude v = TTValue(0., 1.); formatDescription = "instant amplitude of %s input"; sInstance = EXTRA->instance.c_str(); jamoma_edit_string_instance(formatDescription, &inDescription, sInstance); makeInternals_data(x, returnedAddress, TTSymbol("amplitude"), NULL, x->patcherPtr, kTTSym_return, (TTObjectBasePtr*)&aData); aData->setAttributeValue(kTTSym_type, kTTSym_decimal); aData->setAttributeValue(kTTSym_tag, kTTSym_generic); aData->setAttributeValue(kTTSym_rangeBounds, v); aData->setAttributeValue(kTTSym_description, TTSymbol(inDescription->s_name)); aData->setAttributeValue(kTTSym_dataspace, TTSymbol("gain")); aData->setAttributeValue(kTTSym_dataspaceUnit, TTSymbol("linear")); // make internal data to parameter in/amplitude/active makeInternals_data(x, returnedAddress, TTSymbol("amplitude/active"), gensym("return_amplitude_active"), x->patcherPtr, kTTSym_parameter, (TTObjectBasePtr*)&aData); aData->setAttributeValue(kTTSym_type, kTTSym_integer); aData->setAttributeValue(kTTSym_tag, kTTSym_generic); v = TTValue((int)EXTRA->pollInterval); aData->setAttributeValue(kTTSym_valueDefault, v); v = TTValue(0, 1000); aData->setAttributeValue(kTTSym_rangeBounds, v); aData->setAttributeValue(kTTSym_rangeClipmode, kTTSym_low); aData->setAttributeValue(kTTSym_description, TTSymbol("set the sample rate of the amplitude follower")); // launch the clock to update amplitude regulary EXTRA->clock = clock_new(x, (method)in_update_amplitude); if (EXTRA->pollInterval) clock_delay(EXTRA->clock, EXTRA->pollInterval); #endif // expose bypass and mute attributes of TTInput as TTData in the tree structure x->subscriberObject->exposeAttribute(x->wrappedObject, kTTSym_bypass, kTTSym_parameter, &aData); aData->setAttributeValue(kTTSym_type, kTTSym_boolean); aData->setAttributeValue(kTTSym_tag, kTTSym_generic); aData->setAttributeValue(kTTSym_description, TTSymbol("When active, this attribute bypasses the model's processing algtorithm, letting incoming signal pass through unaffected")); v = TTValue(0); aData->setAttributeValue(kTTSym_valueDefault, v); x->subscriberObject->exposeAttribute(x->wrappedObject, kTTSym_mute, kTTSym_parameter, &aData); aData->setAttributeValue(kTTSym_type, kTTSym_boolean); aData->setAttributeValue(kTTSym_tag, kTTSym_generic); aData->setAttributeValue(kTTSym_description, TTSymbol("When active, this attribute turns off model's inputs.")); v = TTValue(0); aData->setAttributeValue(kTTSym_valueDefault, v); } }