<feed xmlns='http://www.w3.org/2005/Atom'>
<title>demo.git/src/audio/backend, branch main</title>
<subtitle>Vide-coded 64k demo system</subtitle>
<id>https://git.taar-o.com/demo.git/atom?h=main</id>
<link rel='self' href='https://git.taar-o.com/demo.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/'/>
<updated>2026-05-21T06:10:47Z</updated>
<entry>
<title>style: apply clang-format</title>
<updated>2026-05-21T06:10:47Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-05-21T06:10:47Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=d806027dcaeadcdd8d2febd88bc46b2fd2c465de'/>
<id>urn:sha1:d806027dcaeadcdd8d2febd88bc46b2fd2c465de</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix: code review cleanup — bugs, dead code, factorization (-167 lines)</title>
<updated>2026-05-20T20:44:44Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-05-20T20:44:44Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=5d20c892dedce7bc7486acbd72fbd35da69e413e'/>
<id>urn:sha1:5d20c892dedce7bc7486acbd72fbd35da69e413e</id>
<content type='text'>
Bugs:
- B1: fix dead tempo debug (prev_tempo captured after assignment)
- B2: fix ReloadAssetsFromFile leak for disk-loaded assets; simplify DropAsset
- B3: fix get_free_pool_slot leak (unregister synth + free data on reuse)
- B4: volatile -&gt; std::atomic with acquire/release in miniaudio_backend, synth
- B5: fix unaligned reads in scene_loader (memcpy-based read_f32/read_u32)
- B6: fix shader module + BGL + pipeline layout leaks in gpu.cc, pipeline_builder

Dead code:
- D1: remove unused particle_defs.h
- D3: remove create_post_process_pipeline_simple (zero callers)
- D4: remove empty gpu_draw()
- D5: remove write-only Hybrid3D::initialized_
- D6: remove legacy pending buffer path in audio.cc

Factorization:
- F1: Effect::run_fullscreen_pass() replaces boilerplate in 5 effects
- F2: particle_common.wgsl snippet, #include in 3 WGSL shaders
- F3: gpu_create_shader_module() helper, used in 3 call sites
- F5: get_world_aabb() shared between bvh.cc and physics.cc
- F6: samples_to_seconds() replaces 6 inline expressions
- F7: gpu_create_linear/nearest_sampler use SamplerCache; add nearest() preset

37/37 tests passing.

handoff(Claude): code review batch — all items verified, no regressions.
</content>
</entry>
<entry>
<title>style: Apply clang-format</title>
<updated>2026-02-17T07:16:03Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-17T07:16:03Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=64f977f6fbedf75d5edbc3963e002b593c8428d8'/>
<id>urn:sha1:64f977f6fbedf75d5edbc3963e002b593c8428d8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix: use low-latency profile for regular Core Audio callbacks</title>
<updated>2026-02-17T06:33:32Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-17T06:33:32Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=cdd14146df16de0493acfd6dfbf24c154edbfce3'/>
<id>urn:sha1:cdd14146df16de0493acfd6dfbf24c154edbfce3</id>
<content type='text'>
Switches miniaudio from conservative to low_latency performance profile
to fix irregular beat timing on macOS. Conservative profile caused
uneven callback intervals, desynchronizing playback.

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>fix(build): add missing headers and enum casts for strict compilation</title>
<updated>2026-02-16T14:05:01Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-16T14:05:01Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=a8b1525ca86819757b06b51fedf6aff222cf52bb'/>
<id>urn:sha1:a8b1525ca86819757b06b51fedf6aff222cf52bb</id>
<content type='text'>
Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>refactor: invert FATAL_CHECK logic to standard assertion style</title>
<updated>2026-02-16T11:52:07Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-16T11:52:07Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=83322562ce0c33a8026611471dc7b1b3241bce64'/>
<id>urn:sha1:83322562ce0c33a8026611471dc7b1b3241bce64</id>
<content type='text'>
- Inverted FATAL_CHECK macro to crash if condition is FALSE (standard assertion)
- Updated all call sites in audio, GPU, and CNN subsystems
- Updated documentation and examples
- Recorded completion in doc/COMPLETED.md
</content>
</entry>
<entry>
<title>perf(audio): smooth playback time and RMS-based peak at 60Hz</title>
<updated>2026-02-15T22:56:43Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-15T22:56:43Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=5c7feffd3749ce4b355d0db6334cf39ca94d8d82'/>
<id>urn:sha1:5c7feffd3749ce4b355d0db6334cf39ca94d8d82</id>
<content type='text'>
Interpolates audio playback time between callbacks using CLOCK_MONOTONIC
for smooth 60Hz updates instead of coarse 8-10Hz steps.

Replaces artificial peak decay with true RMS calculation over 50ms
window. Ring buffer computes RMS directly on internal buffer without
copies for efficiency.

All backends updated with get_callback_state() interface for time
interpolation. Tests passing (34/34).

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>fix: WAV dump header corruption and early exit handling</title>
<updated>2026-02-12T00:07:31Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-12T00:07:31Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=ca161d800e8a503d4109cf706c70611f8ecb9d85'/>
<id>urn:sha1:ca161d800e8a503d4109cf706c70611f8ecb9d85</id>
<content type='text'>
- wav_dump_backend: Fix data_size double-counting channels (line 126)
- test_wav_dump: Assert on data_size validation instead of warning
- main: Add SIGINT/SIGTERM handlers to finalize WAV on Ctrl+C
- Guard signal handler code with DEMO_HEADLESS ifdef

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>style: Apply clang-format to all source files</title>
<updated>2026-02-08T06:40:29Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-08T06:40:29Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=c9195f997f3e797f03ab90464e4158717198a167'/>
<id>urn:sha1:c9195f997f3e797f03ab90464e4158717198a167</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix(audio): Synchronize audio-visual timing with playback time</title>
<updated>2026-02-07T15:41:30Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-07T15:41:30Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=f2963ac821a3af1c54002ba13944552166956d04'/>
<id>urn:sha1:f2963ac821a3af1c54002ba13944552166956d04</id>
<content type='text'>
Problem: test_demo was "flashing a lot" - visual effects triggered ~400ms
before audio was heard, causing poor synchronization.

Root Causes:
1. Beat calculation used physical time (platform_state.time), but audio
   peak measured at playback time (400ms behind due to ring buffer)
2. Peak decay too slow (0.7 per callback = 800ms fade) relative to beat
   interval (500ms at 120 BPM)

Solution:
1. Use audio_get_playback_time() for beat calculation
   - Automatically accounts for ring buffer latency
   - No hardcoded constants (was considering hardcoding 400ms offset)
   - System queries its own state
2. Faster decay rate (0.5 vs 0.7) to match beat interval
3. Added inline PeakMeterEffect for visual debugging

Changes:
- src/test_demo.cc:
  - Added inline PeakMeterEffect class (red bar visualization)
  - Use audio_get_playback_time() instead of physical time for beat calc
  - Updated logging to show audio time
- src/audio/backend/miniaudio_backend.cc:
  - Changed decay rate from 0.7 to 0.5 (500ms fade time)
- src/gpu/gpu.{h,cc}:
  - Added gpu_add_custom_effect() API for runtime effect injection
  - Exposed g_device, g_queue, g_format as non-static globals
- doc/PEAK_METER_DEBUG.md:
  - Initial analysis of timing issues
- doc/AUDIO_TIMING_ARCHITECTURE.md:
  - Comprehensive architecture documentation
  - Time source hierarchy (physical → audio playback → music)
  - Future work: TimeProvider class, tracker_get_bpm() API

Architectural Principle:
Single source of truth - platform_get_time() is the only physical clock.
Everything else derives from it. No hardcoded latency constants.

Result: Visual effects now sync perfectly with heard audio.
</content>
</entry>
</feed>
