コード例 #1
0
ファイル: MeshShape.cpp プロジェクト: vanurag/dart
void MeshShape::setMesh(
    const aiScene* _mesh, const std::string& _path,
    const common::ResourceRetrieverPtr& _resourceRetriever)
{
    mMesh = _mesh;

    if(nullptr == _mesh) {
        mMeshPath = "";
        mMeshUri = "";
        mResourceRetriever = nullptr;
        return;
    }

    common::Uri uri;
    if(uri.fromString(_path))
    {
        mMeshUri = _path;

        if(uri.mScheme.get_value_or("file") == "file")
            mMeshPath = uri.mPath.get_value_or("");
    }
    else
    {
        dtwarn << "[MeshShape::setMesh] Failed parsing URI '" << _path << "'.\n";
        mMeshUri = "";
        mMeshPath = "";
    }

    mResourceRetriever = _resourceRetriever;

    _updateBoundingBoxDim();
    computeVolume();
}
コード例 #2
0
void testHelperFunctions( const std::string & meshFile, const uint_t numTotalBlocks )
{
   auto mesh = make_shared<MeshType>();
   mesh::readAndBroadcast( meshFile, *mesh);
   auto triDist = make_shared< mesh::TriangleDistance<MeshType> >( mesh );
   auto distanceOctree = make_shared< DistanceOctree< MeshType > >( triDist );

   const real_t meshVolume  = real_c( computeVolume( *mesh ) );
   const real_t blockVolume = meshVolume / real_c( numTotalBlocks );
   static const real_t cellsPersBlock = real_t(1000);
   const real_t cellVolume = blockVolume / cellsPersBlock;
   const real_t dx = std::pow( cellVolume, real_t(1) / real_t(3) );

   WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with createStructuredBlockStorageInsideMesh with block size" );
   auto sbf0 = mesh::createStructuredBlockStorageInsideMesh( distanceOctree, dx, numTotalBlocks );
   
   WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with createStructuredBlockStorageInsideMesh with block size" );
   Vector3<uint_t> blockSize( sbf0->getNumberOfXCells(), sbf0->getNumberOfYCells(), sbf0->getNumberOfZCells() );
   auto sbf1 = mesh::createStructuredBlockStorageInsideMesh( distanceOctree, dx, blockSize );

   auto exteriorAabb = computeAABB( *mesh ).getScaled( real_t(2) );

   WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with createStructuredBlockStorageInsideMesh with block size" );
   auto sbf2 = mesh::createStructuredBlockStorageOutsideMesh( exteriorAabb, distanceOctree, dx, numTotalBlocks );

   WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with createStructuredBlockStorageInsideMesh with block size" );
   blockSize = Vector3<uint_t>( sbf2->getNumberOfXCells(), sbf2->getNumberOfYCells(), sbf2->getNumberOfZCells() );
   auto sbf3 = mesh::createStructuredBlockStorageOutsideMesh( exteriorAabb, distanceOctree, dx, blockSize );
}
コード例 #3
0
ファイル: CylinderPeteW.cpp プロジェクト: pcwilcox/CIS25
// Detailed constructor
CylinderPeteW::CylinderPeteW(const CirclePeteW &base, 
								const FractionPeteW &height) : 
								CirclePeteW(base), h(height) {
	computeArea();
	computeVolume();
	cout << "\nCalling CylinderPeteW() on " << *this;
}
コード例 #4
0
ファイル: MeshShape.cpp プロジェクト: amehlberg17/dart
void MeshShape::setScale(const Eigen::Vector3d& _scale) {
  assert(_scale[0] > 0.0);
  assert(_scale[1] > 0.0);
  assert(_scale[2] > 0.0);
  mScale = _scale;
  computeVolume();
}
コード例 #5
0
ファイル: BoxShape.cpp プロジェクト: vanurag/dart
void BoxShape::setSize(const Eigen::Vector3d& _size) {
  assert(_size[0] > 0.0);
  assert(_size[1] > 0.0);
  assert(_size[2] > 0.0);
  mSize = _size;
  mBoundingBoxDim = _size;
  computeVolume();
}
コード例 #6
0
ファイル: ShapeCylinder.cpp プロジェクト: bingjeff/dart
ShapeCylinder::ShapeCylinder(double _radius, double _height)
    : Shape(P_CYLINDER),
      mRadius(_radius),
      mHeight(_height)
{
    initMeshes();
    if (mRadius > 0.0 && mHeight > 0.0) {
        computeVolume();
    }
}
コード例 #7
0
ファイル: BoxShape.cpp プロジェクト: vanurag/dart
BoxShape::BoxShape(const Eigen::Vector3d& _size)
  : Shape(BOX),
    mSize(_size) {
  assert(_size[0] > 0.0);
  assert(_size[1] > 0.0);
  assert(_size[2] > 0.0);
  mBoundingBoxDim = _size;
  initMeshes();
  computeVolume();
}
コード例 #8
0
ファイル: MeshShape.cpp プロジェクト: hsu/dart
MeshShape::MeshShape(Eigen::Vector3d _dim, const aiScene *_mesh)
    : Shape(P_MESH),
      mMesh(_mesh),
      mDisplayList(0)
{
    mDim = _dim;
    initMeshes();
    if (mDim != Eigen::Vector3d::Zero())
        computeVolume();
}
コード例 #9
0
ファイル: ShapeEllipsoid.cpp プロジェクト: jmainpri/dart
 ShapeEllipsoid::ShapeEllipsoid(Vector3d _dim, double _mass)
 	: Shape(P_ELLIPSOID, _mass)
 {
 	mDim = _dim;
 	initMeshes();
 	if (mDim != Vector3d::Zero())
 		computeVolume();
 	if (mMass != 0){
 		mInertia = computeInertia(mMass);
 	}
 }
コード例 #10
0
ファイル: MeshShape.cpp プロジェクト: amehlberg17/dart
MeshShape::MeshShape(const Eigen::Vector3d& _scale, const aiScene* _mesh)
  : Shape(MESH),
    mScale(_scale),
    mMesh(_mesh),
    mDisplayList(0) {
  assert(_scale[0] > 0.0);
  assert(_scale[1] > 0.0);
  assert(_scale[2] > 0.0);
  _updateBoundingBoxDim();
  computeVolume();
  initMeshes();
}
コード例 #11
0
status_t AudioPolicyManager::checkAndSetVolume(int stream, int index, audio_io_handle_t output, uint32_t device, int delayMs, bool force)
{

    // do not change actual stream volume if the stream is muted
    if (mOutputs.valueFor(output)->mMuteCount[stream] != 0) {
        LOGV("checkAndSetVolume() stream %d muted count %d", stream, mOutputs.valueFor(output)->mMuteCount[stream]);
        return NO_ERROR;
    }

    // do not change in call volume if bluetooth is connected and vice versa
    if ((stream == AudioSystem::VOICE_CALL && mForceUse[AudioSystem::FOR_COMMUNICATION] == AudioSystem::FORCE_BT_SCO) ||
        (stream == AudioSystem::BLUETOOTH_SCO && mForceUse[AudioSystem::FOR_COMMUNICATION] != AudioSystem::FORCE_BT_SCO)) {
        LOGV("checkAndSetVolume() cannot set stream %d volume with force use = %d for comm",
             stream, mForceUse[AudioSystem::FOR_COMMUNICATION]);
        return INVALID_OPERATION;
    }

    float volume = computeVolume(stream, index, output, device);
    // We actually change the volume if:
    // - the float value returned by computeVolume() changed
    // - the force flag is set
    if (volume != mOutputs.valueFor(output)->mCurVolume[stream] ||
        (stream == AudioSystem::VOICE_CALL) || force) {
        mOutputs.valueFor(output)->mCurVolume[stream] = volume;
        LOGV("setStreamVolume() for output %d stream %d, volume %f, delay %d", output, stream, volume, delayMs);
        if (stream == AudioSystem::VOICE_CALL ||
            stream == AudioSystem::DTMF ||
            stream == AudioSystem::BLUETOOTH_SCO) {
            // offset value to reflect actual hardware volume that never reaches 0
            // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java)
            volume = 0.01 + 0.99 * volume;
        }
        mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output, delayMs);
    }

    if (stream == AudioSystem::VOICE_CALL ||
        stream == AudioSystem::BLUETOOTH_SCO) {
        float voiceVolume;
        // Force voice volume to max for bluetooth SCO as volume is managed by the headset
        if (stream == AudioSystem::VOICE_CALL) {
            voiceVolume = (float)index/(float)mStreams[stream].mIndexMax;
        } else {
            voiceVolume = 1.0;
        }
        if (voiceVolume >= 0 && output == mHardwareOutput) {
            mpClientInterface->setVoiceVolume(voiceVolume, delayMs);
            mLastVoiceVolume = voiceVolume;
        }
    }

    return NO_ERROR;
}
コード例 #12
0
ファイル: ShapeMesh.cpp プロジェクト: jmainpri/dart
 ShapeMesh::ShapeMesh(Vector3d _dim, const aiScene *_mesh)
 	: Shape(P_MESH, 0),
 	  mMesh(_mesh),
 	  mDisplayList(0)
 {
 	mDim = _dim;
     initMeshes();
     if (mDim != Vector3d::Zero())
         computeVolume();
     if (mMass != 0){
         mInertia = computeInertia(mMass);
     }
 }
コード例 #13
0
ファイル: VolumeHistogram.C プロジェクト: garvct/Moose
void
VolumeHistogram::execute()
{
  // loop over quadrature points
  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
  {
    // compute target bin
    int bin = (_value[_qp] - _min_value) / _deltaV;

    // add the volume contributed by the current quadrature point
    if (bin >= 0 && bin < static_cast<int>(_nbins))
      _volume_tmp[bin] += computeVolume();
  }
}
コード例 #14
0
ファイル: LineSegmentShape.cpp プロジェクト: dtbinh/dart
//==============================================================================
LineSegmentShape::LineSegmentShape(float _thickness)
  : Shape(LINE_SEGMENT),
    mThickness(_thickness),
    mDummyVertex(Eigen::Vector3d::Zero())
{
  if (_thickness <= 0.0f)
  {
    dtwarn << "[LineSegmentShape::LineSegmentShape] Attempting to set "
           << "non-positive thickness. We set the thickness to 1.0f instead."
           << std::endl;
    mThickness = 1.0f;
  }

  computeVolume();
}
コード例 #15
0
ファイル: LineSegmentShape.cpp プロジェクト: dtbinh/dart
//==============================================================================
LineSegmentShape::LineSegmentShape(const Eigen::Vector3d& _v1,
                                   const Eigen::Vector3d& _v2,
                                   float _thickness)
  : Shape(LINE_SEGMENT),
    mThickness(_thickness)
{
  if (_thickness <= 0.0f)
  {
    dtwarn << "[LineSegmentShape::LineSegmentShape] Attempting to set "
           << "non-positive thickness. We set the thickness to 1.0f instead."
           << std::endl;
    mThickness = 1.0f;
  }

  addVertex(_v1);
  addVertex(_v2);
  computeVolume();
}
コード例 #16
0
ファイル: CylinderShape.cpp プロジェクト: dartsim/dart
//==============================================================================
void CylinderShape::updateVolume() const
{
  mVolume = computeVolume(mRadius, mHeight);
  mIsVolumeDirty = false;
}
コード例 #17
0
ファイル: CylinderShape.cpp プロジェクト: ofrei/dart
//==============================================================================
void CylinderShape::updateVolume()
{
  mVolume = computeVolume(mRadius, mHeight);
}
コード例 #18
0
ファイル: CylinderPeteW.cpp プロジェクト: pcwilcox/CIS25
// Setter
void CylinderPeteW::setHeight(const FractionPeteW &height) {
	h = (height > 0) ? height : -height;
	computeArea();
	computeVolume();
}
コード例 #19
0
	void PCPolyhedron::addToModel(const PCPtr& nuCloud)
	{
		PCModelObject::addToModel(nuCloud);

		/// 1 - Detectar caras de la nueva nube
		/// 2 - Descartar caras que no pertenecen a la caja (caras de la mano)
		/// 3 - Matchear caras de la nube anterior con las nuevas caras
		/// 4 - Estimar caras ocultas (?)
		
		PCPtr trimmedCloud = getHalo(this->getvMin(),this->getvMax(),0.05,nuCloud);
		
		saveCloud("nucloud.pcd",*nuCloud);
		saveCloud("trimmed.pcd",*trimmedCloud);

		pcPolygonsMutex.lock();
		vector<PCPolygonPtr> prevPcPolygons = pcpolygons;

		//Detecto nuevas caras
		vector<PCPolygonPtr> nuevos = detectPolygons(trimmedCloud,Constants::OBJECT_PLANE_TOLERANCE(),Constants::CLOUD_VOXEL_SIZE * 2,false); 
		
		//Matching de las caras detectadas con las anteriores
		nuevos = mergePolygons(nuevos);

		//Estimación de caras no visibles
		bool estimationOK;
		vector<PCPolygonPtr> estimated = estimateHiddenPolygons(nuevos,estimationOK);

		bool valid = true;
		if(estimationOK)
		{
			for(int i = 0; i < nuevos.size(); i++)
				nuevos.at(i)->setEstimated(false);
			//Actualizo los nuevos polygons si no hubo errores
			nuevos.insert(nuevos.end(),estimated.begin(),estimated.end());
			pcpolygons = nuevos;

			//Unifico vertices
			unifyVertexs();

			isvalid = validate();
		}

		//Chequeo volumenes
		if(IsFeatureActive(FEATURE_INVALIDATE_OBJECT_BY_VOLUME))
		{
			float inVol = computeVolume(trimmedCloud);

			if(getVolume() < inVol * Constants::OBJECT_VOLUME_TOLERANCE)
			{
				cout << "[   INVALID VOLUME    ]" << endl;
				cout << "need: " << inVol * 0.6 << "  --- has: " << getVolume() << endl;
				isvalid = false;
			}
		}
		
		if(estimationOK && isvalid)
		{
			polygonsCache.clear();
			for (vector<PCPolygonPtr>::iterator p = pcpolygons.begin(); p != pcpolygons.end(); ++p)
			{
				polygonsCache.push_back((*p)->getPolygonModelObject());
			}

		}
		else
		{
			pcpolygons = prevPcPolygons;

			//Si hay errores en la estimación, rollback de los pcpolygons mergeados
			for(int i = 0; i < pcpolygons.size(); i++)
				pcpolygons.at(i)->rollBackMatching();

			if(!isvalid)
			{
				//Necesito unificar los vertices despues del rollback
				unifyVertexs();
			}
			isvalid = false;
		}
		
		//Seteo nueva nube
		PCPtr finalCloud (new PC());
		for(int i = 0; i < pcpolygons.size(); i ++)
		{
			*finalCloud += *pcpolygons.at(i)->getCloud();
			saveCloud("pol" + ofToString(pcpolygons.at(i)->getPolygonModelObject()->getName()) + ".pcd", *pcpolygons.at(i)->getCloud());
		}
		saveCloud("finalCloud" + ofToString(getId()) + ".pcd", *finalCloud);

		setCloud(finalCloud);
		pcPolygonsMutex.unlock();

	}
コード例 #20
0
ファイル: BoxShape.cpp プロジェクト: sehoonha/dart
//==============================================================================
void BoxShape::updateVolume()
{
  mVolume = computeVolume(mSize);
}
コード例 #21
0
status_t AudioPolicyManager::checkAndSetVolume(int stream, int index, audio_io_handle_t output, uint32_t device, int delayMs, bool force)
{
#ifdef WITH_QCOM_LPA
    // do not change actual stream volume if the stream is muted
    if ((mOutputs.valueFor(output)->mMuteCount[stream] != 0 && output != mLPADecodeOutput) ||
        (output == mLPADecodeOutput && stream == mLPAStreamType && mLPAMuted == true)) {
#else
    if (mOutputs.valueFor(output)->mMuteCount[stream] != 0) {
#endif
        LOGV("checkAndSetVolume() stream %d muted count %d", stream, mOutputs.valueFor(output)->mMuteCount[stream]);
        return NO_ERROR;
    }

    // do not change in call volume if bluetooth is connected and vice versa
    if ((stream == AudioSystem::VOICE_CALL && mForceUse[AudioSystem::FOR_COMMUNICATION] == AudioSystem::FORCE_BT_SCO) ||
        (stream == AudioSystem::BLUETOOTH_SCO && mForceUse[AudioSystem::FOR_COMMUNICATION] != AudioSystem::FORCE_BT_SCO)) {
        LOGV("checkAndSetVolume() cannot set stream %d volume with force use = %d for comm",
             stream, mForceUse[AudioSystem::FOR_COMMUNICATION]);
        return INVALID_OPERATION;
    }

    float volume = computeVolume(stream, index, output, device);
    // do not set volume if the float value did not change
    if ((volume != mOutputs.valueFor(output)->mCurVolume[stream]) || (stream == AudioSystem::VOICE_CALL)
#ifdef FM_RADIO
        || (stream == AudioSystem::FM)
#endif
        || force) {
        mOutputs.valueFor(output)->mCurVolume[stream] = volume;
        LOGD("setStreamVolume() for output %d stream %d, volume %f, delay %d", output, stream, volume, delayMs);
        if (stream == AudioSystem::VOICE_CALL ||
            stream == AudioSystem::DTMF ||
            stream == AudioSystem::BLUETOOTH_SCO) {
            float voiceVolume = -1.0;
            // offset value to reflect actual hardware volume that never reaches 0
            // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java)
            volume = 0.01 + 0.99 * volume;
            if (stream == AudioSystem::VOICE_CALL) {
                voiceVolume = (float)index/(float)mStreams[stream].mIndexMax;
            } else if (stream == AudioSystem::BLUETOOTH_SCO) {
                voiceVolume = 1.0;
            }
            if (voiceVolume >= 0 && output == mHardwareOutput) {
                mpClientInterface->setVoiceVolume(voiceVolume, delayMs);
            }
#ifdef FM_RADIO
        } else if (stream == AudioSystem::FM) {
            float fmVolume = -1.0;
            fmVolume = computeVolume(stream, index, output, device);
            if (fmVolume >= 0) {
                if(output == mHardwareOutput)
                    mpClientInterface->setFmVolume(fmVolume, delayMs);
                else if(output == mA2dpOutput)
                    mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output, delayMs);
            }
            return NO_ERROR;
#endif
        }
        mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output, delayMs);
    }

    return NO_ERROR;
}

void AudioPolicyManager::setStreamMute(int stream, bool on, audio_io_handle_t output, int delayMs)
{
    StreamDescriptor &streamDesc = mStreams[stream];
    AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output);

    LOGV("setStreamMute() stream %d, mute %d, output %d, mMuteCount %d", stream, on, output, outputDesc->mMuteCount[stream]);

    if (on) {
#ifdef WITH_QCOM_LPA
        if ((outputDesc->mMuteCount[stream] == 0 && output != mLPADecodeOutput) ||
            (output == mLPADecodeOutput && stream == mLPAStreamType && false == mLPAMuted)) {
#else
       if (outputDesc->mMuteCount[stream] == 0) {
#endif
            if (streamDesc.mCanBeMuted) {
                checkAndSetVolume(stream, 0, output, outputDesc->device(), delayMs);
            }
        }
#ifdef WITH_QCOM_LPA
        // increment mMuteCount after calling checkAndSetVolume() so that volume change is not ignored
        if(output == mLPADecodeOutput) {
            if(stream == mLPAStreamType && false == mLPAMuted) {
                mLPAMuted = true;
            }
        } else {
#endif
            outputDesc->mMuteCount[stream]++;
#ifdef WITH_QCOM_LPA
        }
#endif
    } else {
#ifdef WITH_QCOM_LPA
        if ((outputDesc->mMuteCount[stream] == 0 && output != mLPADecodeOutput) ||
            (output == mLPADecodeOutput && stream == mLPAStreamType && false == mLPAMuted)) {
#else
        if (outputDesc->mMuteCount[stream] == 0) {
#endif
            LOGW("setStreamMute() unmuting non muted stream!");
            return;
        }
#ifdef WITH_QCOM_LPA
        if(output == mLPADecodeOutput) {
            if(stream == mLPAStreamType && true == mLPAMuted) {
                mLPAMuted = false;
                checkAndSetVolume(stream, streamDesc.mIndexCur, output, outputDesc->device(), delayMs);
            }
        } else {
            if(--outputDesc->mMuteCount[stream] == 0){
                checkAndSetVolume(stream, streamDesc.mIndexCur, output, outputDesc->device(), delayMs);
            }
        }
#else
        if(--outputDesc->mMuteCount[stream] == 0){
            checkAndSetVolume(stream, streamDesc.mIndexCur, output, outputDesc->device(), delayMs);
        }
#endif
    }
}

void AudioPolicyManager::setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config)
{
    LOGD("setForceUse() usage %d, config %d, mPhoneState %d", usage, config, mPhoneState);

    bool forceVolumeReeval = false;
    switch(usage) {
    case AudioSystem::FOR_COMMUNICATION:
        if (config != AudioSystem::FORCE_SPEAKER && config != AudioSystem::FORCE_BT_SCO &&
            config != AudioSystem::FORCE_NONE) {
            LOGW("setForceUse() invalid config %d for FOR_COMMUNICATION", config);
            return;
        }
        mForceUse[usage] = config;
        break;
    case AudioSystem::FOR_MEDIA:
        if (config != AudioSystem::FORCE_HEADPHONES && config != AudioSystem::FORCE_BT_A2DP &&
            config != AudioSystem::FORCE_WIRED_ACCESSORY && config != AudioSystem::FORCE_NONE &&
            config != AudioSystem::FORCE_SPEAKER) {
            LOGW("setForceUse() invalid config %d for FOR_MEDIA", config);
            return;
        }
        mForceUse[usage] = config;
        {
            uint32_t device = getDeviceForStrategy(STRATEGY_MEDIA);
            setOutputDevice(mHardwareOutput, device);
        }
        break;
    case AudioSystem::FOR_RECORD:
        if (config != AudioSystem::FORCE_BT_SCO && config != AudioSystem::FORCE_WIRED_ACCESSORY &&
            config != AudioSystem::FORCE_NONE) {
            LOGW("setForceUse() invalid config %d for FOR_RECORD", config);
            return;
        }
        mForceUse[usage] = config;
        break;
    case AudioSystem::FOR_DOCK:
        if (config != AudioSystem::FORCE_NONE && config != AudioSystem::FORCE_BT_CAR_DOCK &&
            config != AudioSystem::FORCE_BT_DESK_DOCK && config != AudioSystem::FORCE_WIRED_ACCESSORY) {
            LOGW("setForceUse() invalid config %d for FOR_DOCK", config);
        }
        forceVolumeReeval = true;
        mForceUse[usage] = config;
        break;
    default:
        LOGW("setForceUse() invalid usage %d", usage);
        break;
    }

    // check for device and output changes triggered by new phone state
    uint32_t newDevice = getNewDevice(mHardwareOutput, false);
#ifdef WITH_A2DP
    checkOutputForAllStrategies();
#endif
    updateDeviceForStrategy();
    setOutputDevice(mHardwareOutput, newDevice);
    if (forceVolumeReeval) {
        applyStreamVolumes(mHardwareOutput, newDevice);
    }
}

uint32_t AudioPolicyManager::getDeviceForInputSource(int inputSource)
{
    uint32_t device;

    switch(inputSource) {
    case AUDIO_SOURCE_DEFAULT:
    case AUDIO_SOURCE_MIC:
    case AUDIO_SOURCE_VOICE_RECOGNITION:
        if (mForceUse[AudioSystem::FOR_RECORD] == AudioSystem::FORCE_BT_SCO &&
            mAvailableInputDevices & AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET) {
            device = AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET;
        } else if (mAvailableInputDevices & AudioSystem::DEVICE_IN_WIRED_HEADSET) {
            device = AudioSystem::DEVICE_IN_WIRED_HEADSET;
#ifdef QCOM_ANC
        } else if (mAvailableInputDevices & AudioSystem::DEVICE_IN_ANC_HEADSET) {
            device = AudioSystem::DEVICE_IN_ANC_HEADSET;
#endif
        } else {
            device = AudioSystem::DEVICE_IN_BUILTIN_MIC;
        }
        break;
    case AUDIO_SOURCE_VOICE_COMMUNICATION:
        device = AudioSystem::DEVICE_IN_COMMUNICATION;
        break;
    case AUDIO_SOURCE_CAMCORDER:
        if (hasBackMicrophone()) {
            device = AudioSystem::DEVICE_IN_BACK_MIC;
        } else {
            device = AudioSystem::DEVICE_IN_BUILTIN_MIC;
        }
        break;
    case AUDIO_SOURCE_VOICE_UPLINK:
    case AUDIO_SOURCE_VOICE_DOWNLINK:
    case AUDIO_SOURCE_VOICE_CALL:
        device = AudioSystem::DEVICE_IN_VOICE_CALL;
        break;
#ifdef FM_RADIO
   case AUDIO_SOURCE_FM_RX:
        device = AudioSystem::DEVICE_IN_FM_RX;
        break;
    case AUDIO_SOURCE_FM_RX_A2DP:
        device = AudioSystem::DEVICE_IN_FM_RX_A2DP;
        break;
#endif
    default:
        LOGW("getInput() invalid input source %d", inputSource);
        device = 0;
        break;
    }
    LOGV("getDeviceForInputSource()input source %d, device %08x", inputSource, device);
    return device;
}
コード例 #22
0
ファイル: MeshShape.cpp プロジェクト: amehlberg17/dart
void MeshShape::setMesh(const aiScene* _mesh) {
  assert(_mesh);
  mMesh = _mesh;
  _updateBoundingBoxDim();
  computeVolume();
}
コード例 #23
0
void test( const std::string & meshFile, const uint_t numProcesses, const uint_t numTotalBlocks )
{
   auto mesh = make_shared<MeshType>();
   mesh::readAndBroadcast( meshFile, *mesh);

   auto aabb = computeAABB( *mesh );

   auto domainAABB = aabb.getScaled( typename MeshType::Scalar(3) );

   auto triDist = make_shared< mesh::TriangleDistance<MeshType> >( mesh );
   auto distanceOctree = make_shared< DistanceOctree< MeshType > >( triDist );

   const real_t meshVolume  = real_c( computeVolume( *mesh ) );
   const real_t blockVolume = meshVolume / real_c( numTotalBlocks );
   static const real_t cellsPersBlock = real_t(1000);
   const real_t cellVolume = blockVolume / cellsPersBlock;
   const Vector3<real_t> cellSize( std::pow( cellVolume, real_t(1) / real_t(3) ) );

   ComplexGeometryStructuredBlockforestCreator bfc( domainAABB, cellSize, makeExcludeMeshInterior( distanceOctree, cellSize.min() ) );
   auto wl = mesh::makeMeshWorkloadMemory( distanceOctree, cellSize );
   wl.setInsideCellWorkload(0);
   wl.setOutsideCellWorkload(1);
   wl.setForceZeroMemoryOnZeroWorkload(true);
   bfc.setWorkloadMemorySUIDAssignmentFunction( wl );
   bfc.setRefinementSelectionFunction( makeRefinementSelection( distanceOctree, 5, cellSize[0], cellSize[0] * real_t(5) ) );

   WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with StaticLevelwiseCurveBalanceWeighted Partitioner" );
   bfc.setTargetProcessAssignmentFunction( blockforest::StaticLevelwiseCurveBalanceWeighted() );
   auto sbf_default = bfc.createSetupBlockForest( Vector3<uint_t>(64,64,64), numProcesses );
   //sbf_default->writeVTKOutput("sbf_default");
   WALBERLA_LOG_INFO_ON_ROOT( sbf_default->toString() );

   return;
#ifdef WALBERLA_BUILD_WITH_PARMETIS

   WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with ParMetis (PART_KWAY, no commweights)" );
   bfc.setTargetProcessAssignmentFunction( blockforest::StaticLevelwiseParMetis( blockforest::StaticLevelwiseParMetis::PARMETIS_PART_KWAY ) );
   auto sbf = bfc.createSetupBlockForest( numTotalBlocks, numProcesses );
   //sbf->writeVTKOutput("sbf");
   WALBERLA_LOG_INFO_ON_ROOT( sbf->toString() );


   WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with ParMetis (PART_KWAY, commweights)" );
   bfc.setTargetProcessAssignmentFunction( blockforest::StaticLevelwiseParMetis( commInXDirection, blockforest::StaticLevelwiseParMetis::PARMETIS_PART_KWAY ) );
   auto sbf_edge = bfc.createSetupBlockForest( numTotalBlocks, numProcesses );
   //sbf_edge->writeVTKOutput("sbf_edge");
   WALBERLA_LOG_INFO_ON_ROOT( sbf_edge->toString() );

   WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with ParMetis (PART_GEOM_KWAY, no commweights)" );
   bfc.setTargetProcessAssignmentFunction( blockforest::StaticLevelwiseParMetis( blockforest::StaticLevelwiseParMetis::PARMETIS_PART_GEOM_KWAY ) );
   auto sbf_geom = bfc.createSetupBlockForest( numTotalBlocks, numProcesses );
   //sbf_geom->writeVTKOutput("sbf_geom");
   WALBERLA_LOG_INFO_ON_ROOT( sbf_geom->toString() );


   WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with ParMetis (PART_GEOM_KWAY, commweights)" );
   bfc.setTargetProcessAssignmentFunction( blockforest::StaticLevelwiseParMetis( commInXDirection, blockforest::StaticLevelwiseParMetis::PARMETIS_PART_GEOM_KWAY ) );
   auto sbf_geom_edge = bfc.createSetupBlockForest( numTotalBlocks, numProcesses );
   //sbf_geom_edge->writeVTKOutput("sbf_geom_edge");
   WALBERLA_LOG_INFO_ON_ROOT( sbf_geom_edge->toString() );

#endif
}
コード例 #24
0
ファイル: EllipsoidShape.cpp プロジェクト: sehoonha/dart
//==============================================================================
void EllipsoidShape::updateVolume()
{
  mVolume = computeVolume(mSize);
}
コード例 #25
0
ファイル: Shape.cpp プロジェクト: jmainpri/dart
 void Shape::setDim(const Eigen::Vector3d& _dim) {
     mDim = _dim;
     computeVolume();
     mInertia = computeInertia(mMass);
 }
コード例 #26
0
//==============================================================================
void ConeShape::updateVolume()
{
  mVolume = computeVolume(mRadius, mHeight);
}
コード例 #27
0
ファイル: SphereShape.cpp プロジェクト: dartsim/dart
//==============================================================================
void SphereShape::updateVolume()
{
    mVolume = computeVolume(mRadius);
}