diff options
author | Alec Murphy <alec@checksum.fail> | 2021-12-17 21:15:22 -0500 |
---|---|---|
committer | Alec Murphy <alec@checksum.fail> | 2021-12-17 21:15:22 -0500 |
commit | 467000a0d8aa7d353135942dc4dd20a10bd97ca0 (patch) | |
tree | 48a205d8284e91a1243eb7072a0d050135362f56 | |
parent | e9ed2e69b3c4759d68dfb477086a8ca247e85318 (diff) |
Split @ac97_process_audio into separate Task
-rw-r--r-- | Lib/AC97.HC | 10 | ||||
-rw-r--r-- | Player.HC | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/Lib/AC97.HC b/Lib/AC97.HC index e5654bb..1ae82f3 100644 --- a/Lib/AC97.HC +++ b/Lib/AC97.HC @@ -217,4 +217,12 @@ I64 @ac97_init() { return 0; } -@ac97_init;
\ No newline at end of file +U0 @ac97_task() { + while (1) { + @ac97_process_audio; + Sleep(1); + } +} + +@ac97_init; +Spawn(&@ac97_task, "AC97 Task", , 1);
\ No newline at end of file @@ -437,7 +437,8 @@ U0 PlayerTask() { I64 i; while (1) { i = 0; - if (FifoI64Cnt(Audio.output[0].data) < BDL_BUF_SIZE) + if (FifoI64Cnt(Audio.output[0].data) < BDL_BUF_SIZE && + player.media.pcm_data && !player.media.paused && !player.media.stopped) while (player.media.seek_frame + player.media.fifo_frame < player.media.pcm_frames && i < BDL_BUF_SIZE) { @@ -447,11 +448,6 @@ U0 PlayerTask() { player.media.fifo_frame++; i++; } - if (FifoI64Cnt(Audio.output[0].data)) { - if (player.media.pcm_data && !player.media.paused && - !player.media.stopped) - @ac97_process_audio; - } Sleep(1); } } |