nandi/jolt-nativepublic Fork 0
fa4ecdfed6a830e6099d5fab9be24ef72ea1923b
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Lift freeq's AV media plane out of sleek 90f8b89 · on fa4ecdfed6a830e6099d5fab9be24ef72ea1923b · nandi · 19d ago
AppDelegate.m · 53 lines · 1.7 KBMathematica Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
//  AppDelegate.m
//  cpal-ios-example
//
//  Created by Michael Hills on 2/10/20.
//

#import "AppDelegate.h"
@import AVFoundation;

void rust_ios_main(void);


@interface AppDelegate ()

@end

@implementation AppDelegate



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.

    // It is necessary to access the sharedInstance so that calls to AudioSessionGetProperty
    // will work.
    AVAudioSession *session = AVAudioSession.sharedInstance;
    // Setting up the category is not necessary, but generally advised.
    // 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 = nil;
    BOOL isSetCategorySuccess = [session setCategory:AVAudioSessionCategoryPlayAndRecord
                                         withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetooth
                                               error:&categoryError];
    if (isSetCategorySuccess) {
        NSError *activateError = nil;
        BOOL isActivateSuccess = [session setActive:YES error:&activateError];

        if (isActivateSuccess) {
            NSLog(@"Calling rust_ios_main()");
            rust_ios_main();
        } else {
            NSLog(@"Failed to activate audio session: %@", activateError);
        }
    } else {
        NSLog(@"Failed to set category: %@", categoryError);
    }

    return YES;
}

@end