在 Audiokinetic 社区问答论坛上,用户可对 Wwise 和 Strata 相关问题进行提问和解答。如需从 Audiokinetic 技术支持团队获取答复,请务必使用技术支持申请单页面。

How to determine the speaker configuration/number of channels at runtime?

0 投票
Hi,

I'd like to find out the number of speakers/channels configured at runtime for Wwise (Windows in this case). Is there a simple way to do so? Ideally it would be something we could query periodically and update in case the output device changes in Windows.

Thank you,

Brent
最新提问 5月 3, 2017 分类:General Discussion | 用户: Brent S. (140 分)

1个回答

0 投票
We are using Unreal (older integration) so I'll post my answer here if someone else needs it.

I added a call to register the bus volume callback for the master audio bus in the initialization routine.

    if (AK_Success != AK::SoundEngine::RegisterBusVolumeCallback(MASTER_AUDIO_BUS, AkMasterBusSpeakerVolumeMatrixCallback))
    {
        UE_LOG(LogInit, Warning, TEXT("Could not register the master bus volume callback."));
    }
 

Then had the callback set the rtpc based on the number of channels, removing the low frequency effects channel in the count if found.    

 

static const AkUniqueID MASTER_AUDIO_BUS = 3803692087U;
void FAkAudioDevice::AkMasterBusSpeakerVolumeMatrixCallback(AkSpeakerVolumeMatrixCallbackInfo *in_pCallbackInfo)
{
    static unsigned long LastNumChannels = 0xffffffff;

    if (in_pCallbackInfo
        && (in_pCallbackInfo->outputConfig.uNumChannels != LastNumChannels))
    {
        auto AudioDevice = FAkAudioDevice::Get();
        if (!AudioDevice)
        {
            return;
        }

        LastNumChannels = in_pCallbackInfo->outputConfig.uNumChannels;

        const FString& ChannelRtpc = GetDefault<UAkSettings>()->SpeakerChannelRtpcName;
        if (ChannelRtpc.Len())
        {
            // remove the .1 low frequency effects channel from the reported channel count
            const bool HasLFE = in_pCallbackInfo->outputConfig.HasLFE();
            const unsigned long ReportedChannels = LastNumChannels - (HasLFE ? 1 : 0);

            UE_LOG(LogAkAudio, Display, TEXT("Number of audio channels found: %d%s"), ReportedChannels, (HasLFE ? TEXT(".1") : TEXT("")));

            AudioDevice->SetRTPCValue(*ChannelRtpc, ReportedChannels);
        }
    }
}
最新回答 5月 15, 2017 用户: Brent S. (140 分)
This no longer works in 2017.1.3.6377
...