new music on color-square
This commit is contained in:
@@ -69,7 +69,9 @@ impl HostAudio {
|
||||
pub fn send_commands(&mut self, commands: &mut Vec<AudioCommand>) {
|
||||
if let Some(producer) = &mut self.producer {
|
||||
for cmd in commands.drain(..) {
|
||||
let _ = producer.try_push(cmd);
|
||||
if let Err(_) = producer.try_push(cmd) {
|
||||
eprintln!("[HostAudio] Command ringbuffer full, dropping command.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,6 +110,7 @@ impl AudioMixer {
|
||||
loop_mode,
|
||||
} => {
|
||||
if voice_id < MAX_CHANNELS {
|
||||
println!("[AudioMixer] Playing voice {}: vol={}, pitch={}, loop={:?}", voice_id, volume, pitch, loop_mode);
|
||||
self.voices[voice_id] = Channel {
|
||||
sample: Some(sample),
|
||||
active: true,
|
||||
|
||||
@@ -230,17 +230,32 @@ impl HostDebugger {
|
||||
|
||||
// Map Certification tags (0xCA01-0xCA03) to 'Cert' protocol events.
|
||||
if event.tag >= 0xCA01 && event.tag <= 0xCA03 {
|
||||
let rule = match event.tag {
|
||||
0xCA01 => "cycles_budget",
|
||||
0xCA02 => "max_syscalls",
|
||||
0xCA03 => "max_host_cpu_us",
|
||||
_ => "unknown"
|
||||
}.to_string();
|
||||
let tel = &firmware.os.telemetry_last;
|
||||
let cert_config = &firmware.os.certifier.config;
|
||||
|
||||
let (rule, used, limit) = match event.tag {
|
||||
0xCA01 => (
|
||||
"cycles_budget".to_string(),
|
||||
tel.cycles_used,
|
||||
cert_config.cycles_budget_per_frame.unwrap_or(0),
|
||||
),
|
||||
0xCA02 => (
|
||||
"max_syscalls".to_string(),
|
||||
tel.syscalls as u64,
|
||||
cert_config.max_syscalls_per_frame.unwrap_or(0) as u64,
|
||||
),
|
||||
0xCA03 => (
|
||||
"max_host_cpu_us".to_string(),
|
||||
tel.host_cpu_time_us,
|
||||
cert_config.max_host_cpu_us_per_frame.unwrap_or(0),
|
||||
),
|
||||
_ => ("unknown".to_string(), 0, 0),
|
||||
};
|
||||
|
||||
self.send_event(DebugEvent::Cert {
|
||||
rule,
|
||||
used: 0,
|
||||
limit: 0,
|
||||
used,
|
||||
limit,
|
||||
frame_index: firmware.os.logical_frame_index,
|
||||
});
|
||||
}
|
||||
@@ -261,6 +276,14 @@ impl HostDebugger {
|
||||
vm_steps: tel.vm_steps,
|
||||
syscalls: tel.syscalls,
|
||||
cycles: tel.cycles_used,
|
||||
host_cpu_time_us: tel.host_cpu_time_us,
|
||||
violations: tel.violations,
|
||||
gfx_used_bytes: tel.gfx_used_bytes,
|
||||
gfx_inflight_bytes: tel.gfx_inflight_bytes,
|
||||
gfx_slots_occupied: tel.gfx_slots_occupied,
|
||||
audio_used_bytes: tel.audio_used_bytes,
|
||||
audio_inflight_bytes: tel.audio_inflight_bytes,
|
||||
audio_slots_occupied: tel.audio_slots_occupied,
|
||||
});
|
||||
self.last_telemetry_frame = current_frame;
|
||||
}
|
||||
|
||||
@@ -124,21 +124,31 @@ impl HostRunner {
|
||||
let color_bg = prometeu_core::model::Color::INDIGO; // Dark blue to stand out
|
||||
let color_warn = prometeu_core::model::Color::RED;
|
||||
|
||||
self.hardware.gfx.fill_rect(5, 5, 140, 65, color_bg);
|
||||
self.hardware.gfx.fill_rect(5, 5, 140, 100, color_bg);
|
||||
self.hardware.gfx.draw_text(10, 10, &format!("FPS: {:.1}", self.stats.current_fps), color_text);
|
||||
self.hardware.gfx.draw_text(10, 18, &format!("HOST: {:.2}MS", tel.host_cpu_time_us as f64 / 1000.0), color_text);
|
||||
self.hardware.gfx.draw_text(10, 26, &format!("STEPS: {}", tel.vm_steps), color_text);
|
||||
self.hardware.gfx.draw_text(10, 34, &format!("SYSC: {}", tel.syscalls), color_text);
|
||||
self.hardware.gfx.draw_text(10, 42, &format!("CYC: {}", tel.cycles_used), color_text);
|
||||
|
||||
self.hardware.gfx.draw_text(10, 50, &format!("GFX: {}K/16M ({}S)", tel.gfx_used_bytes / 1024, tel.gfx_slots_occupied), color_text);
|
||||
if tel.gfx_inflight_bytes > 0 {
|
||||
self.hardware.gfx.draw_text(10, 58, &format!("LOAD GFX: {}KB", tel.gfx_inflight_bytes / 1024), color_warn);
|
||||
}
|
||||
|
||||
self.hardware.gfx.draw_text(10, 66, &format!("AUD: {}K/32M ({}S)", tel.audio_used_bytes / 1024, tel.audio_slots_occupied), color_text);
|
||||
if tel.audio_inflight_bytes > 0 {
|
||||
self.hardware.gfx.draw_text(10, 74, &format!("LOAD AUD: {}KB", tel.audio_inflight_bytes / 1024), color_warn);
|
||||
}
|
||||
|
||||
let cert_color = if tel.violations > 0 { color_warn } else { color_text };
|
||||
self.hardware.gfx.draw_text(10, 50, &format!("CERT LAST: {}", tel.violations), cert_color);
|
||||
self.hardware.gfx.draw_text(10, 82, &format!("CERT LAST: {}", tel.violations), cert_color);
|
||||
|
||||
if tel.violations > 0 {
|
||||
if let Some(event) = self.firmware.os.log_service.get_recent(10).into_iter().rev().find(|e| e.tag >= 0xCA01 && e.tag <= 0xCA03) {
|
||||
let mut msg = event.msg.clone();
|
||||
if msg.len() > 30 { msg.truncate(30); }
|
||||
self.hardware.gfx.draw_text(10, 58, &msg, color_warn);
|
||||
self.hardware.gfx.draw_text(10, 90, &msg, color_warn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user