# Quick Start

Get your first sound playing in 4 simple steps.

#### 1. Create an Audio Database

Right-click in your Project view and select `Create > SnivelerCode > Audio Database`. Add an `AudioClip` (e.g., an explosion sound) to the list.

#### 2. Generate IDs

Select your new Audio Database asset. In the Inspector, click the green **"Generate C# Constants"** button. This creates a file containing your Audio IDs.

#### 3. Scene Setup

Create an empty GameObject in your sub-scene. Add the `AudioSettingsAuthoring` component to it and assign your Audio Database asset.

#### 4. Play a Sound from Code

Use the Fluent API inside any Burst-compiled system:

```csharp
using SnivelerCode.AudioDispatcher.Runtime;
using Unity.Burst;
using Unity.Entities;

[BurstCompile]
public partial struct CombatSystem : ISystem
{
    [BurstCompile]
    public void OnUpdate(ref SystemState state)
    {
        // 1. Get the Audio Writer
        var audioSingleton = SystemAPI.GetSingleton<NativeAudioSystem.Singleton>();
        
        state.Dependency = new CombatJob
        {
            AudioWriter = audioSingleton.Writer
        }.ScheduleParallel(state.Dependency);
    }
}

[BurstCompile]
public partial struct CombatJob : IJobEntity
{
    public NativeQueue<AudioEvent>.ParallelWriter AudioWriter;

    private void Execute(in LocalTransform transform)
    {
        // 2. Play the sound!
        AudioIDs.EXPLOSION.Shot(transform.Position).Apply(AudioWriter);
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sniveler-code.gitbook.io/dots/audio-dispatcher-audio-source/quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
