stevesims / agon-vdp

Official AGON QUARK Firmware: ESP32 VDP
MIT License
0 stars 0 forks source link

Allow the audio system to support different commands #1

Closed stevesims closed 1 year ago

stevesims commented 1 year ago

We would like to enhance the audio system provided in the agon-vdp to support several new features to allow Agon Console8 games to sound better.

Examples of enhancements may include the ability to use a different waveform including noise, adjust the volume of a channel that is playing audio, playback PCM samples, apply an ADSR envelope, and potentially also to apply a pitch envelope to a channel.

The documentation for the VDU 23, 0, &85 audio command includes waveform as the second argument, however its usage is not documented, and the implementation ignores this value.

It is therefore suggested that the waveform argument byte could be changed instead to indicate an audio command to be processed. Arguments following this byte may vary, depending on the command being used.

To (attempt to) maintain compatibility with existing code, audio command zero will be simple note playback. There is a risk that some existing code may have used a waveform value other than zero, but as we are still relatively early in the life of the Agon Light hopefully that risk is minimal.

stevesims commented 1 year ago

The audio-enhancements branch now includes support for this.

Code for handling audio VDU commands has been refactored into a separate file, vdu_audio.h, and that includes a revised vdu_sys_audio function that can handle multiple audio commands.

stevesims commented 1 year ago

Done