aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Murphy <alec@checksum.fail>2021-12-17 21:15:22 -0500
committerAlec Murphy <alec@checksum.fail>2021-12-17 21:15:22 -0500
commit467000a0d8aa7d353135942dc4dd20a10bd97ca0 (patch)
tree48a205d8284e91a1243eb7072a0d050135362f56
parente9ed2e69b3c4759d68dfb477086a8ca247e85318 (diff)
Split @ac97_process_audio into separate Task
-rw-r--r--Lib/AC97.HC10
-rw-r--r--Player.HC8
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
diff --git a/Player.HC b/Player.HC
index f11c654..56fd409 100644
--- a/Player.HC
+++ b/Player.HC
@@ -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);
}
}