Example #1
0
bool		CAAudioUnit::HasCustomView () const
{
	UInt32 dataSize = 0;
	OSStatus result = GetPropertyInfo(kAudioUnitProperty_GetUIComponentList,
                                        kAudioUnitScope_Global, 0,
                                        &dataSize, NULL);
	if (result || !dataSize) {
		dataSize = 0;
		result = GetPropertyInfo(kAudioUnitProperty_CocoaUI,
                                        kAudioUnitScope_Global, 0,
                                        &dataSize, NULL);
		if (result || !dataSize)
			return false;
	}
	return true;
}
void CEntityPropertyHandler::LoadEntityXMLProperties(IEntity *pEntity, const XmlNodeRef& xml)
{
	if(auto properties = xml->findChild("Properties"))
	{
		for(int i = 0; i < properties->getNumAttributes(); i++)
		{
			const char *name;
			const char *value;

			properties->getAttributeByIndex(i, &name, &value);

			int index = 0;
			bool exists = false;

			for(; index < GetPropertyCount(); index++)
			{
				SPropertyInfo info;
				GetPropertyInfo(index, info);

				if(!strcmp(info.name, name))
				{
					exists = true;
					break;
				}
			}

			if(exists)
				SetProperty(pEntity, index, value);
			else
				MonoWarning("Could not set property %s because it did not exist", name);
		}
	}
}
NF_SHARE_PTR<NFIPropertyManager> NFCCommonRedisModule::GetPropertyInfo(const NFGUID & self, const std::string & strClassName)
{
	std::vector<std::string> vKeyCacheList;
	std::vector<std::string> vValueCacheList;

	return GetPropertyInfo(self, strClassName, vKeyCacheList, vValueCacheList);
}
Example #4
0
OSStatus		CAAudioUnit::IsElementCountWritable (AudioUnitScope inScope, bool &outWritable) const
{
	Boolean isWritable;
	UInt32 outDataSize;
	OSStatus result = GetPropertyInfo (kAudioUnitProperty_ElementCount, inScope, 0, &outDataSize, &isWritable);
	if (result)
		return result;
	outWritable = isWritable ? true : false;
	return noErr;
}
Example #5
0
void CMonoEntityExtension::FullSerialize(TSerialize ser)
{
	IEntity *pEntity = GetEntity();

	ser.BeginGroup("Properties");
	auto pPropertyHandler = static_cast<CEntityPropertyHandler *>(pEntity->GetClass()->GetPropertyHandler());
	for(int i = 0; i < pPropertyHandler->GetPropertyCount(); i++)
	{
		if(ser.IsWriting())
		{
			IEntityPropertyHandler::SPropertyInfo propertyInfo;
			pPropertyHandler->GetPropertyInfo(i, propertyInfo);

			ser.Value(propertyInfo.name, pPropertyHandler->GetProperty(pEntity, i));
		}
		else
		{
			IEntityPropertyHandler::SPropertyInfo propertyInfo;
			pPropertyHandler->GetPropertyInfo(i, propertyInfo);

			char *propertyValue = nullptr;
			ser.ValueChar(propertyInfo.name, propertyValue, 0);

			pPropertyHandler->SetProperty(pEntity, i, propertyValue);
		}
	}

	ser.EndGroup();

	ser.BeginGroup("ManagedEntity");

	IMonoArray *pArgs = CreateMonoArray(1);
	pArgs->InsertNativePointer(&ser);

	m_pScript->GetClass()->InvokeArray(m_pScript->GetManagedObject(), "InternalFullSerialize", pArgs);
	pArgs->Release();

	ser.EndGroup();
}
Example #6
0
    HRESULT EnumDebugPropertyInfo2::Next( ULONG celt, DEBUG_PROPERTY_INFO* rgelt, ULONG* pceltFetched )
    {
        if ( rgelt == NULL )
            return E_INVALIDARG;
        if ( pceltFetched == NULL )
            return E_INVALIDARG;

        HRESULT     hr = S_OK;
        uint32_t    countLeft = mEEEnum->GetCount() - mEEEnum->GetIndex();
        uint32_t    i = 0;
        MagoEE::EvalOptions options = { 0 };
        wstring     name;
        wstring     fullName;

        if ( celt > countLeft )
            celt = countLeft;

        for ( i = 0; i < celt; i++ )
        {
            // make sure this is in the loop so it gets cleaned up every time
            MagoEE::EvalResult  result = { 0 };

            // keep enumerating even if we fail to get an item
            hr = mEEEnum->EvaluateNext( options, result, name, fullName );
            if ( FAILED( hr ) )
            {
                hr = GetErrorPropertyInfo( hr, name.c_str(), fullName.c_str(), rgelt[i] );
                if ( FAILED( hr ) )
                    return hr;
                continue;
            }

            hr = GetPropertyInfo( result, name.c_str(), fullName.c_str(), rgelt[i] );
            if ( FAILED( hr ) )
            {
                hr = GetErrorPropertyInfo( hr, name.c_str(), fullName.c_str(), rgelt[i] );
                if ( FAILED( hr ) )
                    return hr;
                continue;
            }
        }

        *pceltFetched = i;

        return S_OK;
    }
Example #7
0
void Flea3Camera::SetWhiteBalanceRedBlue(bool& white_balance,
                                         bool& auto_white_balance, int& red,
                                         int& blue) {
  if (!camera_info_.isColorCamera) {
    // Not even a color camera
    ROS_WARN("Camera %s is not a color camera, white balance not supported",
             serial().c_str());
    auto_white_balance = false;
    white_balance = false;
    red = 0;
    blue = 0;
    return;
  }

  // Check if white balance is supported
  const auto prop_info = GetPropertyInfo(camera_, WHITE_BALANCE);
  if (!prop_info.present) {
    white_balance = false;
    auto_white_balance = false;
    blue = 0;
    red = 0;
    return;
  }

  // Set white balance
  Error error;
  Property prop;
  prop.type = WHITE_BALANCE;
  prop.onOff = white_balance;
  prop.autoManualMode = auto_white_balance;
  prop.absControl = false;
  prop.valueA = red;
  prop.valueB = blue;
  error = camera_.SetProperty(&prop);

  // Get white balance
  camera_.GetProperty(&prop);
  white_balance = prop.onOff;
  auto_white_balance = prop.autoManualMode;
  red = prop.valueA;
  blue = prop.valueB;
}
Example #8
0
bool			CAAudioUnit::HasDynamicScope (AudioUnitScope inScope, SInt32 &outTotalNumChannels) const
{
	// ok - now we need to check the AU's capability here.
	// this is the default assumption of an audio effect unit
	Boolean* isWritable = 0;
	UInt32	dataSize = 0;
	OSStatus result = GetPropertyInfo (kAudioUnitProperty_SupportedNumChannels,
								kAudioUnitScope_Global, 0,
								&dataSize, isWritable); //don't care if this is writable

		// AU has to explicitly tell us about this.
	if (result) return false;

	StackAUChannelInfo info (dataSize);

	result = GetProperty (kAudioUnitProperty_SupportedNumChannels,
							kAudioUnitScope_Global, 0,
							info.mChanInfo, &dataSize);
	if (result) return false;

	return ValidateDynamicScope (inScope, outTotalNumChannels, info.mChanInfo, (dataSize / sizeof(AUChannelInfo)));
}
Example #9
0
bool		CAAudioUnit::CanDo (const CAAUChanHelper		&inputs,
								const CAAUChanHelper		&outputs) const

{
// first check our state
		// huh!
	if (inputs.mNumEls == 0 && outputs.mNumEls == 0) return false;

	UInt32 elCount;
	if (GetElementCount (kAudioUnitScope_Input, elCount)) { return false; }
	if (elCount != inputs.mNumEls) return false;

	if (GetElementCount (kAudioUnitScope_Output, elCount)) { return false; }
	if (elCount != outputs.mNumEls) return false;

// (1) special cases (effects and sources (generators and instruments) only)
	UInt32	dataSize = 0;
	if (GetPropertyInfo (kAudioUnitProperty_SupportedNumChannels,
									kAudioUnitScope_Global, 0, &dataSize, NULL) != noErr)
	{
		if (Comp().Desc().IsEffect() || Comp().Desc().IsOffline()) {
			UInt32 numChan = outputs.mNumEls > 0 ? outputs.mChans[0] : inputs.mChans[0];
			for (unsigned int in = 0; in < inputs.mNumEls; ++in)
				if (numChan != inputs.mChans[in]) return false;
			for (unsigned int out = 0; out < outputs.mNumEls; ++out)
				if (numChan != outputs.mChans[out]) return false;
			return true;
		}

			// in this case, all the channels have to match the current config
		if (Comp().Desc().IsGenerator() || Comp().Desc().IsMusicDevice()) {
			for (unsigned int in = 0; in < inputs.mNumEls; ++in) {
				UInt32 chan;
				if (NumberChannels (kAudioUnitScope_Input, in, chan)) return false;
				if (chan != UInt32(inputs.mChans[in])) return false;
			}
			for (unsigned int out = 0; out < outputs.mNumEls; ++out) {
				UInt32 chan;
				if (NumberChannels (kAudioUnitScope_Output, out, chan)) return false;
				if (chan != UInt32(outputs.mChans[out])) return false;
			}
			return true;
		}

			// if we get here we can't determine anything about channel capabilities
		return false;
	}

	StackAUChannelInfo info (dataSize);

	if (GetProperty (kAudioUnitProperty_SupportedNumChannels,
							kAudioUnitScope_Global, 0,
							info.mChanInfo, &dataSize) != noErr)
	{
		return false;
	}

	int numInfo = dataSize / sizeof(AUChannelInfo);

// (2) Test for dynamic capability (or no elements on that scope)
	SInt32 dynInChans = 0;
	if (ValidateDynamicScope (kAudioUnitScope_Input, dynInChans, info.mChanInfo, numInfo)) {
		if (CheckDynCount (dynInChans, inputs) == false) return false;
	}

	SInt32 dynOutChans = 0;
	if (ValidateDynamicScope (kAudioUnitScope_Output, dynOutChans, info.mChanInfo, numInfo)) {
		if (CheckDynCount (dynOutChans, outputs) == false) return false;
	}

	if (dynOutChans && dynInChans) { return true; }

// (3)	Just need to test one side
	if (dynInChans || (inputs.mNumEls == 0)) {
		return CheckOneSide (outputs, true, info.mChanInfo, numInfo);
	}

	if (dynOutChans || (outputs.mNumEls == 0)) {
		return CheckOneSide (inputs, false, info.mChanInfo, numInfo);
	}

// (4) - not a dynamic AU, has ins and outs, and has channel constraints so we test every possible pairing
	for (unsigned int in = 0; in < inputs.mNumEls; ++in)
	{
		bool testInAlready = false;
		for (unsigned int i = 0; i < in; ++i) {
			if (inputs.mChans[i] == inputs.mChans[in]) {
				testInAlready = true;
				break;
			}
		}
		if (!testInAlready) {
			for (unsigned int out = 0; out < outputs.mNumEls; ++out) {
					// try to save a little bit and not test the same pairing multiple times...
				bool testOutAlready = false;
				for (unsigned int i = 0; i < out; ++i) {
					if (outputs.mChans[i] == outputs.mChans[out]) {
						testOutAlready = true;
						break;
					}
				}
				if (!testOutAlready) {
					if (!ValidateChannelPair (inputs.mChans[in], outputs.mChans[out],info.mChanInfo, numInfo)) {
						return false;
					}
				}
			}
		}
	}

	return true;
}