커뮤니티 Q&A

Audiokinetic의 커뮤니티 Q&A 포럼에 오신 것을 환영합니다. 이 포럼은 Wwise와 Strata 사용자들이 서로 도움을 주는 곳입니다. Audiokinetic의 직접적인 도움을 얻으려면 지원 티켓 페이지를 사용하세요. 버그를 보고하려면 Audiokinetic 런처에서 Bug Report 옵션을 사용하세요. (Q&A 포럼에 제출된 버그 보고는 거절됩니다. 전용 Bug Report 시스템을 사용하면 보고 내용이 담당자에게 정확히 전달되어 문제 해결 가능성이 크게 높아집니다.)<segment 6493>

빠르고 정확한 답변을 얻으려면 질문을 올릴 때 다음 팁을 참고하세요.

  • 구체적인 내용을 적어주세요: 무엇을 하려는지, 혹은 어떤 특정 문제에 부딪혔는지 설명하세요.
  • 핵심 정보를 포함하세요: Wwise와 게임 엔진 버전, 운영체제 등 관련 정보를 함께 제공하세요.
  • 시도한 방법들을 알려주세요: 문제 해결을 위해 이미 어떤 단계를 시도해봤는지 설명해주세요.
  • 객관적인 사실에 초점을 맞추세요: 문제의 기술적 사실을 중심으로 설명하세요. 문제에 집중할수록 다른 사람들이 더 빠르게 해결책을 찾을 수 있습니다.

0 투표
Hi,

 

I am trying to  have multiple Sound outputs in Unreal. Now my current implementation of Wwise in Unreal is pretty basic and relies on just using your Blueprints to attach to Events on our custom objects.
Looking up secondary Outputs in the documentation shows code that's meant for a direct C++ implementation and not unreal it seems (from the use of wchar_t at least).
So I'm guessing multiple outputs should be possible with Blueprints in Unreal instead, although I can't really see how.
I'm also not sure what the intended use of the AK Unreal components is, it seems to fill both the role of emitter and listener?
Also rn a listener seems to be auto generated, can I prevent this? Or does this not happen When I manually set a listener anyway?
Can you give me an outline how a manual setup of multiple outputs would look like in Unreal? At the moment I'm not even sure If I am supposed to
do anything in code or if this is implementation is supposed to be blueprint only.

 

Thanks in advance!
General Discussion Patrycja p. (160 포인트) 로 부터

2 답변

0 투표

Hey, man! 

I have been searching for an answer for six months and I succeeded) I will try to show my own solution and maybe it will help you. I need to have 2 players (VR and keyboard+mouse) and make 2 listeners with my own audio devices. How did I do it? First, this can only be done using C++, and you must download Visual Studio to create code and rebuild the wwise plugin. And after some manipulations with the code, you can use the prepared AKСomponent in Blueprints. In short, AKComponent will get 2 variables: the audio device name in OS and the audio device name in Wwise, and you will connect it together in Blueprints. And step by step:

- I created 2 variables (this parameters you can fill in Blueprints) in AkComponent.h (Base path is: Plugins\Wwise\Source\AkAudio\Classes\)

/**
* Name of Audio Device in Wwise. If empty, "System" is using 
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, Category = "AkComponent")
FString WwiseDeviceName;

/** 
* Name of Audio Device in OS. If empty, default device is using 
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, Category = "AkComponent")
FString AudioDeviceName;

- Then we go to AkAudioDevice.h to create some tough functions:

// this need to find your audio device in OS by name parameter above
TTuple <AkUInt32, FString> SearchAudioDeviceIdByName(FString deviceName);

// this function add secondary output and connect audio device from OS with device from Wwise
AkOutputDeviceID AddCustomOutput(FString AudioDevice, FString WwiseDevice, UAkComponent* in_pComponent);

// important function remove secondary output when game stopped
AKRESULT RemoveCustomOutput(AkOutputDeviceID deviceId); 

- Now go to AkAudioDevice.cpp and create functions above:

TTuple <AkUInt32, FString> FAkAudioDevice::SearchAudioDeviceIdByName(FString deviceName)
{
     TTuple <AkUInt32, FString> result;
     AkUInt32 immDeviceCount = AK::GetWindowsDeviceCount(AkDeviceState_Active);

     for (AkUInt32 i = 0; i < immDeviceCount; ++i) {
          AkUInt32 deviceId = AK_INVALID_DEVICE_ID;
          AK::GetWindowsDevice(i, deviceId, NULL, AkDeviceState_Active);

         auto deviceNameWstr = AK::GetWindowsDeviceName(i, deviceId, AkDeviceState_Active);

         if (FString(deviceNameWstr).Contains(deviceName)) {
             result.Key = deviceId;
             result.Value = FString(deviceNameWstr);
             break;
         }
    }

    return result;
}

 

AkOutputDeviceID FAkAudioDevice::AddCustomOutput(FString AudioDevice, FString WwiseDevice, UAkComponent* in_pComponent)
{
      TTuple <AkUInt32, FString> Device;
      AkOutputDeviceID deviceId = AK_INVALID_DEVICE_ID;
      FString WwiseDeviceName = "System";
      AKRESULT res = AK_Fail;

      if (AudioDevice.Len() == 0 && WwiseDevice.Len() == 0) {
          return deviceId;
      }

      if (WwiseDevice.Len() > 0) {
           WwiseDeviceName = WwiseDevice;
      }

      Device = SearchAudioDeviceIdByName(*AudioDevice);

      if (Device.Key) {
           AkOutputSettings outputSettings(*WwiseDeviceName, Device.Key);
           auto gameObjID = in_pComponent->GetAkGameObjectID();

           res = AK::SoundEngine::AddOutput(outputSettings, &deviceId, &gameObjID, 1);
      }

      if (res != AK_Success) {
          UE_LOG(LogAkAudio, Error, TEXT("Searching of VR Audio Devices is failed: %d"), res);
      } else {
          FString componentName = in_pComponent->GetName();
          UE_LOG(LogAkAudio, Warning, TEXT("AkComponent \"%s\" attached to \"%s\" <-> \"%s\" "), *componentName, *Device.Value, *WwiseDeviceName);
      }
      return deviceId;
}

 

AKRESULT FAkAudioDevice::RemoveCustomOutput(AkOutputDeviceID deviceId)
{
      return AK::SoundEngine::RemoveOutput(deviceId);
}

- And at the end we go to AkComponent.cpp and look for  UAkComponent::PostRegisterGameObject() and UAkComponent::PostUnregisterGameObject(). It perfect place to manipulate with devices. Here we just use functions just created:

void UAkComponent::PostRegisterGameObject() 
{
        FAkAudioDevice* AkAudioDevice = FAkAudioDevice::Get();
        if (AudioDeviceName.Len() > 0 || WwiseDeviceName.Len() > 0) {
              OutputID = AkAudioDevice->AddCustomOutput(AudioDeviceName, WwiseDeviceName, this);
        }
}

void UAkComponent::PostUnregisterGameObject() 
{
      FAkAudioDevice* AkAudioDevice = FAkAudioDevice::Get();
      if (AkAudioDevice && OutputID != AK_INVALID_DEVICE_ID) {
            AkAudioDevice->RemoveCustomOutput(OutputID);
      }
}

That's it. If you find some patience and managed with compiler, you get new posibility in Blueprint)

After this hell you have to create AkComponent as a listener and attach any other AkComponent to it as a listener:

Ed K. (300 포인트) 로 부터
0 투표
Ed K. (300 포인트) 로 부터
...