From ed4953dd59e77a7583073d690117ae37d8e3e58d Mon Sep 17 00:00:00 2001 From: Alexander Timonenkov Date: Mon, 17 Feb 2025 16:29:56 +0300 Subject: [PATCH 1/6] Fix iOS example --- examples/ios-feedback/ios-src/AppDelegate.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/ios-feedback/ios-src/AppDelegate.m b/examples/ios-feedback/ios-src/AppDelegate.m index 18bf183e3..7f3c37948 100644 --- a/examples/ios-feedback/ios-src/AppDelegate.m +++ b/examples/ios-feedback/ios-src/AppDelegate.m @@ -36,11 +36,14 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetooth error:&error]; - if (success) { + NSError *activateError; + [session setActive:YES error:&activateError]; + + if (success && activateError == nil) { NSLog(@"Calling rust_ios_main()"); rust_ios_main(); } else { - NSLog(@"Failed to configure audio session category"); + NSLog(@"Failed to configure audio session category or active audio session"); } return YES; From b82c6fde2b90642683c9bdcb0cae26b97c3c21dd Mon Sep 17 00:00:00 2001 From: Alexander Timonenkov Date: Thu, 31 Jul 2025 10:41:24 +0300 Subject: [PATCH 2/6] Better error handling in iOS example --- examples/ios-feedback/ios-src/AppDelegate.m | 29 +++++++++++---------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/examples/ios-feedback/ios-src/AppDelegate.m b/examples/ios-feedback/ios-src/AppDelegate.m index 7f3c37948..ae84dd91e 100644 --- a/examples/ios-feedback/ios-src/AppDelegate.m +++ b/examples/ios-feedback/ios-src/AppDelegate.m @@ -22,9 +22,6 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. - NSError *error; - BOOL success; - // It is necessary to access the sharedInstance so that calls to AudioSessionGetProperty // will work. AVAudioSession *session = AVAudioSession.sharedInstance; @@ -32,18 +29,22 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( // Since this demo records and plays, lets use AVAudioSessionCategoryPlayAndRecord. // Also default to speaker as defaulting to the phone earpiece would be unusual. // Allowing bluetooth should direct audio to your bluetooth headset. - success = [session setCategory:AVAudioSessionCategoryPlayAndRecord - withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetooth - error:&error]; - - NSError *activateError; - [session setActive:YES error:&activateError]; - - if (success && activateError == nil) { - NSLog(@"Calling rust_ios_main()"); - rust_ios_main(); + NSError *categoryError; + BOOL isSetCategorySuccess = [session setCategory:AVAudioSessionCategoryPlayAndRecord + withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetooth + error:&categoryError]; + if (isSetCategorySuccess && categoryError == nil) { + NSError *activateError; + BOOL isActivateSuccess = [session setActive:YES error:&activateError]; + + if (isActivateSuccess && activateError == nil) { + NSLog(@"Calling rust_ios_main()"); + rust_ios_main(); + } else { + NSLog(@"Failed to active audio session"); + } } else { - NSLog(@"Failed to configure audio session category or active audio session"); + NSLog(@"Failed to configure audio session category"); } return YES; From 0f39725a50eac596db8a1678260ab6fb637e2b57 Mon Sep 17 00:00:00 2001 From: NightBlaze Date: Mon, 4 Aug 2025 08:56:30 +0300 Subject: [PATCH 3/6] Update spelling Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- examples/ios-feedback/ios-src/AppDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ios-feedback/ios-src/AppDelegate.m b/examples/ios-feedback/ios-src/AppDelegate.m index ae84dd91e..8552877fc 100644 --- a/examples/ios-feedback/ios-src/AppDelegate.m +++ b/examples/ios-feedback/ios-src/AppDelegate.m @@ -41,7 +41,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( NSLog(@"Calling rust_ios_main()"); rust_ios_main(); } else { - NSLog(@"Failed to active audio session"); + NSLog(@"Failed to activate audio session"); } } else { NSLog(@"Failed to configure audio session category"); From df5bcdb696db38f0f81db3ceaa5f90c10ddde615 Mon Sep 17 00:00:00 2001 From: Alexander Timonenkov Date: Mon, 4 Aug 2025 09:45:30 +0300 Subject: [PATCH 4/6] Improve error handling and logging --- examples/ios-feedback/ios-src/AppDelegate.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/ios-feedback/ios-src/AppDelegate.m b/examples/ios-feedback/ios-src/AppDelegate.m index 8552877fc..608c4e1d1 100644 --- a/examples/ios-feedback/ios-src/AppDelegate.m +++ b/examples/ios-feedback/ios-src/AppDelegate.m @@ -29,22 +29,22 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( // Since this demo records and plays, lets use AVAudioSessionCategoryPlayAndRecord. // Also default to speaker as defaulting to the phone earpiece would be unusual. // Allowing bluetooth should direct audio to your bluetooth headset. - NSError *categoryError; + NSError *categoryError = nil; BOOL isSetCategorySuccess = [session setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetooth error:&categoryError]; - if (isSetCategorySuccess && categoryError == nil) { - NSError *activateError; + if (isSetCategorySuccess) { + NSError *activateError = nil; BOOL isActivateSuccess = [session setActive:YES error:&activateError]; - if (isActivateSuccess && activateError == nil) { + if (isActivateSuccess) { NSLog(@"Calling rust_ios_main()"); rust_ios_main(); } else { - NSLog(@"Failed to activate audio session"); + NSLog(@"Failed to activate audio session: %@", activateError); } } else { - NSLog(@"Failed to configure audio session category"); + NSLog(@"Failed to set category: %@", categoryError); } return YES; From d0857d5e7112829b01d854a9542ae5923584a804 Mon Sep 17 00:00:00 2001 From: Alexander Timonenkov Date: Wed, 6 Aug 2025 09:55:12 +0300 Subject: [PATCH 5/6] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d8ec9027..0fe88e487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Unreleased - All error enums are now `Clone`. +- Fix an iOS example by properly activating audio session. # Version 0.15.3 (2024-03-04) From 846c4cadfa6ff466aeb3970eb3a36d9ad6b92e79 Mon Sep 17 00:00:00 2001 From: Roderick van Domburg Date: Fri, 8 Aug 2025 14:43:37 +0200 Subject: [PATCH 6/6] docs: keep consistent style --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccfdad5d7..d17fb6145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,9 @@ # Unreleased -- ALSA(process_output): pass `silent=true` to `PCM.try_recover`, so it doesn't write to stderr -- WASAPI: Expose IMMDevice from WASAPI host Device. +- ALSA(process_output): pass `silent=true` to `PCM.try_recover`, so it doesn't write to stderr. - CoreAudio: `Device::supported_configs` now returns a single element containing the available sample rate range when all elements have the same `mMinimum` and `mMaximum` values (which is the most common case). -- Fix an iOS example by properly activating audio session. +- iOS: Fix example by properly activating audio session. +- WASAPI: Expose IMMDevice from WASAPI host Device. # Version 0.16.0 (2025-06-07)