Skip to content

Put the audio subsystem behind pxsim.audiohost - #11780

Draft
Eric Anderson (humanapp) wants to merge 1 commit into
humanapp/stack/1-simcorefrom
humanapp/stack/2-audiohost
Draft

Eric Anderson (humanapp) wants to merge 1 commit into
humanapp/stack/1-simcorefrom
humanapp/stack/2-audiohost

Conversation

@humanapp

Copy link
Copy Markdown
Collaborator

Second of the stacked PRs replacing #11665 (2 of 8).

Sound code now plays through pxsim.audiohost. The default host is silent, but still takes as long to play a sound as the audible sound would, and ticks the sequencer's metronome via the host timers. The browser-side bundle registers the Web Audio implementation at load, and behaves as it does today.

Other changes:

  • Minor bugfix: A play now fires one "playinstructions" sound event instead of two.
  • Minor code tidy-up: The play instruction buffer layout is defined once, in pxsim.music, and the player and the song code both read it.

The sound code plays through pxsim.audiohost, a seam with a silent default that still takes as long as the sound would and ticks the sequencer's metronome on the host timers, and a Web Audio implementation that the browser bundle registers at load. AudioContextManager keeps its API and forwards to the host, so targets are unaffected; its soundEventCallback stays for now with a bridge onto the host's sound event handler, and a play fires one playinstructions event instead of two. The instruction buffer layout lives in one place, pxsim.music, which the player and the song code both read.
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.

1 participant