本文整理汇总了C++中slotIntVal函数的典型用法代码示例。如果您正苦于以下问题:C++ slotIntVal函数的具体用法?C++ slotIntVal怎么用?C++ slotIntVal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slotIntVal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}