Commit graph

24 commits

Author SHA1 Message Date
Stephen Gutekanst
d9e11a8296 Audio: respect volume properly
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-07-06 11:16:55 -07:00
Stephen Gutekanst
a6157642b8 Audio: fix accounting for remainder of sample buffer
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-22 17:35:22 -07:00
Ali Chraghi
6e5c68c1c7 Audio: don't deinit the player 2024-05-13 14:54:51 +02:00
Ali Chraghi
39bf303057 Audio: add volume component 2024-05-13 14:54:51 +02:00
Stephen Gutekanst
9a059d6f8c Audio: fix unlock
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-13 07:57:38 +02:00
Stephen Gutekanst
194fe8a451 Audio: fix potential exit deadlock
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-13 07:54:14 +02:00
Stephen Gutekanst
36f21d5c4d Audio: correct deinit race across threads
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-13 04:20:16 +02:00
Stephen Gutekanst
0200bed7ec examples: simplify dependencies, mach depends on Opus
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-11 14:35:54 -07:00
Stephen Gutekanst
22ac26b57e module: rename events -> systems, remove 'event arguments'
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-08 13:39:07 -07:00
Stephen Gutekanst
6feaad630e {examples,Audio}: optimize needless setComponent calls away
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
bd655828e3 all: use new mach.Entity.Mod query API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
541ce9e7c0 all: rename mach.Entity.Mod -> mach.Entities.Mod
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
69ff2e027f all: rename mod.entities -> mod.__entities (private)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
2e8926d6fa module: rename query -> queryDeprecated
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
7ad38d6eff Audio: do not use event arguments
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-06 14:00:54 -07:00
Ali Chraghi
e711f69fad Audio: duplicate mono sounds to all channels 2024-05-06 14:00:36 -07:00
Stephen Gutekanst
9d95fcf0c2 Audio: always target 48000hz f32 audio
Resampling, which requires fairly involved (and certainly not free) filters,
is needed if the audio we are mixing does not match the sample rate of the
output device. Most OS audio APIs support resampling on their own, but have
preferred hardware formats. Most console hardware since Xbox/PS2/GC supposedly
prefers 48khz natively, but otherwise there seems to be no big preference
between 48khz or 44.1khz.

The important aspect is that we pick one, and encourage people to keep their
audio in one, so that runtime resampling is not required (both in mach itself,
and potentially without-our-knowledge in the OS audio system if we chose a
sample rate which the native hardware does not prefer.)

General guidance will be:

* `mach.Audio` module will always aim to select 48khz, f32 audio output from the
  OS APIs. Let the OS APIs do resampling, or if they do not then we can do so.
* We will prefer 48khz, f32 audio samples everywhere internally in our basic audio
  mixing etc. APIs.
* Tooling will aim to convert audio to Opus (or flac for lossless) format, with 48khz
  and number of channels depending on audio type (e.g. 1ch for most sfx, any number of
  channels for bgm, and maybe some exception for multi-channel sfx in the future.)

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-05 12:56:21 -07:00
Stephen Gutekanst
fc0ff2fffd all: rename local_events -> events
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-29 20:17:26 -07:00
Stephen Gutekanst
33bfdee520 {module,Audio}: ability to store event name and send it later
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-29 20:17:26 -07:00
Stephen Gutekanst
3504dfcab6 Audio: make deinit explicit
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-29 20:17:26 -07:00
Stephen Gutekanst
7011ad4848 audio: handle possible invalidated pointer after buffer growth
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-17 11:28:37 -07:00
Stephen Gutekanst
282c83877e audio: redesign audio module
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-16 19:14:37 -07:00
Stephen Gutekanst
f1dbc3955c audio: cleanup audio module
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-16 11:48:15 -07:00
Ali Chraghi
be3300b80a audio: add audio mixing/playback module 2024-04-16 10:50:59 -07:00