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


C++ OSCollectionIterator::reset方法代码示例

本文整理汇总了C++中OSCollectionIterator::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ OSCollectionIterator::reset方法的具体用法?C++ OSCollectionIterator::reset怎么用?C++ OSCollectionIterator::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OSCollectionIterator的用法示例。


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

示例1: GetKeyboardReservedStructEventForService

static KeyboardReserved * GetKeyboardReservedStructEventForService(IOHIKeyboard *service, UInt32 * index = 0)
{
    KeyboardReserved 	* retVal    = 0;
    
    if (gKeyboardReservedArray) {
        OSCollectionIterator    * iterator  = 0;
        iterator = OSCollectionIterator::withCollection(gKeyboardReservedArray);
        if (iterator) {
            bool done = false;
            while (!done) {
                OSObject * obj = 0;
                while (!done && (NULL != (obj = iterator->getNextObject()))) {
                    OSData * data = OSDynamicCast(OSData, obj);
                    if (data) {
                        retVal = (KeyboardReserved *)data->getBytesNoCopy();
                        if (retVal && (retVal->service == service)) {
                            if (index)
                                *index = gKeyboardReservedArray->getNextIndexOfObject(obj, 0);
                            done = true;
                        }
                        else {
                            retVal = 0;
                        }
                    }
                }
                if (iterator->isValid()) {
                    done = true;
                }
                else {
                    iterator->reset();
                }
        
            }        
            iterator->release();
        }
    }
    
    return retVal;
}
开发者ID:MomandDad,项目名称:netbook-installer,代码行数:39,代码来源:IOHIKeyboard.cpp

示例2: init

bool driver::init(OSDictionary *properties) {
    OSArray *speedArray = NULL;
    OSCollectionIterator *speedIterator = NULL;
    OSString *speedKey;

    chkpoint("Initializing\n");
    if (super::init(properties) == false) fail("super::init");
	
    speedArray = OSDynamicCast(OSArray, getProperty(kVID));
    if (speedArray == NULL) fail("no " kVID "!\n");

    speedIterator = OSCollectionIterator::withCollection(speedArray);
    if (speedIterator == NULL) fail("no speediterator!\n");

    speedIterator->reset();
    while (speedKey = (OSString *)speedIterator->getNextObject()) {
         sscanf(speedKey->getCStringNoCopy(),"%d,%d,%x",&speedstep_cpu_setting[num_speeds].cpuMhz,&speedstep_cpu_setting[num_speeds].cpuMv,&speedstep_cpu_setting[num_speeds].VID);
	 if (speedstep_cpu_setting[num_speeds].cpuMhz<=100 || speedstep_cpu_setting[num_speeds].cpuMv<=700 || speedstep_cpu_setting[num_speeds].VID < 0xFF) { // Some sane values - 700mv is the absolute minimum possible?
	  bzero(&speedstep_cpu_setting[num_speeds],sizeof(speedstep_cpu_t));
	  err("Ignoring invalid mhz,mv specified = %s\n",speedKey->getCStringNoCopy());
	 } else {
	  //speedstep_cpu_setting[num_speeds].VID=VID(speedstep_cpu_setting[num_speeds].cpuMhz,speedstep_cpu_setting[num_speeds].cpuMv);
	  info("Identified configured speed %uMhz, %umv, VID=0x%04x\n",speedstep_cpu_setting[num_speeds].cpuMhz,speedstep_cpu_setting[num_speeds].cpuMv,speedstep_cpu_setting[num_speeds].VID);
          num_speeds++;
	 }
    }
	
    if (!num_speeds) fail("No valid speeds given"); // No valid settings, bail!
    dbg("%d speed settings used\n", num_speeds);

    eist_lock=IOSimpleLockAlloc();
    if (!eist_lock) fail("IOSimpleLockAlloc");
	
    return(true);
	
    fail:
    return(false);
}
开发者ID:Kami,项目名称:xnu-speedstep-air,代码行数:38,代码来源:TurboEIST.cpp

示例3: OSDynamicCast

bool eqMac2DriverEngine::createAudioStreams(IOAudioSampleRate *initialSampleRate)
{
    bool			result = false;
    OSNumber*		number = NULL;
    UInt32			numStreams;
	UInt32			streamNum;
    OSArray*		formatArray = NULL;
	OSArray*		sampleRateArray = NULL;
    UInt32			startingChannelID = 1;
    OSString*		desc;
    
    desc = OSDynamicCast(OSString, getProperty(DESCRIPTION_KEY));
    if (desc)
        setDescription(desc->getCStringNoCopy());
    
    number = OSDynamicCast(OSNumber, getProperty(NUM_STREAMS_KEY));
    if (number)
        numStreams = number->unsigned32BitValue();
	else
        numStreams = NUM_STREAMS;
    
    formatArray = OSDynamicCast(OSArray, getProperty(FORMATS_KEY));
    if (formatArray == NULL) {
		IOLog("SF formatArray is NULL\n");
        goto Done;
    }
    
    sampleRateArray = OSDynamicCast(OSArray, getProperty(SAMPLE_RATES_KEY));
    if (sampleRateArray == NULL) {
		IOLog("SF sampleRateArray is NULL\n");
        goto Done;
    }
    
    for (streamNum = 0; streamNum < numStreams; streamNum++) {
        UInt32					maxBitWidth = 0;
        UInt32					maxNumChannels = 0;
        OSCollectionIterator*	formatIterator = NULL;
		OSCollectionIterator*	sampleRateIterator = NULL;
        OSDictionary*			formatDict;
        IOAudioSampleRate		sampleRate;
        IOAudioStreamFormat		initialFormat;
        bool					initialFormatSet;
        UInt32					channelID;
        char					outputStreamName[64];
		char					inputStreamName[64];
        
        initialFormatSet = false;
        
        sampleRate.whole = 0;
        sampleRate.fraction = 0;
		
        inputStream = new IOAudioStream;
        if (inputStream == NULL) {
			IOLog("SF could not create new input IOAudioStream\n");
            goto Error;
        }
        
        outputStream = new IOAudioStream;
        if (outputStream == NULL) {
			IOLog("SF could not create new output IOAudioStream\n");
			goto Error;
        }

        snprintf(inputStreamName, 64, "eqMac2Driver Input Stream #%u", (unsigned int)streamNum + 1);
        snprintf(outputStreamName, 64, "eqMac2Driver Output Stream #%u", (unsigned int)streamNum + 1);

        if (!inputStream->initWithAudioEngine(this, kIOAudioStreamDirectionInput, startingChannelID, inputStreamName) ||
            !outputStream->initWithAudioEngine(this, kIOAudioStreamDirectionOutput, startingChannelID, outputStreamName)) {
			IOLog("SF could not init one of the streams with audio engine. \n");
            goto Error;
        }
        
        formatIterator = OSCollectionIterator::withCollection(formatArray);
        if (!formatIterator) {
			IOLog("SF NULL formatIterator\n");
            goto Error;
        }
        
        sampleRateIterator = OSCollectionIterator::withCollection(sampleRateArray);
        if (!sampleRateIterator) {
			IOLog("SF NULL sampleRateIterator\n");
            goto Error;
        }
        
        formatIterator->reset();
        while ((formatDict = (OSDictionary *)formatIterator->getNextObject())) {
            IOAudioStreamFormat format;
            
            if (OSDynamicCast(OSDictionary, formatDict) == NULL) {
				IOLog("SF error casting formatDict\n");
                goto Error;
            }
            
            if (IOAudioStream::createFormatFromDictionary(formatDict, &format) == NULL) {
				IOLog("SF error in createFormatFromDictionary()\n");
				goto Error;
            }
            
            if (!initialFormatSet) {
                initialFormat = format;
//.........这里部分代码省略.........
开发者ID:Laurinus,项目名称:eqMac2,代码行数:101,代码来源:eqMac2DriverEngine.cpp

示例4: printDictionaryKeys

//*********************************************************************************
// printDictionaryKeys
//
// Print the keys for the given dictionary and selected contents.
//*********************************************************************************
void printDictionaryKeys (OSDictionary * inDictionary, char * inMsg)
{
  OSCollectionIterator * mcoll = OSCollectionIterator::withCollection (inDictionary);
  OSSymbol * mkey;
  OSString * ioClass;
  unsigned int i = 0;
 
  mcoll->reset ();

  mkey = OSDynamicCast (OSSymbol, mcoll->getNextObject ());

  while (mkey) {

    // kprintf ("dictionary key #%d: %s\n", i, mkey->getCStringNoCopy () );

    // if this is the IOClass key, print it's contents

    if ( mkey->isEqualTo ("IOClass") ) {
      ioClass = (OSString *) inDictionary->getObject ("IOClass");
      if ( ioClass ) IOLog ("%s IOClass is %s\n", inMsg, ioClass->getCStringNoCopy () );
    }

    // if this is an IOProviderClass key print it

    if ( mkey->isEqualTo ("IOProviderClass") ) {
      ioClass = (OSString *) inDictionary->getObject ("IOProviderClass");
      if ( ioClass ) IOLog ("%s IOProviderClass is %s\n", inMsg, ioClass->getCStringNoCopy () );

    }

    // also print IONameMatch keys
    if ( mkey->isEqualTo ("IONameMatch") ) {
      ioClass = (OSString *) inDictionary->getObject ("IONameMatch");
      if ( ioClass ) IOLog ("%s IONameMatch is %s\n", inMsg, ioClass->getCStringNoCopy () );
    }

    // also print IONameMatched keys

    if ( mkey->isEqualTo ("IONameMatched") ) {
      ioClass = (OSString *) inDictionary->getObject ("IONameMatched");
      if ( ioClass ) IOLog ("%s IONameMatched is %s\n", inMsg, ioClass->getCStringNoCopy () );
    }

#if 0
    // print clock-id

    if ( mkey->isEqualTo ("AAPL,clock-id") ) {
      char * cstr;
      cstr = getCStringForObject (inDictionary->getObject ("AAPL,clock-id"));
      if (cstr)
        kprintf (" ===> AAPL,clock-id is %s\n", cstr );
    }
#endif

    // print name

    if ( mkey->isEqualTo ("name") ) {
      char nameStr[64];
      nameStr[0] = 0;
      getCStringForObject (inDictionary->getObject ("name"), nameStr );
      if (strlen(nameStr) > 0)
        IOLog ("%s name is %s\n", inMsg, nameStr);
    }

    mkey = (OSSymbol *) mcoll->getNextObject ();

    i++;
  }

  mcoll->release ();
}
开发者ID:OpenDarwin-CVS,项目名称:SEDarwin,代码行数:76,代码来源:IOPlatformExpert.cpp

示例5: start

bool ACPIMonitor::start(IOService * provider)
{
	if (!super::start(provider)) 
        return false;

	acpiDevice = (IOACPIPlatformDevice *)provider;
	
	if (!acpiDevice) {
        HWSensorsWarningLog("ACPI device not ready");
        return false;
    }
    
    if (OSDictionary *config = OSDynamicCast(OSDictionary, getProperty("Keys Associations"))) {
        // Temperatures
        if ((temperatures = OSDynamicCast(OSDictionary, config->getObject("Temperatures")))) {
            OSCollectionIterator *iterator = OSCollectionIterator::withCollection(temperatures);
            
            iterator->reset();
            
            while (OSString *key = OSDynamicCast(OSString, iterator->getNextObject())) {
                
                OSString *method = OSDynamicCast(OSString, temperatures->getObject(key));
                
                if (method && kIOReturnSuccess == acpiDevice->evaluateObject(method->getCStringNoCopy())) {
                    if (!addSensor(key->getCStringNoCopy(), TYPE_SP78, TYPE_SPXX_SIZE, kFakeSMCTemperatureSensor, 0))
                        HWSensorsWarningLog("can't add temperature sensor for method %s with key %s", method->getCStringNoCopy(), key->getCStringNoCopy());
                }
            };
            
           //HWSensorsInfoLog("%d temperature sensor(s) added", count);
        }
        else return false;
        
        
        // Voltages
        if ((voltages = OSDynamicCast(OSDictionary, config->getObject("Voltages")))) {
            OSCollectionIterator *iterator = OSCollectionIterator::withCollection(voltages);
            
            iterator->reset();
            
            while (OSString *key = OSDynamicCast(OSString, iterator->getNextObject())) {
                
                OSString *method = OSDynamicCast(OSString, voltages->getObject(key));
                
                if (method && kIOReturnSuccess == acpiDevice->evaluateObject(method->getCStringNoCopy())) {
                    if (!addSensor(key->getCStringNoCopy(), TYPE_FP4C, TYPE_FPXX_SIZE, kFakeSMCVoltageSensor, 0))
                        HWSensorsWarningLog("can't add voltage sensor for method %s with key %s", method->getCStringNoCopy(), key->getCStringNoCopy());
                }
            };
            
            //HWSensorsInfoLog("%d voltage sensor(s) added", count);
        }
        else return false;
        
        
        // Tachometers
        if ((tachometers = OSDynamicCast(OSDictionary, config->getObject("Tachometers")))) {
            UInt16 count = 0;
            OSArray* fanNames = OSDynamicCast(OSArray, getProperty("Fan Names"));
            
            OSCollectionIterator *iterator = OSCollectionIterator::withCollection(tachometers);
            
            iterator->reset();
            
            while (OSString *key = OSDynamicCast(OSString, iterator->getNextObject())) {
                
                OSString *method = OSDynamicCast(OSString, tachometers->getObject(key));
                
                if (method && kIOReturnSuccess == acpiDevice->evaluateObject(method->getCStringNoCopy())) {
                    OSString* name = NULL;
                    
                    if (fanNames)
                        name = OSDynamicCast(OSString, fanNames->getObject(count));
                    
                    if (!addTachometer(count, name ? name->getCStringNoCopy() : 0))
                        HWSensorsWarningLog("Failed to register tachometer sensor %d", count);
                    
                    count++;
                }
            };
            
            //HWSensorsInfoLog("%d tachometer sensor(s) added", count);
        }
        else return false;
    }
    
	registerService();

	return true;	
}
开发者ID:alexandrezia,项目名称:HWSensors,代码行数:90,代码来源:ACPIMonitor.cpp

示例6: OSKextLog

void
KLDBootstrap::readBooterExtensions(void)
{
    IORegistryEntry           * booterMemoryMap         = NULL;  // must release
    OSDictionary              * propertyDict            = NULL;  // must release
    OSCollectionIterator      * keyIterator             = NULL;  // must release
    OSString                  * deviceTreeName          = NULL;  // do not release
    
    const _DeviceTreeBuffer   * deviceTreeBuffer        = NULL;  // do not free
    char                      * booterDataPtr           = NULL;  // do not free
    OSData                    * booterData              = NULL;  // must release

    OSKext                    * aKext                   = NULL;  // must release

    OSKextLog(/* kext */ NULL,
        kOSKextLogProgressLevel |
        kOSKextLogDirectoryScanFlag | kOSKextLogKextBookkeepingFlag,
        "Reading startup extensions from booter memory.");
    
    booterMemoryMap = IORegistryEntry::fromPath( "/chosen/memory-map", gIODTPlane);

    if (!booterMemoryMap) {
        OSKextLog(/* kext */ NULL,
            kOSKextLogErrorLevel |
            kOSKextLogGeneralFlag | kOSKextLogDirectoryScanFlag,
            "Can't read booter memory map.");
        goto finish;
    }

    propertyDict = booterMemoryMap->dictionaryWithProperties();
    if (!propertyDict) {
        OSKextLog(/* kext */ NULL,
            kOSKextLogErrorLevel |
            kOSKextLogDirectoryScanFlag,
            "Can't get property dictionary from memory map.");
        goto finish;
    }

    keyIterator = OSCollectionIterator::withCollection(propertyDict);
    if (!keyIterator) {
        OSKextLog(/* kext */ NULL,
            kOSKextLogErrorLevel |
            kOSKextLogGeneralFlag,
            "Can't allocate iterator for driver images.");
        goto finish;
    }

    /* Create dictionary of excluded kexts
     */
    OSKext::createExcludeListFromBooterData(propertyDict, keyIterator);
    keyIterator->reset();

    while ( ( deviceTreeName =
        OSDynamicCast(OSString, keyIterator->getNextObject() ))) {

        const char * devTreeNameCString = deviceTreeName->getCStringNoCopy();
        OSData * deviceTreeEntry = OSDynamicCast(OSData,
            propertyDict->getObject(deviceTreeName));

       /* Clear out the booterData from the prior iteration.
        */
        OSSafeReleaseNULL(booterData);

        /* If there is no entry for the name, we can't do much with it. */
        if (!deviceTreeEntry) {
            continue;
        }

        /* Make sure it is a kext */
        if (strncmp(devTreeNameCString,
                    BOOTER_KEXT_PREFIX,
                    CONST_STRLEN(BOOTER_KEXT_PREFIX))) {
            continue;
        }

        deviceTreeBuffer = (const _DeviceTreeBuffer *)
            deviceTreeEntry->getBytesNoCopy(0, sizeof(deviceTreeBuffer));
        if (!deviceTreeBuffer) {
           /* We can't get to the data, so we can't do anything,
            * not even free it from physical memory (if it's there).
            */
            OSKextLog(/* kext */ NULL,
                kOSKextLogErrorLevel |
                kOSKextLogDirectoryScanFlag,
                "Device tree entry %s has NULL pointer.",
                devTreeNameCString);
            goto finish;  // xxx - continue, panic?
        }

        booterDataPtr = (char *)ml_static_ptovirt(deviceTreeBuffer->paddr);
        if (!booterDataPtr) {
            OSKextLog(/* kext */ NULL,
                kOSKextLogErrorLevel |
                kOSKextLogDirectoryScanFlag,
                "Can't get virtual address for device tree entry %s.",
                devTreeNameCString);
            goto finish;
        }

       /* Wrap the booter data buffer in an OSData and set a dealloc function
//.........这里部分代码省略.........
开发者ID:wzw19890321,项目名称:xnu-1,代码行数:101,代码来源:bootstrap.cpp

示例7: OSDynamicCast

bool	AREngine::CreateStreams(IOAudioSampleRate* outInitialSampleRate, UInt32* outNumberChannels)
{
	//	set the return values
	bool theAnswer = true;
	*outNumberChannels = 0;
	
	//	set up some local variables
	OSArray* theFormatArray = NULL;
	OSArray* theSampleRateArray = NULL;
	OSString* theOSString = NULL;
	UInt32 theNumberStreams = NUM_STREAMS;
	OSNumber* theOSNumber = NULL;
	
	//	get the array of formats
	theFormatArray = OSDynamicCast(OSArray, getProperty(FORMATS_KEY));
	FailIfNULLWithAction(theFormatArray, theAnswer = false, Done, "AREngine::CreateStreams: Couldn't get the format array");
	
	//	get the array of sample rates
	theSampleRateArray = OSDynamicCast(OSArray, getProperty(SAMPLE_RATES_KEY));
	FailIfNULLWithAction(theSampleRateArray, theAnswer = false, Done, "AREngine::CreateStreams: Couldn't get the sample rate array");
	
	//	get the description
	theOSString = OSDynamicCast(OSString, getProperty(DESCRIPTION_KEY));
	if(theOSString != NULL)
	{
		setDescription(theOSString->getCStringNoCopy());
	}
	
	//	get the number of streams
	theOSNumber = OSDynamicCast(OSNumber, getProperty(NUM_STREAMS_KEY));
	if(theOSNumber != NULL)
	{
		theNumberStreams = theOSNumber->unsigned32BitValue();
	}
	
	//	make the streams
	for(UInt32 theStreamNumber = 0; theStreamNumber < theNumberStreams; ++theStreamNumber)
	{
		//	initialize some local variables
		bool theResult = false;
		UInt32 theMaxBitWidth = 0;
		UInt32 theMaxNumberChannels = 0;
		IOAudioStream* theInputStream = NULL;
		IOAudioStream* theOutputStream = NULL;
		OSCollectionIterator* theFormatIterator = NULL;
		OSCollectionIterator* theSampleRateIterator = NULL;
		OSDictionary* theFormatDictionary = NULL;
		IOAudioSampleRate theSampleRate = { 0, 0 };
		IOAudioStreamFormat theInitialFormat;
		bool theInitialFormatSet = false;
		char theInputStreamName[32];
		char theOutputStreamName[32];
		UInt32 theStreamBufferSize = 0;

		//	allocate and initialize the input stream
		if(theNumberStreams > 1)
		{
			snprintf(theInputStreamName, 32, "Input Stream #%ld", theStreamNumber + 1);
		}
		else
		{
			snprintf(theInputStreamName, 32, "Input Stream");
		}
		theInputStream = new IOAudioStream;
		FailIfNULLWithAction(theInputStream, theAnswer = false, Error, "AREngine::CreateStreams: couldn't create the input stream");
		theResult = theInputStream->initWithAudioEngine(this, kIOAudioStreamDirectionInput, *outNumberChannels + 1, theInputStreamName);
		FailIfWithAction(!theResult, theAnswer = false, Error, "AREngine::CreateStreams: couldn't initialize the input stream");

		//	allocate and initialize the output stream
		if(theNumberStreams > 1)
		{
			snprintf(theOutputStreamName, 32, "Output Stream #%ld", theStreamNumber + 1);
		}
		else
		{
			snprintf(theOutputStreamName, 32, "Output Stream");
		}
		theOutputStream = new IOAudioStream;
		FailIfNULLWithAction(theOutputStream, theAnswer = false, Error, "AREngine::CreateStreams: couldn't create the output stream");
		theResult = theOutputStream->initWithAudioEngine(this, kIOAudioStreamDirectionOutput, *outNumberChannels + 1, theOutputStreamName);
		FailIfWithAction(!theResult, theAnswer = false, Error, "AREngine::CreateStreams: couldn't initialize the output stream");

		//	make an iterator for the format array
		theFormatIterator = OSCollectionIterator::withCollection(theFormatArray);
		FailIfNULLWithAction(theFormatIterator, theAnswer = false, Error, "AREngine::CreateStreams: couldn't create the format iterator");
		
		//	make an iterator for the sample rate array
		theSampleRateIterator = OSCollectionIterator::withCollection(theSampleRateArray);
		FailIfNULLWithAction(theSampleRateIterator, theAnswer = false, Error, "AREngine::CreateStreams: couldn't create the sample rate iterator");

		//	iterate through the formats
		theFormatIterator->reset();
		theFormatDictionary = (OSDictionary*)theFormatIterator->getNextObject();
		while(theFormatDictionary != NULL)
		{
			//	make sure we have a dictionary
			if(OSDynamicCast(OSDictionary, theFormatDictionary) != NULL)
			{
				//	convert the dictionary into something we can deal with
				IOAudioStreamFormat theFormat;
//.........这里部分代码省略.........
开发者ID:paulz,项目名称:zirkonium,代码行数:101,代码来源:AREngine.cpp

示例8: createAudioStreams


//.........这里部分代码省略.........
        initialFormatSet = false;
        
        sampleRate.whole = 0;
        sampleRate.fraction = 0;
                
        inputStream = new IOAudioStream;
        if (inputStream == NULL) {
            goto Error;
        }
        
        outputStream = new IOAudioStream;
        if (outputStream == NULL) {
            goto Error;
        }
        
        sprintf(inputStreamName, "Input Stream #%ld", streamNum + 1);
        sprintf(outputStreamName, "Output Stream #%ld", streamNum + 1);

        if (!inputStream->initWithAudioEngine(this, kIOAudioStreamDirectionInput, startingChannelID, inputStreamName) ||
            !outputStream->initWithAudioEngine(this, kIOAudioStreamDirectionOutput, startingChannelID, outputStreamName)) {
            goto Error;
        }
        
        formatIterator = OSCollectionIterator::withCollection(formatArray);
        if (!formatIterator) {
            goto Error;
        }
        
        sampleRateIterator = OSCollectionIterator::withCollection(sampleRateArray);
        if (!sampleRateIterator) {
            goto Error;
        }
        
        formatIterator->reset();
        while (formatDict = (OSDictionary *)formatIterator->getNextObject()) {
            IOAudioStreamFormat format;
            
            if (OSDynamicCast(OSDictionary, formatDict) == NULL) {
                goto Error;
            }
            
            if (IOAudioStream::createFormatFromDictionary(formatDict, &format) == NULL) {
                goto Error;
            }
            
            if (!initialFormatSet) {
                initialFormat = format;
            }
            
            sampleRateIterator->reset();
            while (number = (OSNumber *)sampleRateIterator->getNextObject()) {
                if (!OSDynamicCast(OSNumber, number)) {
                    goto Error;
                }
                
                sampleRate.whole = number->unsigned32BitValue();
                
                inputStream->addAvailableFormat(&format, &sampleRate, &sampleRate);
                if (format.fBitDepth == 24) {
                    IOAudioStream::AudioIOFunction functions[2];
                    functions[0] = process24BitSamples;
                    functions[1] = clip24BitSamples;
                    //outputStream->addAvailableFormat(&format, &sampleRate, &sampleRate, functions, 2);
                    outputStream->addAvailableFormat(&format, &sampleRate, &sampleRate, (IOAudioStream::AudioIOFunction)clip24BitSamples);
					if (format.fNumericRepresentation == kIOAudioStreamSampleFormatLinearPCM && format.fIsMixable == TRUE) {
						format.fIsMixable = FALSE;
开发者ID:arnelh,项目名称:Examples,代码行数:67,代码来源:PhantomAudioEngine.cpp

示例9: setParamProperties

IOReturn	ApplePS2CypressTouchPad::setParamProperties( OSDictionary * dict )
{
  if (dict == 0)
    return super::setParamProperties(dict);

  OSNumber * clicking = OSDynamicCast( OSNumber, dict->getObject("Clicking") );
  OSNumber * dragging = OSDynamicCast( OSNumber, dict->getObject("Dragging") );
  OSNumber * draglock = OSDynamicCast( OSNumber, dict->getObject("DragLock") );
  OSNumber * hscroll  = OSDynamicCast( OSNumber, dict->getObject("TrackpadHorizScroll") );
  OSNumber * vscroll  = OSDynamicCast( OSNumber, dict->getObject("TrackpadScroll") );
  OSNumber * scrollspeed = OSDynamicCast( OSNumber, dict->getObject("HIDTrackpadScrollAcceleration") );

  OSNumber * onefingermaxtaptime = OSDynamicCast( OSNumber, dict->getObject("Cypress1FingerMaxTapTime") );
  OSNumber * twofingermaxtaptime = OSDynamicCast( OSNumber, dict->getObject("Cypress2FingerMaxTapTime") );
  OSNumber * threefingermaxtaptime = OSDynamicCast( OSNumber, dict->getObject("Cypress3FingerMaxTapTime") );
  OSNumber * fourfingermaxtaptime = OSDynamicCast( OSNumber, dict->getObject("Cypress4FingerMaxTapTime") );
  OSNumber * fivefingermaxtaptime = OSDynamicCast( OSNumber, dict->getObject("Cypress5FingerMaxTapTime") );
  OSNumber * dragPressureAverage = OSDynamicCast( OSNumber, dict->getObject("CypressDragPressureAverage"));
  OSNumber * fiveFingerSleepTimer = OSDynamicCast( OSNumber, dict->getObject("Cypress5FingerSleepTimer"));
  OSNumber * fiveFingerScreenLockTimer = OSDynamicCast( OSNumber, dict->getObject("Cypress5FingerScreenLockTimer"));
  OSNumber * pressureFiltering = OSDynamicCast( OSNumber, dict->getObject("CypressPressureFiltering"));
  OSNumber * twoFingerFiltering = OSDynamicCast( OSNumber, dict->getObject("Cypress2FingerFiltering"));
  OSNumber * threeFingerFiltering = OSDynamicCast( OSNumber, dict->getObject("Cypress3FingerFiltering"));
  OSNumber * fourFingerFiltering = OSDynamicCast( OSNumber, dict->getObject("Cypress4FingerFiltering"));
  OSBoolean * fourFingerHorizSwipeGesture = OSDynamicCast( OSBoolean, dict->getObject("CypressFourFingerHorizSwipeGesture") );
  OSBoolean * fourFingerVertSwipeGesture = OSDynamicCast( OSBoolean, dict->getObject("CypressFourFingerVertSwipeGesture") );
  OSBoolean * twoFingerRightClick = OSDynamicCast( OSBoolean, dict->getObject("CypressTwoFingerRightClick") );
  OSBoolean * threeFingerDrag = OSDynamicCast( OSBoolean, dict->getObject("CypressThreeFingerDrag"));
  OSBoolean * fiveFingerSleep = OSDynamicCast( OSBoolean, dict->getObject("CypressFiveFingerSleep"));
  OSBoolean * fiveFingerScreenLock = OSDynamicCast( OSBoolean, dict->getObject("CypressFiveFingerScreenLock"));


#ifdef DEBUG
  OSCollectionIterator* iter = OSCollectionIterator::withCollection( dict );
  OSObject* obj;

  iter->reset();
  while ((obj = iter->getNextObject()) != NULL)
    {
      OSString* str = OSDynamicCast( OSString, obj );
      OSNumber* val = OSDynamicCast( OSNumber, dict->getObject( str ) );
      if (val)
	DEBUG_LOG("%s: Dictionary Object: %s Value: %d\n", getName(),
		  str->getCStringNoCopy(), val->unsigned32BitValue());
      else
	DEBUG_LOG("%s: Dictionary Object: %s Value: ??\n", getName(),
		  str->getCStringNoCopy());
    }
#endif
  if (pressureFiltering)
    {
      _pressureFiltering = pressureFiltering->unsigned32BitValue();
      _kalZ.noiseLevel(_pressureFiltering);
      setProperty("CypressPressureFiltering", pressureFiltering);
    }
  if (twoFingerFiltering)
    {
      _twoFingerFiltering = twoFingerFiltering->unsigned32BitValue();
      setProperty("Cypress2FingerFiltering", twoFingerFiltering);
    }
  if (threeFingerFiltering)
    {
      _threeFingerFiltering = threeFingerFiltering->unsigned32BitValue();
      setProperty("Cypress3FingerFiltering", threeFingerFiltering);
    }
  if (fourFingerFiltering)
    {
      _fourFingerFiltering = fourFingerFiltering->unsigned32BitValue();
      setProperty("Cypress4FingerFiltering", fourFingerFiltering);
    }
  if (clicking)
    {
      _clicking = clicking->unsigned32BitValue() & 0x1 ? true : false;
      setProperty("Clicking", clicking);
    }
  _clicking = true;
  if (dragging)
    {
      _dragging = dragging->unsigned32BitValue() & 0x1 ? true : false;
      setProperty("Dragging", dragging);
    }
  _dragging = true;
  if (draglock)
    {
      _dragLock = draglock->unsigned32BitValue() & 0x1 ? true : false;
      setProperty("DragLock", draglock);
    }
  _dragLock = true;
  if (hscroll)
    {
      _trackpadHorizScroll = hscroll->unsigned32BitValue() & 0x1 ? true : false;
      setProperty("TrackpadHorizScroll", hscroll);
    }
  _trackpadHorizScroll = true;
  if (vscroll)
    {
      _trackpadScroll = vscroll->unsigned32BitValue() & 0x1 ? true : false;
      setProperty("TrackpadScroll", vscroll);
    }
  _trackpadScroll = true;
//.........这里部分代码省略.........
开发者ID:ulysse31,项目名称:voodoops2controllercypress,代码行数:101,代码来源:VoodooPS2CypressTouchPad.cpp


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