diff --git a/src/builtin/organya-wavetable-doukutsu.bin b/src/builtin/organya-wavetable-doukutsu.bin index 4ab3a9f..3f68ac6 100644 Binary files a/src/builtin/organya-wavetable-doukutsu.bin and b/src/builtin/organya-wavetable-doukutsu.bin differ diff --git a/src/sound/mod.rs b/src/sound/mod.rs index efdb5c2..2ed0a5e 100644 --- a/src/sound/mod.rs +++ b/src/sound/mod.rs @@ -103,7 +103,7 @@ impl SoundManager { } pub fn play_sfx(&mut self, id: u8) { - self.tx.send(PlaybackMessage::PlaySample(id)); + let _ = self.tx.send(PlaybackMessage::PlaySample(id)); } pub fn play_song(&mut self, song_id: usize, constants: &EngineConstants, ctx: &mut Context) -> GameResult { @@ -197,7 +197,7 @@ fn run(rx: Receiver, bank: SoundBank, org_engine.set_sample_rate(sample_rate as usize); org_engine.loops = usize::MAX; - let buf_size = sample_rate as usize * 15 / 1000; + let buf_size = sample_rate as usize * 10 / 1000; let mut bgm_buf = vec![0x8080; buf_size]; let mut pxt_buf = vec![0x8000; buf_size]; let mut bgm_index = 0; diff --git a/src/sound/playback.rs b/src/sound/playback.rs index d9a9c8a..82b5997 100644 --- a/src/sound/playback.rs +++ b/src/sound/playback.rs @@ -4,7 +4,6 @@ use crate::sound::organya::Song as Organya; use crate::sound::stuff::*; use crate::sound::wav::*; use crate::sound::wave_bank::SoundBank; -use num_traits::real::Real; pub struct PlaybackEngine { song: Organya, @@ -73,7 +72,7 @@ impl PlaybackEngine { } } - for (idx, (track, buf)) in song.tracks[8..].iter().zip(buffers[128..].iter_mut()).enumerate() { + for (idx, (_track, buf)) in song.tracks[8..].iter().zip(buffers[128..].iter_mut()).enumerate() { *buf = MaybeUninit::new( RenderBuffer::new( @@ -145,8 +144,8 @@ impl PlaybackEngine { } } - for (inst, buf) in song.tracks[8..].iter().zip(self.track_buffers[128..].iter_mut()) { - *buf = RenderBuffer::new(samples.samples[inst.inst.inst as usize].clone()); + for (idx, (_track, buf)) in song.tracks[8..].iter().zip(self.track_buffers[128..].iter_mut()).enumerate() { + *buf = RenderBuffer::new(samples.samples[idx].clone()); } self.song = song; diff --git a/src/sound/stuff.rs b/src/sound/stuff.rs index 6b9cadb..998516a 100644 --- a/src/sound/stuff.rs +++ b/src/sound/stuff.rs @@ -1,25 +1,25 @@ pub const FRQ_TBL: [i16; 12] = [ - 261,278,294,311,329,349,371,391,414,440,466,494 + 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494 ]; pub const PAN_TBL: [i16; 13] = [ - 0,43,86,129,172,215,256,297,340,383,426,469,512 + 0, 43, 86, 129, 172, 215, 256, 297, 340, 383, 426, 469, 512 ]; pub const OCT_TBL: [i16; 8] = [ - 32,64,64,128,128,128,128,128 + 32, 64, 64, 128, 128, 128, 128, 128 ]; pub fn org_key_to_freq(key: u8, a: i16) -> i32 { let (oct, pitch) = org_key_to_oct_pitch(key); let freq = FRQ_TBL[pitch as usize] as f32; - let oct = OCT_TBL[oct as usize] as f32; + let oct = OCT_TBL[oct as usize] as f32; (freq * oct) as i32 + (a as i32 - 1000) } -pub fn org_key_to_drum_freq(key: u8) -> i32 { +pub fn org_key_to_drum_freq(key: u8) -> i32 { key as i32 * 800 + 100 } @@ -32,7 +32,7 @@ pub fn org_vol_to_vol(vol: u8) -> i32 { } pub fn org_key_to_oct_pitch(key: u8) -> (u8, u8) { - (key/12, key%12) + (key / 12, key % 12) } // s1: sample 1