Commit graph

12 commits

Author SHA1 Message Date
Clownacy
f78f6b7105 Split Organya callback data
The function pointer only ever needs to be set once, unlike the
timer. This should avoid any scary race-conditions.
2020-04-18 00:54:24 +01:00
Clownacy
1ad6fdf539 Rename mutex 2020-04-17 23:52:00 +01:00
Clownacy
b06e1e1312 Remove old junk 2020-04-17 23:48:40 +01:00
Clownacy
5bcc0ec393 New way to allocate Wii U voices
The previous method wasn't good enough: we were still maxing-out at
96 (did the Decaf devs misread that as hex? Is that why the
emulator's limit is 150 instead?).

Anyway, this new solution is a little brutish, but I can't think of
anything else that would work: right now, I have the Organya thread
constantly polling a linked-list of the currently-loaded sounds, and
checking if their voices have finished playing or not. If they've
finished, they get freed.

When AudioBackend_PlaySound is called, if checks if the sound's voice
has been freed or not, and reallocates it if it has.

There doesn't seem to be a noticable overhead to this, and it keeps
the number of currently-allocated voices *very* low (from 10 to 20 on
average).
2020-04-17 23:43:17 +01:00
Clownacy
b123e3743e Clean-up the weird buggy code
I'mma just assume each sound needs their struct preserving for some
reason.
2020-04-17 21:48:34 +01:00
Clownacy
db14899b3e Try to fix Wii U audio hang part 2
I encountered a hang earlier, so the previous attempt obviously
didn't work.
2020-04-17 18:34:26 +01:00
Clownacy
76e7a6f857 Revert some suspicious code
I'm getting some rare audio hangs. I tried doing some
regression-testing, but it's so random that I'm getting anomalous
results. That said, there were suspicious results around this change
(and also the way `mix_data` is initialised/cleared), so I'm
reverting this for now, and restoring it next time I encounter a
hang.
2020-04-17 16:58:07 +01:00
Clownacy
d025fecf54 Minor cleanup 2020-04-17 15:47:56 +01:00
Clownacy
a177f44b88 Clean up Wii U audio backend 2020-04-17 14:15:23 +01:00
Clownacy
9eacc74ee2 Got music working on Wii U! 2020-04-17 01:47:23 +01:00
Clownacy
edc9299007 Fix the game using too many Wii U voices
Now it just allocates channels on-demand, rather than ahead-of-time.
2020-04-16 22:42:33 +01:00
Clownacy
a7ebdb75e5 Added unfinished Wii U audio backend
Currently doesn't produce sound unless you stop Organya from calling
AudioBackend_CreateSound, because it exhausts the Wii U's 150-sound
pool before the SFX get any of them.
2020-04-16 22:19:00 +01:00