feat(audio): add 32-voice PCM mixing and native music sequencing
Add self-contained SoundBanks and MusicBanks with per-sample PCM16 and IMA ADPCM storage, materialized to resident PCM16. Integrate instrument envelopes, automation, shared DSP and host lifecycle controls while preserving staged real-time execution.
This commit is contained in:
@@ -960,7 +960,7 @@ fn persistent_save_preempts_real_multichunk_asset_decoders() {
|
||||
self.inner.sync()
|
||||
}
|
||||
}
|
||||
for kind in [BankType::GLYPH, BankType::SOUNDS, BankType::SCENE] {
|
||||
for kind in [BankType::GLYPH, BankType::SOUNDS, BankType::MUSIC, BankType::SCENE] {
|
||||
let (card, disk) = formatted();
|
||||
drop(card);
|
||||
let events: Events = Arc::default();
|
||||
@@ -985,8 +985,37 @@ fn persistent_save_preempts_real_multichunk_asset_decoders() {
|
||||
)
|
||||
}
|
||||
BankType::SOUNDS => {
|
||||
(vec![0x12; 16385], 16385, serde_json::json!({"sample_rate":44100,"channels":1}))
|
||||
let mut bytes = vec![0u8; 88];
|
||||
bytes[..4].copy_from_slice(b"SBNK");
|
||||
bytes[4] = 1;
|
||||
bytes[49] = 1;
|
||||
bytes[80] = 255;
|
||||
bytes[81] = 128;
|
||||
for (at, value) in [
|
||||
(8, 1u32),
|
||||
(20, 960),
|
||||
(24, 500000),
|
||||
(32, u32::MAX),
|
||||
(52, 44100),
|
||||
(56, 8192),
|
||||
(68, 88),
|
||||
(72, 16384),
|
||||
(84, 65536),
|
||||
] {
|
||||
bytes[at..at + 4].copy_from_slice(&value.to_le_bytes());
|
||||
}
|
||||
bytes.extend([0x12; 16384]);
|
||||
(bytes, 16472, serde_json::json!({"version":1}))
|
||||
}
|
||||
BankType::MUSIC => (
|
||||
include_bytes!(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/../../../test-fixtures/audio/mixed-music.mbnk"
|
||||
))
|
||||
.to_vec(),
|
||||
6395,
|
||||
serde_json::json!({"version":1}),
|
||||
),
|
||||
BankType::SCENE => {
|
||||
let mut bytes = vec![0; 140];
|
||||
bytes[..8].copy_from_slice(&[b'S', b'C', b'N', b'E', 1, 0, 4, 0]);
|
||||
@@ -1079,6 +1108,12 @@ fn persistent_save_preempts_real_multichunk_asset_decoders() {
|
||||
assert_eq!(bank.samples[0].sample_rate, 44100);
|
||||
assert_eq!(bank.samples[0].data, vec![0x1212; 8192]);
|
||||
}
|
||||
BankType::MUSIC => {
|
||||
let bank = banks.music_bank_slot(0).unwrap();
|
||||
assert_eq!(bank.events.len(), 4);
|
||||
assert_eq!(bank.samples.len(), 2);
|
||||
assert_eq!(bank.samples[1].channels, 2);
|
||||
}
|
||||
BankType::SCENE => {
|
||||
let bank = banks.scene_bank_slot(0).unwrap();
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user