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


C++ slotRawPtr函数代码示例

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


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

示例1: prTempoClock_SetTempoAtBeat

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

	TempoClock *clock = (TempoClock*)slotRawPtr(&slotRawObject(a)->slots[1]);
	if (!clock) {
		error("clock is not running.\n");
		return errFailed;
	}

	double tempo, beat;
	int err = slotDoubleVal(b, &tempo);
	if (err) return errFailed;
	if (tempo <= 0.) {
		error("invalid tempo %g\n", tempo);
		return errFailed;
	}

	err = slotDoubleVal(c, &beat);
	if (err) return errFailed;

	clock->SetTempoAtBeat(tempo, beat);

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

示例2: 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

示例3: prTempoClock_SetAll

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

	TempoClock *clock = (TempoClock*)slotRawPtr(&slotRawObject(a)->slots[1]);
	if (!clock) {
		error("clock is not running.\n");
		return errFailed;
	}

	double tempo, beat, secs;
	int err = slotDoubleVal(b, &tempo);
	if (err) return errFailed;

	err = slotDoubleVal(c, &beat);
	if (err) return errFailed;

	err = slotDoubleVal(d, &secs);
	if (err) return errFailed;

	clock->SetAll(tempo, beat, secs);

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

示例4: prSFWrite

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

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

	SNDFILE *file = (SNDFILE*)slotRawPtr(&slotRawObject(a)->slots[0]);

	if (!isKindOfSlot(b, class_rawarray)) return errWrongType;

	switch (slotRawObject(b)->obj_format) {
		case obj_int16 :
			sf_write_short(file, (short*)slotRawInt8Array(b)->b, slotRawObject(b)->size);
			break;
		case obj_int32 :
			sf_write_int(file, (int*)slotRawInt8Array(b)->b, slotRawObject(b)->size);
			break;
		case obj_float :
			sf_write_float(file, (float*)slotRawInt8Array(b)->b, slotRawObject(b)->size);
			break;
		case obj_double :
			sf_write_double(file, (double*)slotRawInt8Array(b)->b, slotRawObject(b)->size);
			break;
		default:
			error("sample format not supported.\n");
			return errFailed;
	}

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

示例5: prSetControlBusValues

int prSetControlBusValues(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 (!IsObj(c))
		return errFailed;

	PyrObject * values = slotRawObject(c);
	server_shared_memory_client * client = (server_shared_memory_client*)slotRawPtr(ptrSlot);
	float * control_busses = client->get_control_busses() + busIndex;

	for (int i = 0; i != values->size; ++i) {
		float value;
		int error = slotFloatVal(values->slots + i, &value);
		if (error != errNone)
			return error;

		control_busses[i] = value;
	}
	return errNone;
}
开发者ID:robertol80,项目名称:supercollider,代码行数:35,代码来源: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: prTempoClock_Sched

int prTempoClock_Sched(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a = g->sp - 2;
	PyrSlot *b = g->sp - 1;
	PyrSlot *c = g->sp;
	double delta, beats;
	int err;

	TempoClock *clock = (TempoClock*)slotRawPtr(&slotRawObject(a)->slots[1]);
	if (!clock) {
		error("clock is not running.\n");
		return errFailed;
	}

	if (!SlotEq(&g->thread->clock, a)) {
		beats = clock->ElapsedBeats();
		//post("shouldn't call TempoClock-sched from a different clock. Use schedAbs.\n");
		//return errFailed;
	} else {
		err = slotDoubleVal(&g->thread->beats, &beats);
		if (err) return errNone; // return nil OK, just don't schedule
	}

	err = slotDoubleVal(b, &delta);
	if (err) return errNone; // return nil OK, just don't schedule
	beats += delta;
	if (beats == dInfinity)
		return errNone; // return nil OK, just don't schedule

	clock->Add(beats, c);

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

示例8: 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

示例9: finalize_image_object

int finalize_image_object( struct VMGlobals *g, struct PyrObject *obj )
{
    SharedImage *shared_image_ptr =
            reinterpret_cast<SharedImage*>( slotRawPtr(obj->slots) );
    delete shared_image_ptr;
    SetNil( obj->slots+0 );
    return errNone;
}
开发者ID:Lucideam,项目名称:supercollider,代码行数:8,代码来源:prim_QImage.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: qcDebugMsg

int QcTreeWidget::Item::finalize( VMGlobals *g, PyrObject *obj )
{
  qcDebugMsg(1,"finalizing QTreeViewItem!");
  if( IsPtr( obj->slots+0 ) ) {
    QcTreeWidget::ItemPtr *ptr = static_cast<QcTreeWidget::ItemPtr*>( slotRawPtr(obj->slots+0) );
    delete ptr;
  }
  return errNone;
}
开发者ID:8c6794b6,项目名称:supercollider,代码行数:9,代码来源:QcTreeWidget.cpp

示例12: returnFromBlock

HOT void returnFromBlock(VMGlobals *g)
{
	PyrFrame *curframe;
	PyrFrame *returnFrame;
	PyrFrame *homeContext;
	PyrBlock *block;
	PyrMethod *meth;
	PyrMethodRaw *methraw;
	PyrMethodRaw *blockraw;

	//if (gTraceInterpreter) postfl("->returnFromBlock\n");
	//printf("->returnFromBlock\n");
#ifdef GC_SANITYCHECK
	g->gc->SanityCheck();
	CallStackSanity(g, "returnFromBlock");
#endif
	curframe = g->frame;

//again:
	returnFrame = slotRawFrame(&curframe->caller);
	if (returnFrame) {
		block = slotRawBlock(&curframe->method);
		blockraw = METHRAW(block);

		g->frame = returnFrame;
		g->ip = (unsigned char *)slotRawPtr(&returnFrame->ip);
		g->block = slotRawBlock(&returnFrame->method);
		homeContext = slotRawFrame(&returnFrame->homeContext);
		meth = slotRawMethod(&homeContext->method);
		methraw = METHRAW(meth);
		slotCopy(&g->receiver, &homeContext->vars[0]); //??
		g->method = meth;

		meth = slotRawMethod(&curframe->method);
		methraw = METHRAW(meth);
		if (!methraw->needsHeapContext) {
			g->gc->Free(curframe);
		} else {
			SetInt(&curframe->caller, 0);
		}

	} else {
		////// this should never happen .
		error("return from Function at top of call stack.\n");
		g->method = NULL;
		g->block = NULL;
		g->frame = NULL;
		g->sp = g->gc->Stack()->slots - 1;
		longjmp(g->escapeInterpreter, 1);
	}
	//if (gTraceInterpreter) postfl("<-returnFromBlock\n");
#ifdef GC_SANITYCHECK
	g->gc->SanityCheck();
	CallStackSanity(g, "returnFromBlock");
#endif
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:56,代码来源:PyrMessage.cpp

示例13: prNetAddr_Disconnect

static int prNetAddr_Disconnect(VMGlobals *g, int numArgsPushed)
{
	PyrSlot* netAddrSlot = g->sp;
	PyrObject* netAddrObj = slotRawObject(netAddrSlot);

	SC_TcpClientPort *comPort = (SC_TcpClientPort*)slotRawPtr(netAddrObj->slots + ivxNetAddr_Socket);
	if (comPort) comPort->Close();

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

示例14: prTempoClock_Free

int prTempoClock_Free(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a = g->sp;
	TempoClock *clock = (TempoClock*)slotRawPtr(&slotRawObject(a)->slots[1]);
	if (!clock) return errNone;	// not running

	SetNil(slotRawObject(a)->slots + 1);
	clock->StopReq();

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

示例15: prFileFlush

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

	a = g->sp;
	pfile = (PyrFile*)slotRawObject(a);
	file = (FILE*)slotRawPtr(&pfile->fileptr);
	if (file != NULL) fflush(file);
	return errNone;
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:12,代码来源:PyrFilePrim.cpp


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