本文整理汇总了C++中AudioParameter::get方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioParameter::get方法的具体用法?C++ AudioParameter::get怎么用?C++ AudioParameter::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioParameter
的用法示例。
在下文中一共展示了AudioParameter::get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: getParameters
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
}
示例3: setParameters
status_t AudioHardware::setParameters(const String8& keyValuePairs)
{
AudioParameter param = AudioParameter(keyValuePairs);
String8 value;
String8 key;
const char BT_NREC_KEY[] = "bt_headset_nrec";
const char BT_NAME_KEY[] = "bt_headset_name";
const char BT_NREC_VALUE_ON[] = "on";
LOGV("setParameters() %s", keyValuePairs.string());
if (keyValuePairs.length() == 0) return BAD_VALUE;
key = String8(BT_NREC_KEY);
if (param.get(key, value) == NO_ERROR) {
if (value == BT_NREC_VALUE_ON) {
mBluetoothNrec = true;
} else {
mBluetoothNrec = false;
LOGI("Turning noise reduction and echo cancellation off for BT "
"headset");
}
}
key = String8(BT_NAME_KEY);
if (param.get(key, value) == NO_ERROR) {
mBluetoothId = 0;
for (int i = 0; i < mNumSndEndpoints; i++) {
if (!strcasecmp(value.string(), mSndEndpoints[i].name)) {
mBluetoothId = mSndEndpoints[i].id;
LOGI("Using custom acoustic parameters for %s", value.string());
break;
}
}
if (mBluetoothId == 0) {
LOGI("Using default acoustic parameters "
"(%s not in acoustic database)", value.string());
doRouting();
}
}
return NO_ERROR;
}
示例4: getParameters
char* AudioHardwareOutput::getParameters(const char* keys) {
Settings s;
// Explicit scope for auto-lock pattern.
{
// Snapshot the current settings so we don't have to hold the settings
// lock while formatting the results.
Mutex::Autolock _l(mSettingsLock);
s = mSettings;
}
AudioParameter param = AudioParameter(String8(keys));
String8 tmp;
/***************************************************************
* HDMI Audio Options *
***************************************************************/
if (param.get(kHDMIAllowedParamKey, tmp) == NO_ERROR)
param.addInt(kHDMIAllowedParamKey, s.hdmi.allowed ? 1 : 0);
if (param.get(kHDMIDelayCompParamKey, tmp) == NO_ERROR)
param.addFloat(kHDMIDelayCompParamKey,
static_cast<float>(s.hdmi.delayCompUsec) / 1000.0);
if (param.get(kFixedHDMIOutputParamKey, tmp) == NO_ERROR)
param.addInt(kFixedHDMIOutputParamKey, s.hdmi.isFixed ? 1 : 0);
if (param.get(kFixedHDMIOutputLevelParamKey, tmp) == NO_ERROR)
param.addFloat(kFixedHDMIOutputLevelParamKey, s.hdmi.fixedLvl);
/***************************************************************
* Other Options *
***************************************************************/
if (param.get(kVideoDelayCompParamKey, tmp) == NO_ERROR)
param.addFloat(kVideoDelayCompParamKey,
static_cast<float>(s.videoDelayCompUsec) / 1000.0);
return strdup(param.toString().string());
}
示例5: getParameters
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();
}
示例6: getParameters
String8 AudioStreamInMotorola::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)mDevices);
}
LOGD("getParameters(%s)", param.toString().string());
return param.toString();
}
示例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();
}
示例8: setParameter
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;
}
示例9: getParameters
String8 AudioStreamInWrapper::getParameters(const String8& keys)
{
LOGV("AudioStreamInWrapper::getParameters(\"%s\")", keys.string());
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("AudioStreamInWrapper::getParameters() %s", param.toString().string());
return param.toString();
}
示例10: loadPluginStuff
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;
}
示例11: loadPluginFromFile
//==============================================================================
bool LadspaPlugin::loadPluginFromFile (const File& filePath)
{
ptrLibrary = PlatformUtilities::loadDynamicLibrary (filePath.getFullPathName());
if (ptrLibrary != 0)
{
LADSPA_Descriptor_Function pfDescriptorFunction
= (LADSPA_Descriptor_Function)
PlatformUtilities::getProcedureEntryPoint (ptrLibrary, T("ladspa_descriptor"));
if (pfDescriptorFunction != 0)
{
for (uint32 iPluginIndex = 0;; iPluginIndex++)
{
ptrPlug = pfDescriptorFunction (iPluginIndex);
if (ptrPlug != NULL)
break;
}
if (ptrPlug == 0)
{
printf ("Cannot find any valid descriptor in shared library \n");
return false;
}
}
else
{
// plugin raised an exception
printf ("Cannot find any valid plugin in shared library \n");
return false;
}
}
else
{
printf ("You are trying to load a shared library ? \n");
return false;
}
jassert (ptrPlug);
pluginFile = filePath;
plugin = ptrPlug->instantiate (ptrPlug, (unsigned int) samplingRate);
ins.clear ();
outs.clear ();
pars.clear ();
for (unsigned int i = 0; i < ptrPlug->PortCount; i++)
{
if (ptrPlug->PortDescriptors [i] & LADSPA_PORT_CONTROL) pars.add (i);
if (ptrPlug->PortDescriptors [i] & LADSPA_PORT_AUDIO)
{
if (ptrPlug->PortDescriptors [i] & LADSPA_PORT_INPUT) ins.add (i);
if (ptrPlug->PortDescriptors [i] & LADSPA_PORT_OUTPUT) outs.add (i);
}
}
int numParams = pars.size ();
params = new float [numParams];
normalized = new float [numParams];
memset (params, 0, numParams * sizeof (float));
memset (normalized, 0, numParams * sizeof (float));
for (int i = 0; i < numParams; i++)
ptrPlug->connect_port (plugin, pars [i], &normalized[i]);
// create params
setNumParameters (numParams);
for (int i = 0; i < numParams; i++)
{
AudioParameter* parameter = new AudioParameter ();
parameter->part (i);
parameter->name (ptrPlug->PortNames [pars [i]]);
parameter->get (MakeDelegate (this, &LadspaPlugin::getParameterReal));
parameter->set (MakeDelegate (this, &LadspaPlugin::setParameterReal));
parameter->text (MakeDelegate (this, &LadspaPlugin::getParameterTextReal));
registerParameter (i, parameter);
}
// setCurrentProgram (0);
return true;
}
示例12: loadPluginFromFile
//==============================================================================
bool DssiPlugin::loadPluginFromFile (const File& filePath)
{
ptrLibrary = PlatformUtilities::loadDynamicLibrary (filePath.getFullPathName());
if (ptrLibrary != 0)
{
DSSI_Descriptor_Function pfDescriptorFunction
= (DSSI_Descriptor_Function)
PlatformUtilities::getProcedureEntryPoint (ptrLibrary, T("dssi_descriptor"));
if (pfDescriptorFunction != 0)
{
for (uint32 iPluginIndex = 0;; iPluginIndex++)
{
ptrPlug = pfDescriptorFunction (iPluginIndex);
if (ptrPlug != NULL)
break;
}
if (ptrPlug == 0)
{
printf ("Cannot find any valid descriptor in shared library \n");
return false;
}
}
else
{
// plugin raised an exception
printf ("Cannot find any valid plugin in shared library \n");
return false;
}
}
else
{
printf ("You are trying to load a shared library ? \n");
return false;
}
jassert (ptrPlug);
pluginFile = filePath;
ladspa = ptrPlug->LADSPA_Plugin;
// version = ptrPlug->DSSI_API_Version;
plugin = ladspa->instantiate (ladspa, (unsigned int) samplingRate);
/*
if (ptrPlug->configure)
ptrPlug->configure (DSSI_PROJECT_DIRECTORY_KEY, (const char*) filePath.getParentDirectory()
.getFullPathName ());
*/
// count ports
ins.clear ();
outs.clear ();
pars.clear ();
for (uint i = 0; i < ladspa->PortCount; i++)
{
LADSPA_PortDescriptor pod = ladspa->PortDescriptors[i];
if (pod & LADSPA_PORT_AUDIO)
{
if (pod & LADSPA_PORT_INPUT) ins.add (i);
else if (pod & LADSPA_PORT_OUTPUT) outs.add (i);
}
else if (pod & LADSPA_PORT_CONTROL)
{
pars.add (i);
}
}
// create ports
int numParams = pars.size ();
params = new float [numParams];
normalized = new float [numParams];
memset (params, 0, numParams * sizeof (float));
memset (normalized, 0, numParams * sizeof (float));
// connect ports
if (ladspa->connect_port)
{
for (int i = 0; i < pars.size (); i++)
ladspa->connect_port (plugin, pars [i], &normalized[i]);
for (int i = 0; i < ins.size (); i++)
ladspa->connect_port (plugin, ins [i], emptyBuffer.getSampleData (0));
for (int i = 0; i < outs.size (); i++)
ladspa->connect_port (plugin, outs [i], emptyBuffer.getSampleData (0));
}
// count programs
if (ptrPlug->get_program)
for (numPrograms = 0; ptrPlug->get_program (plugin, numPrograms); ++numPrograms);
// set default to 0
// setCurrentProgram (0);
setDefaultProgram ();
// start osc listener to itself
//.........这里部分代码省略.........