• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ slotRawObject函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: prSignalOverWrite

int prSignalOverWrite(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a, *b, *c;
	int err;
	int index;

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

	if (NotObj(b) || !isKindOf(slotRawObject(b), class_signal)) return errWrongType;
	err = slotIntVal(c, &index);
	if (err) return errWrongType;

	signal_overwrite(g, slotRawObject(a), slotRawObject(b), index);
	return errNone;
}
开发者ID:danstowell,项目名称:SuperCute,代码行数:17,代码来源:PyrSignalPrim.cpp


示例17: prSFOpenRead

int prSFOpenRead(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a, *b;
	char filename[PATH_MAX];
	SNDFILE *file;
	SF_INFO info;
	const char *headerstr;
	const char *sampleformatstr;

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

	PyrObject *obj1 = slotRawObject(a);

	if (!isKindOfSlot(b, class_string)) return errWrongType;
	if (slotRawObject(b)->size > PATH_MAX - 1) return errFailed;

	memcpy(filename, slotRawString(b)->s, slotRawObject(b)->size);
	filename[slotRawString(b)->size] = 0;

	info.format = 0;
	file = sf_open(filename, SFM_READ, &info);


	if (file) {
		SetPtr(obj1->slots + 0, file);
		sndfileFormatInfoToStrings(&info, &headerstr, &sampleformatstr);
		//headerFormatToString(&info, &headerstr);
		PyrString *hpstr = newPyrString(g->gc, headerstr, 0, true);
		SetObject(obj1->slots+1, hpstr);
		g->gc->GCWriteNew(obj1, (PyrObjectHdr*)hpstr); // we know hpstr is white so we can use GCWriteNew
		PyrString *smpstr = newPyrString(g->gc, sampleformatstr, 0, true);
		SetObject(obj1->slots+2, smpstr);
		g->gc->GCWriteNew(obj1, (PyrObjectHdr*)smpstr); // we know smpstr is white so we can use GCWriteNew
		SetInt(obj1->slots + 3, info.frames);
		SetInt(obj1->slots + 4, info.channels);
		SetInt(obj1->slots + 5, info.samplerate);

		SetTrue(a);
	} else {
		SetNil(a);
		SetFalse(a);
	}
	return errNone;
}
开发者ID:claudiocabral,项目名称:supercollider,代码行数:45,代码来源:PyrFilePrim.cpp


示例18: prPipeOpen

int prPipeOpen(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a, *b, *c;
	char mode[12];
	PyrFile *pfile;
	FILE *file;

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

	if (NotObj(c) || !isKindOf(slotRawObject(c), class_string)
		|| NotObj(b) || !isKindOf(slotRawObject(b), class_string))
		return errWrongType;
	if (slotRawObject(c)->size > 11) return errFailed;
	pfile = (PyrFile*)slotRawObject(a);

        char *commandLine = (char*)malloc(slotRawObject(b)->size + 1);
	memcpy(commandLine, slotRawString(b)->s, slotRawObject(b)->size);
	commandLine[slotRawString(b)->size] = 0;

	memcpy(mode, slotRawString(c)->s, slotRawObject(c)->size);
	mode[slotRawString(c)->size] = 0;

	pid_t pid;
	file = sc_popen(commandLine, &pid, mode);
	free(commandLine);
	if (file) {
		SetPtr(&pfile->fileptr, file);
		SetInt(a, pid);
	} else {
		SetNil(a);
	}
	return errNone;
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:35,代码来源:PyrFilePrim.cpp


示例19: prHID_API_Initialize

int prHID_API_Initialize(VMGlobals* g, int numArgsPushed)
{
	PyrSlot *args = g->sp - numArgsPushed + 1;
	PyrSlot *self = args + 0;

	SC_HID_APIManager::instance().setPyrObject( slotRawObject(self) );
	// initialize HID_APIManager
	return SC_HID_APIManager::instance().init();
}
开发者ID:ASauer,项目名称:supercollider,代码行数:9,代码来源:SC_HID_api.cpp


示例20: prSignalNormalizeTransferFn

int prSignalNormalizeTransferFn(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a;

	a = g->sp;

	signal_normalize_transfer_fn(slotRawObject(a));
	return errNone;
}
开发者ID:danstowell,项目名称:SuperCute,代码行数:9,代码来源:PyrSignalPrim.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ slotRawPtr函数代码示例发布时间:2022-05-30
下一篇:
C++ slotOk函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap