Tramway SDK
Classes | Enumerations | Functions | Variables
tram::Audio::Spatial Namespace Reference

Experimental path tracing audio system. More...

Classes

struct  AudioBuffer
 
struct  AudioRender
 
struct  AudioSource
 
struct  PathExplorationResult
 
struct  PathFromAudioSource
 
struct  PathRenderingInfo
 
struct  PathTracingResult
 

Enumerations

enum  AudioSourceFlags : uint16_t { SOURCE_PLAYING = 1 , SOURCE_REPEATING = 2 }
 
enum  AudioSampleRate : uint16_t { SAMPLERATE_44100 = 1 , SAMPLERATE_22050 = 2 , SAMPLERATE_11025 = 4 }
 

Functions

void InitOutput ()
 
void UpdateOutput ()
 
void UninitOutput ()
 
void LockRenderlist ()
 
void UnlockRenderlist ()
 
void FindPaths (PathExplorationResult &result, bool metropolis, vec3 position)
 
void FindPathsMetropolis (PathExplorationResult *exploration, PathTracingResult *result, vec3 position)
 
void InitExplorationPaths (PathExplorationResult *paths)
 
void ValidateResult (PathTracingResult &result, vec3 position)
 
void RenderResult (PathTracingResult &result, vec3 position)
 
void CheckReverb (PathExplorationResult *paths)
 
void MakeSomeSourcePaths (PathFromAudioSource &path, vec3 source_position)
 

Variables

const size_t PATHS_FOR_RENDERING = 10
 
const size_t PATHS_FOR_SOURCE = 5
 
const size_t PATHS_FOR_LISTENER = 5
 
const size_t BUFFER_COUNT = 1000
 
const size_t SOURCE_COUNT = 200
 
const size_t SOURCE_DEPTH_LIMIT = 3
 
const size_t LISTENER_DEPTH_LIMIT = 6
 
AudioBuffer audiobuffers [BUFFER_COUNT]
 
AudioSource audiosources [SOURCE_COUNT]
 
AudioRender audiorenders [SOURCE_COUNT]
 
vec3 listener_position
 
quat listener_orientation
 
int32_t listener_reverb_delay [5]
 
float listener_reverb_distance [5]
 
float listener_reverb_force [5]
 
float listener_reverb_normalized [5]
 

Detailed Description

Experimental path tracing audio system.

It uses bi-directional path tracing together with Primary Sample Space Metropolis Light Transport algorithm to find paths between the listener and audio sources.

It then attentuates sounds based on surface reflection absorption and distance, does panning based on the angle between the listener and the last reflection and then convolves the resulting impulse response with the sound being played back by the audio source.

Sounds pretty bad (needs tweaking), very slow as well (no optimizations).

I haven't tried recently, but it probably doesn't even compile.

Todo:

Make sure that it compiles and do some improvements

Investigate the possibilities of using hardware accelerated ray-tracing

I am very poor and can't afford a graphics card, NVIDIA pls sponsor me

Enumeration Type Documentation

◆ AudioSampleRate

Enumerator
SAMPLERATE_44100 
SAMPLERATE_22050 
SAMPLERATE_11025 

◆ AudioSourceFlags

Enumerator
SOURCE_PLAYING 
SOURCE_REPEATING 

Function Documentation

◆ CheckReverb()

void tram::Audio::Spatial::CheckReverb ( PathExplorationResult paths)

◆ FindPaths()

void tram::Audio::Spatial::FindPaths ( PathExplorationResult result,
bool  metropolis,
vec3  position 
)

◆ FindPathsMetropolis()

void tram::Audio::Spatial::FindPathsMetropolis ( PathExplorationResult exploration,
PathTracingResult result,
vec3  position 
)

◆ InitExplorationPaths()

void tram::Audio::Spatial::InitExplorationPaths ( PathExplorationResult paths)

◆ InitOutput()

void tram::Audio::Spatial::InitOutput ( )

◆ LockRenderlist()

void tram::Audio::Spatial::LockRenderlist ( )

◆ MakeSomeSourcePaths()

void tram::Audio::Spatial::MakeSomeSourcePaths ( PathFromAudioSource path,
vec3  source_position 
)

◆ RenderResult()

void tram::Audio::Spatial::RenderResult ( PathTracingResult result,
vec3  position 
)

◆ UninitOutput()

void tram::Audio::Spatial::UninitOutput ( )

◆ UnlockRenderlist()

void tram::Audio::Spatial::UnlockRenderlist ( )

◆ UpdateOutput()

void tram::Audio::Spatial::UpdateOutput ( )

◆ ValidateResult()

void tram::Audio::Spatial::ValidateResult ( PathTracingResult result,
vec3  position 
)

Variable Documentation

◆ audiobuffers

AudioBuffer tram::Audio::Spatial::audiobuffers[BUFFER_COUNT]
extern

◆ audiorenders

AudioRender tram::Audio::Spatial::audiorenders[SOURCE_COUNT]
extern

◆ audiosources

AudioSource tram::Audio::Spatial::audiosources[SOURCE_COUNT]
extern

◆ BUFFER_COUNT

const size_t tram::Audio::Spatial::BUFFER_COUNT = 1000

◆ LISTENER_DEPTH_LIMIT

const size_t tram::Audio::Spatial::LISTENER_DEPTH_LIMIT = 6

◆ listener_orientation

quat tram::Audio::Spatial::listener_orientation
extern

◆ listener_position

vec3 tram::Audio::Spatial::listener_position
extern

◆ listener_reverb_delay

int32_t tram::Audio::Spatial::listener_reverb_delay[5]
extern

◆ listener_reverb_distance

float tram::Audio::Spatial::listener_reverb_distance[5]
extern

◆ listener_reverb_force

float tram::Audio::Spatial::listener_reverb_force[5]
extern

◆ listener_reverb_normalized

float tram::Audio::Spatial::listener_reverb_normalized[5]
extern

◆ PATHS_FOR_LISTENER

const size_t tram::Audio::Spatial::PATHS_FOR_LISTENER = 5

◆ PATHS_FOR_RENDERING

const size_t tram::Audio::Spatial::PATHS_FOR_RENDERING = 10

◆ PATHS_FOR_SOURCE

const size_t tram::Audio::Spatial::PATHS_FOR_SOURCE = 5

◆ SOURCE_COUNT

const size_t tram::Audio::Spatial::SOURCE_COUNT = 200

◆ SOURCE_DEPTH_LIMIT

const size_t tram::Audio::Spatial::SOURCE_DEPTH_LIMIT = 3