2.2 KiB
autosample
Graphical interface for automatically recording samples from existing analog audio hardware.
Build
Requires MSVC (Visual Studio or Build Tools) with the Windows SDK.
Open a Developer Command Prompt, then:
cl /nologo nob.c
nob.exe
build\autosample.exe
The first command is a one-time bootstrap. After that, nob.exe detects changes to nob.c and rebuilds itself automatically.
Project structure
nob.c Build script (compiled to nob.exe)
nob.h nob build system (vendored, single-header)
src/
main.cpp Entry point and main loop
platform/
platform.h Window management API (platform-agnostic)
platform_win32.cpp Win32 implementation
renderer/
renderer.h Renderer API (graphics-agnostic)
renderer_dx12.cpp DirectX 12 implementation + Dear ImGui backend
vendor/
imgui/ Dear ImGui (vendored source)
backends/ Platform and renderer backends (Win32, DX12)
The platform and renderer layers are C-style APIs with opaque handles. platform.h abstracts window creation so other backends can be added without touching the rest of the code. renderer.h abstracts graphics initialization and frame management.
Code style
This project is written in C-style C++. We use .cpp files and a small subset of C++ features (default struct values, function overloading, namespaces where useful) but avoid the rest. No classes, no inheritance, limit templates, no exceptions, no RAII, avoid STL containers or algorithms. Data is plain structs. Functions operate on those structs, or pointers to them.
Opening braces go on the same line as the function signature (K&R style), not on the next line.
Memory is managed with arena allocators where possible rather than individual malloc/free or new/delete calls. Arenas make allocation fast, avoid fragmentation, and simplify cleanup.
Dependencies
All dependencies are vendored as source. Nothing to download or install beyond the Windows SDK.
- nob.h - build system
- Dear ImGui - GUI