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

C++ PsychErrorExitMsg函数代码示例

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

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



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

示例1: SCREENAddAudioBufferToMovie

PsychError SCREENAddAudioBufferToMovie(void)
{
	static char useString[] = "Screen('AddAudioBufferToMovie', moviePtr, audioBuffer);";
	static char synopsisString[] = 
		"Add a buffer filled with audio data samples to movie 'moviePtr'.\n"
        "The movie must have been created in 'CreateMovie' with an options string that "
        "enables writing of an audio track into the movie, otherwise this function will fail.\n"
        "You enable writing of audio tracks by adding the keyword 'AddAudioTrack' to the options string.\n"
        "Alternatively, if your options string is a gst-launch style pipeline description, it must contain "
        "one pipeline element with a name option of 'name=ptbaudioappsrc'.\n"
        "'audioBuffer' must be 'numChannels' rows by 'numSamples' columns double matrix of audio data. "
        "Each row encodes one audio channel, each column element in a row encodes a sample. "
        "E.g., a 2-by-48000 matrix would encode 48000 samples for a two channel stereo sound track.\n"
        "Sample values must lie in the range between -1.0 and +1.0.\n"
        "The audio buffer is converted into a movie specific sound format and then appended to "
        "the audio samples already stored in the audio track.\n"
		"\n";

	static char seeAlsoString[] = "FinalizeMovie AddFrameToMovie CloseMovie PlayMovie GetMovieImage GetMovieTimeIndex SetMovieTimeIndex";
	
	int     moviehandle = -1;
    int     m, n, p;
    double* buffer;
	
	// All sub functions should have these two lines
	PsychPushHelp(useString, synopsisString, seeAlsoString);
	if(PsychIsGiveHelp()) {PsychGiveHelp(); return(PsychError_none);};
	
	PsychErrorExit(PsychCapNumInputArgs(2));            // Max. 2 input args.
	PsychErrorExit(PsychRequireNumInputArgs(2));        // Min. 2 input args required.
	PsychErrorExit(PsychCapNumOutputArgs(0));           // Max. 0 output args.
	
    // Get movie handle:
	PsychCopyInIntegerArg(1, kPsychArgRequired, &moviehandle);
    
    // And audio date buffer:
	PsychAllocInDoubleMatArg(2, kPsychArgRequired, &m, &n, &p, &buffer);
    if (p!=1 || m < 1 || n < 1) PsychErrorExitMsg(PsychError_user, "Invalid audioBuffer provided. Must be a 2D matrix with at least one row and at least one column!");

    // Pass audio data to movie writing engine:
    PsychAddAudioBufferToMovie(moviehandle, m, n, buffer);
    
	return(PsychError_none);
}
开发者ID:ChiNasa511,项目名称:Psychtoolbox-3,代码行数:44,代码来源:SCREENOpenMovie.c


示例2: SCREENPlayMovie

PsychError SCREENPlayMovie(void) 

{
    int                                 moviehandle = -1;
    double                              rate = 0;
    int                                 loop = 0;
    double                              sndvolume = 1;
    double                              dropped = 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(2));        // Min. 2 input args required.
    PsychErrorExit(PsychCapNumOutputArgs(1));           // Max. 1 output args.

    // Get the movie handle:
    PsychCopyInIntegerArg(1, TRUE, &moviehandle);
    if (moviehandle==-1) {
        PsychErrorExitMsg(PsychError_user, "PlayMovie called without valid handle to a movie object.");
    }

    // Get the requested playback rate.
    PsychCopyInDoubleArg(2, TRUE, &rate);

    // Get the 'loop' flag: If zero, we don't loop, otherwise we loop.
    PsychCopyInIntegerArg(3, FALSE, &loop);

    // Get the requested sound volume. Defaults to 1 == Full blast!
    PsychCopyInDoubleArg(4, FALSE, &sndvolume);
    if (sndvolume<0) sndvolume = 0;
    if (sndvolume>1) sndvolume = 1;

    // Start playback via low-level routines:
    dropped = (double) PsychPlaybackRate(moviehandle, rate, loop, sndvolume);

    // Return optional count of dropped frames:
    PsychCopyOutDoubleArg(1, FALSE, dropped);

    // Ready!
    return(PsychError_none);
}
开发者ID:AlanFreeman,项目名称:Psychtoolbox-3,代码行数:43,代码来源:SCREENPlayMovie.c


示例3: PsychHIDGetIndexFromRecord

/*
    PsychHIDGetIndexFromRecord()

    The inverse of PsychHIDGetDeviceRecordPtrFromIndex.

    This O(n) where n is the number of device elements.   We could make it O(1) if we modified
    the element structure in the HID Utilities library to include a field specifying the index of the element or
    collection.

    Note that if PsychHIDGetIndexFromRecord() is O(n) then its caller, PsychHIDGetCollections, is O(n^2) for each
    device, whereas if PsychHIDGetIndexFromRecord() is O(1) then psychHIDGetCollections becomes O(n) for each
    device.
*/
int PsychHIDGetIndexFromRecord(pRecDevice deviceRecord, pRecElement elementRecord, HIDElementTypeMask typeMask)
{
    int         elementIndex;
    pRecElement currentElement;

    if (elementRecord == NULL)
        return(0);
    elementIndex = 1;
    for (currentElement = HIDGetFirstDeviceElement(deviceRecord, typeMask);
        currentElement != elementRecord && currentElement != NULL;
        currentElement = HIDGetNextDeviceElement(currentElement, typeMask))
        ++elementIndex;
    if (currentElement == elementRecord)
        return elementIndex;
    else {
        PsychErrorExitMsg(PsychError_internal, "Element record not found within device record");
        return 0; //make the compiler happy
    }
}
开发者ID:zacklb,项目名称:Psychtoolbox-3,代码行数:32,代码来源:PsychHIDHelpers.c


示例4: PsychCopyInWindowIndexArg

psych_bool PsychCopyInWindowIndexArg(int position, psych_bool required, PsychWindowIndexType *windowIndex)
{

	double *arg;
        psych_bool isThere;
	
	if(position==kPsychUseDefaultArgPosition)
		position = kPsychDefaultNumdexArgPosition; 
        isThere=PsychAllocInDoubleArg(position,required,&arg);
        if(!isThere)
            return(FALSE);
	*windowIndex = (PsychWindowIndexType)*arg;
	if(IsWindowIndex(*windowIndex))
		return(TRUE);
	else{
		PsychErrorExitMsg(PsychError_invalidWindex,NULL);
		return(FALSE);  //only to satisfy the compiler with a return statement.
	}
}
开发者ID:Epixoft,项目名称:Psychtoolbox-3,代码行数:19,代码来源:ScreenArguments.c


示例5: PsychHIDGetCollectionRecordFromDeviceRecordAndCollectionIndex

pRecElement PsychHIDGetCollectionRecordFromDeviceRecordAndCollectionIndex(pRecDevice deviceRecord, int elementIndex)
{
    int				i;
    pRecElement			currentElement;

    PsychHIDVerifyInit();
    i=1;
    for(currentElement=HIDGetFirstDeviceElement(deviceRecord, kHIDElementTypeCollection); 
        currentElement != NULL; 
        currentElement=HIDGetNextDeviceElement (currentElement, kHIDElementTypeCollection))
    {    
        if(i==elementIndex)
            return(currentElement);
        ++i;
    }
    PsychErrorExitMsg(PsychError_internal, "Invalid collection index specified.  Has a device has been unplugged? Try rebuilding the device list");
    return(NULL);  //make the compiler happy.

}
开发者ID:Jakobth,项目名称:Psychtoolbox-3,代码行数:19,代码来源:PsychHIDHelpers.c


示例6: PsychSetOutputDithering

/* PsychSetOutputDithering() - Control bit depth control and dithering on digital display output encoder:
 * 
 * This function enables or disables bit depths truncation or dithering of digital display output ports of supported
 * graphics hardware. Currently the ATI Radeon X1000/HD2000/HD3000/HD4000/HD5000 and later cards should allow this.
 *
 * This needs support from the Psychtoolbox kernel level support driver for low-level register reads
 * and writes to the GPU registers.
 *
 *
 * 'windowRecord'	Is used to find the Id of the screen for which mode should be changed. If set to NULL then...
 * 'screenId'       ... is used to determine the screenId for the screen. Otherwise 'screenId' is ignored.
 * 'ditherEnable'   Zero = Disable any dithering. Non-Zero Reenable dithering after it has been disabled by us,
 *                  or if it wasn't disabled beforehand, enable it with a control mode as specified by the numeric
 *                  value of 'ditherEnable'. The value is GPU specific.
 *
 */
psych_bool  PsychSetOutputDithering(PsychWindowRecordType* windowRecord, int screenId, unsigned int ditherEnable)
{
#if PSYCH_SYSTEM == PSYCH_OSX || PSYCH_SYSTEM == PSYCH_LINUX

	// Child protection:
	if (windowRecord && !PsychIsOnscreenWindow(windowRecord)) PsychErrorExitMsg(PsychError_internal, "Invalid non-onscreen windowRecord provided!!!");
	
	// Either screenid from windowRecord or as passed in:
	if (windowRecord) screenId = windowRecord->screenNumber;
    
    // Do the call:
    PsychOSKDSetDitherMode(screenId, ditherEnable);

    return(TRUE);
#else
	// This cool stuff not supported on the uncool Windows OS:
    if(PsychPrefStateGet_Verbosity() > 1) printf("PTB-WARNING: GPU dithering control requested, but this is not supported on MS-Windows.\n");
	return(FALSE);
#endif
}
开发者ID:zampeta,项目名称:Psychtoolbox-3,代码行数:36,代码来源:PsychGraphicsHardwareHALSupport.c


示例7: PsychSetATSUStyleAttributesFromPsychWindowRecord

void PsychSetATSUStyleAttributesFromPsychWindowRecord(ATSUStyle atsuStyle,  PsychWindowRecordType *winRec)
{
	PsychFontStructType		*psychFontRecord;
	int						psychColorSize;
	//for ATSU attributes
	ATSUFontID				atsuFontID;
	Fixed					atsuFontSize;
	ATSURGBAlphaColor		atsuFontColor;
	ATSStyleRenderingOptions atsuRenderOptions;
	GLdouble				colorVector[4];
	OSStatus				callError;
	ATSUAttributeTag		aaTags[] =  {kATSUFontTag, kATSUSizeTag, kATSURGBAlphaColorTag, kATSUStyleRenderingOptionsTag };
	ByteCount				aaSizes[] = {sizeof(ATSUFontID), sizeof(Fixed), sizeof(ATSURGBAlphaColor), sizeof(ATSStyleRenderingOptions) };
	ATSUAttributeValuePtr   aaValue[] = {&atsuFontID, &atsuFontSize, &atsuFontColor, &atsuRenderOptions};
	
	//set the font index
	PsychGetFontRecordFromFontNumber(winRec->textAttributes.textFontNumber, &psychFontRecord);
	if(psychFontRecord==NULL)
		PsychErrorExitMsg(PsychError_internal, "Failed to lookup the font from the font number");
	atsuFontID=psychFontRecord->fontFMRef;

	//set the font size
	atsuFontSize=Long2Fix((long)(winRec->textAttributes.textSize));

	//set the color
	PsychCoerceColorMode(&(winRec->textAttributes.textColor));
	PsychConvertColorToDoubleVector(&(winRec->textAttributes.textColor), winRec, colorVector);
	atsuFontColor.red=(float)colorVector[0];
	atsuFontColor.green=(float)colorVector[1];
	atsuFontColor.blue=(float)colorVector[2];
	atsuFontColor.alpha=(float)colorVector[3];
	
	// Set anti-aliasing mode (on/off): Default is to leave it up to the system to decide when
	// to anti-alias and when not. But this flag allows to always force anti-aliasin on or off:
	atsuRenderOptions = kATSStyleNoOptions;
	if(PsychPrefStateGet_TextAntiAliasing()==0) atsuRenderOptions = kATSStyleNoAntiAliasing; 
	if(PsychPrefStateGet_TextAntiAliasing()> 0) atsuRenderOptions = kATSStyleApplyAntiAliasing; 
	
	//assign attributes to the style object
	callError=ATSUSetAttributes(atsuStyle, 4, aaTags, aaSizes, aaValue);
}
开发者ID:BackupTheBerlios,项目名称:osxptb-svn,代码行数:41,代码来源:ScreenFontGlue.c


示例8: FindCollectionElements

/*
    FindCollectionElements()

    Non-recursively return of a list of a collection's memember elements.

    HID element records hold three pointers to other element records: pPrevious, pChild and pSibling.  FindCollectionElements()
    operates on the theory that the members of a collection are its child and all of that child's siblings.

*/
int PsychHIDFindCollectionElements(pRecElement collectionRecord, HIDElementTypeMask elementTypeMask, pRecElement *collectionMembers, int maxListElements)
{
    pRecElement         currentElement;
    int                 numElements = 0;
    CFIndex             i, nmax;
    HIDElementTypeMask  currentElementMaskValue;

    CFArrayRef children = IOHIDElementGetChildren(collectionRecord);
    nmax = CFArrayGetCount(children);
    for (i = 0; i < nmax; i++) {
        currentElement = (pRecElement)CFArrayGetValueAtIndex(children, i);
        currentElementMaskValue = HIDConvertElementTypeToMask(IOHIDElementGetType(currentElement));
        if (currentElementMaskValue & elementTypeMask) {
            if (numElements == maxListElements) PsychErrorExitMsg(PsychError_internal, "Number of collection elements exceeds allocated storage space.");
            collectionMembers[numElements] = currentElement;
            ++numElements;
        }
    }

    return numElements;
}
开发者ID:zacklb,项目名称:Psychtoolbox-3,代码行数:30,代码来源:PsychHIDHelpers.c


示例9: PsychHIDOSKbQueueFlush

void PsychHIDOSKbQueueFlush(int deviceIndex)
{
	if(!hidDataRef || !psychHIDKbQueueFirstPress || !psychHIDKbQueueFirstRelease || !psychHIDKbQueueLastPress || !psychHIDKbQueueLastRelease){
		PsychErrorExitMsg(PsychError_user, "Queue has not been created.");
	}
	
	// Drain the queue of any unprocessed events
	{
		IOHIDEventStruct event;
		AbsoluteTime zeroTime= {0,0};
		
		while(  (*hidDataRef->hidQueueInterface)->getNextEvent(hidDataRef->hidQueueInterface, &event, zeroTime, 0) == kIOReturnSuccess){
			if ((event.longValueSize != 0) && (event.longValue != NULL)) free(event.longValue);
		}
	}
	
	pthread_mutex_lock(&psychHIDKbQueueMutex);

	// Zero out the scored values
	{
		int i;
		for(i=0; i<256; i++){
			
			psychHIDKbQueueFirstPress[i].hi=0;
			psychHIDKbQueueFirstPress[i].lo=0;

			psychHIDKbQueueFirstRelease[i].hi=0;
			psychHIDKbQueueFirstRelease[i].lo=0;

			psychHIDKbQueueLastPress[i].hi=0;
			psychHIDKbQueueLastPress[i].lo=0;

			psychHIDKbQueueLastRelease[i].hi=0;
			psychHIDKbQueueLastRelease[i].lo=0;
		}
        
        modifierKeyState = 0;        
	}
	pthread_mutex_unlock(&psychHIDKbQueueMutex);
}
开发者ID:AlanFreeman,项目名称:Psychtoolbox-3,代码行数:40,代码来源:PsychHIDKbQueueFlush.c


示例10: PsychHIDOSKbQueueRelease

void PsychHIDOSKbQueueRelease(int deviceIndex)
{
    if (deviceIndex < 0) {
        deviceIndex = PsychHIDGetDefaultKbQueueDevice();
        // Ok, deviceIndex now contains our default keyboard to use - The first suitable keyboard.
    }

    if ((deviceIndex < 0) || (deviceIndex >= ndevices)) {
        // Out of range index:
        PsychErrorExitMsg(PsychError_user, "Invalid 'deviceIndex' specified. No such device!");
    }

    // Keyboard queue for this deviceIndex already exists?
    if (NULL == psychHIDKbQueueFirstPress[deviceIndex]) {
        // No. Nothing to do then.
        return;
    }

    // Ok, we have a keyboard queue. Stop any operation on it first:
    PsychHIDOSKbQueueStop(deviceIndex);

    // Release its data structures:
    free(psychHIDKbQueueFirstPress[deviceIndex]);
    psychHIDKbQueueFirstPress[deviceIndex] = NULL;
    free(psychHIDKbQueueFirstRelease[deviceIndex]);
    psychHIDKbQueueFirstRelease[deviceIndex] = NULL;
    free(psychHIDKbQueueLastPress[deviceIndex]);
    psychHIDKbQueueLastPress[deviceIndex] = NULL;
    free(psychHIDKbQueueLastRelease[deviceIndex]);
    psychHIDKbQueueLastRelease[deviceIndex] = NULL;
    free(psychHIDKbQueueScanKeys[deviceIndex]);
    psychHIDKbQueueScanKeys[deviceIndex] = NULL;

    // Release kbqueue event buffer:
    PsychHIDDeleteEventBuffer(deviceIndex);

    // Done.
    return;
}
开发者ID:NxNiki,项目名称:Psychtoolbox-3,代码行数:39,代码来源:PsychHIDStandardInterfaces.cpp


示例11: PsychGetScreenDepths

void PsychGetScreenDepths(int screenNumber, PsychDepthType *depths)
{
  int* x11_depths;
  int  i, count;

  if(screenNumber>=numDisplays) PsychErrorExitMsg(PsychError_internal, "screenNumber is out of range"); //also checked within SCREENPixelSizes

  x11_depths = XListDepths(displayCGIDs[screenNumber], PsychGetXScreenIdForScreen(screenNumber), &count);
  if (depths && count>0) {
    // Query successful: Add all values to depth struct:
    for(i=0; i<count; i++) PsychAddValueToDepthStruct(x11_depths[i], depths);
    XFree(x11_depths);
  }
  else {
    // Query failed: Assume at least 32 bits is available.
    printf("PTB-WARNING: Couldn't query available display depths values! Returning a made up list...\n");
    fflush(NULL);
    PsychAddValueToDepthStruct(32, depths);
    PsychAddValueToDepthStruct(24, depths);
    PsychAddValueToDepthStruct(16, depths); 
  }
}
开发者ID:BackupTheBerlios,项目名称:osxptb-svn,代码行数:22,代码来源:PsychScreenGlue.c


示例12: ReportSysctlError

static void ReportSysctlError(int errorValue)
{
	psych_bool	foundError;
    int sysctlErrors[]={EFAULT, EINVAL, ENOMEM, ENOTDIR, EISDIR, EOPNOTSUPP, EPERM};
    int i, errorIndex, numSysctlErrors=7; 
    char *sysctlErrorStrings[]={"EFAULT", "EINVAL", "ENOMEM", "ENOTDIR", "EISDIR", "EOPNOTSUPP", "EPERM", "UNRECOGNIZED"};

    if(errorValue == 0) return;

	foundError=0;
	errorIndex=7;
	
    for(i=0; i<numSysctlErrors; i++){
        if(errno==sysctlErrors[i]){
			foundError=1;
			errorIndex=i;
            break;
		}
    }

    PsychErrorExitMsg(PsychError_internal, sysctlErrorStrings[errorIndex]);
}
开发者ID:BackupTheBerlios,项目名称:osxptb-svn,代码行数:22,代码来源:SCREENComputer.c


示例13: Screen

/* PsychSetupVertexColorArrays()

   Helper routine, called from the different batch drawing functions of Screen():
*/
void PsychSetupVertexColorArrays(PsychWindowRecordType *windowRecord, psych_bool enable, int mc, double* colors, unsigned char *bytecolors)
{
	if (enable) {
		// Enable and setup whatever's used:
		if (windowRecord->defaultDrawShader) {
			// Shader based unclamped path:
			if (colors)     glTexCoordPointer(mc, GL_DOUBLE, 0, colors);

			// Can't support uint8 datatype for this vertex attribute :-(
			if (bytecolors) PsychErrorExitMsg(PsychError_user, "Sorry, this function can't accept matrices of uint8 type for colors\nif color clamping is disabled or high precision mode active.\n Use the double() operator to convert to double matrix.");

			glEnableClientState(GL_TEXTURE_COORD_ARRAY);
			glColorPointer(4, GL_DOUBLE, 0, NULL);
		}
		else {
			// Standard path:
			if (colors)     glColorPointer(mc, GL_DOUBLE, 0, colors);
			if (bytecolors) glColorPointer(mc, GL_UNSIGNED_BYTE, 0, bytecolors);

			glEnableClientState(GL_COLOR_ARRAY);
			glTexCoordPointer(4, GL_DOUBLE, 0, NULL);
		}
	}
	else {
		// Disable whatever's used:
		if (windowRecord->defaultDrawShader) {
			// Shader based unclamped path:
			glDisableClientState(GL_TEXTURE_COORD_ARRAY);
		}
		else {
			// Standard path:
			glDisableClientState(GL_COLOR_ARRAY);
		}
		
		glColorPointer(4, GL_DOUBLE, 0, NULL);
		glTexCoordPointer(4, GL_DOUBLE, 0, NULL);
	}
}
开发者ID:neurodebian,项目名称:psychtoolbox-3-old-gitsvn-based,代码行数:42,代码来源:PsychGLGlue.c


示例14: SCREENTextMode

PsychError SCREENTextMode(void) 
{

    PsychTextDrawingModeType		newCopyMode;
    Str255							oldCopyModeName; 
    char							*newCopyModeName;
    psych_bool							doSetMode;
    PsychWindowRecordType			*windowRecord;
    psych_bool							nameError;                           
    
    //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);
    
    //Get the old copy mode & its name
    PsychGetTextDrawingModeNameFromTextDrawingModeConstant(oldCopyModeName, 255, windowRecord->textAttributes.textMode);
    PsychCopyOutCharArg(1, FALSE, oldCopyModeName);
    
    //Get the copy new mode string 
    doSetMode= PsychAllocInCharArg(2, FALSE, &newCopyModeName);
    if(doSetMode){
        nameError=PsychGetTextDrawingModeConstantFromTextDrawingModeName(&newCopyMode, newCopyModeName);
        if(nameError)
            PsychErrorExitMsg(PsychError_user, "Invalid text copy mode.  See Screen('TextModes') for a list of allowable modes");
		windowRecord->textAttributes.needsRebuild|=(windowRecord->textAttributes.textMode != newCopyMode) ? TRUE : FALSE;
        windowRecord->textAttributes.textMode=newCopyMode;	
    }
	
    return(PsychError_none);
}
开发者ID:BackupTheBerlios,项目名称:osxptb-svn,代码行数:38,代码来源:SCREENTextMode.c


示例15: PsychHIDOSKbQueueFlush

void PsychHIDOSKbQueueFlush(int deviceIndex)
{
    // Get true keyboardqueue index assigned to deviceIndex from original user provided deviceIndex:
    deviceIndex = PsychHIDOSGetKbQueueDevice(deviceIndex, NULL);

	// Does Keyboard queue for this deviceIndex already exist?
	if (NULL == psychHIDKbQueueFirstPress[deviceIndex]) {
		// No. Bad bad...
		printf("PsychHID-ERROR: Tried to flush non-existent keyboard queue for deviceIndex %i! Call KbQueueCreate first!\n", deviceIndex);
		PsychErrorExitMsg(PsychError_user, "Invalid keyboard 'deviceIndex' specified. No queue for that device yet!");
	}

	// Clear out current state for this queue:
	PsychLockMutex(&KbQueueMutex);
	memset(psychHIDKbQueueFirstPress[deviceIndex]   , 0, (256 * sizeof(double)));
	memset(psychHIDKbQueueFirstRelease[deviceIndex] , 0, (256 * sizeof(double)));
	memset(psychHIDKbQueueLastPress[deviceIndex]    , 0, (256 * sizeof(double)));
	memset(psychHIDKbQueueLastRelease[deviceIndex]  , 0, (256 * sizeof(double)));
    modifierKeyState[deviceIndex] = 0;
	PsychUnlockMutex(&KbQueueMutex);

    return;
}
开发者ID:Orca25,项目名称:Psychtoolbox-3,代码行数:23,代码来源:PsychHIDStandardInterfaces.c


示例16: SCREENCloseVideoCapture

PsychError SCREENCloseVideoCapture(void) 
{
    int capturehandle = -1;
    
    // 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(0));           // No output args.

    // Get the handle:
    PsychCopyInIntegerArg(1, TRUE, &capturehandle);
    if (capturehandle==-1) {
        PsychErrorExitMsg(PsychError_user, "CloseVideoCapture called without valid handle to a capture object.");
    }

    // Try to delete the object, releasing all associated ressources:
    PsychCloseVideoCaptureDevice(capturehandle);

    // Ready!    
    return(PsychError_none);
}
开发者ID:AlanFreeman,项目名称:Psychtoolbox-3,代码行数:23,代码来源:SCREENCloseVideoCapture.c


示例17: PsychtcbCombine

void APIENTRY PsychtcbCombine(GLdouble c[3], void *d[4], GLfloat w[4], void **out)
{
    GLdouble *nv;

    (void) d, (void) w;

    // Free slots available?
    if (combinerCacheSlot >= combinerCacheSize) {
	    // Nope. Need to alloc another cache for up to another 1000 elements:
	    combinerCacheSize = 1000;
	    combinerCacheSlot = 0;
	    combinerCache = (GLdouble *) PsychMallocTemp(sizeof(GLdouble) * 3 * combinerCacheSize);
	    if (NULL == combinerCache) PsychErrorExitMsg(PsychError_outofMemory, "Out of memory condition in Screen('FillPoly')! Not enough space.");
    }

    nv = (GLdouble *) &(combinerCache[combinerCacheSlot * 3]);
    nv[0] = c[0];
    nv[1] = c[1];
    nv[2] = c[2];
    *out = nv;

	combinerCacheSlot++;
}
开发者ID:Psychtoolbox-3,项目名称:Psychtoolbox-3,代码行数:23,代码来源:SCREENFillPoly.c


示例18: SCREENGetMovieTimeIndex

PsychError SCREENGetMovieTimeIndex(void) 
{
    int moviehandle = -1;
    
    // 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 movie handle:
    PsychCopyInIntegerArg(1, TRUE, &moviehandle);
    if (moviehandle==-1) {
        PsychErrorExitMsg(PsychError_user, "GetMovieTimeIndex called without valid handle to a movie object.");
    }
    
    // Retrieve and return current movie time index:
    PsychCopyOutDoubleArg(1, TRUE, PsychGetMovieTimeIndex(moviehandle));
    
    return(PsychError_none);
}
开发者ID:AlanFreeman,项目名称:Psychtoolbox-3,代码行数:23,代码来源:SCREENGetMovieTimeIndex.c


示例19: PsychHIDCreateEventBuffer

psych_bool PsychHIDCreateEventBuffer(int deviceIndex)
{
	unsigned int bufferSize;

	if (deviceIndex < 0) deviceIndex = PsychHIDGetDefaultKbQueueDevice();

	bufferSize = hidEventBufferCapacity[deviceIndex];

	// Already created? If so, nothing to do:
	if (hidEventBuffer[deviceIndex] || (bufferSize < 1)) return(FALSE);
	
	hidEventBuffer[deviceIndex] = (PsychHIDEventRecord*) calloc(sizeof(PsychHIDEventRecord), bufferSize);
	if (NULL == hidEventBuffer[deviceIndex]) PsychErrorExitMsg(PsychError_outofMemory, "Insufficient memory to create KbQueue event buffer!");
	
	// Prepare mutex for buffer:
	PsychInitMutex(&hidEventBufferMutex[deviceIndex]);
	PsychInitCondition(&hidEventBufferCondition[deviceIndex], NULL);

	// Flush it:
	PsychHIDFlushEventBuffer(deviceIndex);
	
	return(TRUE);
}
开发者ID:Jakobth,项目名称:Psychtoolbox-3,代码行数:23,代码来源:PsychHIDHelpers.c


示例20: SCREENGlobalRect

PsychError SCREENGlobalRect(void)  
{	
	int						screenNumber;
	PsychWindowRecordType	*windowRecord;
	PsychRectType			rect; 
    
	//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));			
	PsychErrorExit(PsychRequireNumInputArgs(1));		 
	PsychErrorExit(PsychCapNumOutputArgs(1));			

	if(PsychIsScreenNumberArg(1)) {
		// Real screen id: Get screens global rect and return it:
		PsychCopyInScreenNumberArg(1, TRUE, &screenNumber);
		PsychGetGlobalScreenRect(screenNumber, rect);
		PsychCopyOutRectArg(1, FALSE, rect);
	}
	else if(PsychIsWindowIndexArg(1)) {
		// Window:
		PsychAllocInWindowRecordArg(1, TRUE, &windowRecord);

		//  Onscreen?
		if (PsychIsOnscreenWindow(windowRecord)) {
			PsychCopyOutRectArg(1, FALSE, windowRecord->globalrect);
		}
		else {
			PsychCopyOutRectArg(1, FALSE, windowRecord->rect);
		}
	}
	else PsychErrorExitMsg(PsychError_user, "Argument was recognized as neither a window index nor a screen pointer");

	return(PsychError_none);
}
开发者ID:BackupTheBerlios,项目名称:osxptb-svn,代码行数:37,代码来源:SCREENGlobalRect.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ PsychIsGiveHelp函数代码示例发布时间:2022-05-30
下一篇:
C++ PsychErrorExit函数代码示例发布时间: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