Skip to content

Commit efeb7ec

Browse files
authored
Merge pull request #6621 from frenzibyte/default-audio-device
Fix audio not working on iOS
2 parents e6fcd16 + f127378 commit efeb7ec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

osu.Framework/Audio/AudioManager.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ public class AudioManager : AudioCollectionManager<AudioComponent>
7070
/// The names of all available audio devices.
7171
/// </summary>
7272
/// <remarks>
73+
/// <para>
7374
/// This property does not contain the names of disabled audio devices.
75+
/// </para>
76+
/// <para>
77+
/// This property may also not necessarily contain the name of the default audio device provided by the OS.
78+
/// Consumers should provide a "Default" audio device entry which sets <see cref="AudioDevice"/> to an empty string.
79+
/// </para>
7480
/// </remarks>
7581
public IEnumerable<string> AudioDeviceNames => audioDeviceNames;
7682

@@ -334,7 +340,9 @@ private bool setAudioDevice(string deviceName = null)
334340
return true;
335341

336342
// try using the system default if there is any device present.
337-
if (audioDeviceNames.Count > 0 && setAudioDevice(bass_default_device))
343+
// mobiles are an exception as the built-in speakers may not be provided as an audio device name,
344+
// but they are still provided by BASS under the internal device name "Default".
345+
if ((audioDeviceNames.Count > 0 || RuntimeInfo.IsMobile) && setAudioDevice(bass_default_device))
338346
return true;
339347

340348
// no audio devices can be used, so try using Bass-provided "No sound" device as last resort.

0 commit comments

Comments
 (0)