mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
Fix host-sdl/doom audio. Have app ask via syscall if audio can be rendered before sending, else any mismatch in rates will cause queue over/underflow in host-sdl.
This commit is contained in:
parent
4e61e3bd4a
commit
09985655a2
4 changed files with 16 additions and 8 deletions
|
|
@ -198,8 +198,10 @@ fn submain() !void {
|
|||
|
||||
while(true) {
|
||||
pd.doom_update();
|
||||
const doomSndBuf: [*]i16 = pd.doom_get_sound_buffer();
|
||||
uvm.renderAudio(doomSndBuf, 2048);
|
||||
if (uvm.canRenderAudio()) {
|
||||
const doomSndBuf: [*]i16 = pd.doom_get_sound_buffer();
|
||||
uvm.renderAudio(doomSndBuf, 2048);
|
||||
}
|
||||
|
||||
const fb: [*]const u8 = pd.doom_get_framebuffer(4);
|
||||
uvm.render(fb, WIDTH * HEIGHT * 4);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ pub inline fn syscall(id: u32, param1: u32, param2: u32) u32 {
|
|||
return val;
|
||||
}
|
||||
|
||||
pub inline fn canRenderAudio() bool {
|
||||
return syscall(uvm32.UVM32_SYSCALL_CANRENDERAUDIO, 0, 0) != 0;
|
||||
}
|
||||
|
||||
pub inline fn renderAudio(audbuf: [*]const i16, len:u32) void {
|
||||
_ = syscall(uvm32.UVM32_SYSCALL_RENDERAUDIO, @intFromPtr(audbuf), len);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue