Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d17910c
add empty AudObstructionOcclusion class implementation
phevosccp Jul 21, 2026
92791e1
create class skeleton layout
phevosccp Jul 21, 2026
e03e8fc
implement api call SetObjectObstructionAndOcclusion and structs for f…
phevosccp Jul 21, 2026
061c107
implement SetObstructionOcclusion and improve structs for emitter sta…
phevosccp Jul 21, 2026
b1682c3
implement setTarget and Advance logic
phevosccp Jul 21, 2026
eded50a
write the update loop for emitters state
phevosccp Jul 21, 2026
2a167d9
- typo fix
phevosccp Jul 21, 2026
efb5dc6
- removeEmitter , reset, clear implementation
phevosccp Jul 21, 2026
aa8c083
minor change on SetEmitterLineOfSightBlockage
phevosccp Jul 21, 2026
972eaba
add guard to avoid setting emutters on the listener
phevosccp Jul 21, 2026
1ad6aba
make fade rate 1 second
phevosccp Jul 21, 2026
71b22ca
add getter/setter for enabling occlusion/obstruction
phevosccp Jul 21, 2026
b343ee9
Get/SetObstructionOcclusionFadeRate added
phevosccp Jul 21, 2026
d255354
expose the audobstructionOcclusion from the audmanager
phevosccp Jul 21, 2026
e3f5196
expose audobstruction/occlusion methods to blue
phevosccp Jul 21, 2026
42ac113
temporarily revert carbon blue/core version bumps
phevosccp Jul 22, 2026
69acb3e
install to monolith fix
phevosccp Jul 22, 2026
2834a90
flaky test fix
phevosccp Jul 22, 2026
1d01b52
flaky test incomplete commit
phevosccp Jul 22, 2026
f43493c
minor typo
phevosccp Jul 22, 2026
8c9365b
requested PR changes
phevosccp Jul 24, 2026
6a6e621
requested PR changes #2
phevosccp Jul 24, 2026
209bdfb
Merge branch 'main' of https://github.com/carbonengine/audio into occ…
phevosccp Jul 24, 2026
a44d88e
another attempt to fix flaky test
phevosccp Jul 27, 2026
16fb516
- Added doxygen
phevosccp Jul 27, 2026
610d4e4
Fix :
phevosccp Jul 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ccp_add_library(CarbonAudio SHARED
src/AudGameObjResource.cpp
src/AudGeometry.cpp
src/AudGeometry_Blue.cpp
src/AudObstructionOcclusion.cpp
src/SpatialAudioSettings.cpp
src/audio2.cpp
src/AudGameObjResource_Blue.cpp
Expand Down Expand Up @@ -83,6 +84,7 @@ target_sources(CarbonAudio PRIVATE
src/AudUIPlayer.h
src/AudMusicPlayer.h
src/AudGeometry.h
src/AudObstructionOcclusion.h
src/SpatialAudioSettings.h
src/autoversion.h
src/DebugUtilities.h
Expand Down Expand Up @@ -187,6 +189,14 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
RUNTIME DESTINATION bin/${CCP_PLATFORM}/${CCP_ARCHITECTURE}/${CCP_TOOLSET}
)

if(MSVC)
install(
FILES $<TARGET_PDB_FILE:CarbonAudio>
CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES}
DESTINATION bin/${CCP_PLATFORM}/${CCP_ARCHITECTURE}/${CCP_TOOLSET}
OPTIONAL
)
endif()
# Generate target configuration for the monolith
configure_ccp_vendor_config_file(
TARGET CarbonAudio
Expand Down
19 changes: 12 additions & 7 deletions InstallToMonolith.vcxproj
Comment thread
phevosccp marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<!--
CCP_EVE_PERFORCE_BRANCH_PATH points at the P4V branch root, e.g. D:\frontier-master.
Fall back to HKCU\Environment so a Visual Studio started before the variable
was set still picks it up without a restart.
-->
<MonolithBranchRoot>$(CCP_EVE_PERFORCE_BRANCH_PATH)</MonolithBranchRoot>
<MonolithBranchRoot Condition="'$(MonolithBranchRoot)' == ''">$([MSBuild]::GetRegistryValue('HKEY_CURRENT_USER\Environment', 'CCP_EVE_PERFORCE_BRANCH_PATH'))</MonolithBranchRoot>
<MonolithInstallPrefix Condition="'$(MonolithBranchRoot)' != ''">$(MonolithBranchRoot.Replace('\', '/'))/vendor/github.com/ccpgames/carbon-audio/develop</MonolithInstallPrefix>
<MonolithInstallPrefix Condition="'$(MonolithBranchRoot)' != ''">$(MonolithBranchRoot.Replace('\', '/'))/vendor/github.com/carbonengine/audio/develop</MonolithInstallPrefix>
<MonolithInstallDirWin Condition="'$(MonolithBranchRoot)' != ''">$(MonolithBranchRoot)\vendor\github.com\carbonengine\audio\develop</MonolithInstallDirWin>
<MonolithBuildDir>.cmake-build-monolith</MonolithBuildDir>
<VsScratchDir>$(ProjectDir)$(MonolithBuildDir)\.vs-installtomonolith\$(Platform)\$(Configuration)\</VsScratchDir>
<RepoRoot>$(ProjectDir.Replace('\', '/'))</RepoRoot>
<MonolithBuildScript>setlocal
cd /d "$(ProjectDir)"
Expand All @@ -39,18 +36,26 @@ set "PATH_TO_VCPKG_ROOT=$(ProjectDir)vendor\github.com\microsoft\vcpkg"
echo Installing CarbonAudio to: $(MonolithInstallPrefix)
cmake -S . -B $(MonolithBuildDir) -G "Visual Studio 18 2026" "-DCMAKE_TOOLCHAIN_FILE=$(RepoRoot)vendor/github.com/microsoft/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$(RepoRoot)vendor/github.com/carbonengine/vcpkg-registry/toolchains/x64-windows-145-carbon.cmake" "-DVCPKG_OVERLAY_TRIPLETS=$(RepoRoot)vendor/github.com/carbonengine/vcpkg-registry/triplets" -DVCPKG_TARGET_TRIPLET=x64-windows-internal -DVCPKG_HOST_TRIPLET=x64-windows-internal -DVCPKG_USE_HOST_TOOLS=ON -DINSTALL_TO_MONOLITH=ON -DBUILD_TESTING=OFF "-DCMAKE_INSTALL_PREFIX=$(MonolithInstallPrefix)"
if errorlevel 1 exit /b 1
if exist "$(MonolithInstallDirWin)" echo Removing existing install at: $(MonolithInstallDirWin)
if exist "$(MonolithInstallDirWin)" rmdir /s /q "$(MonolithInstallDirWin)"
cmake --build $(MonolithBuildDir) --config Internal --target INSTALL
if errorlevel 1 exit /b 1
echo === CarbonAudio installed to $(MonolithInstallPrefix) ===
</MonolithBuildScript>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Internal|x64'">
<IntDir>$(VsScratchDir)</IntDir>
<OutDir>$(VsScratchDir)</OutDir>
<NMakeBuildCommandLine>$(MonolithBuildScript)</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>cd /d "$(ProjectDir)"
if exist $(MonolithBuildDir) rmdir /s /q $(MonolithBuildDir)
mkdir "$(VsScratchDir)" 2&gt;nul
$(MonolithBuildScript)</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>cd /d "$(ProjectDir)"
if exist $(MonolithBuildDir) rmdir /s /q $(MonolithBuildDir)</NMakeCleanCommandLine>
if exist $(MonolithBuildDir) rmdir /s /q $(MonolithBuildDir)
mkdir "$(VsScratchDir)" 2&gt;nul
if exist "$(MonolithInstallDirWin)" echo Removing install at: $(MonolithInstallDirWin)
if exist "$(MonolithInstallDirWin)" rmdir /s /q "$(MonolithInstallDirWin)"</NMakeCleanCommandLine>
<NMakeOutput>$(ProjectDir)$(MonolithBuildDir)\Internal\_audio2_internal.pyd</NMakeOutput>
<NMakePreprocessorDefinitions>WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
</PropertyGroup>
Expand Down
44 changes: 44 additions & 0 deletions src/AudManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ AudManager::AudManager( IRoot* lockobj ) :
// Initialize sound prioritization system
m_soundPrioritization = new SoundPrioritization();
m_spatialAudioSettings = new SpatialAudioSettings();
m_obstructionOcclusion = std::make_unique<AudObstructionOcclusion>( this );
}

AudManager::~AudManager()
Expand Down Expand Up @@ -117,6 +118,8 @@ void AudManager::Process()
m_soundPrioritization->CullAudio();
}

m_obstructionOcclusion->Update();

// Process bank requests, events, positions, RTPC, etc.
AK::SoundEngine::RenderAudio();

Expand Down Expand Up @@ -340,6 +343,11 @@ void AudManager::UnregisterGameObject( AkGameObjectID gameObjID )
{
m_soundPrioritization->UnregisterGameObject( gameObjID );
}

if( m_obstructionOcclusion )
Comment thread
phevosccp marked this conversation as resolved.
{
m_obstructionOcclusion->RemoveEmitter( gameObjID );
}
}

bool AudManager::InitCommunication()
Expand Down Expand Up @@ -530,6 +538,41 @@ const bool AudManager::SpatialAudioIsSupported()
return s_systemSupportsSpatialAudio;
}

bool AudManager::SetEmitterLineOfSightBlockage( AkGameObjectID emitterID, float blockage )
{
return m_obstructionOcclusion->SetEmitterLineOfSightBlockage( emitterID, blockage );
}

float AudManager::GetEmitterOcclusion( AkGameObjectID emitterID ) const
{
return m_obstructionOcclusion->GetEmitterOcclusion( emitterID );
}

void AudManager::ClearObstructionOcclusion()
{
m_obstructionOcclusion->ClearAll();
}

bool AudManager::GetObstructionOcclusionEnabled() const
{
return m_obstructionOcclusion->IsEnabled();
}

void AudManager::SetObstructionOcclusionEnabled( bool value )
{
m_obstructionOcclusion->SetEnabled( value );
}

float AudManager::GetObstructionOcclusionFadeRate() const
{
return m_obstructionOcclusion->GetFadeRate();
}

void AudManager::SetObstructionOcclusionFadeRate( float value )
{
m_obstructionOcclusion->SetFadeRate( value );
}

void AudManager::UpdateSettings( AudSettings* settings )
{
m_settings = settings;
Expand Down Expand Up @@ -776,6 +819,7 @@ void AudManager::Disable()
}

ClearBanks();
m_obstructionOcclusion->Reset();
AudGeometry::ClearAllGeometry();
#ifndef AK_OPTIMIZED
AK::SoundEngine::UnregisterResourceMonitorCallback(ResourceMonitorCallback);
Expand Down
14 changes: 14 additions & 0 deletions src/AudManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "AudListener.h"
#include "SoundPrioritization.h"
#include "SpatialAudioSettings.h"
#include "AudObstructionOcclusion.h"
#include "LowLevelIO/LowLevelIOHook.h"
#include <atomic>
#include <memory>
Expand Down Expand Up @@ -122,6 +123,18 @@ BLUE_CLASS( AudManager ) :
bool GetSpatialAudioGeometryEnabled() const;
// Enables or disables spatial audio geometry.
void SetSpatialAudioGeometryEnabled( bool enabled );
// Set a single line-of-sight blockage ratio for an emitter [0.0, 1.0]. 0 = clear line of sight.
bool SetEmitterLineOfSightBlockage( AkGameObjectID emitterID, float blockage );
// Current, mid-fade occlusion value for an emitter. 0.0 if the emitter is clear or not tracked.
float GetEmitterOcclusion( AkGameObjectID emitterID ) const;
// Fade all obstruction/occlusion values back to clear.
void ClearObstructionOcclusion();
// Enable or disable game-driven obstruction/occlusion processing.
bool GetObstructionOcclusionEnabled() const;
void SetObstructionOcclusionEnabled( bool value );
// How fast obstruction/occlusion values fade towards their targets, in units per second.
float GetObstructionOcclusionFadeRate() const;
void SetObstructionOcclusionFadeRate( float value );
// Can be called to see if the current platform supports spatial audio.
const bool SpatialAudioIsSupported();
// Stop all currently playing sounds on all game objects.
Expand Down Expand Up @@ -239,6 +252,7 @@ BLUE_CLASS( AudManager ) :

SoundPrioritization* m_soundPrioritization;
SpatialAudioSettings* m_spatialAudioSettings;
std::unique_ptr<AudObstructionOcclusion> m_obstructionOcclusion;

// Map of game objects, used to guard Wwise callbacks
std::unordered_map<AkGameObjectID, AudGameObjResource*> m_callbackGameObjects;
Expand Down
24 changes: 24 additions & 0 deletions src/AudManager_Blue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const Be::ClassInfo* AudManager::ExposeToBlue()
MAP_PROPERTY( "transmissionLoss", GetTransmissionLoss, SetTransmissionLoss, "Per-mesh setting: transmission loss [0.0-1.0] applied to geometry surfaces when meshes are registered.")
MAP_PROPERTY( "enableDiffraction", GetEnableDiffraction, SetEnableDiffraction, "Per-mesh setting: enable or disable geometric diffraction on mesh geometry.")
MAP_PROPERTY( "enableDiffractionOnBoundaryEdges", GetEnableDiffractionOnBoundaryEdges, SetEnableDiffractionOnBoundaryEdges, "Per-mesh setting: switch to enable or disable geometric diffraction on boundary edges for this mesh.")

// Obstruction / occlusion
MAP_PROPERTY( "obstructionOcclusionEnabled", GetObstructionOcclusionEnabled, SetObstructionOcclusionEnabled, "Enable or disable game-driven obstruction/occlusion processing. Disabling fades all values back to clear.")
MAP_PROPERTY( "obstructionOcclusionFadeRate", GetObstructionOcclusionFadeRate, SetObstructionOcclusionFadeRate, "How fast obstruction/occlusion values fade towards their targets, in units per second. 0 = instantaneous.")

MAP_METHOD_AND_WRAP
(
Expand Down Expand Up @@ -160,6 +164,26 @@ const Be::ClassInfo* AudManager::ExposeToBlue()
":param stateName: The state you want to set in Wwise."
)
MAP_METHOD_AND_WRAP
(
"SetEmitterLineOfSightBlockage",
SetEmitterLineOfSightBlockage,
"Set a line-of-sight blockage ratio [0.0-1.0] for an emitter (0 = clear). Returns True if the emitter exists."
)
MAP_METHOD_AND_WRAP
(
"GetEmitterOcclusion",
GetEmitterOcclusion,
"Get the occlusion value currently applied to an emitter. This is the live, mid-fade value "
"rather than the target that was set, so it can be used to observe a fade in progress. "
"Returns 0.0 if the emitter is clear or is not being tracked."
)
MAP_METHOD_AND_WRAP
(
"ClearObstructionOcclusion",
ClearObstructionOcclusion,
"Fade the obstruction/occlusion values of all tracked emitters back to clear."
)
MAP_METHOD_AND_WRAP
(
"SpatialAudioIsSupported",
SpatialAudioIsSupported,
Expand Down
Loading