Audio: duplicate mono sounds to all channels

This commit is contained in:
Ali Chraghi 2024-05-06 10:10:11 +03:30 committed by Stephen Gutekanst
parent 9d95fcf0c2
commit e711f69fad
3 changed files with 49 additions and 19 deletions

View file

@ -77,6 +77,7 @@ fn audioStateChange(
// Play a new sound
const entity = try audio.newEntity();
try audio.set(entity, .samples, try fillTone(audio, frequency));
try audio.set(entity, .channels, @intCast(audio.state().player.channels().len));
try audio.set(entity, .playing, true);
try audio.set(entity, .index, 0);
}
@ -116,6 +117,7 @@ fn tick(
// Play a new sound
const entity = try audio.newEntity();
try audio.set(entity, .samples, try fillTone(audio, keyToFrequency(ev.key)));
try audio.set(entity, .channels, @intCast(audio.state().player.channels().len));
try audio.set(entity, .playing, true);
try audio.set(entity, .index, 0);