本文整理汇总了C++中PsychCopyOutDoubleArg函数的典型用法代码示例。如果您正苦于以下问题:C++ PsychCopyOutDoubleArg函数的具体用法?C++ PsychCopyOutDoubleArg怎么用?C++ PsychCopyOutDoubleArg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PsychCopyOutDoubleArg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SCREENGetOpenGLDrawMode
PsychError SCREENGetOpenGLDrawMode(void)
{
static char useString[] = "[targetwindow, IsOpenGLRendering] = Screen('GetOpenGLDrawMode');";
static char synopsisString[] = "Return information about current OpenGL rendering state.\n"
"'targetwindow' is the window handle of the window that is currently enabled for "
"drawing. That is, the last window a Screen drawing command was drawing to, or "
"the window which is the current target for OpenGL rendering commands.\n"
"'IsOpenGLRendering' if equal to zero, then normal 2D Screen drawing is active. "
"If greater than zero, then Matlab OpenGL drawing is active, ie. a Screen('BeginOpenGL'); "
"command was executed and OpenGL code can draw into 'targetwindow'. ";
static char seeAlsoString[] = "BeginOpenGL EndOpenGL SetOpenGLTexture GetOpenGLTexture moglcore";
PsychWindowRecordType *windowRecord;
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString,seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check for superfluous arguments
PsychErrorExit(PsychCapNumInputArgs(0)); // The maximum number of inputs
PsychErrorExit(PsychRequireNumInputArgs(0)); // Number of required inputs.
PsychErrorExit(PsychCapNumOutputArgs(2)); // The maximum number of outputs
windowRecord = PsychGetDrawingTarget();
// Return window handle of currently active drawing target window:
PsychCopyOutDoubleArg(1, FALSE, (double) ((windowRecord) ? windowRecord->windowIndex : 0));
// Return draw mode: OpenGL userspace rendering or Screen() internal rendering?
PsychCopyOutDoubleArg(2, FALSE, (double) PsychIsUserspaceRendering());
// Ready:
return(PsychError_none);
}
示例2: SCREENWindowSize
PsychError SCREENWindowSize(void)
{
PsychWindowRecordType *windowRecord;
int screenNumber;
PsychRectType rect;
double rectWidth, rectHeight;
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString,seeAlsoString);
if(PsychIsGiveHelp()) {
PsychGiveHelp();
return(PsychError_none);
};
//check for superfluous arguments
PsychErrorExit(PsychCapNumInputArgs(1)); //The maximum number of inputs
PsychErrorExit(PsychRequireNumInputArgs(1)); //Insist that the argument be present.
PsychErrorExit(PsychCapNumOutputArgs(2)); //The maximum number of outputs
if(PsychIsScreenNumberArg(1)) {
PsychCopyInScreenNumberArg(1, TRUE, &screenNumber);
PsychGetScreenRect(screenNumber, rect);
rectWidth=PsychGetWidthFromRect(rect);
rectHeight=PsychGetHeightFromRect(rect);
PsychCopyOutDoubleArg(1, kPsychArgOptional, rectWidth);
PsychCopyOutDoubleArg(2, kPsychArgOptional, rectHeight);
} else if(PsychIsWindowIndexArg(1)) {
PsychAllocInWindowRecordArg(1, TRUE, &windowRecord);
PsychOSProcessEvents(windowRecord, 0);
rectWidth=PsychGetWidthFromRect(windowRecord->rect);
rectHeight=PsychGetHeightFromRect(windowRecord->rect);
if (windowRecord->specialflags & kPsychHalfWidthWindow) {
// Special case for stereo: Only half the real window width:
rectWidth = rectWidth / 2;
}
if (windowRecord->specialflags & kPsychHalfHeightWindow) {
// Special case for stereo: Only half the real window width:
rectHeight = rectHeight / 2;
}
PsychCopyOutDoubleArg(1, kPsychArgOptional, rectWidth);
PsychCopyOutDoubleArg(2, kPsychArgOptional, rectHeight);
} else
PsychErrorExitMsg(PsychError_user, "Argument was recognized as neither a window index nor a screen pointer");
return(PsychError_none);
}
示例3: SCREENStopVideoCapture
PsychError SCREENStopVideoCapture(void)
{
int capturehandle = -1;
int dropped;
// All sub functions should have these two lines
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()) {PsychGiveHelp(); return(PsychError_none);};
PsychErrorExit(PsychCapNumInputArgs(1)); // Max. 1 input args.
PsychErrorExit(PsychRequireNumInputArgs(1)); // Min. 1 input args required.
PsychErrorExit(PsychCapNumOutputArgs(1)); // One output arg.
// Get the handle:
PsychCopyInIntegerArg(1, TRUE, &capturehandle);
if (capturehandle==-1) {
PsychErrorExitMsg(PsychError_user, "StopVideoCapture called without valid handle to a capture object.");
}
// Try to stop capture:
dropped = PsychVideoCaptureRate(capturehandle, 0, 0, NULL);
PsychCopyOutDoubleArg(1, FALSE, dropped);
// Ready!
return(PsychError_none);
}
示例4: EyelinkCurrentMode
PsychError EyelinkCurrentMode(void)
{
int iMode = 0;
// Add help strings
PsychPushHelp(useString, synopsisString, seeAlsoString);
// Output help if asked
if(PsychIsGiveHelp()) {
PsychGiveHelp();
return(PsychError_none);
}
// Check arguments
PsychErrorExit(PsychCapNumInputArgs(0));
PsychErrorExit(PsychRequireNumInputArgs(0));
PsychErrorExit(PsychCapNumOutputArgs(1));
// Verify eyelink is up and running
EyelinkSystemIsConnected();
EyelinkSystemIsInitialized();
iMode = eyelink_current_mode();
// Assign output arg
PsychCopyOutDoubleArg(1, TRUE, iMode);
return(PsychError_none);
}
示例5: SCREENTextStyle
PsychError SCREENTextStyle(void)
{
boolean doSetStyle;
PsychWindowRecordType *windowRecord;
int oldTextStyle, newTextStyle;
//all subfunctions should have these two lines.
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check for valid number of arguments
PsychErrorExit(PsychRequireNumInputArgs(1));
PsychErrorExit(PsychCapNumInputArgs(2));
PsychErrorExit(PsychCapNumOutputArgs(1));
//Get the window record
PsychAllocInWindowRecordArg(kPsychUseDefaultArgPosition, TRUE, &windowRecord);
//Save the old text size value and return it.
oldTextStyle=windowRecord->textAttributes.textStyle;
PsychCopyOutDoubleArg(1, FALSE, (double)oldTextStyle);
//Fetch and set the new size if it is specified.
doSetStyle= PsychCopyInIntegerArg(2, FALSE, &newTextStyle);
if(doSetStyle)
windowRecord->textAttributes.textStyle=newTextStyle;
return(PsychError_none);
}
示例6: EyelinkGetTrackerVersion
PsychError EyelinkGetTrackerVersion(void)
{
int iVersion=0;
char strVersion[40]="unknown tracker type";
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check to see if the user supplied superfluous arguments
PsychErrorExit(PsychCapNumInputArgs(0));
PsychErrorExit(PsychRequireNumInputArgs(0));
PsychErrorExit(PsychCapNumOutputArgs(2));
// // Verify eyelink is up and running
// EyelinkSystemIsConnected();
// EyelinkSystemIsInitialized();
iVersion = eyelink_get_tracker_version(strVersion);
// mexPrintf("Tracker Version: '%s'\n", strVersion );
PsychCopyOutDoubleArg(1, TRUE, iVersion);
PsychCopyOutCharArg(2, FALSE, strVersion);
return(PsychError_none);
}
示例7: GESTALTGestalt
PsychError GESTALTGestalt(void)
{
char *selectorCString;
OSType selectorConstant;
CFStringRef selectorCFString;
OSErr callError;
long responseLong, i;
PsychNativeBooleanType *responseArray;
psych_bool returnResponse;
PsychErrorExit(PsychCapNumOutputArgs(1));
PsychErrorExit(PsychCapNumInputArgs(1));
PsychAllocInCharArg(1, kPsychArgRequired, &selectorCString);
if( strlen(selectorCString) != 4)
PsychErrorExitMsg(PsychError_user, "The selector code must be a four-character string");
selectorCFString=CFStringCreateWithCString (NULL, selectorCString, kCFStringEncodingUTF8);
selectorConstant= UTGetOSTypeFromString(selectorCFString);
callError= Gestalt(selectorConstant, &responseLong);
CFRelease(selectorCFString);
if(callError)
PsychCopyOutDoubleArg(1, kPsychArgOptional, (double)callError);
else{
returnResponse=PsychAllocOutBooleanMatArg(1, kPsychArgOptional, 1, 32, 1, &responseArray);
if(returnResponse){
for(i=0;i<32;i++){
if(1<<i & responseLong)
responseArray[31-i]=TRUE;
else
responseArray[31-i]=FALSE;
}
}
}
return(PsychError_none);
}
示例8: SCREENPixelSize
PsychError SCREENPixelSize(void)
{
int screenNumber;
double depth;
PsychWindowRecordType *windowRecord;
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check to see if the user supplied superfluous arguments
PsychErrorExit(PsychCapNumOutputArgs(1));
PsychErrorExit(PsychCapNumInputArgs(1));
//get specified screen number.
if(PsychIsScreenNumberArg(1)){
PsychCopyInScreenNumberArg(1, TRUE, &screenNumber);
depth=(double)PsychGetScreenDepthValue(screenNumber);
}else if(PsychIsWindowIndexArg(1)){
PsychAllocInWindowRecordArg(1,TRUE,&windowRecord);
depth=(double)windowRecord->depth;
}else
PsychErrorExit(PsychError_invalidNumdex);
//Allocate a return matrix and load it with the depth values.
PsychCopyOutDoubleArg(1, FALSE, depth);
return(PsychError_none);
}
示例9: IOPORTVerbosity
PsychError IOPORTVerbosity(void)
{
static char useString[] = "oldlevel = IOPort('Verbosity' [,level]);";
static char synopsisString[] =
"Set level of verbosity for error/warning/status messages. 'level' optional, new level "
"of verbosity. 'oldlevel' is the old level of verbosity. The following levels are "
"supported: 0 = Shut up. 1 = Print errors, 2 = Print also warnings, 3 = Print also some info, "
"4 = Print more useful info (default), >5 = Be very verbose (mostly for debugging the driver itself). ";
static char seeAlsoString[] = "";
int level= -1;
// Setup online help:
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()) {PsychGiveHelp(); return(PsychError_none); };
PsychErrorExit(PsychCapNumInputArgs(1)); // The maximum number of inputs
PsychErrorExit(PsychRequireNumInputArgs(0)); // The required number of inputs
PsychErrorExit(PsychCapNumOutputArgs(1)); // The maximum number of outputs
PsychCopyInIntegerArg(1, kPsychArgOptional, &level);
if (level < -1) PsychErrorExitMsg(PsychError_user, "Invalid level of verbosity provided. Valid are levels of zero and greater.");
// Return current/old level:
PsychCopyOutDoubleArg(1, kPsychArgOptional, (double) verbosity);
// Set new level, if one was provided:
if (level > -1) verbosity = level;
return(PsychError_none);
}
示例10: WAITSECSYieldSecs
PsychError WAITSECSYieldSecs(void)
{
static char useString[] = "[realWakeupTimeSecs] = WaitSecs('YieldSecs', waitPeriodSecs);";
// 1
static char synopsisString[] =
"Wait for at least \"waitPeriodSecs\", don't care if it takes a few milliseconds longer. "
"Optionally, return the real wakeup time \"realWakeupTimeSecs\".\n"
"This call is useful if you want your code to release the cpu for a few milliseconds, "
"e.g., to avoid overloading the cpu in a spinning loop, and you don't care if the "
"wait takes a few msecs longer than specified. If you do care, use one of the other "
"WaitSecs() variants! The other variants emphasize accuracy of timed waits, even if "
"this causes a high load on the processor.\n";
static char seeAlsoString[] = "";
double waitPeriodSecs;
double now;
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString,seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check to see if the user supplied superfluous arguments
PsychErrorExit(PsychCapNumOutputArgs(1));
PsychErrorExit(PsychCapNumInputArgs(1));
PsychCopyInDoubleArg(1,TRUE,&waitPeriodSecs);
PsychYieldIntervalSeconds(waitPeriodSecs);
// Return current system time at end of sleep:
PsychGetAdjustedPrecisionTimerSeconds(&now);
PsychCopyOutDoubleArg(1, FALSE, now);
return(PsychError_none);
}
示例11: SCREENWindowSize
PsychError SCREENWindowSize(void)
{
PsychWindowRecordType *windowRecord;
int screenNumber;
double rectWidth, rectHeight;
long fbWidth, fbHeight;
int realFBSize = 0;
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString,seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check for superfluous arguments
PsychErrorExit(PsychCapNumInputArgs(2)); //The maximum number of inputs
PsychErrorExit(PsychRequireNumInputArgs(1)); //Insist that the argument be present.
PsychErrorExit(PsychCapNumOutputArgs(2)); //The maximum number of outputs
// Get optional 'realFBSize' flag: Defaults to zero.
PsychCopyInIntegerArg(2, FALSE, &realFBSize);
if(PsychIsScreenNumberArg(1)){
PsychCopyInScreenNumberArg(1, TRUE, &screenNumber);
if (realFBSize) {
// Physical size in pixels:
PsychGetScreenPixelSize(screenNumber, &fbWidth, &fbHeight);
}
else {
// Logical size in points:
PsychGetScreenSize(screenNumber, &fbWidth, &fbHeight);
}
PsychCopyOutDoubleArg(1, kPsychArgOptional, fbWidth);
PsychCopyOutDoubleArg(2, kPsychArgOptional, fbHeight);
}else if(PsychIsWindowIndexArg(1)){
PsychAllocInWindowRecordArg(1, TRUE, &windowRecord);
PsychOSProcessEvents(windowRecord, 0);
rectWidth=PsychGetWidthFromRect((realFBSize) ? windowRecord->rect : windowRecord->clientrect);
rectHeight=PsychGetHeightFromRect((realFBSize) ? windowRecord->rect : windowRecord->clientrect);
PsychCopyOutDoubleArg(1, kPsychArgOptional, rectWidth);
PsychCopyOutDoubleArg(2, kPsychArgOptional, rectHeight);
}else
PsychErrorExitMsg(PsychError_user, "Argument was recognized as neither a window index nor a screen pointer");
return(PsychError_none);
}
示例12: SCREENStartVideoCapture
PsychError SCREENStartVideoCapture(void)
{
int capturehandle = -1;
double captureFPS = 25;
int dropframes = 0;
double starttime = 0;
// All sub functions should have these two lines
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()) {PsychGiveHelp(); return(PsychError_none);};
PsychErrorExit(PsychCapNumInputArgs(4)); // Max. 4 input args.
PsychErrorExit(PsychRequireNumInputArgs(1)); // Min. 1 input args required.
PsychErrorExit(PsychCapNumOutputArgs(2)); // Max. 2 output args.
// Get the handle:
PsychCopyInIntegerArg(1, TRUE, &capturehandle);
if (capturehandle==-1) {
PsychErrorExitMsg(PsychError_user, "StartVideoCapture called without valid handle to a capture object.");
}
PsychCopyInDoubleArg(2, FALSE, &captureFPS);
if (captureFPS<=0) {
PsychErrorExitMsg(PsychError_user, "StartVideoCapture called with a negative capture rate.");
}
PsychCopyInIntegerArg(3, FALSE, &dropframes);
if (dropframes<0) {
PsychErrorExitMsg(PsychError_user, "StartVideoCapture called with invalid (negative) dropframes - argument.");
}
PsychCopyInDoubleArg(4, FALSE, &starttime);
if (starttime<0) {
PsychErrorExitMsg(PsychError_user, "StartVideoCapture called with invalid (negative) startAt - argument.");
}
// Try to start capture:
captureFPS = (double) PsychVideoCaptureRate(capturehandle, captureFPS, dropframes, &starttime);
PsychCopyOutDoubleArg(1, FALSE, captureFPS);
PsychCopyOutDoubleArg(2, FALSE, starttime);
// Ready!
return(PsychError_none);
}
示例13: PSYCHHIDOpenUSBDevice
PsychError PSYCHHIDOpenUSBDevice(void)
{
PsychUSBSetupSpec deviceSpec;
int deviceID, vendorID, configurationId;
int errcode;
int usbHandle = -1;
PsychUSBDeviceRecord *usbDev = NULL;
// Setup the help features.
PsychPushHelp(useString, synopsisString, seeAlsoString);
if (PsychIsGiveHelp()) {
PsychGiveHelp();
return PsychError_none;
}
// Make sure the correct number of input arguments is supplied.
PsychErrorExit(PsychCapNumInputArgs(3));
PsychErrorExit(PsychRequireNumInputArgs(2));
PsychErrorExit(PsychCapNumOutputArgs(1));
// Grab the mandatory vendor and device IDs.
PsychCopyInIntegerArg(1, TRUE, &vendorID);
PsychCopyInIntegerArg(2, TRUE, &deviceID);
// Try to get free slot in internal device bank: This will error-exit if no capacity left.
usbDev = PsychHIDGetFreeUSBDeviceSlot(&usbHandle);
// Setup specification of wanted device:
// So far we only match against vendorID and deviceID, but may want to extend this
// to more options in the future. That's why its passed via a PsychUSBSetupSpec struct.
// -> Can rather easily extend that struct (and corresponding open routines) with new
// fields without major code rewrites in other places.
deviceSpec.vendorID = vendorID;
deviceSpec.deviceID = deviceID;
// This is the index of the device configuration to choose: Defaults to zero.
configurationId = 0;
PsychCopyInIntegerArg(3, FALSE, &configurationId);
deviceSpec.configurationID = (int) configurationId;
// Try to open the device. This will init the device structure properly and
// also set the valid flag to "active/open" if open succeeds:
if (!PsychHIDOSOpenUSBDevice(usbDev, &errcode, &deviceSpec)) {
// MK TODO: We don't set or use 'errcode' yet.
PsychErrorExitMsg(PsychError_user, "Failed to open the specified type of generic USB device. Make sure it is plugged in or not already open.");
}
// Return device handle:
PsychCopyOutDoubleArg(1, FALSE, (double) usbHandle);
return PsychError_none;
}
示例14: SCREENDisplaySize
PsychError SCREENDisplaySize(void)
{
static char useString[] = "[width, height]=Screen('DisplaySize', ScreenNumber);";
static char synopsisString[] =
"Return the physical width and height of the output display device associated with 'ScreenNumber'. "
"The size is returned in units of millimeters as reported by the display device itself to the OS. "
"On MacOS-X, if Extended Display Identification Data (EDID) for the display device is not "
"available, the size is estimated by OS-X based on the device width and height in pixels, with an "
"assumed resolution of 2.835 pixels/mm or 72 DPI, a reasonable guess for displays predating "
"EDID support. On M$-Windows and GNU/Linux, the behaviour in case of missing EDID data is "
"unknown. This function returns a width and height of zero if physical display size can't be "
"queried from the operating system. Please handle the returned information with great caution. "
"It is unclear how accurate the EDID data for typical monitors or video beamers really is. This "
"information could be pretty unreliable and therefore misleading!";
static char seeAlsoString[] = "";
int screenNumber, Width, Height;
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString,seeAlsoString);
if(PsychIsGiveHelp()) {
PsychGiveHelp();
return(PsychError_none);
};
//check for superfluous arguments
PsychErrorExit(PsychCapNumInputArgs(1)); //The maximum number of inputs
PsychErrorExit(PsychRequireNumInputArgs(1)); //Insist that the argument be present.
PsychErrorExit(PsychCapNumOutputArgs(2)); //The maximum number of outputs
// Retrieve screen number:
PsychCopyInScreenNumberArg(1, TRUE, &screenNumber);
// Query physical size of this screen in millimeters:
PsychGetDisplaySize(screenNumber, &Width, &Height);
// Return it:
PsychCopyOutDoubleArg(1, kPsychArgOptional, (double) Width);
PsychCopyOutDoubleArg(2, kPsychArgOptional, (double) Height);
return(PsychError_none);
}
示例15: SCREENTextStyle
PsychError SCREENTextStyle(void)
{
psych_bool doSetStyle, foundFont;
PsychWindowRecordType *windowRecord;
int oldTextStyle, newTextStyle;
#if PSYCH_SYSTEM == PSYCH_OSX
PsychFontStructType *fontRecord;
#endif
//all subfunctions should have these two lines.
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check for valid number of arguments
PsychErrorExit(PsychRequireNumInputArgs(1));
PsychErrorExit(PsychCapNumInputArgs(2));
PsychErrorExit(PsychCapNumOutputArgs(1));
//Get the window record
PsychAllocInWindowRecordArg(kPsychUseDefaultArgPosition, TRUE, &windowRecord);
//Save the old text size value and return it.
oldTextStyle=windowRecord->textAttributes.textStyle;
PsychCopyOutDoubleArg(1, FALSE, (double)oldTextStyle);
//Fetch and set the new size if it is specified.
doSetStyle= PsychCopyInIntegerArg(2, FALSE, &newTextStyle);
if (doSetStyle) {
windowRecord->textAttributes.needsRebuild|=(windowRecord->textAttributes.textStyle != newTextStyle) ? TRUE : FALSE;
windowRecord->textAttributes.textStyle=newTextStyle;
#if PSYCH_SYSTEM == PSYCH_OSX
// Need to update font name and number from changed style on OS/X:
foundFont = PsychGetFontRecordFromFontFamilyNameAndFontStyle((char*) windowRecord->textAttributes.textFontName, windowRecord->textAttributes.textStyle, &fontRecord);
if (foundFont) {
strncpy((char*) windowRecord->textAttributes.textFontName, (const char*) fontRecord->fontFMFamilyName, 255);
windowRecord->textAttributes.textFontNumber= fontRecord->fontNumber;
}
else {
// Failed! Revert to old setting:
windowRecord->textAttributes.textStyle = oldTextStyle;
}
#endif
}
return(PsychError_none);
}