Skip to content

Add #import music / #import sound and lib/audio.s - #70

Merged
rozensoftware merged 3 commits into
masterfrom
cursor/import-music-sound-5c24
Oct 21, 2026
Merged

rozensoftware merged 3 commits into
masterfrom
cursor/import-music-sound-5c24

Conversation

@rozensoftware

Copy link
Copy Markdown
Owner

Summary

Makes Amiga audio as convenient as graphics assets: compile-time #import music / #import sound, plus HAS-ABI wrappers in lib/audio.s over ptplayer.

Author experience

#import music "assets/title.mod" as mus_title;
#import sound "assets/laser.raw" as sfx_laser;
#import sound "assets/boom.iff" as sfx_boom vol=40 pri=120;

#include "../includes/audio_defs.has";

call InitAudio();
call PlayMusic(mus_title);   // const track ID
call PlaySound(sfx_laser);   // const sfx ID
call PauseMusic();
call ChangeMusic(mus_ingame);
call QuitAudio();

What landed

  • #import music — ProTracker .mod → CHIP DATA_C fragment + const track ID
  • #import sound — .raw / .iff / .8svx (via tools/extract_8svx.py) → CHIP sample + sfx_table entry; options period / vol / pri / channel
  • Codegen emits music_table + sfx_table whenever any audio import is present
  • lib/audio.s — InitAudio, QuitAudio, PlayMusic, ChangeMusic, StopMusic, PauseMusic, ResumeMusic, PlaySound, SetMusicVolume (frame pointer preserved when using a6=CUSTOM)
  • Auto-link: audio.s → ptplayer.s
  • Docs, changelog, ptplayer skill updated
  • Regressions: import_audio_load_test.has, import_audio_iff_test.has

Validation

  • Dual-CPU compile (68000 / 68020) of audio import tests
  • vasmm68k_mot assemble of generated .s, lib/audio.s, lib/ptplayer.s
  • tests/test_import_directive.py — 30 passed
  • IFF 8SVX extract + #import sound path verified

Notes

  • Import as labels are integer constants (table indices), not & pointers
  • incbin paths are absolute so vasm can find assets when fragments are INCLUDEd from another directory
Open in Web Open in Cursor 

rozensoftware and others added 3 commits October 21, 2026 19:14
Compile-time audio imports emit CHIP DATA_C fragments and aggregated
music_table/sfx_table; validator treats labels as const IDs. HAS-ABI
wrappers in audio.s wrap ptplayer; docs and regression example included.

Co-authored-by: Piotr Rozentreter <rozensoftware@users.noreply.github.com>
vasm resolves incbin relative to the main source file, not INCLUDEd
fragments, so relative paths from build/gen broke assembly. Also add an
IFF 8SVX #import sound regression fixture.

Co-authored-by: Piotr Rozentreter <rozensoftware@users.noreply.github.com>
@rozensoftware
rozensoftware marked this pull request as ready for review October 21, 2026 18:34
@rozensoftware
rozensoftware merged commit 59fb4d5 into master Oct 21, 2026
2 checks passed
@rozensoftware
rozensoftware deleted the cursor/import-music-sound-5c24 branch October 21, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants