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>
Note that on e.g. web platform, swapbuffers is not an explicit call.
We also need a signal that the frame has been submitted and finished,
and this is it.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
* `@import("mach").core.gpu` has been renamed to `@import("mach").gpu`
* `pub const SYSGPUInterface` now has a default value (i.e. you do not need to write it in your main.zig, if you were.)
* You can now check `if (comptime mach.use_sysgpu)` for any conditional code you might have that should only run with sysgpu.
This (old):
```
pub const mach_core_options = core.ComptimeOptions{
.use_wgpu = false,
.use_sysgpu = true,
};
```
Has been replaced by this:
```
pub const use_sysgpu = true;
```
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
* No longer abuse event arguments for pipeline information.
* Store pipeline information as entities/components.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This moves github.com/hexops/mach-gpu@528dad0823dafeae5d474c88cc658b091bf2e605 to
this repository in the src/gpu directory. It can be imported via `@import("mach").gpu`.
Soon we will move away from mach-gpu entirely as part of #1166 - but in the meantime
I am giving a workshop at https://sycl.it and it would be nice for people using the
`mach.gpu.*` API to be able to search the API in this single repository.
There's not much harm to moving this code here.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>