diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-28 10:15:48 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-28 10:15:48 +0100 |
| commit | 0db129c1dde77d82117742cc12caa05cb814914b (patch) | |
| tree | 85e4d2b4a981531d29f907b5bc403bfe3a470890 /HOWTO.md | |
| parent | 7505b9792063a6272d2b193abbfdd49a97480207 (diff) | |
docs: Document gen_assets.sh usage
Adds instructions to HOWTO.md for re-generating assets from source audio using the provided script.
Diffstat (limited to 'HOWTO.md')
| -rw-r--r-- | HOWTO.md | 27 |
1 files changed, 19 insertions, 8 deletions
@@ -129,24 +129,35 @@ This system allows embedding binary assets directly into the demo executable. #### Defining Assets -Assets are defined in `assets/final/assets.txt`. Each line specifies: -* `ASSET_NAME`: The identifier for the asset in C++ (e.g., `SAMPLE_142`). +Assets are defined in `assets/final/demo_assets.txt` (for the demo) and `assets/final/test_assets_list.txt` (for tests). Each line specifies: +* `ASSET_NAME`: The identifier for the asset in C++ (e.g., `KICK_1`). * `filename.ext`: The path to the asset file (relative to `assets/final/`). * `NONE`: Compression type (currently only `NONE` is supported). * `"Description"`: An optional description. -Example `assets/final/assets.txt` entry: +Example `assets/final/demo_assets.txt` entry: ``` -SAMPLE_142, sample_142.spec, NONE, "A drum kick sample" +KICK_1, kick1.spec, NONE, "A drum kick sample" ``` +#### Re-generating Assets + +To re-analyze source audio files (WAV/MP3) into spectrograms and update the embedded assets in the source tree, use the provided script: + +```bash +./scripts/gen_assets.sh +``` + +This script: +1. Ensures `spectool` and `asset_packer` are built. +2. Converts source audio files in `assets/wav/` to `.spec` files in `assets/final/`. +3. Runs `asset_packer` to update `src/assets.h` and `src/assets_data.cc`. + #### Building with Assets -The `asset_packer` tool processes `assets/final/assets.txt` and generates two files: -* `build/src/assets.h`: Contains the `AssetId` enum and `GetAsset` function declaration. -* `build/src/assets_data.cc`: Contains the binary data for each asset. +The build system automatically runs `asset_packer` whenever the asset lists are modified. The generated files are located in the build directory (`build/src/`). -These files are automatically generated as part of the normal build process when `demo64k` is built. To trigger generation, simply run: +To build the demo with the latest assets: ```bash cmake -S . -B build |
