stereo to system audio engine, multi-channel audio to SDL
This commit is contained in:
1 parent
cf11b06f3e
commit
e548bda73a
2 files changed
+4
-4
No files matched your search
@@ -290,11 +290,10 @@ int ArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, v
|
|||||||
TemporarySettings* tempSettings = [dataMan getSettings];
|
TemporarySettings* tempSettings = [dataMan getSettings];
|
||||||
bool useBluetoothD2P = tempSettings.useBuiltinMic || !tempSettings.redirectMic;
|
bool useBluetoothD2P = tempSettings.useBuiltinMic || !tempSettings.redirectMic;
|
||||||
AVAudioSessionCategoryOptions bluetoothAudioOption = useBluetoothD2P ? AVAudioSessionCategoryOptionAllowBluetoothA2DP : AVAudioSessionCategoryOptionAllowBluetooth;
|
AVAudioSessionCategoryOptions bluetoothAudioOption = useBluetoothD2P ? AVAudioSessionCategoryOptionAllowBluetoothA2DP : AVAudioSessionCategoryOptionAllowBluetooth;
|
||||||
AVAudioSessionCategoryOptions audioMixOption = opusConfig->channelCount > 2 ? 0 : AVAudioSessionCategoryOptionMixWithOthers;
|
|
||||||
AVAudioSession *session = [AVAudioSession sharedInstance];
|
AVAudioSession *session = [AVAudioSession sharedInstance];
|
||||||
[session setCategory:tempSettings.redirectMic ? AVAudioSessionCategoryPlayAndRecord : AVAudioSessionCategoryPlayback
|
[session setCategory:tempSettings.redirectMic ? AVAudioSessionCategoryPlayAndRecord : AVAudioSessionCategoryPlayback
|
||||||
mode:AVAudioSessionModeDefault
|
mode:AVAudioSessionModeDefault
|
||||||
options:audioMixOption|AVAudioSessionCategoryOptionDefaultToSpeaker|bluetoothAudioOption
|
options:AVAudioSessionCategoryOptionMixWithOthers|AVAudioSessionCategoryOptionDefaultToSpeaker|bluetoothAudioOption
|
||||||
error:nil];
|
error:nil];
|
||||||
if(tempSettings.redirectMic) if(@available(iOS 13.0, *)) [session setAllowHapticsAndSystemSoundsDuringRecording:YES error:nil];
|
if(tempSettings.redirectMic) if(@available(iOS 13.0, *)) [session setAllowHapticsAndSystemSoundsDuringRecording:YES error:nil];
|
||||||
[session setActive:YES error:nil];
|
[session setActive:YES error:nil];
|
||||||
@@ -411,7 +410,7 @@ void ArDecodeAndPlaySample(char* sampleData, int sampleLength)
|
|||||||
|
|
||||||
float* fbuf = (float*)audioBuffer;
|
float* fbuf = (float*)audioBuffer;
|
||||||
|
|
||||||
if(useSystemAudioEngine) {
|
if(audioConfig.channelCount <= 2) {
|
||||||
// 创建 AVAudioPCMBuffer
|
// 创建 AVAudioPCMBuffer
|
||||||
AVAudioFrameCount frameCount = decodeLen;
|
AVAudioFrameCount frameCount = decodeLen;
|
||||||
AVAudioPCMBuffer *buffer = [[AVAudioPCMBuffer alloc] initWithPCMFormat:audioFormat frameCapacity:frameCount];
|
AVAudioPCMBuffer *buffer = [[AVAudioPCMBuffer alloc] initWithPCMFormat:audioFormat frameCapacity:frameCount];
|
||||||
|
|||||||
@@ -790,7 +790,8 @@ BOOL isCustomResolution(int resolutionSelected) {
|
|||||||
[self addSetting:self.redirectMicStack ofId:@"redirectMicStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
|
[self addSetting:self.redirectMicStack ofId:@"redirectMicStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
|
||||||
[self addSetting:self.useBuiltinMicStack ofId:@"useBuiltinMicStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
|
[self addSetting:self.useBuiltinMicStack ofId:@"useBuiltinMicStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
|
||||||
[self addSetting:self.micVolumeStack ofId:@"micVolumeStack" withInfoTag:NO withDynamicLabel:YES to:audioSection];
|
[self addSetting:self.micVolumeStack ofId:@"micVolumeStack" withInfoTag:NO withDynamicLabel:YES to:audioSection];
|
||||||
[self addSetting:self.audioEngineStack ofId:@"audioEngineStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
|
// [self addSetting:self.audioEngineStack ofId:@"audioEngineStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
|
||||||
|
// cancel audio engine selector due to system engine is unable to playback multi-channel audio
|
||||||
[self addSetting:self.audioConfigStack ofId:@"audioConfigStack" withInfoTag:NO withDynamicLabel:NO to:audioSection];
|
[self addSetting:self.audioConfigStack ofId:@"audioConfigStack" withInfoTag:NO withDynamicLabel:NO to:audioSection];
|
||||||
[audioSection addToParentStack:_parentStack];
|
[audioSection addToParentStack:_parentStack];
|
||||||
// [audioSection setExpanded:NO];
|
// [audioSection setExpanded:NO];
|
||||||
|
|||||||
Reference in new issue
Block a user