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


C++ AudioParameter类代码示例

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


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

示例1: String8

status_t AudioPolicyManager::startInput(audio_io_handle_t input)
{
    status_t status = AudioPolicyManagerBase::startInput(input);

    if (status == NO_ERROR) {
        AudioInputDescriptor *inputDesc = mInputs.valueFor(input);
        String8 key = String8("Input Source");
        String8 value;
        switch(inputDesc->mInputSource) {
        case AUDIO_SOURCE_VOICE_RECOGNITION:
            value = String8("Voice Recognition");
            break;
        case AUDIO_SOURCE_CAMCORDER:
            value = String8("Camcorder");
            break;
        case AUDIO_SOURCE_DEFAULT:
        case AUDIO_SOURCE_MIC:
            value = String8("Default");
        default:
            break;
        }
        AudioParameter param = AudioParameter();
        param.add(key, value);
        mpClientInterface->setParameters(input, param.toString());
    }
    return status;
}
开发者ID:Carsus,项目名称:android_device_samsung_captivate,代码行数:27,代码来源:AudioPolicyManager.cpp

示例2: AudioParameter

status_t AudioStreamInMotorola::setParameters(const String8& keyValuePairs)
{
    AudioParameter param = AudioParameter(keyValuePairs);
    status_t status = NO_ERROR;
    int device;
    String8 key;
    int source;
    LOGD("setParameters(%s) called", keyValuePairs.string());

    // reading routing parameter
    key = String8(AudioParameter::keyRouting);
    if (param.getInt(key, device) == NO_ERROR) {
        LOGD("setParameters(): set input routing %x", device);
        if (device & (device - 1)) {
            LOGE("setParameters(): device value is invalid for routing");
            status = BAD_VALUE;
        } else {
            mDevices = device;
            status = mHardware->doRouting();
        }
        param.remove(key);
    }

    if (param.size()) {
        LOGE("setParameters(): parameter size is invalid");
        status = BAD_VALUE;
    }

    return status;
}
开发者ID:Aaahh,项目名称:shadow-cm11.0,代码行数:30,代码来源:AudioStreamInMotorola.cpp

示例3: LOGV

status_t AudioStreamInWrapper::setParameters(const String8& keyValuePairs)
{
        LOGV("AudioStreamInWrapper::setParameters(\"%s\")", keyValuePairs.string());

	AudioParameter param = AudioParameter(keyValuePairs);
	String8 key;
	status_t status = NO_ERROR;
	int device;

	// reading routing parameter
	key = String8(AudioParameter::keyRouting);
	if (param.getInt(key, device) == NO_ERROR) {
		LOGV("set input routing %x", device);
		if (device & (device - 1)) {
			status = BAD_VALUE;
		} else {
			mDevices = device;
			status = mHardware->doRouting();
		}
		param.remove(key);
	}

	if (param.size()) {
		status = BAD_VALUE;
	}
	return status;
}
开发者ID:PyYoshi,项目名称:cm4is01_android,代码行数:27,代码来源:AudioHardwareWrapper.cpp

示例4: out_set_parameters

static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
{
    int exiting = -1;
    AudioParameter parms = AudioParameter(String8(kvpairs));
    // FIXME this is using hard-coded strings but in the future, this functionality will be
    //       converted to use audio HAL extensions required to support tunneling
    if ((parms.getInt(String8("exiting"), exiting) == NO_ERROR) && (exiting > 0)) {
        const struct submix_stream_out *out =
                reinterpret_cast<const struct submix_stream_out *>(stream);

        pthread_mutex_lock(&out->dev->lock);

        { // using the sink
            sp<MonoPipe> sink = out->dev->rsxSink.get();
            if (sink == 0) {
                pthread_mutex_unlock(&out->dev->lock);
                return 0;
            }

            ALOGI("shutdown");
            sink->shutdown(true);
        } // done using the sink

        pthread_mutex_unlock(&out->dev->lock);
    }

    return 0;
}
开发者ID:Alex025,项目名称:platform_hardware_libhardware,代码行数:28,代码来源:audio_hw.cpp

示例5: ALOGD

void AudioPolicyManagerSPRD::releaseOutput(audio_io_handle_t output)
{
    #ifdef DUMP_DEBUG
    ALOGD("releaseOutput() %d", output);
    #endif
    ssize_t index = mOutputs.indexOfKey(output);
    if (index < 0) {
        ALOGW("releaseOutput() releasing unknown output %d", output);
        return;
    }

	if(is_voip_set) {
	    AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);
		if(outputDesc->mRefCount[AudioSystem::VOICE_CALL] == 0) {
			AudioParameter param;
			param.add(String8("sprd_voip_start"), String8("false"));
			mpClientInterface->setParameters(0, param.toString());
			is_voip_set = false;
		}
	}

#ifdef AUDIO_POLICY_TEST
    int testIndex = testOutputIndex(output);
    if (testIndex != 0) {
        AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);
        if (outputDesc->isActive()) {
            mpClientInterface->closeOutput(output);
            delete mOutputs.valueAt(index);
            mOutputs.removeItem(output);
            mTestOutputs[testIndex] = 0;
        }
        return;
    }
#endif //AUDIO_POLICY_TEST

    AudioOutputDescriptor *desc = mOutputs.valueAt(index);
    if (desc->mFlags & AudioSystem::OUTPUT_FLAG_DIRECT) {
        if (desc->mDirectOpenCount <= 0) {
            ALOGW("releaseOutput() invalid open count %d for output %d",
                                                              desc->mDirectOpenCount, output);
            return;
        }
        if (--desc->mDirectOpenCount == 0) {
            closeOutput(output);
            // If effects where present on the output, audioflinger moved them to the primary
            // output by default: move them back to the appropriate output.
            audio_io_handle_t dstOutput = getOutputForEffect();
            if (dstOutput != mPrimaryOutput) {
                mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX, mPrimaryOutput, dstOutput);
            }
        }
    }
}
开发者ID:blade-af3,项目名称:android_device_zte_P731A20,代码行数:53,代码来源:AudioPolicyManagerSPRD.cpp

示例6: AudioParameter

String8 AudioAACStreamIn::getParameters(const String8& keys)
{
    AudioParameter param = AudioParameter(keys);
    String8 value;
    String8 key = String8(AudioParameter::keyRouting);

    if (param.get(key, value) == NO_ERROR) {
        param.addInt(key, (int)mDevice);
    }

    ALOGV("getParameters() %s", param.toString().string());
    return param.toString();
}
开发者ID:jportner,项目名称:android_device_mitre_svmp,代码行数:13,代码来源:AudioFakeHardware.cpp

示例7: AudioParameter

String8 AudioHardware::AudioStreamOutMSM72xx::getParameters(const String8& keys)
{
    AudioParameter param = AudioParameter(keys);
    String8 value;
    String8 key = String8(AudioParameter::keyRouting);

    if (param.get(key, value) == NO_ERROR) {
        LOGV("get routing %x", mDevices);
        param.addInt(key, (int)mDevices);
    }

    LOGV("AudioStreamOutMSM72xx::getParameters() %s", param.toString().string());
    return param.toString();
}
开发者ID:Jamin13,项目名称:M9300_CM7,代码行数:14,代码来源:AudioHardware.cpp

示例8: AudioParameter

status_t AudioResourceManager::setParameter(const String8& keyValuePairs) {

    String8 key;
    String8 value;
    status_t status = NO_ERROR;
    AudioParameter param = AudioParameter(keyValuePairs);

    Mutex::Autolock autolock(mLock);

    ALOGD(" setParameter %s:",  keyValuePairs.string());
    for(uint8_t i=0; i < ARRAY_SIZE(sUseCaseNameToEnumValue); i++) {
        key = sUseCaseNameToEnumValue[i].name;
        if (param.get(key, value) == NO_ERROR) {

            audio_use_case_value_t useCase =
                        (audio_use_case_value_t) extractMetaData(
                    sUseCaseNameToEnumValue,
                    ARRAY_SIZE(sUseCaseNameToEnumValue),
                    key);
            ALOGD("key = %s, value = %s, useCase = %d",
                        key.string(), value.string(), (int32_t)useCase);
            if(value == "true") {
                // check if there is a conflicting usecase
                // if yes, return error without updating the refCount
                // if no increment the refCount
                ALOGV("handleConcurrency");
                status = handleConcurrency(useCase, true);
            }
            else if(value == "false") {
                // Decrement the refCount
                ALOGV("updateUsecaseRefCount");
                status = updateUsecaseRefCount(useCase, false);
            }
            else {
                ALOGE(" Wrong value set for use case = %s", key.string());
                status = BAD_VALUE;
            }
            break;
        } else {
            status = NAME_NOT_FOUND;
            ALOGV("Not a concurrency setParameter - Not an error");

        }
    }
    param.remove(key);

    return status;
}
开发者ID:CMSM8226,项目名称:android_hardware_qcom_audio-caf,代码行数:48,代码来源:AudioResourceManager.cpp

示例9: ALOGD

String8 AudioALSAStreamOut::getParameters(const String8 &keys)
{
#ifdef MTK_DYNAMIC_CHANGE_HAL_BUFFER_SIZE
    ALOGD("%s, keyvalue %s", __FUNCTION__, keys.string());

    String8 value;
    String8 keyLowLatency = String8("LowLatency");

    AudioParameter param = AudioParameter(keys);
    AudioParameter returnParam = AudioParameter();

    if (param.get(keyLowLatency, value) == NO_ERROR)
    {
        param.remove(keyLowLatency);

        char buf[10];
        sprintf(buf, "%d", LOW_LATENCY_HAL_BUFFER_SIZE);
        returnParam.add(keyLowLatency, String8(buf));
    }

    const String8 keyValuePairs = returnParam.toString();
    ALOGD("-%s(), return \"%s\"", __FUNCTION__, keyValuePairs.string());
    return keyValuePairs;
#else
    ALOGD("%s()", __FUNCTION__);
    AudioParameter param = AudioParameter(keys);
    return param.toString();
#endif
}
开发者ID:rombaby,项目名称:MT6735_Longcheer,代码行数:29,代码来源:AudioALSAStreamOut.cpp

示例10: CHECK

void AudioOffloadPlayer::SendMetaDataToHal(sp<AudioSink>& aSink,
                                           const sp<MetaData>& aMeta)
{
  int32_t sampleRate = 0;
  int32_t bitRate = 0;
  int32_t channelMask = 0;
  int32_t delaySamples = 0;
  int32_t paddingSamples = 0;
  CHECK(aSink.get());

  AudioParameter param = AudioParameter();

  if (aMeta->findInt32(kKeySampleRate, &sampleRate)) {
    param.addInt(String8(AUDIO_OFFLOAD_CODEC_SAMPLE_RATE), sampleRate);
  }
  if (aMeta->findInt32(kKeyChannelMask, &channelMask)) {
    param.addInt(String8(AUDIO_OFFLOAD_CODEC_NUM_CHANNEL), channelMask);
  }
  if (aMeta->findInt32(kKeyBitRate, &bitRate)) {
    param.addInt(String8(AUDIO_OFFLOAD_CODEC_AVG_BIT_RATE), bitRate);
  }
  if (aMeta->findInt32(kKeyEncoderDelay, &delaySamples)) {
    param.addInt(String8(AUDIO_OFFLOAD_CODEC_DELAY_SAMPLES), delaySamples);
  }
  if (aMeta->findInt32(kKeyEncoderPadding, &paddingSamples)) {
    param.addInt(String8(AUDIO_OFFLOAD_CODEC_PADDING_SAMPLES), paddingSamples);
  }

  AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("SendMetaDataToHal: bitRate %d,"
      " sampleRate %d, chanMask %d, delaySample %d, paddingSample %d", bitRate,
      sampleRate, channelMask, delaySamples, paddingSamples));

  aSink->SetParameters(param.toString());
  return;
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:35,代码来源:AudioOffloadPlayer.cpp

示例11: AudioParameter

String8 A2dpAudioInterface::getParameters(const String8& keys)
{
    AudioParameter param = AudioParameter(keys);
    AudioParameter a2dpParam = AudioParameter();
    String8 value;
    String8 key;

    key = "bluetooth_enabled";
    if (param.get(key, value) == NO_ERROR) {
        value = mBluetoothEnabled ? "true" : "false";
        a2dpParam.add(key, value);
        param.remove(key);
    }
    key = "A2dpSuspended";
    if (param.get(key, value) == NO_ERROR) {
        value = mSuspended ? "true" : "false";
        a2dpParam.add(key, value);
        param.remove(key);
    }

    String8 keyValuePairs  = a2dpParam.toString();

    if (param.size()) {
        if (keyValuePairs != "") {
            keyValuePairs += ";";
        }
        keyValuePairs += mHardwareInterface->getParameters(param.toString());
    }

    LOGV("getParameters() %s", keyValuePairs.string());
    return keyValuePairs;
}
开发者ID:DongheonKim,项目名称:android_frameworks_base,代码行数:32,代码来源:A2dpAudioInterface.cpp

示例12: ALOGD

int AudioFtm::Audio_FM_I2S_Play(char bEnable)
{
    ALOGD("%s()", __FUNCTION__);

    const float kMaxFmVolume = 1.0;

    if (mStreamOut == NULL)
    {
        if (mStreamManager->getStreamOutVectorSize() == 0) // Factory mode
        {
            uint32_t devices = 0x2;
            int format = 0x1;
            uint32_t channels = 0x3;
            uint32_t sampleRate = 44100;
            status_t status = 0;

            mStreamManager->openOutputStream(devices, &format, &channels, &sampleRate, &status);
        }

        mStreamOut = mStreamManager->getStreamOut(0);
    }

    if (bEnable == true)
    {
        // force assigned earphone
        AudioParameter paramRouting = AudioParameter();
        paramRouting.addInt(String8(AudioParameter::keyRouting), AUDIO_DEVICE_OUT_WIRED_HEADPHONE);
        mStreamOut->setParameters(paramRouting.toString());

        // enable
        mStreamManager->setFmVolume(0);
        mStreamManager->setFmEnable(true);
        mStreamManager->setFmVolume(kMaxFmVolume);
    }
    else
    {
        // disable
        mStreamManager->setFmVolume(0);
        mStreamManager->setFmEnable(false);
    }

    return true;
}
开发者ID:Scorpio92,项目名称:mediatek,代码行数:43,代码来源:AudioFtm.cpp

示例13: LOGV

/*
Overwriting this function from base class to allow 2 acitve AudioRecord clients in case of FM.
One for FM A2DP playbck and other for FM recording.
*/
status_t AudioPolicyManager::startInput(audio_io_handle_t input)
{
    LOGV("startInput() input %d", input);
    ssize_t index = mInputs.indexOfKey(input);
    if (index < 0) {
        LOGW("startInput() unknow input %d", input);
        return BAD_VALUE;
    }
    AudioInputDescriptor *inputDesc = mInputs.valueAt(index);
    AudioParameter param = AudioParameter();
    param.addInt(String8(AudioParameter::keyRouting), (int)inputDesc->mDevice);
    // use Voice Recognition mode or not for this input based on input source
    int vr_enabled = inputDesc->mInputSource == AUDIO_SOURCE_VOICE_RECOGNITION ? 1 : 0;
    param.addInt(String8("vr_mode"), vr_enabled);
    LOGV("AudioPolicyManager::startInput(%d), setting vr_mode to %d", inputDesc->mInputSource, vr_enabled);
    mpClientInterface->setParameters(input, param.toString());
    inputDesc->mRefCount = 1;
    return NO_ERROR;
}
开发者ID:chambejp,项目名称:hardware,代码行数:23,代码来源:AudioPolicyManager.cpp

示例14: AudioParameter

status_t AudioStreamOutWrapper::setParameters(const String8& keyValuePairs)
{
	AudioParameter param = AudioParameter(keyValuePairs);
	String8 key = String8(AudioParameter::keyRouting);
	status_t status = NO_ERROR;
	int device;

        LOGV("AudioStreamOutWrapper::setParameters(\"%s\")", keyValuePairs.string());

	if (param.getInt(key, device) == NO_ERROR) {
		mDevices = device;
		LOGV("set output routing %x", mDevices);
		uint32_t routes = devicesToRoutes(mDevices);
		status = mHardware->setRouting(AudioSystem::MODE_NORMAL, routes);
		param.remove(key);
	}

	if (param.size()) {
		status = BAD_VALUE;
	}
	return status;
}
开发者ID:PyYoshi,项目名称:cm4is01_android,代码行数:22,代码来源:AudioHardwareWrapper.cpp

示例15: setNumParameters

bool WrappedJucePlugin::loadPluginStuff ()
{
   if (instance)
   {
      int numParams = instance->getNumParameters();
    setNumParameters (numParams);
    for (int i=0; i<numParams; i++)
    {
      AudioParameter* parameter = new AudioParameter ();
        parameter->part (i);
        parameter->name (instance->getParameterName(i));
        parameter->get (MakeDelegate (this, &WrappedJucePlugin::getParameterReal));
        parameter->set (MakeDelegate (this, &WrappedJucePlugin::setParameterReal));
        parameter->text (MakeDelegate (this, &WrappedJucePlugin::getParameterTextReal));
      registerParameter(i, parameter);
    }

   }
   
   return true;
}
开发者ID:christianscheuer,项目名称:jivemodular,代码行数:21,代码来源:WrappedJucePlugin.cpp


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