Audio: duplicate mono sounds to all channels
This commit is contained in:
parent
9d95fcf0c2
commit
e711f69fad
3 changed files with 49 additions and 19 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue