Exemplo n.º 1
0
TTSampleMatrix::TTSampleMatrix(TTValue& arguments) : 
	TTMatrix(arguments),
	mSampleRate(44100.0)
{
	this->setType("float64");
	this->setElementCount(1);

	addAttributeWithGetterAndSetter(NumChannels,		kTypeUInt16);
	addAttributeWithGetterAndSetter(Length,				kTypeFloat64);
	addAttributeWithGetterAndSetter(LengthInSamples,	kTypeUInt64);
	addAttribute(SampleRate,							kTypeFloat64);
	
	addMessage(normalize);
	addMessageWithArguments(fill);

	addMessageWithArguments(getValueAtIndex);
	registerMessage("peek", (TTMethod)&TTSampleMatrix::getValueAtIndex);
	registerMessage("peeki", (TTMethod)&TTSampleMatrix::getValueAtIndex);

	addMessageWithArguments(setValueAtIndex);
	registerMessage("poke", (TTMethod)&TTSampleMatrix::setValueAtIndex);

	// 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?
}
Exemplo n.º 2
0
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);
}
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?
}
Exemplo n.º 4
0
void Groups::refreshMessage(not_null<HistoryItem*> item) {
	if (!isGrouped(item)) {
		unregisterMessage(item);
		return;
	}
	if (!IsServerMsgId(item->id)) {
		return;
	}
	const auto groupId = item->groupId();
	const auto i = _groups.find(groupId);
	if (i == end(_groups)) {
		registerMessage(item);
		return;
	}
	auto &items = i->second.items;
	const auto position = findPositionForItem(items, item);
	auto current = ranges::find(items, item);
	if (current == end(items)) {
		items.insert(position, item);
	} else if (position == current + 1) {
		return;
	} else if (position > current + 1) {
		for (++current; current != position; ++current) {
			std::swap(*(current - 1), *current);
		}
	} else if (position < current) {
		for (; current != position; --current) {
			std::swap(*(current - 1), *current);
		}
	} else {
		Unexpected("Position of item in Groups::refreshMessage().");
	}
	refreshViews(items);
}
Exemplo n.º 5
0
void CmiDirect_assocLocalBuffer(CmiDirectUserHandle *userHandle,void *sendBuf,int sendBufSize) {

    /* one-sided primitives would require registration of memory */
    gni_return_t            status = GNI_RC_SUCCESS;
    
    userHandle->localNode=CmiMyNode();
    userHandle->localBuf=sendBuf;

    if(userHandle->transSize <= SMSG_MAX_MSG)
    {
        status = registerMessage(userHandle->localBuf, userHandle->transSize, 0, &(userHandle->localMdh)); 
        //MEMORY_REGISTER(onesided_hnd, nic_hndl, userHandle->localBuf, userHandle->transSize, &userHandle->localMdh, &omdh, status);
    }
    else if(IsMemHndlZero((GetMemHndl(userHandle->localBuf)))){
        //status = registerMempool(userHandle->localBuf);
        userHandle->localMdh = GetMemHndl(userHandle->localBuf);
    } else
        userHandle->localMdh = GetMemHndl(userHandle->localBuf);
   
    if(status != GNI_RC_SUCCESS) {
        userHandle->localMdh.qword1 = 0;
        userHandle->localMdh.qword2 = 0;
    }

#if CMI_DIRECT_DEBUG
    printHandle(userHandle, "Associate Handler");
#endif
}
Exemplo n.º 6
0
/**
 To be called on the receiver to create a handle and return its number
**/
CmiDirectUserHandle CmiDirect_createHandle(int localNode,void *recvBuf, int recvBufSize, void (*callbackFnPtr)(void *), void *callbackData,double initialValue) {

    gni_return_t            status = GNI_RC_SUCCESS;
    CmiDirectUserHandle userHandle;
    userHandle.handle=1; 
    userHandle.localNode=localNode;
    userHandle.remoteNode= CmiMyNode();
    userHandle.transSize=recvBufSize;
    userHandle.remoteBuf=recvBuf;
    userHandle.initialValue=initialValue;
    userHandle.callbackFnPtr=callbackFnPtr;
    userHandle.callbackData=callbackData;
    if(recvBufSize <= SMSG_MAX_MSG)
    {
        status = registerMessage(userHandle.remoteBuf, recvBufSize, 0, &userHandle.remoteMdh); 
        //MEMORY_REGISTER(onesided_hnd, nic_hndl, userHandle.remoteBuf, recvBufSize, &(userHandle.remoteMdh), &omdh, status);
    }
    else if(IsMemHndlZero((GetMemHndl(userHandle.remoteBuf)))){
        //status = registerMempool(userHandle.remoteBuf);
        userHandle.remoteMdh = GetMemHndl(userHandle.remoteBuf);
    } else
        userHandle.remoteMdh = GetMemHndl(userHandle.remoteBuf);
    if(status != GNI_RC_SUCCESS) {
        userHandle.remoteMdh.qword1 = 0;
        userHandle.remoteMdh.qword2 = 0;
    }

#if REMOTE_EVENT
    userHandle.ack_index =  IndexPool_getslot(&ackPool, userHandle.remoteBuf, 1);
#endif
#if CMI_DIRECT_DEBUG
    //printHandle(&userHandle, "Create Handler");
#endif
    return userHandle;
}
Exemplo n.º 7
0
CmiDirectMemoryHandler CmiDirect_registerMemory(void *buff, int size)
{
    CmiDirectMemoryHandler mem_hndl; 
    gni_return_t        status;
    status = registerMessage(buff, size, 0, &mem_hndl); 
    //MEMORY_REGISTER(onesided_hnd, nic_hndl, buff, size, &mem_hndl, &omdh, status);
    GNI_RC_CHECK("cmidirect register memory fails\n", status);
    return mem_hndl;
}
Exemplo n.º 8
0
TTBuffer::TTBuffer(TTValue& arguments) : 
	TTAudioObject(arguments)
{
	// By convention, the first argument for a TTAudioObject is the number of channels
	// So we'll maintain that here, and then use the second argument for the name of the buffer
	
	TTUInt16	channelCount = 1;
	TTSymbol	name = kTTSymEmpty;
	
	if (arguments.getSize() > 0) {
		arguments.get(0, channelCount);	// TODO: should we limit range?  should zero mean to just reference an existing buffers channelcount?
		if (arguments.getSize() > 1)
			arguments.get(1, name);
	}
	
	if (!gTTBufferNameMap)
		gTTBufferNameMap = new TTHash;
	
	addMessageWithArguments(getNames);
	addAttributeWithSetter(Name, kTypeSymbol);
	
	addAttributeWithGetterAndSetter(NumChannels,		kTypeUInt16);
	addAttributeWithGetterAndSetter(Length,				kTypeFloat64);
	addAttributeWithGetterAndSetter(LengthInSamples,	kTypeUInt64);
//	addAttribute(SampleRate,							kTypeFloat64);
	
	addMessage(normalize);
	addMessageWithArguments(fill);

	addMessageWithArguments(getValueAtIndex);
	registerMessage("peek", (TTMethod)&TTBuffer::getValueAtIndex);

	addMessageWithArguments(setValueAtIndex);
	registerMessage("poke", (TTMethod)&TTBuffer::setValueAtIndex);
	
	// initialize
	setAttributeValue("name", name);
	if (channelCount)
		setAttributeValue("numChannels", channelCount);			
}
Exemplo n.º 9
0
//-----------------------------------------------------------
DatabaserServer::DatabaserServer(const Config& config)
{
	registerMessage();

    std::string tem;
	bool b=config.getValue("gamedatabaseserver",m_RemoteIP);
	assert(b);
	b=config.getValue("gamedatabaseserverpassword",m_PassWord);
	assert(b);
	b=config.getValue("gamedatabaseserverportnumber",tem);
    assert(b);
	m_PortNumber=Helper::StringToInt(tem);
	m_Address=RakNet::SystemAddress(m_RemoteIP.c_str(),m_PortNumber);
	return ;
}
Exemplo n.º 10
0
void AccountClient::registerAccount(const QString &username,
                                    const QString &password,
                                    const QString &email,
                                    const QString &captchaResponse)
{
    MessageOut registerMessage(PAMSG_REGISTER);
    registerMessage.writeInt32(PROTOCOL_VERSION);
    registerMessage.writeString(username);
    registerMessage.writeString(passwordHash(username, password));
    registerMessage.writeString(email);
    registerMessage.writeString(captchaResponse);
    send(registerMessage);

    mPendingUsername = username;
}
Exemplo n.º 11
0
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;
}
Exemplo n.º 12
0
void WindowManager::onRegisterSuccess()
{
    qDebug() << "WindowManager: Registered successfully";
    emit registerMessage();
}
Exemplo n.º 13
0
void Messages::copy() {
    qApp->clipboard()->setText (m_console->toPlainText());
    registerMessage (QString   ("<font color=\"#aaa\"><p>")
                     + tr      ("INFO: Console output copied to clipboard")
                     + QString ("</p></font>"));
}