TTSampleMatrix::TTSampleMatrix(const TTValue& arguments) : TTMatrix(arguments), mSampleRate(ttEnvironment->mSampleRate) { this->setTypeWithoutResize(kTypeFloat64); this->setElementCountWithoutResize(1); this->resize(); this->mUserCount = 0; this->mBufferPoolStage = kSM_Idle; addAttributeWithGetterAndSetter(NumChannels, kTypeInt32); addAttributeWithGetterAndSetter(LengthInSeconds, kTypeFloat64); addAttributeWithGetterAndSetter(LengthInSamples, kTypeInt32); addAttribute(SampleRate, kTypeUInt32); addAttribute( UserCount, kTypeUInt16); addAttributeProperty( UserCount, readOnly, YES); addMessage(normalize); addMessageWithArguments(fill); addMessageWithArguments(getValueAtIndex); registerMessage("peek", (TTMethod)&TTSampleMatrix::getValueAtIndex); registerMessage("peeki", (TTMethod)&TTSampleMatrix::getValueAtIndex); addMessageWithArguments(setValueAtIndex); registerMessage("poke", (TTMethod)&TTSampleMatrix::setValueAtIndex); addMessageWithArguments(load); // TODO: more messages to implement // "readFile" (requires libsndfile straightening-out) // "writeFile" (requires libsndfile straightening-out) // a way to query attributes: for example what is the sr and bpm of an AIFF file? }
TTAudioObjectBase::TTAudioObjectBase(const TTValue& arguments) : TTObjectBase(arguments), mMaxNumChannels(0), attrMute(0), inputArray(kTTSym_audiosignalarray,2), outputArray(kTTSym_audiosignalarray,2), startProcessingTime(0.0), accumulatedProcessingTime(0.0), accumulatedProcessingCalls(0.0) { // Convention: 'Public' attribute names begin with a capital letter, 'Private' attribute names begin with a lower case letter // registerAttribute("maxNumChannels", kTypeUInt8, &maxNumChannels, (TTSetterMethod)&TTAudioObjectBase::setMaxNumChannels); addAttributeWithSetter(MaxNumChannels, kTypeUInt16); addAttributeProperty(MaxNumChannels, defaultValue, 1); registerAttribute(kTTSym_sampleRate, kTypeUInt32, &sr, (TTSetterMethod)&TTAudioObjectBase::setSr); registerAttribute("bypass", kTypeBoolean, &attrBypass, (TTSetterMethod)&TTAudioObjectBase::setBypass); registerAttribute("mute", kTypeBoolean, &attrMute, (TTSetterMethod)&TTAudioObjectBase::setMute); registerMessage("test", (TTMethod)&TTAudioObjectBase::test); registerMessage("calculate", (TTMethod)&TTAudioObjectBase::calculateMessage); registerMessage("resetBenchmarking", (TTMethod)&TTAudioObjectBase::resetBenchmarking, kTTMessagePassNone); registerMessage("getProcessingBenchmark", (TTMethod)&TTAudioObjectBase::getProcessingBenchmark); // Set Defaults... setAttributeValue(kTTSym_sampleRate, ttEnvironment->mSampleRate); setProcess(&TTAudioObjectBase::bypassProcess); setCalculate(&TTAudioObjectBase::defaultCalculateMethod); setAttributeValue("bypass", NO); }
TTClock::TTClock(const TTValue& arguments) : TTObjectBase(arguments), mDuration(0.), mOffset(0.), mSpeed(1.), mExternalTick(NO), mInfinite(NO), mRunning(NO), mPaused(NO), mPosition(0.), mDate(0.), mCallback(NULL), mBaton(NULL) { mCallback = TTClockPositionCallback((TTPtr)arguments[0]); mBaton = arguments[1]; addAttribute(Name, kTypeSymbol); addAttributeProperty(Name, readOnly, YES); addAttribute(Version, kTypeSymbol); addAttributeProperty(Version, readOnly, YES); addAttribute(Author, kTypeSymbol); addAttributeProperty(Author, readOnly, YES); addAttributeWithSetter(Duration, kTypeFloat64); addAttributeWithSetter(Offset, kTypeFloat64); addAttributeWithSetter(Speed, kTypeFloat64); addAttribute(ExternalTick, kTypeBoolean); addAttribute(Infinite, kTypeBoolean); addAttribute(Stretchable, kTypeBoolean); addAttributeProperty(Stretchable, readOnly, YES); addAttribute(Running, kTypeBoolean); addAttributeProperty(Running, readOnly, YES); addAttribute(Paused, kTypeBoolean); addAttributeProperty(Paused, readOnly, YES); addAttribute(Position, kTypeFloat64); addAttributeProperty(Position, readOnly, YES); addAttribute(Date, kTypeFloat64); addAttributeProperty(Date, readOnly, YES); addMessage(Go); addMessage(Stop); addMessage(Pause); addMessage(Resume); addMessage(Tick); }
TTProtocol::TTProtocol(const TTValue& arguments) : TTObjectBase(arguments), mRunning(NO), mSelectedApplication(kTTSymEmpty) { mApplicationManager = arguments[0]; mMonitorInCallback = arguments[1]; mMonitorOutCallback = arguments[2]; registerAttribute(TTSymbol("applicationNames"), kTypeLocalValue, NULL, (TTGetterMethod)& TTProtocol::getApplicationNames); addAttribute(Name, kTypeSymbol); addAttributeProperty(Name, readOnly, YES); addAttribute(Version, kTypeSymbol); addAttributeProperty(Version, readOnly, YES); addAttribute(Author, kTypeSymbol); addAttributeProperty(Author, readOnly, YES); addAttribute(Get, kTypeBoolean); addAttributeProperty(Get, readOnly, YES); addAttribute(Set, kTypeBoolean); addAttributeProperty(Set, readOnly, YES); addAttribute(Listen, kTypeBoolean); addAttributeProperty(Listen, readOnly, YES); addAttribute(Discover, kTypeBoolean); addAttributeProperty(Discover, readOnly, YES); addAttribute(DiscoverAll, kTypeBoolean); addAttributeProperty(DiscoverAll, readOnly, YES); addAttribute(Monitor, kTypeBoolean); addMessageWithArguments(ApplicationRegister); addMessageWithArguments(ApplicationRename); addMessageWithArguments(ApplicationUnregister); addMessageWithArguments(ApplicationSelect); addMessage(ApplicationSelectLocal); addMessageWithArguments(isRegistered); addMessageWithArguments(Scan); addMessageWithArguments(Run); addMessageWithArguments(Stop); }
TTData::TTData(const TTValue& arguments) : TTCallback(arguments), mValue(TTValue(0.0)), mValueDefault(TTValue(0.0)), mValueStepsize(TTValue(0.1)), // this default value is expected in #TTData::setType method mType(kTTSym_generic), mTags(TTValue(kTTSym_none)), mPriority(0), mDescription(kTTSym_none), mRepetitionsFilter(NO), mActive(YES), mInitialized(NO), mRangeBounds(0.0, 1.0), // this default value is expected in #TTData::setType method mRangeClipmode(kTTSym_none), mDynamicInstances(NO), mInstanceBounds(0, -1), mRampDrive(kTTSym_none), mRampDriveDefault(TTSymbol("system")), #ifndef TT_NO_DSP mRampFunction(kTTSym_none), // this default value is expected in #TTData::setType method #endif mRampStatus(NO), mDataspace(kTTSym_none), mDataspaceUnit(kTTSym_none), mService(kTTSymEmpty) { if (arguments.size() == 1) mService = arguments[0]; registerAttribute(kTTSym_value, kTypeNone, NULL, (TTGetterMethod)&TTData::getValue, (TTSetterMethod)&TTData::setGenericValue); addAttributeWithGetterAndSetter(ValueDefault, kTypeNone); addAttributeWithGetterAndSetter(ValueStepsize, kTypeNone); addAttributeWithSetter(Type, kTypeSymbol); addAttributeWithSetter(Tags, kTypeLocalValue); addAttributeWithSetter(Priority, kTypeInt32); addAttributeWithSetter(Description, kTypeSymbol); addAttributeWithSetter(RepetitionsFilter, kTypeBoolean); addAttributeWithSetter(Active, kTypeBoolean); addAttribute(Initialized, kTypeBoolean); addAttributeProperty(Initialized, readOnly, YES); addAttributeProperty(Initialized, hidden, YES); addAttributeWithSetter(RangeBounds, kTypeLocalValue); addAttributeWithSetter(RangeClipmode, kTypeSymbol); // this is a temporary solution for Blue Yéti addAttribute(DynamicInstances, kTypeBoolean); addAttributeProperty(DynamicInstances, hidden, YES); addAttributeWithSetter(InstanceBounds, kTypeLocalValue); addAttributeProperty(InstanceBounds, hidden, YES); addAttributeWithSetter(RampDrive, kTypeSymbol); addAttribute(RampDriveDefault, kTypeSymbol); addAttributeProperty(RampDriveDefault, hidden, YES); #ifndef TT_NO_DSP addAttributeWithSetter(RampFunction, kTypeSymbol); #endif addAttribute(RampFunctionParameters, kTypeLocalValue); addAttributeProperty(RampFunctionParameters, readOnly, YES); addAttribute(RampStatus, kTypeBoolean); addAttributeProperty(RampStatus, readOnly, YES); addAttributeProperty(RampStatus, hidden, YES); // hidden for Max addAttributeWithSetter(Dataspace, kTypeSymbol); addAttributeWithSetter(DataspaceUnit, kTypeSymbol); addAttribute(Service, kTypeSymbol); //addAttributeProperty(Service, hidden, YES); // we don't hide this attribute to mirror it (even if we want to hide it for Max) registerMessage(kTTSym_Init, (TTMethod)&TTData::GenericInit, kTTMessagePassNone); addMessageWithArguments(Inc); addMessageWithArguments(Dec); addMessageWithArguments(Command); addMessageProperty(Command, hidden, YES); addMessageWithArguments(RampSet); addMessageProperty(RampSet, hidden, YES); addMessageWithArguments(RampTarget); addMessageProperty(RampTarget, hidden, YES); addMessageWithArguments(RampGo); addMessageProperty(RampGo, hidden, YES); addMessageWithArguments(RampSlide); addMessageProperty(RampSlide, hidden, YES); // needed to be handled by a TTTextHandler addMessageWithArguments(WriteAsText); addMessageProperty(WriteAsText, hidden, YES); mIsSending = NO; mIsOverridingDataspaceUnit = NO; commandMethod = (TTMethodValue)&TTData::GenericCommand; // cache some message and attribute for observer notification this->findAttribute(kTTSym_value, &valueAttribute); this->findAttribute(kTTSym_initialized, &initializedAttribute); // set no time for external ramp drive externalRampTime = 0; }