feat(audio): add guest voice controls and reliable lifecycle delivery
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
This commit is contained in:
@@ -8,10 +8,10 @@ use crate::utilities::{draw_owned_rgba8888_frame_to_rgba8, draw_rgba8888_to_rgba
|
||||
use pixels::wgpu::PresentMode;
|
||||
use pixels::{Pixels, PixelsBuilder, SurfaceTexture};
|
||||
use prometeu_drivers::hardware::Hardware;
|
||||
use prometeu_drivers::{AudioCommand, LocalFramebufferRenderBackend, MemoryBanks};
|
||||
use prometeu_drivers::{LocalFramebufferRenderBackend, MemoryBanks};
|
||||
use prometeu_firmware::{BootTarget, Firmware, FirmwareState};
|
||||
use prometeu_hal::telemetry::CertificationConfig;
|
||||
use prometeu_hal::{OwnedRgba8888Frame, RenderOwnership, RuntimePlatform};
|
||||
use prometeu_hal::{AudioBridge, OwnedRgba8888Frame, RenderOwnership, RuntimePlatform};
|
||||
use prometeu_system::{LatestRenderFrameStore, RenderWorkerConfig, discover_games_root};
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
@@ -147,8 +147,6 @@ pub struct HostRunner {
|
||||
|
||||
/// The physical audio driver.
|
||||
audio: HostAudio,
|
||||
/// Last known pause state to sync with audio.
|
||||
last_paused_state: bool,
|
||||
/// Worker-published frame store used as the single observable publication source.
|
||||
render_frame_store: LatestRenderFrameStore,
|
||||
/// Tracks whether a new logical frame or host-only surface invalidation requires presentation.
|
||||
@@ -238,7 +236,6 @@ impl HostRunner {
|
||||
stats: HostStats::new(),
|
||||
debugger: HostDebugger::new(),
|
||||
audio: HostAudio::new(),
|
||||
last_paused_state: false,
|
||||
render_frame_store,
|
||||
presentation: PresentationState::default(),
|
||||
}
|
||||
@@ -312,7 +309,7 @@ impl ApplicationHandler for HostRunner {
|
||||
|
||||
self.pixels = Some(pixels);
|
||||
|
||||
if let Err(err) = self.audio.init() {
|
||||
if let Err(err) = self.audio.init(self.hardware.audio.transport()) {
|
||||
eprintln!("[HostAudio] Disabled: {}", err);
|
||||
}
|
||||
|
||||
@@ -442,22 +439,11 @@ impl ApplicationHandler for HostRunner {
|
||||
self.stats.record_host_cpu_time(self.firmware.os.vm().last_frame_cpu_time_us());
|
||||
}
|
||||
|
||||
// Sync pause state with audio.
|
||||
// We do this AFTER firmware.tick to avoid MasterPause/Resume commands
|
||||
// being cleared by the OS if a new logical frame starts in this tick.
|
||||
let lifecycle_audio_paused = self.firmware.game_lifecycle_audio_paused();
|
||||
let is_paused = lifecycle_audio_paused
|
||||
let is_paused = self.firmware.game_lifecycle_audio_paused()
|
||||
|| self.firmware.os.vm().paused()
|
||||
|| self.debugger.waiting_for_start;
|
||||
if is_paused != self.last_paused_state {
|
||||
self.last_paused_state = is_paused;
|
||||
let cmd =
|
||||
if is_paused { AudioCommand::MasterPause } else { AudioCommand::MasterResume };
|
||||
self.hardware.audio.commands.push(cmd);
|
||||
}
|
||||
|
||||
// Sync virtual audio commands to the physical mixer.
|
||||
self.audio.send_commands(&mut self.hardware.audio.commands);
|
||||
self.hardware.audio.set_paused(is_paused);
|
||||
self.audio.service();
|
||||
|
||||
self.accumulator -= self.frame_target_dt;
|
||||
self.stats.record_frame();
|
||||
|
||||
Reference in New Issue
Block a user