pfs::string serial::parityToString (parity_t parity) { return parity == serial::ParityNone ? _l1("none") : parity == serial::ParityOdd ? _l1("odd") : parity == serial::ParityEven ? _l1("even") : _l1(""); }
void AudioHardwareOutput::standbyStatusUpdate(bool isInStandby, bool isMCStream) { Mutex::Autolock _l1(mStreamLock); bool hdmiAllowed; { Mutex::Autolock _l2(mSettingsLock); hdmiAllowed = mSettings.hdmi.allowed; } // If there is no HDMI, do nothing if (hdmiAllowed && mHDMIConnected) { // If a multi-channel stream goes to standy state, we must switch // to stereo stream. If MC comes out of standby, we must switch // back to MC. No special processing needed for main stream. // AudioStreamOut class handles that correctly if (isMCStream) { uint32_t mcMask; uint32_t mainMask; if (isInStandby) { mainMask = HDMIAudioOutput::classDevMask(); mcMask = 0; } else { mainMask = 0; mcMask = HDMIAudioOutput::classDevMask(); } if (NULL != mMainOutput) mMainOutput->setTgtDevices(mainMask); if (NULL != mMCOutput) mMCOutput->setTgtDevices(mcMask); } } }
status_t AudioHardwareOutput::obtainOutput(const AudioStreamOut& tgtStream, uint32_t devMask, sp<AudioOutput>* newOutput) { Mutex::Autolock _l1(mOutputLock); // Sanity check the device mask passed to us. There should exactly one bit // set, no less, no more. if (popcount(devMask) != 1) { ALOGW("bad device mask in obtainOutput, %08x", devMask); return INVALID_OPERATION; } // Start by checking to see if the requested output is currently busy. AudioOutputList::iterator I; for (I = mPhysOutputs.begin(); I != mPhysOutputs.end(); ++I) if (devMask & (*I)->devMask()) return OK; // Yup; its busy. // Looks like we don't currently have an output of the requested type. // Figure out which type is being requested and try to construct one. OutputSettings* S = NULL; if (devMask & HDMIAudioOutput::classDevMask()) { *newOutput = new HDMIAudioOutput(); S = &mSettings.hdmi; } else { ALOGW("%s stream out requested output of unknown type %08x", tgtStream.getName(), devMask); return BAD_VALUE; } if (*newOutput == NULL) return NO_MEMORY; status_t res = (*newOutput)->setupForStream(tgtStream); if (res != OK) { ALOGE("%s setupForStream() returned %d", tgtStream.getName(), res); *newOutput = NULL; } else { ALOGI("%s stream out adding %s output.", tgtStream.getName(), (*newOutput)->getOutputName()); mPhysOutputs.push_back(*newOutput); { // Apply current settings Mutex::Autolock _l2(mSettingsLock); (*newOutput)->setVolume(mSettings.masterVolume); (*newOutput)->setMute(mSettings.masterMute); (*newOutput)->setExternalDelay_uSec(S->delayCompUsec); (*newOutput)->setOutputIsFixed(S->isFixed); (*newOutput)->setFixedOutputLevel(S->fixedLvl); } } return res; }
status_t AudioHardwareOutput::setMasterMute(bool muted) { Mutex::Autolock _l1(mOutputLock); Mutex::Autolock _l2(mSettingsLock); mSettings.masterMute = muted; AudioOutputList::iterator I; for (I = mPhysOutputs.begin(); I != mPhysOutputs.end(); ++I) (*I)->setMute(mSettings.masterMute); return NO_ERROR; }
status_t AudioHardwareOutput::setMasterVolume(float volume) { Mutex::Autolock _l1(mOutputLock); Mutex::Autolock _l2(mSettingsLock); mSettings.masterVolume = volume; AudioOutputList::iterator I; for (I = mPhysOutputs.begin(); I != mPhysOutputs.end(); ++I) (*I)->setVolume(mSettings.masterVolume); return NO_ERROR; }
status_t AudioHardwareOutput::setParameters(const char* kvpairs) { AudioParameter param = AudioParameter(String8(kvpairs)); status_t status = NO_ERROR; float floatVal; int intVal; Settings initial, s; { // Record the initial state of the settings from inside the lock. Then // leave the lock in order to parse the changes to be made. Mutex::Autolock _l(mSettingsLock); initial = s = mSettings; } /*************************************************************** * HDMI Audio Options * ***************************************************************/ if (param.getInt(kHDMIAllowedParamKey, intVal) == NO_ERROR) { s.hdmi.allowed = (intVal != 0); param.remove(kHDMIAllowedParamKey); } if ((param.getFloat(kHDMIDelayCompParamKey, floatVal) == NO_ERROR) && (floatVal >= 0.0) && (floatVal <= AudioOutput::kMaxDelayCompensationMSec)) { uint32_t delay_comp = static_cast<uint32_t>(floatVal * 1000.0); s.hdmi.delayCompUsec = delay_comp; param.remove(kHDMIDelayCompParamKey); } if (param.getInt(kFixedHDMIOutputParamKey, intVal) == NO_ERROR) { s.hdmi.isFixed = (intVal != 0); param.remove(kFixedHDMIOutputParamKey); } if ((param.getFloat(kFixedHDMIOutputLevelParamKey, floatVal) == NO_ERROR) && (floatVal <= 0.0)) { s.hdmi.fixedLvl = floatVal; param.remove(kFixedHDMIOutputLevelParamKey); } /*************************************************************** * Other Options * ***************************************************************/ if ((param.getFloat(kVideoDelayCompParamKey, floatVal) == NO_ERROR) && (floatVal >= 0.0) && (floatVal <= AudioOutput::kMaxDelayCompensationMSec)) { s.videoDelayCompUsec = static_cast<uint32_t>(floatVal * 1000.0); param.remove(kVideoDelayCompParamKey); } if (param.size()) status = BAD_VALUE; // If there was a change made to settings, go ahead and apply it now. bool allowedOutputsChanged = false; if (memcmp(&initial, &s, sizeof(initial))) { Mutex::Autolock _l1(mOutputLock); Mutex::Autolock _l2(mSettingsLock); if (memcmp(&initial.hdmi, &s.hdmi, sizeof(initial.hdmi))) allowedOutputsChanged = allowedOutputsChanged || applyOutputSettings_l(initial.hdmi, s.hdmi, mSettings.hdmi, HDMIAudioOutput::classDevMask()); if (initial.videoDelayCompUsec != s.videoDelayCompUsec) mSettings.videoDelayCompUsec = s.videoDelayCompUsec; uint32_t tmp = 0; if (mSettings.hdmi.allowed && (tmp < mSettings.hdmi.delayCompUsec)) tmp = mSettings.hdmi.delayCompUsec; if (mMaxDelayCompUsec != tmp) mMaxDelayCompUsec = tmp; } if (allowedOutputsChanged) { Mutex::Autolock _l(mStreamLock); updateTgtDevices_l(); } return status; }
virtual pfs::string typeLetter () const { return _l1("t"); }
TensorMechanicsPlasticOrthotropic::TensorMechanicsPlasticOrthotropic( const InputParameters & parameters) : TensorMechanicsPlasticIsotropicSD(parameters), _c1(getParam<std::vector<Real>>("c1")), _c2(getParam<std::vector<Real>>("c2")) { _c = 1.0; _l1(0, 0, 0, 0) = (_c1[1] + _c1[2]) / 3.0; _l1(0, 0, 1, 1) = -_c1[2] / 3.0; _l1(0, 0, 2, 2) = -_c1[1] / 3.0; _l1(1, 1, 0, 0) = -_c1[2] / 3.0; _l1(1, 1, 1, 1) = (_c1[0] + _c1[2]) / 3.0; _l1(1, 1, 2, 2) = -_c1[0] / 3.0; _l1(2, 2, 0, 0) = -_c1[1] / 3.0; _l1(2, 2, 1, 1) = -_c1[0] / 3.0; _l1(2, 2, 2, 2) = (_c1[0] + _c1[1]) / 3.0; _l1(0, 1, 1, 0) = _c1[5] / 2.0; _l1(0, 1, 0, 1) = _c1[5] / 2.0; _l1(1, 0, 1, 0) = _c1[5] / 2.0; _l1(1, 0, 0, 1) = _c1[5] / 2.0; _l1(0, 2, 0, 2) = _c1[4] / 2.0; _l1(0, 2, 2, 0) = _c1[4] / 2.0; _l1(2, 0, 2, 0) = _c1[4] / 2.0; _l1(2, 0, 0, 2) = _c1[4] / 2.0; _l1(1, 2, 2, 1) = _c1[3] / 2.0; _l1(1, 2, 1, 2) = _c1[3] / 2.0; _l1(2, 1, 1, 2) = _c1[3] / 2.0; _l1(2, 1, 2, 1) = _c1[3] / 2.0; _l2(0, 0, 0, 0) = (_c2[1] + _c2[2]) / 3.0; _l2(0, 0, 1, 1) = -_c2[2] / 3.0; _l2(0, 0, 2, 2) = -_c2[1] / 3.0; _l2(1, 1, 0, 0) = -_c2[2] / 3.0; _l2(1, 1, 1, 1) = (_c2[0] + _c2[2]) / 3.0; _l2(1, 1, 2, 2) = -_c2[0] / 3.0; _l2(2, 2, 0, 0) = -_c2[1] / 3.0; _l2(2, 2, 1, 1) = -_c2[0] / 3.0; _l2(2, 2, 2, 2) = (_c2[0] + _c2[1]) / 3.0; _l2(0, 1, 1, 0) = _c2[5] / 2.0; _l2(0, 1, 0, 1) = _c2[5] / 2.0; _l2(1, 0, 1, 0) = _c2[5] / 2.0; _l2(1, 0, 0, 1) = _c2[5] / 2.0; _l2(0, 2, 0, 2) = _c2[4] / 2.0; _l2(0, 2, 2, 0) = _c2[4] / 2.0; _l2(2, 0, 2, 0) = _c2[4] / 2.0; _l2(2, 0, 0, 2) = _c2[4] / 2.0; _l2(1, 2, 2, 1) = _c2[3] / 2.0; _l2(1, 2, 1, 2) = _c2[3] / 2.0; _l2(2, 1, 1, 2) = _c2[3] / 2.0; _l2(2, 1, 2, 1) = _c2[3] / 2.0; }