Hello. I'd like to use the Audio input plugin in C++ with UE4.
As background information, let me show you how I fist created a simple gunshot sound I was able to create with the First Person Template.
So I first load the bank from the BeginPlay(). Obviously, subsequent calls to LoadBank() will fail with AK_BankAlreadyLoaded but I'm not concerned with that for the moment.
void AWwiseTestCharacter::BeginPlay()
{
FAkAudioDevice* AudioDevice = FAkAudioDevice::Get();
AKRESULT res = AudioDevice->LoadBank("Main.bnk", AK_DEFAULT_POOL_ID, bankID);
switch (res)
{
case AK_Success:
break;
case AK_BankAlreadyLoaded:
UE_LOG(LogFPChar, Warning, TEXT("%s"), ANSI_TO_TCHAR("Bank already loaded."));
break;
default:
UE_LOG(LogFPChar, Warning, TEXT("Wwise Load error: %d"), (int32)res);
break;
}
}
Firing the event was simple enough:
void AWwiseTestCharacter::OnFire()
{
FAkAudioDevice* AudioDevice = FAkAudioDevice::Get();
if (AudioDevice)
uint32 WwiseID = AudioDevice->PostEvent(TEXT("FIRE_TRIGGER"), this, 0, NULL, NULL, false);
}
Now I'm trying to use the Audio Input Plug-in.
The first thing I did was to add a new sound SFX in the Wwise project, in my default work unit, added "Wwise audio input" as source, named it "MyVoice". (I don't know if renaming the "Wwise Audio Input" text has any significance but I also changed it to "MyVoice").
Then I created an event called "Voice_Trigger" and attached "MyVoice" onto it. I tested it with my microphone and it works.
I generated the sound bank.
Now where do I go from here ? I don't know how to get a handler to the plugin from the FAkAudioDevice object so I can add the necessary callbacks. And any post event on my voice data returns a Event ID not found.
Is the process described accurate and what to I need to get it a step further ? If the SFX a good choice or is it better to use a "Sound Voice".
Regards.