Fix sound once again :)
This commit is contained in:
parent
cd2f9ddfd8
commit
6c1ad38f0a
17
shell.nix
17
shell.nix
@ -1,20 +1,6 @@
|
||||
let
|
||||
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
|
||||
nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
|
||||
rustNightlyChannelClippy = (nixpkgs.rustChannelOf { date = "2020-01-29"; channel = "nightly"; }).rust.override {
|
||||
extensions = [
|
||||
"rust-src"
|
||||
"rls-preview"
|
||||
"rustfmt-preview"
|
||||
];
|
||||
};
|
||||
rustNightlyChannel = nixpkgs.latest.rustChannels.nightly.rust.override {
|
||||
extensions = [
|
||||
"rust-src"
|
||||
"rls-preview"
|
||||
"rustfmt-preview"
|
||||
];
|
||||
};
|
||||
rustStableChannel = nixpkgs.latest.rustChannels.stable.rust.override {
|
||||
extensions = [
|
||||
"rust-src"
|
||||
@ -28,12 +14,11 @@ in
|
||||
stdenv.mkDerivation {
|
||||
name = "moz_overlay_shell";
|
||||
buildInputs = [
|
||||
rustNightlyChannelClippy
|
||||
rustStableChannel
|
||||
rls
|
||||
rustup
|
||||
pkg-config
|
||||
SDL2
|
||||
pulseaudio
|
||||
];
|
||||
TELOXIDE_TOKEN = "916718418:AAFFtn9WmqipuKCvwiXZ2cEIA_IuNqlO94I";
|
||||
}
|
||||
|
||||
@ -369,7 +369,10 @@ impl Interconnect {
|
||||
0xFF70 => {
|
||||
if self.wram_bank != val {
|
||||
if val > 7 {
|
||||
panic!("Trying to switch to wram bank {} which is non-existing", val);
|
||||
panic!(
|
||||
"Trying to switch to wram bank {} which is non-existing",
|
||||
val
|
||||
);
|
||||
}
|
||||
if val == 0 {
|
||||
self.wram_bank = 1;
|
||||
|
||||
@ -379,7 +379,10 @@ impl SoundManager {
|
||||
let mut counter = 0;
|
||||
|
||||
while !do_exit.load(Ordering::Relaxed) {
|
||||
for _ in 0..100 {
|
||||
const N_SAMPLES: usize = 1024;
|
||||
let mut sample_buffer = [[128u8; 2]; N_SAMPLES];
|
||||
|
||||
for idx in 0..N_SAMPLES {
|
||||
if let Some((s1, s2)) = {
|
||||
let mut c_obj = obj.lock().unwrap();
|
||||
|
||||
@ -397,14 +400,10 @@ impl SoundManager {
|
||||
// Get sample
|
||||
c_obj.sample()
|
||||
} {
|
||||
let samps = [[s1, s2]];
|
||||
playback.write(&samps[..]);
|
||||
} else {
|
||||
let samps = [[128, 128]];
|
||||
playback.write(&samps[..]);
|
||||
sample_buffer[idx] = [s1, s2];
|
||||
}
|
||||
}
|
||||
std::thread::sleep(std::time::Duration::from_millis(1));
|
||||
playback.write(&sample_buffer[..]);
|
||||
}
|
||||
})
|
||||
.unwrap(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user