当前位置: 首页>>代码示例>>C++>>正文


C++ slotRawObject函数代码示例

本文整理汇总了C++中slotRawObject函数的典型用法代码示例。如果您正苦于以下问题:C++ slotRawObject函数的具体用法?C++ slotRawObject怎么用?C++ slotRawObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了slotRawObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: prFilePutFloatLE

int prFilePutFloatLE(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a, *b;
	PyrFile *pfile;
	FILE *file;

	a = g->sp - 1;
	b = g->sp;

	pfile = (PyrFile*)slotRawObject(a);
	file = (FILE*)slotRawPtr(&pfile->fileptr);
	if (file == NULL) {
		dumpObjectSlot(a);
		return errFailed;
	}

	float val;
	int err = slotFloatVal(b, &val);
	if (err) return err;

	SC_IOStream<FILE*> scio(file);
	scio.writeFloat_le(val);

	return errNone;
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:25,代码来源:PyrFilePrim.cpp

示例2: prLID_GetAbsInfo

int prLID_GetAbsInfo(VMGlobals *g, int numArgsPushed)
{
	PyrSlot* args = g->sp - 2;
	int evtCode;
	int err;

	PyrObject* obj = SC_LID::getObject(args+0);
	if (!obj) return errWrongType;

	err = slotIntVal(args+1, &evtCode);
	if (err) return err;

	if (!isKindOfSlot(args+2, s_absInfoClass->u.classobj))
		return errWrongType;
	PyrObject* infoObj = slotRawObject(&args[2]);

	SC_LID* dev = SC_LID::getDevice(obj);
	if (!dev) return errFailed;

	struct input_absinfo info;
	err = dev->getAbsInfo(evtCode, &info);
	if (err) return err;

	SetInt(infoObj->slots+0, info.value);
	SetInt(infoObj->slots+1, info.minimum);
	SetInt(infoObj->slots+2, info.maximum);
	SetInt(infoObj->slots+3, info.fuzz);
	SetInt(infoObj->slots+4, info.flat);

	slotCopy(&args[0], &args[2]);

	return errNone;
}
开发者ID:danstowell,项目名称:SuperCute,代码行数:33,代码来源:SC_LID.cpp

示例3: makeSynthBundle

int makeSynthBundle(big_scpacket *packet, PyrSlot *slots, int size, bool useElapsed)
{
	double time;
	int err;
	int64 oscTime;

	err = slotDoubleVal(slots, &time);
	if (!err) {
		if (useElapsed) {
			oscTime = ElapsedTimeToOSC(time);
		} else {
			oscTime = (int64)(time * kSecondsToOSC);
		}
	} else {
		oscTime = 1;	// immediate
	}
	packet->OpenBundle(oscTime);

	for (int i=1; i<size; ++i) {
		if (isKindOfSlot(slots+i, class_array)) {
			PyrObject *obj = slotRawObject(&slots[i]);
			int error = makeSynthMsgWithTags(packet, obj->slots, obj->size);
			if (error != errNone)
				return error;
		}
	}
	packet->CloseBundle();
	return errNone;
}
开发者ID:robertol80,项目名称:supercollider,代码行数:29,代码来源:OSCData.cpp

示例4: prArray_OSCBytes

int prArray_OSCBytes(VMGlobals *g, int numArgsPushed)
{
	PyrSlot* a = g->sp;
	PyrObject *array = slotRawObject(a);
	PyrSlot* args = array->slots;
	int numargs = array->size;
	if (numargs < 1) return errFailed;
	big_scpacket packet;

	if (IsFloat(args) || IsNil(args) || IsInt(args)) {
		makeSynthBundle(&packet, args, numargs, false);
	} else if (IsSym(args) || isKindOfSlot(args, class_string)) {
		int error = makeSynthMsgWithTags(&packet, args, numargs);
		if (error != errNone)
			return error;
	} else {
		return errWrongType;
	}

	int size = packet.size();
	PyrInt8Array* obj = newPyrInt8Array(g->gc, size, 0, true);
	obj->size = size;
	memcpy(obj->b, packet.data(), size);
	SetObject(a, (PyrObject*)obj);
	//for (int i=0; i<packet.size()/4; i++) post("%d %p\n", i, packet.buf[i]);

	return errNone;
}
开发者ID:robertol80,项目名称:supercollider,代码行数:28,代码来源:OSCData.cpp

示例5: prConnectSharedMem

int prConnectSharedMem(VMGlobals *g, int numArgsPushed)
{
#if !defined(SC_IPHONE)
	PyrSlot *a = g->sp - 1;
	PyrSlot *b = g->sp;

	assert(IsObj(a));

	PyrObject * self = slotRawObject(a);
	int portNumber = slotRawInt(b);

	int ptrIndex       = 0;
	int finalizerIndex = 1;

	try {
		server_shared_memory_client * client = new server_shared_memory_client(portNumber);
		SetPtr(self->slots + ptrIndex, client);

		InstallFinalizer(g, self, finalizerIndex, disconnectSharedMem);

		postfl("Shared memory server interface initialized\n");
	} catch (std::exception & e) {
		postfl("Cannot connect to shared memory: %s\n", e.what());
		return errFailed;
	}
#else
	postfl("Warning: Shared memory server interface disabled on iphone\n");
#endif
	return errNone;
}
开发者ID:robertol80,项目名称:supercollider,代码行数:30,代码来源:OSCData.cpp

示例6: prSetControlBusValue

int prSetControlBusValue(VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a = g->sp - 2;
	PyrSlot *b = g->sp - 1;
	PyrSlot *c = g->sp;

	assert(IsObj(a));
	PyrObject * self = slotRawObject(a);
	int ptrIndex       = 0;
	PyrSlot * ptrSlot = self->slots + ptrIndex;
	if (NotPtr(ptrSlot))
		return errFailed;

	if (!IsInt(b))
		return errFailed;

	int busIndex = slotRawInt(b);

	if (NotPtr(ptrSlot))
		return errFailed;

	float value;
	int error = slotFloatVal(c, &value);
	if (error != errNone)
		return error;

	server_shared_memory_client * client = (server_shared_memory_client*)slotRawPtr(ptrSlot);

	client->get_control_busses()[busIndex] = value;
	return errNone;
}
开发者ID:robertol80,项目名称:supercollider,代码行数:31,代码来源:OSCData.cpp

示例7: prPriorityQueueClear

int prPriorityQueueClear(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot* a = g->sp;	// priority queue

	PriorityQueueClear(slotRawObject(a));
	return errNone;
}
开发者ID:DSastre,项目名称:supercollider,代码行数:7,代码来源:PyrListPrim.cpp

示例8: prSignalAddHarmonic

int prSignalAddHarmonic(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a, *b, *c, *d;
	int err;
	float harmonic, amp;
	double phase, step;
	PyrObject *signal;
	float *out;

	a = g->sp - 3;
	b = g->sp - 2;
	c = g->sp - 1;
	d = g->sp;

	err = slotFloatVal(b, &harmonic);
	if (err) return errWrongType;
	err = slotFloatVal(c, &amp);
	if (err) return errWrongType;
	err = slotDoubleVal(d, &phase);
	if (err) return errWrongType;

	signal = slotRawObject(a);
	out = (float*)(signal->slots) - 1;
	step = twopi * harmonic / signal->size;
	UNROLL_CODE(signal->size, out, *++out += sin(phase) * amp; phase += step; );
开发者ID:danstowell,项目名称:SuperCute,代码行数:25,代码来源:PyrSignalPrim.cpp

示例9: PriorityQueueAdd

void PriorityQueueAdd(struct VMGlobals *g, PyrObject* queueobj, PyrSlot* item, double time)
{
	PyrObject *schedq, *newschedq;
	int size, maxsize;

	PyrSlot *schedqSlot = queueobj->slots;
	if (!IsObj(schedqSlot)) {
		size = 32;
		schedq = newPyrArray(g->gc, size, 0, true);
		schedq->size = 1;
		SetInt(schedq->slots + 0, 0); // stability count
		SetObject(schedqSlot, schedq);
		g->gc->GCWrite(queueobj, schedq);
	} else {
		schedq = slotRawObject(schedqSlot);
		maxsize = ARRAYMAXINDEXSIZE(schedq);
		size = schedq->size;
		if (size+3 > maxsize) {

			newschedq = newPyrArray(g->gc, maxsize*2, 0, true);
			newschedq->size = size;

			slotCopy(newschedq->slots, schedq->slots, size);
			assert(IsInt(newschedq->slots));

			SetObject(schedqSlot, newschedq);
			g->gc->GCWrite(queueobj, newschedq);

			schedq = newschedq;
		}
	}

	addheap(g, schedq, time, item);
}
开发者ID:DSastre,项目名称:supercollider,代码行数:34,代码来源:PyrListPrim.cpp

示例10: read

 static QObjectProxy* read( PyrSlot *slot )
 {
   PyrSlot *proxySlot = slotRawObject( slot )->slots;
   if( IsPtr( proxySlot ) )
     return (QObjectProxy*) slotRawPtr( proxySlot );
   else
     return 0;
 }
开发者ID:dashaxiong,项目名称:supercollider,代码行数:8,代码来源:type_codec.hpp

示例11: prArrayMultiChanExpand

int prArrayMultiChanExpand(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a, *slot, *slots1, *slots2, *slots3, *slots4;
	PyrObject *obj1, *obj2, *obj3, *obj4;
	int i, j, size, len, maxlen;

	a = g->sp;
	obj1 = slotRawObject(a);
	size = obj1->size;
	slots1 = obj1->slots;
	maxlen = 1;
	for (j=0; j<size; ++j) {
		slot = slots1 + j;
		if (IsObj(slot)) {
			if (slotRawObject(slot)->classptr == class_array) {
				len = slotRawObject(slot)->size;
				maxlen = len > maxlen ? len : maxlen;
			} else if (isKindOf(slotRawObject(slot), class_sequenceable_collection) && (slotRawObject(slot)->classptr != class_string)) {
				return errFailed; // this primitive only handles Arrays.
			}
		}
	}

	obj2 = newPyrArray(g->gc, maxlen, 0, true);
	SetObject(a, obj2);
	slots2 = obj2->slots;
	for (i=0; i<maxlen; ++i) {
		obj3 = newPyrArray(g->gc, size, 0, true);
		obj3->size = size;
		SetObject(slots2 + i, obj3);
		g->gc->GCWriteNew(obj2, obj3); // we know obj3 is white so we can use GCWriteNew
		obj2->size++;
		slots1 = obj1->slots;
		slots3 = obj3->slots;
		for (j=0; j<size; ++j) {
			slot = slots1 + j;
			if (IsObj(slot)) {
				if (slotRawObject(slot)->classptr == class_array && slotRawObject(slot)->size > 0) {
					PyrSlot *slotToCopy;
					obj4 = slotRawObject(slot);
					slots4 = obj4->slots;
					slotToCopy = &slots4[i % obj4->size];
					slotCopy(&slots3[j],slotToCopy);
					g->gc->GCWrite(obj3, slotToCopy);
				} else {
					slotCopy(&slots3[j],slot);
					g->gc->GCWrite(obj3, slot);
				}
			} else {
				slotCopy(&slots3[j],slot); // we don't need GCWrite here, as slot is not an object
			}
		}
	}

	return errNone;
}
开发者ID:bagong,项目名称:supercollider,代码行数:56,代码来源:PyrListPrim.cpp

示例12: prTempoClock_Dump

int prTempoClock_Dump(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a = g->sp;
	TempoClock *clock = (TempoClock*)slotRawPtr(&slotRawObject(a)->slots[1]);
	if (clock) clock->Dump();

	return errNone;
}
开发者ID:ELVIS-Project,项目名称:VISIntervalSonifier,代码行数:8,代码来源:PyrSched.cpp

示例13: prDisconnectSharedMem

int prDisconnectSharedMem(VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a = g->sp;

	assert(IsObj(a));
	PyrObject * self = slotRawObject(a);
	return disconnectSharedMem(g, self);
}
开发者ID:robertol80,项目名称:supercollider,代码行数:8,代码来源:OSCData.cpp

示例14: prNetAddr_SendRaw

int prNetAddr_SendRaw(VMGlobals *g, int numArgsPushed)
{
	PyrSlot* netAddrSlot = g->sp - 1;
	PyrSlot* arraySlot = g->sp;
	PyrObject* netAddrObj = slotRawObject(netAddrSlot);

	if (!IsObj(arraySlot) || !isKindOf(slotRawObject(arraySlot), class_rawarray)) {
		error("sendRaw arg must be a kind of RawArray.\n");
		return errWrongType;
	}
	PyrObject *array = slotRawObject(arraySlot);

	char *bufptr = (char*)array->slots;
	int32 msglen = array->size * gFormatElemSize[array->obj_format];

	return netAddrSend(netAddrObj, msglen, bufptr, false);
}
开发者ID:robertol80,项目名称:supercollider,代码行数:17,代码来源:OSCData.cpp

示例15: prOpFloat

inline int prOpFloat(VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a, *b;
	PyrSymbol *msg;

	a = g->sp - 1;
	b = g->sp;

	switch (GetTag(b)) {
		case tagInt :
			SetRaw(a, Functor::run(slotRawFloat(a), (double)slotRawInt(b)));
			break;
		case tagChar :
		case tagPtr :
		case tagNil :
		case tagFalse :
		case tagTrue :
			goto send_normal_2;
		case tagSym :
			SetSymbol(a, slotRawSymbol(b));
			break;
		case tagObj :
			if (isKindOf(slotRawObject(b), class_signal))
				SetObject(a, Functor::signal_fx(g, slotRawFloat(a), slotRawObject(b)));
			else
				goto send_normal_2;
			break;
		default :
			SetRaw(a, Functor::run(slotRawFloat(a), slotRawFloat(b)));
			break;
	}
	g->sp-- ; // drop
	g->numpop = 0;
#if TAILCALLOPTIMIZE
	g->tailCall = 0;
#endif
	return errNone;

	send_normal_2:
	if (numArgsPushed != -1)  // special case flag meaning it is a primitive
		return errFailed;	// arguments remain on the stack

	msg = gSpecialBinarySelectors[g->primitiveIndex];
	sendMessage(g, msg, 2);
	return errNone;
}
开发者ID:danstowell,项目名称:SuperCute,代码行数:46,代码来源:PyrMathPrim.cpp


注:本文中的slotRawObject函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。