festival icon indicating copy to clipboard operation
festival copied to clipboard

`Audio` rewrite

Open hinto-janai opened this issue 1 year ago • 1 comments

What

The code for Audio is too entwined.

The major roles Audio plays is:

  • Audio decoding/demuxing
  • Kernel signal handling
  • OS media control + metadata handling
  • AUDIO_STATE state & logic management

Problems

The cause of most of these issues is the state + logic handling of AUDIO_STATE being half-baked into Audio:

  • There's tons of code duplication
  • There's potential deadlocks all over the place
  • It's hard to read and maintain

Goal

"Given this signal, what will happen to the audio state?"

This is really hard to answer as it stands, because everything is so intertwined.

The goal should be small finite state machine, which AUDIO_STATE really is at its core.

The methods should be tied to the global AUDIO_STATE, not the Audio thread.

hinto-janai avatar Jun 22 '23 00:06 hinto-janai