Commit f560f479 authored by David Reid's avatar David Reid

iOS: Try adding support for Bluetooth routing.

parent 07c26bb9
...@@ -1993,6 +1993,10 @@ typedef struct ...@@ -1993,6 +1993,10 @@ typedef struct
ma_bool32 tryAutoSpawn; /* Enables autospawning of the PulseAudio daemon if necessary. */ ma_bool32 tryAutoSpawn; /* Enables autospawning of the PulseAudio daemon if necessary. */
} pulse; } pulse;
struct struct
{
ma_bool32 noBluetoothRouting;
} coreaudio;
struct
{ {
const char* pClientName; const char* pClientName;
ma_bool32 tryStartServer; ma_bool32 tryStartServer;
...@@ -20401,9 +20405,21 @@ ma_result ma_context_init__coreaudio(const ma_context_config* pConfig, ma_contex ...@@ -20401,9 +20405,21 @@ ma_result ma_context_init__coreaudio(const ma_context_config* pConfig, ma_contex
#if defined(MA_APPLE_MOBILE) #if defined(MA_APPLE_MOBILE)
@autoreleasepool { @autoreleasepool {
AVAudioSession* pAudioSession = [AVAudioSession sharedInstance]; AVAudioSession* pAudioSession = [AVAudioSession sharedInstance];
AVAudioSessionCategoryOptions options = 0;
ma_assert(pAudioSession != NULL); ma_assert(pAudioSession != NULL);
[pAudioSession setCategory: AVAudioSessionCategoryPlayAndRecord error:nil]; /*
Try enabling routing to Bluetooth devices. The AVAudioSessionCategoryOptionAllowBluetoothA2DP is only available
starting from iOS 10 so I'm doing a version check before enabling this.
*/
if (!pConfig->coreaudio.noBluetoothRouting) {
if ([[[UIDevice currentDevice] systemVersion] compare:@"10.0" options:NSNumericSearch] != NSOrderedAscending) {
options = 0x20; /* 0x20 = AVAudioSessionCategoryOptionAllowBluetoothA2DP */
}
}
[pAudioSession setCategory: AVAudioSessionCategoryPlayAndRecord withOptions:options error:nil];
/* By default we want miniaudio to use the speakers instead of the receiver. In the future this may be customizable. */ /* By default we want miniaudio to use the speakers instead of the receiver. In the future this may be customizable. */
ma_bool32 useSpeakers = MA_TRUE; ma_bool32 useSpeakers = MA_TRUE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment