Make audio much more defensive
This commit is contained in:
+5
-5
@@ -138,7 +138,7 @@ impl EmulatorBuilder {
|
||||
self.audio_on,
|
||||
self.watch_rom,
|
||||
self.linked,
|
||||
)?;
|
||||
);
|
||||
if let Some(path) = self.rom {
|
||||
emulator.load_cart(SimId::Player1, &path)?;
|
||||
}
|
||||
@@ -178,11 +178,11 @@ impl Emulator {
|
||||
audio_on: Arc<[AtomicBool; 2]>,
|
||||
watch_rom: Arc<[AtomicBool; 2]>,
|
||||
linked: Arc<AtomicBool>,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
) -> Self {
|
||||
Self {
|
||||
sims: vec![],
|
||||
carts: [None, None],
|
||||
audio: Audio::init()?,
|
||||
audio: Audio::init(),
|
||||
commands,
|
||||
sim_state,
|
||||
state,
|
||||
@@ -198,7 +198,7 @@ impl Emulator {
|
||||
eye_contents: [vec![0u8; 384 * 224 * 2], vec![0u8; 384 * 224 * 2]],
|
||||
audio_samples: Vec::with_capacity(EXPECTED_FRAME_SIZE),
|
||||
buffer: vec![],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reload_cart(&mut self, sim_id: SimId) -> Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user