diff options
Diffstat (limited to 'HOWTO.md')
| -rw-r--r-- | HOWTO.md | 45 |
1 files changed, 42 insertions, 3 deletions
@@ -119,8 +119,47 @@ The executable will be located at `build/specview`. ./build/specview path/to/input.spec ``` -## References and links +### Asset Management System -drum-kit: https://drive.google.com/file/d/13tc7XjkMg-tigvje5qpp6XazK-VcOjoc/view -(got from https://www.reddit.com/r/Drumkits/) +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`). +* `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: +``` +SAMPLE_142, sample_142.spec, NONE, "A drum kick sample" +``` + +#### 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. + +These files are automatically generated as part of the normal build process when `demo64k` is built. To trigger generation, simply run: + +```bash +cmake -S . -B build +cmake --build build +``` + +#### Accessing Assets in Code + +Include `assets.h` and use the `GetAsset` function: + +```cpp +#include "assets.h" + +// ... +size_t asset_size; +const uint8_t* my_asset = GetAsset(AssetId::ASSET_SAMPLE_142, &asset_size); +// ... +// For lazy decompression (scaffolding only): +// DropAsset(AssetId::ASSET_SAMPLE_142, my_asset); +``` |
