mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-11-30 08:08:18 +00:00
make organya sound more like in original game
This commit is contained in:
parent
8603086694
commit
63bfce689d
Binary file not shown.
|
|
@ -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<T>(rx: Receiver<PlaybackMessage>, 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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
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 {
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue