Hi,
Im currently working on FMOD 2.02 on UE 4.27.
The general case is feature to play sound through fmod using asset path.
I have FMOD Event with programmer instrument like :
And in Unreal Engine there is some UWave asset i want to play through fmod.
My code:
FMOD::Sound* Sound = nullptr;
if (FMODAudioComponent)
{
// Load via file
FString SoundPath = *CurrentRadioSong->GetPath().ToString();
if (FPaths::IsRelative(SoundPath))
SoundPath = FPaths::ProjectContentDir() / SoundPath;
FMODAudioComponent->SetEvent(RadioDataAsset->FMODRadioUniversalEvent);
FMODAudioComponent->SetProgrammerSoundName(SoundPath);
FMODAudioComponent->Play();
}
And these FMODAudioComponent.cpp createSound returns FMOD_OK :
else if (SoundName.Contains(TEXT(".")))
{
// Load via file
FString SoundPath = SoundName;
if (FPaths::IsRelative(SoundPath))
{
SoundPath = FPaths::ProjectContentDir() / SoundPath;
}
FMOD::Sound *Sound = nullptr;
if (LowLevelSystem->createSound(TCHAR_TO_UTF8(*SoundPath), SoundMode, nullptr, &Sound) == FMOD_OK)
{
UE_LOG(LogFMOD, Verbose, TEXT("Creating programmer sound from file '%s'"), *SoundPath);
props->sound = (FMOD_SOUND *)Sound;
props->subsoundIndex = -1;
NeedDestroyProgrammerSoundCallback = true;
}
else
{
UE_LOG(LogFMOD, Warning, TEXT("Failed to load programmer sound file '%s'"), *SoundPath);
}
}
But fmod core returns these logs :
LogFMOD: c:\jk\workspace\Build__2.2__Unreal_Win\core_api\src\fmod_systemi.cpp(3919) - filename = /Game/Audio/Music/Gameplay/Track_001 : mode 00010202
LogFMOD: c:\jk\workspace\Build__2.2__Unreal_Win\core_api\src\fmod_systemi.cpp(3923) - FMOD_NONBLOCKING specified. Putting into queue to be opened asynchronously!
LogFMOD: c:\jk\workspace\Build__2.2__Unreal_Win\core_api\src\fmod_systemi.cpp(4060) - setdata soundi = 0000027207BD0B88 : node = 00000271BF6F5E60
LogFMOD: c:\jk\workspace\Build__2.2__Unreal_Win\core_api\src\fmod_systemi.cpp(4064) - add node to async list : head = 00000271B8EA7E58. list count = 0
LogFMOD: c:\jk\workspace\Build__2.2__Unreal_Win\core_api\src\fmod_async.cpp(191) - Starting Asynchronous operation on sound 0000027207BD0B88
LogFMOD: c:\jk\workspace\Build__2.2__Unreal_Win\core_api\src\fmod_systemi_sound.cpp(645) - Create name=‘/Game/Audio/Music/Gameplay/Track_001’, mode=0x00010202
LogFMOD: c:\jk\workspace\Build__2.2__Unreal_Win\core_api\src\fmod_async.cpp(336) - Finished Asynchronous operation on sound 0000027207BD0B88
LogFMOD: c:\jk\workspace\Build__2.2__Unreal_Win\core_api\src\fmod_soundi.cpp(437) - (null) (0000027207BD0B88)
The asset under this path is a SoundWave type.
I decided that if the correct value is returned, the sound creation method itself is OK
The question is where the problem located is and how to implement it in the correct way. Do I need to use a .wav file ? I have read the available documentation and was not able to investigate it