Commit Graph

68 Commits

Author SHA1 Message Date
LA
8527ffddb7 同步更新,以及增加asio和独占wasapi的支持 2025-12-28 14:15:09 +08:00
Dan Balasescu
3b648f96e5 Free WASAPI if requesting to initialise without it
You might think we can free the device (thus freeing WASAPI) before initialising it,
however this destroys any mixers (and other audio objects) already initialised
under that device, which then start to fail with `Handle` errors.

This is not the same thing as as "re-initialisation", i.e. calling
`InitDevice()` multiple times - we pass in the reinit flag to BASS which
handles this correctly.

Rather than freeing the device, this change tackles the core issue that
WASAPI should be freed if the device is requested to be initialised without it.
2025-10-26 18:43:24 +09:00
Dean Herbert
d97d05191d Expose experimental WASAPI support as a user config toggle 2025-10-25 13:11:31 +09:00
Dean Herbert
460ce144cf Add basic log output when using BassWasapi initialisation
Previous impossible to know if it was used or not.
2025-10-22 17:56:44 +09:00
Dan Balasescu
fabadd5d52 Move to FrameworkEnvironment 2025-10-21 15:44:23 +09:00
Dean Herbert
3be315f306 Allow enabling wasapi experimental initialisation via environment variable
`OSU_AUDIO_WASAPI_EXPERIMENTAL` can now be set to `1` to test experimental
WASAPI initialisationsupport. Hopefully reduces latency and doesn't cause
adverse issues this time around.
2025-10-21 14:18:46 +09:00
LastExceed
5ea92863f6 BASSWASAPI init tweaks 2025-10-15 09:11:11 +02:00
Dean Herbert
d87142d76e Disable WASAPI initialisation mode for now 2023-12-27 14:16:29 +09:00
Dean Herbert
b328590ecb Adjust buffer length and update period down to minimums 2023-12-27 03:14:39 +09:00
Bartłomiej Dach
71c9fa3470 Handle WASAPI audio output switches
Co-authored-by: Dean Herbert <pe@ppy.sh>
2023-12-26 18:16:11 +01:00
Dean Herbert
7aafe27529 Free wasapi on exit 2023-12-25 23:43:22 +09:00
Dean Herbert
a0b2071c06 Fix typo
Co-authored-by: Bastian Pedersen <bastian.tangedal@gmail.com>
2023-12-25 17:28:53 +09:00
Dean Herbert
6813e3b899 Add safety to wasapi callback 2023-12-25 15:49:18 +09:00
Dean Herbert
f3c39e8c39 Remove static usage 2023-12-25 15:47:42 +09:00
Dean Herbert
37e5f8b263 Add note about bass init things being in the wrong place 2023-12-25 15:47:42 +09:00
Dean Herbert
c5db3e7bd0 Add comments and tidy up wasapi initialisation code 2023-12-25 15:47:42 +09:00
Dean Herbert
f03169d721 Isolate wasapi initialisation to windows platform 2023-12-25 15:47:42 +09:00
Dean Herbert
82663ab1f6 Fix wasapi initialisation device target 2023-12-25 15:47:42 +09:00
Dean Herbert
fb86f55c16 Transfer initial implementation of BassWasapi initialisation from test project 2023-12-25 15:47:42 +09:00
Dean Herbert
48e9bacb8e Reduce overhead induced by checking Bass CPU usage 2023-05-12 21:26:45 +09:00
andy840119
f60b839ca3 Remove nullable disable annotation and mark some properties as nullable. 2022-08-07 17:27:06 +08:00
Dan Balasescu
c3ed4fcbc1 Free Bass device 0 on Linux 2022-07-13 14:31:52 +09:00
Dan Balasescu
ba1385330c Automated #nullable processing 2022-06-13 21:57:05 +09:00
Dan Balasescu
c8115c9be1 Reduce failures in audio device re-init sequence 2021-11-29 16:41:35 +09:00
Dan Balasescu
f69161954e Refactor 2021-11-25 12:37:01 +09:00
Dan Balasescu
8cd51b5906 Safeguard for switching back to the selected device 2021-11-25 12:30:48 +09:00
Dan Balasescu
5933adbafd Safeguard for ability to free a device 2021-11-25 12:30:37 +09:00
ekrctb
dde9eb08ed Apply "use explict type (built-in types)" inspection fix 2021-10-27 20:51:35 +09:00
smoogipoo
c780f0dcf4 Refactor 2021-10-13 11:39:36 +09:00
smoogipoo
5c201bb6b2 Remove unnecessary log 2021-10-12 20:24:32 +09:00
smoogipoo
ddf3fc2124 Fix audio device 0 re-init on linux
We explicitly don't free device 0 on Linux in order to prevent BASS
native deadlocks.

Thus, re-initting device 0 will always result in
`Bass.LastError = Errors.Already`, a "fail" condition where the correct
device is chosen but the returned `didInit` value is always false, such
that `AudioComponent.UpdateDevice()` is never called on the hierarchy
for the device and components remain on a previous device.

The fix is simple - return `true` for this particular case on Linux. The
rest is a bit of shuffling code around to more natural places.
2021-10-12 20:14:18 +09:00
smoogipoo
4000aa6eef Fix tests on linux 2021-07-15 11:53:50 +09:00
smoogipoo
99e25acaa1 Merge branch 'master' into bassmix 2021-07-15 11:35:12 +09:00
Dean Herbert
c2e30d306e Reformat and standardise GameThread 2021-06-25 14:43:46 +09:00
smoogipoo
e7c9c1ed35 Add ToArray() 2021-05-27 14:38:50 +09:00
Dean Herbert
99b5d88698 Replace locking with audio thread assertions 2021-05-27 13:02:40 +09:00
Dean Herbert
1c98fe812b Combine free logic 2021-05-27 12:40:41 +09:00
Dean Herbert
1b69c4eb2b Merge branch 'master' into bassmix 2021-05-04 14:41:11 +09:00
smoogipoo
a74f96d803 Remove unnecessary locks, make methods internal 2021-04-13 17:34:38 +09:00
smoogipoo
9990c38507 Rework audio device freeing for safety 2021-04-13 16:49:48 +09:00
Jamie Taylor
74afb23226 Samples + TrackBass going through mixer... stuff kinda working WIP 2021-03-03 20:56:03 +09:00
smoogipoo
41ab71c8f4 Add some comments 2020-10-16 18:40:25 +09:00
smoogipoo
76387a248c Update AudioManagers once more after disposing 2020-10-16 17:49:30 +09:00
smoogipoo
56f2e968bf Fix libbass_fx load errors on linux 2020-05-15 13:59:55 +09:00
Dean Herbert
6c615ae0a4 Add back free loop as a catch-all fallback 2020-03-19 13:16:05 +09:00
Dean Herbert
4038157fc4 Attempt to avoid while loop usage 2020-03-18 18:02:40 +09:00
Kelvin
7fe2270e25 Add comment explaining Bass.Free() usage 2020-03-17 22:08:08 -07:00
Kelvin
448d5c7248 Free all devices when AudioThread exits 2020-03-17 21:29:46 -07:00
Dean Herbert
7b5286971f Apply suggestions from code review
Co-Authored-By: Dan Balasescu <smoogipoo@smgi.me>
2020-02-28 20:54:40 +09:00
Dean Herbert
a755402317 Call MakeCurrent from ProcessFrame for better safety 2020-02-28 17:41:16 +09:00