`vaudio.dll` is the main Raytraced Audio DLL. There are other `.dll` files in the SDK that are used to render the debug window. When shipping Vercidium Audio with your games in future, you will only need to include `vaudio.dll`.
> Please note that this SDK does not handle audio playback. Instead it provides the low pass filter and reverb properties that must be applied to each sound, in your engine / audio API of choice
## Quick Start
Step 1 - add `vaudio.dll` as a dependency to your C# project, and then create an instance of a [[raytraced-audio/v110/Classes/RaytracingContext]]. More details are in [[raytraced-audio/v110/Creating a Raytracing Context]].
```cs
using vaudio;
public class Game
{
RaytracingContext context;
public Game()
{
context = new RaytracingContext()
{
WorldPosition = new Vector3F(0, 0, 0),
WorldSize = new Vector3F(50, 50, 50),
RenderingEnabled = true,
ReverbRayCount = 1000,
ReverbBounceCount = 8,
OcclusionRayCount = 500,
OcclusionBounceCount = 6,
};
}
}
```
Step 2 - create a copy of your game's world using low-poly primitives. Read more: [[raytraced-audio/v110/Primitives]].
```cs
// Create a rectangular prism
var prism = new PrismPrimitive()
{
// Set its material
material = MaterialType.Metal,
// Scale it
size = new Vector3F(15),
// Rotate and position it
transform = Matrix4F.CreateRotationX(MathF.PI / 4) *
Matrix4F.CreateTranslation(32, 32, 32)
};
context.AddPrimitive(prism);
```
Step 3 - create a listener emitter that casts occlusion rays towards a target emitter. Read more: [[raytraced-audio/v110/Emitters|Emitters]].
```cs
var listener = new Emitter()
{
Position = new Vector3F(4),
ReverbRayCount = 1000,
ReverbBounceCount = 8,
OcclusionRayCount = 500,
OcclusionBounceCount = 6,
};
var target = new Emitter()
{
Position = new Vector3F(8),
ReverbRayCount = 32,
ReverbBounceCount = 8,
};
// Cast occlusion rays towards the emitter
listener.AddTarget(target);
target.OnRaytracedByAnotherEmitter = (Emitter other) =>
{
var filter = other.GetFilter(target);
// Check low-pass filter gains
var gainLF = (int)(filter.gainLF * 100);
var gainHF = (int)(filter.gainHF * 100);
Console.WriteLine(
quot;The target has {gainLF}% LF gain");
Console.WriteLine(quot;The target has {gainHF}% HF gain");
// PSEUDOCODE - play a sound
Godot.PlaySound(SoundType.Explosion,target.position, filter);
};
```
Step 5 - update the context every frame. This will perform raytracing and handle input for the debug rendering window. Read more: [[raytraced-audio/v110/Advanced/Raytracing Lifecycle]].
```cs
public void Update()
{
// Update the listener's position
listener.Position = new Vector3F(20, 20, 20);
// Perform raytracing on background threads and invoke callbacks
context.Update();
}
```
Step 6 - access reverb properties. Read more: [[raytraced-audio/v110/Reverb]].
```cs
context.OnReverbUpdated = () =>
{
// Access reverb properties
var outside = context.ProcessedReverb.OutsidePercent;
Console.WriteLine(quot;The listener is {(int)(outside * 100)}% outside.");
// Access precalculated EAX properties
var diffusion = context.ListenerEAX.Diffusion;
}
```
Step 7 - access ambient permeation energy on emitters that cast ambient permeation rays. Read more: [[Ambient Permeation]]
```cs
emitter.OnRaytracingComplete = () =>
{
var gainLF = context.AmbientPermeationGainLF;
var gainHF = context.AmbientPermeationGainHF;
}
```
Continue reading:
- [[raytraced-audio/v110/Full Code Example|Full Code Example]]
- [[raytraced-audio/v110/Creating a Raytracing Context|Creating a Raytracing Context]]
- [[Emitters]]
- [[raytraced-audio/v110/Primitives|Primitives]]
- [[raytraced-audio/v110/Reverb|Reverb]]
- [[raytraced-audio/v110/Materials|Materials]]
- [[Ambient Permeation]]
Advanced:
- [[raytraced-audio/v110/Advanced/Threading Architecture|Threading Architecture]]
- [[raytraced-audio/v110/Advanced/Trail-Based Raytracing|Trail-Based Raytracing]]