Hello,
I am trying to utilize all of my outputs from my soundcard which are 8 aux outputs + 2 optical outputs.
I would like to create a UE blueprint callable function to post event to secondary outputs.
I have added another system audio device called "System_Optical" and created a master bus for it.
I did follow and combine some of tutorials and findings from users and the documents such as
Integrating Secondary Outputs (audiokinetic.com)
Blog | Audiokinetic
Q & A | Audiokinetic
I got to a point where I could get my secondary outputs ID and Name correctly but I couldn't do AddOutput();
The result was "AK_NotInitialized(102)".
I don't really know where to start fixing. If anyone has any idea, please shed some light.
Here is my code (C++ Actor Class):
void AMyActor_WwiseCustom::PostEventOn2ndOutput(UAkAudioEvent* Event, UAkComponent* in_pComponent)
{
FString deviceName = "S/PDIF";
FString WwiseDeviceName = "System_Optical";
AKRESULT res = AK_Fail;
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);
UE_LOG(LogAkAudio, Warning, TEXT("Windows Audio Device: %s"), deviceNameWstr);
if (FString(deviceNameWstr).Contains(deviceName)) {
result.Key = deviceId;
result.Value = FString(deviceNameWstr);
break;
}
}
AkOutputDeviceID deviceId = AK_INVALID_DEVICE_ID;
UE_LOG(LogAkAudio, Warning, TEXT("Device ID: %i"), result.Key);
if (result.Key) {
FOnAkPostEventCallback nullCallback;
AkOutputSettings outputSettings(*WwiseDeviceName, result.Key);
auto gameObjID = in_pComponent->GetAkGameObjectID();
res = AK::SoundEngine::AddOutput(outputSettings, &deviceId, &gameObjID, 1);
UAkGameplayStatics::PostEvent(Event, GetOwner(), int32(0), nullCallback);
}
}
Really appreciate.