Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

0 votes
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
in General Discussion by Brent S. (140 points)

1 Answer

0 votes
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);
        }
    }
}
by Brent S. (140 points)
This no longer works in 2017.1.3.6377
...