Announcement

Collapse
No announcement yet.

Steam Audio

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • started a topic Steam Audio

    Steam Audio

    Hey folks,

    Feel free to post any Steam Audio related questions or experiments you do here, so we can keep things consolidated and make it easier for people to get help.

    Be sure to grab the user manual if you're just getting started - it should be pretty helpful.

    We track known issues over at our GitHub issues page.

    We have a forum over at our Steam community that you're welcome to explore - you may find useful discussions there as well.

    Thanks!
    Last edited by freeman_valve; 10-16-2017, 06:05 PM.

  • replied
    Generating probes problem

    Hey, guys. I'm using Steam audio 2.0-beta.13 with UE 4.22. I am able to place a Phonon probe volume but unable to generate probes. Anytime I press "Generate Probes", the following message pops up:
    Unable to create scene.
    I couldn't find any mention of such a problem or the pop-up message above. Am I missing something? Any thoughts for the reason or ideas for a solution?
    Thanks in advance!

    Leave a comment:


  • replied
    Originally posted by YuriNK View Post
    Nope, doesn't work. I'll write here later if I succeed.
    YuriNK

    Freeman just have shared his previously mentioned 4.24 update for steam audio plugin: https://github.com/EpicGames/UnrealEngine/pull/6203

    Looks like they have decided to go with engine source change for level reload support, and their solution seems better because of it also introducing proper support for level reloads on audio plugins.

    I'm going to give a quick try to his PR and see if everything works.

    Edit: There was a bug preventing me from exporting scene, it's suggested as a change in PR now. Rest works without problem, and better than my initial implementation. They did lots of fixes onto my PR.
    Last edited by dyanikoglu; 09-11-2019, 07:08 AM.

    Leave a comment:


  • replied
    Great, Thanks for information and clarify all confusion.

    Leave a comment:


  • replied
    Originally posted by dyanikoglu View Post
    Thanks, I will let you know if problem still persists after this change.
    Nope, doesn't work. I'll write here later if I succeed.

    Leave a comment:


  • replied
    Originally posted by YuriNK View Post
    dyanikoglu
    I can't test it deeply right now, but this should fix it:

    PhononPluginManager.cpp
    Code:
    void FPhononPluginManager::OnListenerShutdown(FAudioDevice* AudioDevice)
    {
     // Shutdown reverb effect
    if (IsUsingSteamAudioPlugin(EAudioPlugin::REVERB))
    {
    ReverbPtr = static_cast<FPhononReverb*>(AudioDevice->ReverbPluginInterface.Get());
    ReverbPtr->DestroyReverbEffect();
    ReverbPtr->Shutdown();
    }
    
    FSteamAudioModule* Module = &FModuleManager::GetModuleChecked<FSteamAudioModule>("SteamAudio");
    if (Module != nullptr)
    {
    Module->UnregisterAudioDevice(AudioDevice);
    }
    }
    PhononReverb.cpp
    Code:
    void FPhononReverb::Shutdown()
    {
    for (auto& ReverbSource : ReverbSources)
    {
    if (ReverbSource.ConvolutionEffect)
    {
    iplDestroyConvolutionEffect(&ReverbSource.ConvolutionEffect);
    }
    }
    
    if (ReverbConvolutionEffect)
    {
    iplDestroyConvolutionEffect(&ReverbConvolutionEffect);
    }
    
    if (IndirectBinauralEffect)
    {
    iplDestroyAmbisonicsBinauralEffect(&IndirectBinauralEffect);
    }
    
    if (IndirectPanningEffect)
    {
    iplDestroyAmbisonicsPanningEffect(&IndirectPanningEffect);
    }
    
    if (BinauralRenderer)
    {
    iplDestroyBinauralRenderer(&BinauralRenderer);
    }
    
    if (IndirectOutDeinterleaved)
    {
    for (int32 i = 0; i < AmbisonicsChannels; ++i)
    {
    delete[] IndirectOutDeinterleaved[i];
    }
    delete[] IndirectOutDeinterleaved;
    IndirectOutDeinterleaved = nullptr;
    }
    
    Environment = nullptr;
    }
    
    void FPhononReverb::DestroyReverbEffect()
    {
    for (FReverbSource& ReverbSource : ReverbSources)
    {
    if (ReverbSource.ConvolutionEffect)
    {
    iplDestroyConvolutionEffect(&ReverbSource.ConvolutionEffect);
    }
    }
    }
    And to be safe:
    Code:
    void FPhononReverb::SetEnvironment(FEnvironment* InEnvironment)
    {
    if (!InEnvironment)
    {
    return;
    }
    
     // Free currently existing environment
    if (Environment)
    {
    // Shutdown all
    DestroyReverbEffect();
    Shutdown();
    }
    
    ...
    }
    Thanks, I will let you know if problem still persists after this change.

    Leave a comment:


  • replied
    dyanikoglu
    I can't test it deeply right now, but this should fix it:

    PhononPluginManager.cpp
    Code:
        void FPhononPluginManager::OnListenerShutdown(FAudioDevice* AudioDevice)
        {
            // Shutdown reverb effect
            if (IsUsingSteamAudioPlugin(EAudioPlugin::REVERB))
            {
                ReverbPtr = static_cast<FPhononReverb*>(AudioDevice->ReverbPluginInterface.Get());
                ReverbPtr->DestroyReverbEffect();
                ReverbPtr->Shutdown();
            }
    
            FSteamAudioModule* Module = &FModuleManager::GetModuleChecked<FSteamAudioModule>("SteamAudio");
            if (Module != nullptr)
            {
                Module->UnregisterAudioDevice(AudioDevice);
            }
        }
    PhononReverb.cpp
    Code:
        void FPhononReverb::Shutdown()
        {
            for (auto& ReverbSource : ReverbSources)
            {
                if (ReverbSource.ConvolutionEffect)
                {
                    iplDestroyConvolutionEffect(&ReverbSource.ConvolutionEffect);
                }
            }
    
            if (ReverbConvolutionEffect)
            {
                iplDestroyConvolutionEffect(&ReverbConvolutionEffect);
            }
    
            if (IndirectBinauralEffect)
            {
                iplDestroyAmbisonicsBinauralEffect(&IndirectBinauralEffect);
            }
    
            if (IndirectPanningEffect)
            {
                iplDestroyAmbisonicsPanningEffect(&IndirectPanningEffect);
            }
    
            if (BinauralRenderer)
            {
                iplDestroyBinauralRenderer(&BinauralRenderer);
            }
    
            if (IndirectOutDeinterleaved)
            {
                for (int32 i = 0; i < AmbisonicsChannels; ++i)
                {
                    delete[] IndirectOutDeinterleaved[i];
                }
                delete[] IndirectOutDeinterleaved;
                IndirectOutDeinterleaved = nullptr;
            }
    
            Environment = nullptr;
        }
    
        void FPhononReverb::DestroyReverbEffect()
        {
            for (FReverbSource& ReverbSource : ReverbSources)
            {
                if (ReverbSource.ConvolutionEffect)
                {
                    iplDestroyConvolutionEffect(&ReverbSource.ConvolutionEffect);
                }
            }
        }
    And to be safe:
    Code:
        void FPhononReverb::SetEnvironment(FEnvironment* InEnvironment)
        {
            if (!InEnvironment)
            {
                return;
            }
    
            // Free currently existing environment
            if (Environment)
            {
                // Shutdown all
                DestroyReverbEffect();
                Shutdown();
            }
    
            ...
        }

    Leave a comment:


  • replied
    Originally posted by YuriNK View Post
    Ok, final version. Works with level streaming - although, doesn't support combining phonon scenes from sublevels.
    Code:
    namespace SteamAudio
    {
    ...
    bool HasSceneOnDisk(UWorld* World)
    {
    FString MapName = StrippedMapName(World->GetMapName());
    FString SceneFileName = RuntimePath + MapName + ".phononscene";
    
    IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
    return PlatformFile.FileExists(*SceneFileName);
    }
    }
    Code:
    void FSteamAudioModule::OnWorld_Cleanup(UWorld* World, bool bSessionEnded, bool bCleanupResources)
    {
    if (FAudioDevice* AudioDevice = GEngine->GetActiveAudioDevice())
    {
    for (TAudioPluginListenerPtr PluginListener : AudioDevice->PluginListeners)
    {
    PluginListener->OnListenerShutdown(AudioDevice);
    }
    }
    }
    
    void FSteamAudioModule::OnWorld_PostCreation(UWorld* World)
    {
    bool bHasSceneOnDisk = SteamAudio::HasSceneOnDisk(World);
    
    if (bHasSceneOnDisk)
    {
    if (FAudioDevice* AudioDevice = GEngine->GetActiveAudioDevice())
    {
    for (TAudioPluginListenerPtr PluginListener : AudioDevice->PluginListeners)
    {
    PluginListener->OnListenerInitialize(AudioDevice, World);
    }
    
    UE_LOG(LogSteamAudio, Log, TEXT("OnWorld_PostCreation: Audio Device updated for world %s"), *World->GetName());
    }
    else
    {
    UE_LOG(LogSteamAudio, Warning, TEXT("OnWorld_PostCreation: Can't get valid Audio Device"));
    }
    }
    else
    {
    UE_LOG(LogSteamAudio, Log, TEXT("OnWorld_PostCreation: no SteamAudio scene for world %s"), *World->GetName());
    }
    }
    Hello again YuriNK

    We have implemented this solution into our source and tested it extensively.

    Unfortunately, we got minor sound distortions on reverbation effects. It sounded like the steam scene was being stacked by getting loaded multiple times incorrectly.
    Last edited by dyanikoglu; 09-04-2019, 09:58 AM.

    Leave a comment:


  • replied
    Originally posted by YuriNK View Post
    So, if you can't wait for 4.24 and don't want to compile engine from sources

    SteamAudio - Project Plugin for Unreal Engine 4.22 (Launcher version)
    Link: https://drive.google.com/open?id=1GT...jZVvygubLoIZFa

    SDK 2.0 beta 17 implementation by dyanikoglu (https://github.com/EpicGames/UnrealEngine/pull/5940)
    + updated SteamAudio headers included
    + my fix to update scene when loading new level

    Usage:steamaudio_api_2.0-beta.17.zip
    steamaudio_embree_2.0-beta.17.zip
    steamaudio_tan_2.0-beta.17.zip
    • Copy DLLs to [UE 4.22 installation dir]/Engine/Binaries/ThirdParty/Phonon/Win64
    • Copy phonon.lib to [UE 4.22 installation dir]/Engine/Source/ThirdParty/libPhonon/phonon_api/lib/Win64
    • Recompile project if necessary
    Thank you for the code blocks above!

    I think you should create a PR for that, I can close my PR and reference yours on there.

    Leave a comment:


  • replied
    I'm using Steam Audio with 4.22, the shipped version. I notice that when I play in PIE the level loading time is significantly longer than when using any other audio setup (default or Resonance). Did anyone else notice that level loading times take longer when using the Steam Audio plugin, or am I doing something wrong?

    Leave a comment:


  • replied
    So, if you can't wait for 4.24 and don't want to compile engine from sources

    SteamAudio - Project Plugin for Unreal Engine 4.22 (Launcher version)
    Link: https://drive.google.com/open?id=1GT...jZVvygubLoIZFa

    SDK 2.0 beta 17 implementation by dyanikoglu (https://github.com/EpicGames/UnrealEngine/pull/5940)
    + updated SteamAudio headers included
    + my fix to update scene when loading new level

    Usage:steamaudio_api_2.0-beta.17.zip
    steamaudio_embree_2.0-beta.17.zip
    steamaudio_tan_2.0-beta.17.zip
    • Copy DLLs to [UE 4.22 installation dir]/Engine/Binaries/ThirdParty/Phonon/Win64
    • Copy phonon.lib to [UE 4.22 installation dir]/Engine/Source/ThirdParty/libPhonon/phonon_api/lib/Win64
    • Recompile project if necessary

    Leave a comment:


  • replied
    Ok, final version. Works with level streaming - although, doesn't support combining phonon scenes from sublevels.
    Code:
    namespace SteamAudio
    {
       ...
        bool HasSceneOnDisk(UWorld* World)
        {
            FString MapName = StrippedMapName(World->GetMapName());
            FString SceneFileName = RuntimePath + MapName + ".phononscene";
    
            IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
            return PlatformFile.FileExists(*SceneFileName);
        }
    }
    Code:
    void FSteamAudioModule::OnWorld_Cleanup(UWorld* World, bool bSessionEnded, bool bCleanupResources)
    {
        if (FAudioDevice* AudioDevice = GEngine->GetActiveAudioDevice())
        {
            for (TAudioPluginListenerPtr PluginListener : AudioDevice->PluginListeners)
            {
                PluginListener->OnListenerShutdown(AudioDevice);
            }
        }
    }
    
    void FSteamAudioModule::OnWorld_PostCreation(UWorld* World)
    {
        bool bHasSceneOnDisk = SteamAudio::HasSceneOnDisk(World);
    
        if (bHasSceneOnDisk)
        {
            if (FAudioDevice* AudioDevice = GEngine->GetActiveAudioDevice())
            {
                for (TAudioPluginListenerPtr PluginListener : AudioDevice->PluginListeners)
                {
                    PluginListener->OnListenerInitialize(AudioDevice, World);
                }
    
                UE_LOG(LogSteamAudio, Log, TEXT("OnWorld_PostCreation: Audio Device updated for world %s"), *World->GetName());
            }
            else
            {
                UE_LOG(LogSteamAudio, Warning, TEXT("OnWorld_PostCreation: Can't get valid Audio Device"));
            }
        }
        else
        {
            UE_LOG(LogSteamAudio, Log, TEXT("OnWorld_PostCreation: no SteamAudio scene for world %s"), *World->GetName());
        }
    }

    Leave a comment:


  • replied
    Originally posted by YuriNK View Post
    I can copy the plugin from Engine/Plugins/Runtime/Steam/SteamAudio to [my project]/Plugins/SteamAudio and modify it. When I open a project, Unreal prefers local version of plugins instead of engine's plugins. I used it to update the plugin to beta 17 (based on your other pull request - thank you again). But this pull request #5979 changes files in Engine/Source folder - as I understand, to update scene in SteamAudio when engine loads new map. So, I'd like to avoid it if it's possible, because really, really don't want to compile engine from sources, and our release is planned before 4.24.
    So, I figured out how to update environment without changing engine's core. FAudioDevice::InitializePluginListeners() function is private, but it just updates PluginListener array, which is public.

    Code:
       void FSteamAudioModule::StartupModule()
       {
           ...
           hWorldPostInit = FWorldDelegates::OnPostWorldCreation.AddRaw(this, &FSteamAudioModule::OnWorld_PostCreation);
       }
    
       void FSteamAudioModule::ShutdownModule()
       {
           FWorldDelegates::OnPostWorldInitialization.Remove(hWorldPostInit);
           ...
       }
    
       void FSteamAudioModule::OnWorld_PostCreation(UWorld* World)
       {
           if (FAudioDevice* AudioDevice = GEngine->GetActiveAudioDevice())
           {
               for (TAudioPluginListenerPtr PluginListener : AudioDevice->PluginListeners)
               {
                   PluginListener->OnListenerShutdown(AudioDevice);
                   PluginListener->OnListenerInitialize(AudioDevice, World);
               }
    
              UE_LOG(LogSteamAudio, Log, TEXT("OnWorld_PostCreation: Audio Device updated for world %s"), *World->GetName());
           }
           else
           {
               UE_LOG(LogSteamAudio, Error, TEXT("OnWorld_PostCreation: Can't get valid Audio Device"));
           }
       }
    UPD. Also, need to filter out sublevels.
    Last edited by YuriNK; 08-20-2019, 07:11 AM.

    Leave a comment:


  • replied
    Hello,

    I'm trying to figure out the best way to stream realtime audio into UE4, any suggestions would be greatly appreiciated!

    Leave a comment:


  • replied
    Originally posted by dyanikoglu View Post

    Unfortunately, no. We need to do these bindings while initializing the Steam Audio plugin, and it should be done inside plugin's source code, on where plugin is initialized.
    Sorry, I'm a bit confused. I can copy the plugin from Engine/Plugins/Runtime/Steam/SteamAudio to [my project]/Plugins/SteamAudio and modify it. When I open a project, Unreal prefers local version of plugins instead of engine's plugins. I used it to update the plugin to beta 17 (based on your other pull request - thank you again). But this pull request #5979 changes files in Engine/Source folder - as I understand, to update scene in SteamAudio when engine loads new map. So, I'd like to avoid it if it's possible, because really, really don't want to compile engine from sources, and our release is planned before 4.24.

    Leave a comment:

Working...
X