本文整理汇总了C++中slotIntVal函数的典型用法代码示例。如果您正苦于以下问题:C++ slotIntVal函数的具体用法?C++ slotIntVal怎么用?C++ slotIntVal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slotIntVal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: prHIDDequeueElement
int prHIDDequeueElement(VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp - 2; //class
PyrSlot *b = g->sp - 1; //locID device
PyrSlot *c = g->sp; //element cookie
int locID, cookieNum;
int err = slotIntVal(b, &locID);
if (err) return err;
err = slotIntVal(c, &cookieNum);
if (err) return err;
IOHIDElementCookie cookie = (IOHIDElementCookie) cookieNum;
//look for the right device:
pRecDevice pCurrentHIDDevice = HIDGetFirstDevice ();
while (pCurrentHIDDevice && (pCurrentHIDDevice->locID !=locID))
pCurrentHIDDevice = HIDGetNextDevice (pCurrentHIDDevice);
if(!pCurrentHIDDevice) return errFailed;
//look for the right element:
pRecElement pCurrentHIDElement = HIDGetFirstDeviceElement (pCurrentHIDDevice, kHIDElementTypeAll);
while (pCurrentHIDElement && (pCurrentHIDElement->cookie != cookie))
pCurrentHIDElement = HIDGetNextDeviceElement (pCurrentHIDElement, kHIDElementTypeAll);
if(!pCurrentHIDElement) return errFailed;
HIDDequeueElement(pCurrentHIDDevice, pCurrentHIDElement);
return errNone;
}
开发者ID:scztt,项目名称:sc-debug,代码行数:25,代码来源:SC_HID.cpp
示例2: prConnectMIDIIn
int prConnectMIDIIn(struct VMGlobals *g, int numArgsPushed)
{
//PyrSlot *a = g->sp - 2;
PyrSlot *b = g->sp - 1;
PyrSlot *c = g->sp;
int err, inputIndex, uid;
err = slotIntVal(b, &inputIndex);
if (err) return errWrongType;
if (inputIndex < 0 || inputIndex >= gNumMIDIInPorts) return errIndexOutOfRange;
err = slotIntVal(c, &uid);
if (err) return errWrongType;
size_t uid_t = uid;
MIDIEndpointRef src=0;
MIDIObjectType mtype;
MIDIObjectFindByUniqueID(uid, (MIDIObjectRef*)&src, &mtype);
if (mtype != kMIDIObjectType_Source) return errFailed;
//pass the uid to the midiReadProc to identify the src
MIDIPortConnectSource(gMIDIInPort[inputIndex], src, (void*)uid_t);
return errNone;
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:27,代码来源:SC_CoreMIDI.cpp
示例3: prHIDGetValue
int prHIDGetValue(VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp - 2; //class
PyrSlot *b = g->sp - 1; //locID device
PyrSlot *c = g->sp; //element cookie
int locID, cookieNum;
int err = slotIntVal(b, &locID);
if (err) return err;
err = slotIntVal(c, &cookieNum);
if (err) return err;
IOHIDElementCookie cookie = (IOHIDElementCookie) cookieNum;
//look for the right device:
pRecDevice pCurrentHIDDevice = HIDGetFirstDevice ();
while (pCurrentHIDDevice && (pCurrentHIDDevice->locID !=locID))
pCurrentHIDDevice = HIDGetNextDevice (pCurrentHIDDevice);
if(!pCurrentHIDDevice) return errFailed;
//look for the right element:
pRecElement pCurrentHIDElement = HIDGetFirstDeviceElement (pCurrentHIDDevice, kHIDElementTypeAll);
// use gElementCookie to find current element
while (pCurrentHIDElement && (pCurrentHIDElement->cookie != cookie))
pCurrentHIDElement = HIDGetNextDeviceElement (pCurrentHIDElement, kHIDElementTypeAll);
if (pCurrentHIDElement)
{
SInt32 value = HIDGetElementValue (pCurrentHIDDevice, pCurrentHIDElement);
// if it's not a button and it's not a hatswitch then calibrate
if(( pCurrentHIDElement->type != kIOHIDElementTypeInput_Button ) &&
( pCurrentHIDElement->usagePage == 0x01 && pCurrentHIDElement->usage != kHIDUsage_GD_Hatswitch))
value = HIDCalibrateValue ( value, pCurrentHIDElement );
SetInt(a, value);
}
else SetNil(a);
return errNone;
}
开发者ID:scztt,项目名称:sc-debug,代码行数:35,代码来源:SC_HID.cpp
示例4: ScIDE_SetDocSelectionMirror
int ScIDE_SetDocSelectionMirror(struct VMGlobals *g, int numArgsPushed)
{
if (!gIpcClient) {
error("ScIDE not connected\n");
return errFailed;
}
PyrSlot * docIDSlot = g->sp - 2;
char id[255];
if (slotStrVal( docIDSlot, id, 255 ))
return errWrongType;
int start, range, err = errNone;
PyrSlot * startSlot = g->sp-1;
err = slotIntVal(startSlot, &start);
if (err) return err;
PyrSlot * rangeSlot = g->sp;
err = slotIntVal(rangeSlot, &range);
if (err) return err;
QByteArray key = QByteArray(id);
gIpcClient->setSelectionMirrorForDocument(key, start, range);
return errNone;
}
开发者ID:8c6794b6,项目名称:supercollider,代码行数:27,代码来源:sc_ipc_client.cpp
示例5: ScIDE_GetDocTextMirror
int ScIDE_GetDocTextMirror(struct VMGlobals *g, int numArgsPushed)
{
if (!gIpcClient) {
error("ScIDE not connected\n");
return errFailed;
}
PyrSlot * returnSlot = g->sp - numArgsPushed + 1;
PyrSlot * docIDSlot = g->sp - 2;
char id[255];
if (slotStrVal( docIDSlot, id, 255 ))
return errWrongType;
int pos, range, err = errNone;
PyrSlot * posSlot = g->sp-1;
err = slotIntVal(posSlot, &pos);
if (err) return err;
PyrSlot * rangeSlot = g->sp;
err = slotIntVal(rangeSlot, &range);
if (err) return err;
QByteArray key = QByteArray(id);
QString docText = gIpcClient->getTextMirrorForDocument(key, pos, range);
PyrString* pyrString = newPyrString(g->gc, docText.toLatin1().constData(), 0, true);
SetObject(returnSlot, pyrString);
return errNone;
}
开发者ID:8c6794b6,项目名称:supercollider,代码行数:32,代码来源:sc_ipc_client.cpp
示例6: prConnectMIDIIn
int prConnectMIDIIn(struct VMGlobals *g, int numArgsPushed)
{
ScopeMutexLock mulo(&gPmStreamMutex);
//PyrSlot *a = g->sp - 2;
PyrSlot *b = g->sp - 1;
PyrSlot *c = g->sp;
int err, inputIndex, uid;
err = slotIntVal(b, &inputIndex);
if (err) return errWrongType;
if (inputIndex < 0 || inputIndex >= gNumMIDIInPorts)
return errIndexOutOfRange;
err = slotIntVal(c, &uid);
if (err)
return errWrongType;
PmStream* inStream = NULL;
int pmdid = gMidiInputIndexToPmDevIndex[uid];
PmError pmerr = Pm_OpenInput( &inStream, pmdid,
PMSTREAM_DRIVER_INFO,
PMSTREAM_INPUT_BUFFER_SIZE,
PMSTREAM_TIME_PROC,
PMSTREAM_TIME_INFO );
if(pmerr != pmNoError)
return errFailed;
gMIDIInStreams[uid] = inStream;
return errNone;
}
开发者ID:2mc,项目名称:supercollider,代码行数:33,代码来源:SC_PortMIDI.cpp
示例7: prSignalFade
int prSignalFade(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a, *b, *c, *d, *e;
int err;
int start, end;
float lvl0, lvl1;
a = g->sp - 4;
b = g->sp - 3;
c = g->sp - 2;
d = g->sp - 1;
e = g->sp;
err = slotIntVal(b, &start);
if (err) {
if (IsNil(b)) start = 0;
else return err;
}
err = slotIntVal(c, &end);
if (err) {
if (IsNil(c)) end = slotRawObject(a)->size;
else return err;
}
err = slotFloatVal(d, &lvl0);
if (err) return err;
err = slotFloatVal(e, &lvl1);
if (err) return err;
signal_fade_range(slotRawObject(a), start, end, lvl0, lvl1);
return errNone;
}
开发者ID:danstowell,项目名称:SuperCute,代码行数:34,代码来源:PyrSignalPrim.cpp
示例8: prHIDSetValue
int prHIDSetValue(VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp - 3; //class
PyrSlot *b = g->sp - 2; //locID
PyrSlot *c = g->sp - 1; //element device
PyrSlot *d = g->sp; //value cookie
int locID, cookieNum, value;
int err = slotIntVal(b, &locID);
if (err) return err;
err = slotIntVal(c, &cookieNum);
if (err) return err;
IOHIDElementCookie cookie = (IOHIDElementCookie) cookieNum;
err = slotIntVal(d, &value);
if (err) return err;
//look for the right device:
pRecDevice pCurrentHIDDevice = HIDGetFirstDevice ();
while (pCurrentHIDDevice && (pCurrentHIDDevice->locID !=locID))
pCurrentHIDDevice = HIDGetNextDevice (pCurrentHIDDevice);
if(!pCurrentHIDDevice) return errFailed;
//look for the right element:
pRecElement pCurrentHIDElement = HIDGetFirstDeviceElement (pCurrentHIDDevice, kHIDElementTypeAll);
// use gElementCookie to find current element
while (pCurrentHIDElement && (pCurrentHIDElement->cookie != cookie))
pCurrentHIDElement = HIDGetNextDeviceElement (pCurrentHIDElement, kHIDElementTypeAll);
//struct IOHIDEventStruct
//{
// IOHIDElementType type;
// IOHIDElementCookie elementCookie;
// SInt32 value;
// AbsoluteTime timestamp;
// UInt32 longValueSize;
// void * longValue;
//};
if (pCurrentHIDElement)
{
IOHIDEventStruct event =
{
kIOHIDElementTypeOutput,
pCurrentHIDElement->cookie,
value,
{0},
sizeof(int),
NULL
};
SInt32 value = HIDSetElementValue (pCurrentHIDDevice, pCurrentHIDElement, &event);
// if it's not a button and it's not a hatswitch then calibrate
// if(( pCurrentHIDElement->type != kIOHIDElementTypeInput_Button ) &&
// ( pCurrentHIDElement->usagePage == 0x01 && pCurrentHIDElement->usage != kHIDUsage_GD_Hatswitch))
// value = HIDCalibrateValue ( value, pCurrentHIDElement );
SetInt(a, value);
}
else SetNil(a);
return errNone;
}
开发者ID:scztt,项目名称:sc-debug,代码行数:56,代码来源:SC_HID.cpp
示例9: prSerialPort_Open
static int prSerialPort_Open(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *args = g->sp - 1 - SerialPort::kNumOptions;
int err;
PyrSlot* self = args+0;
if (getSerialPort(self) != 0)
return errFailed;
char portName[PATH_MAX];
err = slotStrVal(args+1, portName, sizeof(portName));
printf("portName %s\n", portName);
if (err) return err;
SerialPort::Options options;
SerialPort* port = 0;
options.exclusive = IsTrue(args+2);
int baudrate;
err = slotIntVal(args+3, &baudrate);
if (err) return err;
options.baudrate = baudrate;
int databits;
err = slotIntVal(args+4, &databits);
if (err) return err;
options.databits = databits;
options.stopbit = IsTrue(args+5);
int parity;
err = slotIntVal(args+6, &parity);
if (err) return err;
options.parity = (SerialPort::Parity)parity;
options.crtscts = IsTrue(args+7);
options.xonxoff = IsTrue(args+8);
try {
port = new SerialPort(slotRawObject(self), portName, options);
} catch (SerialPort::Error& e) {
std::ostringstream os;
os << "SerialPort Error: " << e.what();
post(os.str().c_str());
return errFailed;
}
SetPtr(slotRawObject(self)->slots+0, port);
return errNone;
}
开发者ID:8c6794b6,项目名称:supercollider,代码行数:54,代码来源:PyrSerialPrim.cpp
示例10: prInitMIDI
int prInitMIDI(struct VMGlobals *g, int numArgsPushed)
{
//PyrSlot *a = g->sp - 2;
PyrSlot *b = g->sp - 1;
PyrSlot *c = g->sp;
int err, numIn, numOut;
err = slotIntVal(b, &numIn);
if (err) return errWrongType;
err = slotIntVal(c, &numOut);
if (err) return errWrongType;
return initMIDI(numIn, numOut);
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:15,代码来源:SC_CoreMIDI.cpp
示例11: 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
示例12: prAllocSharedControls
int prAllocSharedControls(VMGlobals *g, int numArgsPushed)
{
//PyrSlot *a = g->sp - 1;
PyrSlot *b = g->sp;
if (gInternalSynthServer.mWorld) {
post("can't allocate while internal server is running\n");
return errNone;
}
if (gInternalSynthServer.mSharedControls != gDefaultSharedControls) {
free(gInternalSynthServer.mSharedControls);
gInternalSynthServer.mSharedControls = gDefaultSharedControls;
}
int numSharedControls;
int err = slotIntVal(b, &numSharedControls);
if (err) return err;
if (numSharedControls <= 0) {
gInternalSynthServer.mNumSharedControls = 0;
} else if (numSharedControls < kNumDefaultSharedControls) {
gInternalSynthServer.mNumSharedControls = numSharedControls;
} else {
gInternalSynthServer.mNumSharedControls = numSharedControls;
gInternalSynthServer.mSharedControls = (float*)calloc(numSharedControls, sizeof(float));
}
return errNone;
}
开发者ID:scztt,项目名称:sc-debug,代码行数:26,代码来源:OSCData.cpp
示例13: prSpeakText
int prSpeakText(struct VMGlobals *g, int numArgsPushed){
OSErr theErr = noErr;
PyrSlot *obj = g->sp-2;
PyrSlot *a = g->sp-1;
PyrSlot *str = g->sp;
int chan;
slotIntVal(a, &chan);
chan = sc_clip(chan, 0, kMaxSpeechChannels);
if(speechStrings[chan] != NULL) {
post("voice %i already speaking\n", chan);
return errNone;
} else {
// speechStrings[chan] = (char*)pyr_pool_compile->Alloc((a->uo->size + 1)* sizeof(char));
speechStrings[chan] = (char*) malloc((str->uo->size + 1)* sizeof(char));
MEMFAIL(speechStrings[chan]);
slotStrVal(str, speechStrings[chan], str->uo->size+1);
//if(!fCurSpeechChannel) theErr = NewSpeechChannel( NULL, &fCurSpeechChannel );
theErr = SpeakText( fCurSpeechChannel[chan], speechStrings[chan], strlen(speechStrings[chan]));
//should be freed only after the text was spoken!
// todo move this bit to the callback!
// pyr_pool_compile->Free(theTextToSpeak);
}
return errNone;
}
开发者ID:scztt,项目名称:sc-debug,代码行数:30,代码来源:SC_Speech.cpp
示例14: prDirectory_At
int prDirectory_At(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp - 2;
PyrSlot *b = g->sp - 1;
PyrSlot *c = g->sp;
PyrSlot *dirPathSlot = slotRawObject(a)->slots + 0;
int err, index;
err = slotIntVal(c, &index);
if (err) {
SetNil(a);
return err;
}
char name[256], fullPathName[256];
int nameLength, creationDate, modificationDate, isDirectory, isVisible, sizeIfFile;
int dirPathLength = slotRawObject(dirPathSlot)->size;
err = dir_Lookup(slotRawObject(dirPathSlot)s->s, dirPathLength, index+1,
name, &nameLength, &creationDate, &modificationDate, &isDirectory, &isVisible, &sizeIfFile);
if (err == 1) {
SetNil(a);
return errNone;
}
if (err) {
error("Invalid path\n");
SetNil(a);
return errFailed;
}
if (dirPathLength + nameLength + 1 > 255) {
error("Full path name too long.\n");
SetNil(a);
return errFailed;
}
PyrSlot *entryName = slotRawObject(b)->slots + 0;
PyrSlot *entryPath = slotRawObject(b)->slots + 1;
PyrSlot *entryIsDir = slotRawObject(b)->slots + 2;
PyrSlot *entryIsVisible = slotRawObject(b)->slots + 3;
PyrString *nameString = newPyrString(g->gc, name, 0, true);
SetObject(entryName, nameString);
g->gc->GCWrite(slotRawObject(b), (PyrObject*)nameString);
memcpy(fullPathName, slotRawObject(dirPathSlot)s->s, dirPathLength);
fullPathName[dirPathLength] = DELIMITOR;
strcpy(fullPathName + dirPathLength + 1, name);
PyrString *pathString = newPyrString(g->gc, fullPathName, 0, true);
SetObject(entryPath, pathString);
g->gc->GCWrite(slotRawObject(b), (PyrObject*)pathString);
if (isDirectory) { SetTrue(entryIsDir); } else { SetFalse(entryIsDir); }
if (isVisible) { SetTrue(entryIsVisible); } else { SetFalse(entryIsVisible); }
slotCopy(a,b);
return errNone;
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:60,代码来源:PyrFilePrim.cpp
示例15: prSCDoc_ParseFile
int prSCDoc_ParseFile(struct VMGlobals* g, int numArgsPushed)
{
PyrSlot *a, *b, *c;
char filename[PATH_MAX];
int mode, err;
a = g->sp - 2;
b = g->sp - 1;
c = g->sp;
err = slotStrVal(b, filename, PATH_MAX);
if (err) return err;
err = slotIntVal(c, &mode);
if (err) return err;
DocNode *n = scdoc_parse_file(filename, mode);
if(n) {
// doc_node_dump(n);
_doc_traverse(g, n, NULL, a);
doc_node_free_tree(n);
} else {
SetNil(a);
}
return errNone;
}
开发者ID:2mc,项目名称:supercollider,代码行数:26,代码来源:SCDocPrim.cpp
示例16: prSendSysex
int prSendSysex(VMGlobals *g, int numArgsPushed)
{
int err, uid, size;
if( !isKindOfSlot(g->sp, s_int8array->u.classobj) )
return errWrongType;
PyrInt8Array* packet = slotRawInt8Array(g->sp);
size = packet->size;
PyrSlot *u = g->sp - 1;
err = slotIntVal(u, &uid);
if (err) return err;
MIDIEndpointRef dest;
MIDIObjectType mtype;
MIDIObjectFindByUniqueID(uid, (MIDIObjectRef*)&dest, &mtype);
if (mtype != kMIDIObjectType_Destination) return errFailed;
if (!dest) return errFailed;
MIDISysexSendRequest *pk = (MIDISysexSendRequest*) malloc (sizeof(MIDISysexSendRequest) + size);
Byte *data = (Byte *)pk + sizeof(MIDISysexSendRequest);
memcpy(data,packet->b, size);
pk->complete = false;
pk -> destination = dest;
pk -> data = data;
pk -> bytesToSend = size;
pk->completionProc = freeSysex;
pk->completionRefCon = 0;
return ((MIDISendSysex(pk) == (OSStatus)0) ? errNone : errFailed);
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:33,代码来源:SC_CoreMIDI.cpp
示例17: prHIDBuildElementList
int prHIDBuildElementList(VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp - 2; //class
PyrSlot *b = g->sp - 1; //locID device
PyrSlot *c = g->sp; //array
int locID;
int err = slotIntVal(b, &locID);
if (err) return err;
//look for the right device:
pRecDevice pCurrentHIDDevice = HIDGetFirstDevice ();
while (pCurrentHIDDevice && (pCurrentHIDDevice->locID !=locID))
pCurrentHIDDevice = HIDGetNextDevice (pCurrentHIDDevice);
if(!pCurrentHIDDevice) return errFailed;
pRecElement devElement = HIDGetFirstDeviceElement (pCurrentHIDDevice, kHIDElementTypeAll );
UInt32 numElements = HIDCountDeviceElements (pCurrentHIDDevice, kHIDElementTypeAll );
// PyrObject* devAllElementsArray = newPyrArray(g->gc, numElements * sizeof(PyrObject), 0 , true);
PyrObject *devAllElementsArray = c->uo;
// post("numElements: %d\n", numElements);
numElements = sc_clip(numElements, 0, devAllElementsArray->size);
for(uint i=0; i<numElements; i++){
if(devElement){
char cstrElementName [256];
PyrObject* devElementArray = newPyrArray(g->gc, 8 * sizeof(PyrObject), 0 , true);
// type name (1)
HIDGetTypeName((IOHIDElementType) devElement->type, cstrElementName);
PyrString *devstring = newPyrString(g->gc, cstrElementName, 0, true);
SetObject(devElementArray->slots+devElementArray->size++, devstring);
//g->gc->GCWrite(devElementArray, (PyrObject*) devstring);
//usage (2)
HIDGetUsageName (devElement->usagePage, devElement->usage, cstrElementName);
PyrString *usestring = newPyrString(g->gc, cstrElementName, 0, true);
SetObject(devElementArray->slots+devElementArray->size++, usestring);
//g->gc->GCWrite(devElementArray, (PyrObject*) usestring);
//cookie (3)
SetInt(devElementArray->slots+devElementArray->size++, (long) devElement->cookie);
// min (4)
SetInt(devElementArray->slots+devElementArray->size++, (long) devElement->min);
// max (5)
SetInt(devElementArray->slots+devElementArray->size++, (long) devElement->max);
// IO type as int: (6)
SetInt(devElementArray->slots+devElementArray->size++, (int) devElement->type);
// Usage page as int: (7)
SetInt(devElementArray->slots+devElementArray->size++, (long) devElement->usagePage);
// Usage type as int: (8)
SetInt(devElementArray->slots+devElementArray->size++, (long) devElement->usage);
SetObject(devAllElementsArray->slots+i, devElementArray);
//g->gc->GCWrite(devAllElementsArray, (PyrObject*) devElementArray);
}
devElement = HIDGetNextDeviceElement (devElement, kHIDElementTypeAll);
}
SetObject(a, devAllElementsArray);
return errNone;
}
开发者ID:scztt,项目名称:sc-debug,代码行数:60,代码来源:SC_HID.cpp
示例18: netAddrSend
int netAddrSend(PyrObject *netAddrObj, int msglen, char *bufptr, bool sendMsgLen)
{
int err, port, addr;
SC_TcpClientPort* comPort = (SC_TcpClientPort*)(netAddrObj->slots + ivxNetAddr_Socket)->uptr;
if (comPort) {
// send TCP
int tcpSocket = comPort->Socket();
if (sendMsgLen) {
// send length of message in network byte-order
int32 sizebuf = htonl(msglen);
sendall(tcpSocket, &sizebuf, sizeof(int32));
}
sendall(tcpSocket, bufptr, msglen);
} else {
if (gUDPport == 0) return errFailed;
// send UDP
err = slotIntVal(netAddrObj->slots + ivxNetAddr_Hostaddr, &addr);
if (err) return err;
if (addr == 0) {
#ifdef NO_INTERNAL_SERVER
// no internal server under SC_WIN32 yet
#else
if (gInternalSynthServer.mWorld) {
World_SendPacket(gInternalSynthServer.mWorld, msglen, bufptr, &localServerReplyFunc);
}
#endif
return errNone;
}
err = slotIntVal(netAddrObj->slots + ivxNetAddr_PortID, &port);
if (err) return err;
struct sockaddr_in toaddr;
makeSockAddr(toaddr, addr, port);
sendallto(gUDPport->Socket(), bufptr, msglen, (sockaddr*)&toaddr, sizeof(toaddr));
}
return errNone;
}
开发者ID:scztt,项目名称:sc-debug,代码行数:47,代码来源:OSCData.cpp
示例19: prSetSpeechVoice
int prSetSpeechVoice(struct VMGlobals *g, int numArgsPushed){
OSErr theErr = noErr;
//PyrSlot *a = g->sp-2;
PyrSlot *b = g->sp-1;
PyrSlot *c = g->sp;
int val;
int chan;
VoiceSpec theVoiceSpec;
slotIntVal(b, &chan);
slotIntVal(c, &val);
theErr = GetIndVoice (val, &theVoiceSpec);
if (SetSpeechInfo (fCurSpeechChannel[chan], soCurrentVoice, &theVoiceSpec) == incompatibleVoice) return (!errNone);
return errNone;
}
开发者ID:scztt,项目名称:sc-debug,代码行数:17,代码来源:SC_Speech.cpp
示例20: prAscTime
int prAscTime(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp;
PyrSlot *slots = a->uo->slots;
if (IsNil(slots + 0)) {
SetNil(a);
return errNone;
}
struct tm tm0;
if (slotIntVal(slots+0, &tm0.tm_year)) return errWrongType;
tm0.tm_year -= 1900;
if (slotIntVal(slots+1, &tm0.tm_mon)) return errWrongType;
tm0.tm_mon -- ;
if (slotIntVal(slots+2, &tm0.tm_mday)) return errWrongType;
if (slotIntVal(slots+3, &tm0.tm_hour)) return errWrongType;
if (slotIntVal(slots+4, &tm0.tm_min)) return errWrongType;
if (slotIntVal(slots+5, &tm0.tm_sec)) return errWrongType;
if (slotIntVal(slots+6, &tm0.tm_wday)) return errWrongType;
const char *text = asctime(&tm0);
int size = strlen(text) - 1; // Discard trailing newline
PyrString *strobj = newPyrStringN(g->gc, size, 0, true);
memcpy(strobj->s, text, size);
SetObject(a, strobj);
return errNone;
}
开发者ID:scztt,项目名称:sc-debug,代码行数:32,代码来源:PyrUnixPrim.cpp
注:本文中的slotIntVal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论