本文整理汇总了C++中AudioOutputSettings::SetBestSupportedChannels方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioOutputSettings::SetBestSupportedChannels方法的具体用法?C++ AudioOutputSettings::SetBestSupportedChannels怎么用?C++ AudioOutputSettings::SetBestSupportedChannels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioOutputSettings
的用法示例。
在下文中一共展示了AudioOutputSettings::SetBestSupportedChannels方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetUsers
/**
* Returns capabilities supported by the audio device
* amended to take into account the digital audio
* options (AC3 and DTS) as well as the user settings
* If newcopy = false, assume GetCleaned was called before hand
*/
AudioOutputSettings* AudioOutputSettings::GetUsers(bool newcopy)
{
AudioOutputSettings* aosettings;
if (newcopy)
aosettings = GetCleaned(newcopy);
else
aosettings = this;
if (aosettings->m_invalid)
return aosettings;
int cur_channels = gCoreContext->GetNumSetting("MaxChannels", 2);
int max_channels = aosettings->BestSupportedChannels();
bool bAC3 = aosettings->canFeature(FEATURE_AC3) &&
gCoreContext->GetNumSetting("AC3PassThru", false);
bool bDTS = aosettings->canFeature(FEATURE_DTS) &&
gCoreContext->GetNumSetting("DTSPassThru", false);
bool bLPCM = aosettings->canFeature(FEATURE_LPCM) &&
!gCoreContext->GetNumSetting("StereoPCM", false);
bool bEAC3 = aosettings->canFeature(FEATURE_EAC3) &&
gCoreContext->GetNumSetting("EAC3PassThru", false) &&
!gCoreContext->GetNumSetting("Audio48kOverride", false);
// TrueHD requires HBR support.
bool bTRUEHD = aosettings->canFeature(FEATURE_TRUEHD) &&
gCoreContext->GetNumSetting("TrueHDPassThru", false) &&
!gCoreContext->GetNumSetting("Audio48kOverride", false) &&
gCoreContext->GetNumSetting("HBRPassthru", true);
bool bDTSHD = aosettings->canFeature(FEATURE_DTSHD) &&
gCoreContext->GetNumSetting("DTSHDPassThru", false) &&
!gCoreContext->GetNumSetting("Audio48kOverride", false);
if (max_channels > 2 && !bLPCM)
max_channels = 2;
if (max_channels == 2 && (bAC3 || bDTS))
max_channels = 6;
if (cur_channels > max_channels)
cur_channels = max_channels;
aosettings->SetBestSupportedChannels(cur_channels);
aosettings->setFeature(bAC3, FEATURE_AC3);
aosettings->setFeature(bDTS, FEATURE_DTS);
aosettings->setFeature(bLPCM, FEATURE_LPCM);
aosettings->setFeature(bEAC3, FEATURE_EAC3);
aosettings->setFeature(bTRUEHD, FEATURE_TRUEHD);
aosettings->setFeature(bDTSHD, FEATURE_DTSHD);
return aosettings;
}
示例2: UpdateCapabilities
//.........这里部分代码省略.........
realmax_speakers = max_speakers = settings.BestSupportedChannels();
bool bAC3 = settings.canFeature(FEATURE_AC3);
bool bDTS = settings.canFeature(FEATURE_DTS);
bool bLPCM = settings.canFeature(FEATURE_LPCM);
bool bEAC3 = settings.canFeature(FEATURE_EAC3);
bool bTRUEHD = settings.canFeature(FEATURE_TRUEHD);
bool bDTSHD = settings.canFeature(FEATURE_DTSHD);
bAC3 ? m_ac3Check->Show() : m_ac3Check->Hide();
bDTS ? m_dtsCheck->Show() : m_dtsCheck->Hide();
bEAC3 ? m_eac3Check->Show() : m_eac3Check->Hide();
bTRUEHD ? m_truehdCheck->Show() : m_truehdCheck->Hide();
bDTSHD ? m_dtshdCheck->Show() : m_dtshdCheck->Hide();
bAC3 &= (m_ac3Check->GetCheckState() == MythUIStateType::Full);
bDTS &= (m_dtsCheck->GetCheckState() == MythUIStateType::Full);
if (max_speakers > 2 && !bLPCM)
max_speakers = 2;
if (max_speakers == 2 && bAC3)
{
max_speakers = 6;
if (AC3)
{
restore = true;
}
}
int cur_speakers = m_maxspeakers;
if (m_speakerNumberButtonList->GetItemCurrent() != NULL)
{
cur_speakers = qVariantValue<int>
(m_speakerNumberButtonList->GetItemCurrent()->GetData());
}
if (cur_speakers > m_maxspeakers)
{
m_maxspeakers = cur_speakers;
}
if (restore)
{
cur_speakers = m_maxspeakers;
}
if (cur_speakers > max_speakers)
{
LOG(VB_AUDIO, LOG_INFO, QString("Reset device %1").arg(out));
cur_speakers = max_speakers;
}
// Remove everything and re-add available channels
m_speakerNumberButtonList->Reset();
for (int i = 1; i <= max_speakers; i++)
{
if (settings.IsSupportedChannels(i))
{
switch (i)
{
case 2:
{
MythUIButtonListItem *stereo =
new MythUIButtonListItem(m_speakerNumberButtonList,
QObject::tr("Stereo"));
stereo->SetData(2);
break;
}
case 6:
{
MythUIButtonListItem *sixchan =
new MythUIButtonListItem(m_speakerNumberButtonList,
QObject::tr("5.1 Channel Audio"));
sixchan->SetData(6);
break;
}
case 8:
{
MythUIButtonListItem *eightchan =
new MythUIButtonListItem(m_speakerNumberButtonList,
QObject::tr("7.1 Channel Audio"));
eightchan->SetData(8);
break;
}
default:
continue;
}
}
}
m_speakerNumberButtonList->SetValueByData(qVariantFromValue(cur_speakers));
// Return values is used by audio test
// where we mainly are interested by the number of channels
// if we support AC3 and/or LPCM
settings.SetBestSupportedChannels(cur_speakers);
settings.setFeature(bAC3, FEATURE_AC3);
settings.setFeature(bLPCM && realmax_speakers > 2, FEATURE_LPCM);
return settings;
}