File tree Expand file tree Collapse file tree
VoiceCraft.Client/VoiceCraft.Client.Android Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
22using Android . Media ;
3+ using Android . OS ;
34using Android . Runtime ;
45using Avalonia ;
56using Avalonia . Android ;
67using Microsoft . Extensions . DependencyInjection ;
78using SoundFlow . Abstracts ;
9+ using SoundFlow . Backends . MiniAudio ;
10+ using SoundFlow . Backends . MiniAudio . Enums ;
811using VoiceCraft . Client . Android . Audio ;
912using VoiceCraft . Client . Services ;
1013using VoiceCraft . Core ;
@@ -60,8 +63,12 @@ private static void BootstrapServices()
6063 if ( audioManager == null )
6164 throw new Exception ( $ "Could not find { AudioService } . Cannot initialize audio service.") ;
6265
63- App . ServiceCollection . AddSingleton < AudioEngine , AndroidMiniAudioEngine > ( _ =>
64- new AndroidMiniAudioEngine ( audioManager ) ) ;
66+ App . ServiceCollection . AddSingleton < AudioEngine > ( _ =>
67+ {
68+ if ( Build . VERSION . SdkInt >= BuildVersionCodes . O )
69+ return new AndroidMiniAudioEngine ( audioManager ) ;
70+ return new MiniAudioEngine ( [ MiniAudioBackend . OpenSl ] ) ;
71+ } ) ;
6572 App . ServiceCollection . AddSingleton < StorageService > ( nativeStorage ) ;
6673 App . ServiceCollection . AddSingleton < HotKeyService , NativeHotKeyService > ( ) ;
6774 App . ServiceCollection . AddSingleton < IBackgroundService > ( x =>
You can’t perform that action at this time.
0 commit comments