Звук и ресурсы iOS в Realtime Константин Платов программист iOS/OSX VoIP @Mail.ru
Звук и ресурсы iOS вRealtimeКонстантин Платов
программист iOS/OSX VoIP @Mail.ru
Hardware Part
Mic #2
Spk #1
Spk #2
Mic #1Mic #3
Audio Session
Микширование фоновых звуков
Отслеживание аудиопрерываний
Отслеживание аудиопутей
•••
Audio Route
RemoteI/O
Audio Session
CFStringRef newRoute;
size = sizeof(CFStringRef);
AudioSessionGetProperty(
kAudioSessionProperty_AudioRoute,
&size,
&newRoute);
HeadphonesAndMicrophoneSpeakerAndMicrophoneReceiverAndMicrophoneetc. Bluetooth..
••••
Audio RouteiOS 4 iOS 5
kAudioSessionInputRoute_LineIn;
kAudioSessionInputRoute_BuiltInMic;
kAudioSessionInputRoute_HeadsetMic;
kAudioSessionInputRoute_BluetoothHFP;
kAudioSessionInputRoute_USBAudio;
kAudioSessionOutputRoute_LineOut ;
kAudioSessionOutputRoute_Headphones;
kAudioSessionOutputRoute_BluetoothHFP;
kAudioSessionOutputRoute_BluetoothA2DP;
�
�
�
�
�
�
�
�
�
Audio Interruption
PlayPause
Resume
Enter INT
Exit INTExi
t INT
Suspend
Should?Yes No
Из опыта
VSPure-CAPI
AudioSessionInitialize(NULL, NULL, AudioInterruptListner, &_audioDeviceIosInstance)
Objective-CAPI
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryAmbient error:&setCategoryError]
Audio UnitConverter
iPod Equalizer
3D Mixer
Multichannel Mixer
Generic Output
Remote I/O
Voice Processing
I/O
•
•
•
•
•
•
•
Realtime работа со звуком:
Remote I/O
Voice Processing I/O
// Enable IO for recording
UInt32 flag = 1;
TEST_OSS(AudioUnitSetProperty(remoteIOUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Input,
kInputBus,
&flag,
sizeof(flag)));
// Describe format
AudioStreamBasicDescription audioFormat;
audioFormat.mSampleRate = _inputSamplerate;
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket = 1;
Y.A.M.
NET
Remote I/O Coder
iPhone #1
Remote I/O Decoder
iPhone #2
AEC
AG
C
AEC
AG
C
Voice Processing I/O Coder
Y.A.M.
NET
iPhone #1
Voice Processing I/O Decoder
iPhone #2
Эволюция iPhone
iPhone Original 3G 3GS 4 4S 5
Name ARM11 ARM11 Cortex-A8 Cortex-A8 Cortex-A9 Cortex-A9
Arch ARMv6 ARMv6 ARMv7 ARMv7 ARMv7 ARMv7
Freq 412 412 600 800 800 1300
Cores 1 1 1 1 2 2
Ресурсы
Алгоритм AMR-WB AEC AGC Сумма
MIPS @ARM11 90 70 15 175
Аудио
Размерфрейма
NEON MHz / фрейм MHz /
15 фреймовСумма
CIF
352 x 258
Encoder 15 225285Decoder 4 60
VGA
640 x 480
Encoder 30 450585Decoder 9 135
Видео
Что делать?
Оптимизировать самим
Интринсики
Ассемблер
Accelerate framework
Купить у third-party
Открытые библиотеки типа OpenMAX
••••
••
Константин Платов[email protected]