L4. LAB 4: IPHONE AUDIO SIGNAL SAMPLIN 77
L4.4 NATIVE C CODE
e C code to process the data can be linked to the file IosAudioController.m by including the
corresponding header file. e header file includes all the global variables and functions to be
linked outside their scope.
e steps required to link the C code are as follows.
e function to be linked is coded in the .c file and the corresponding header file is linked
with the same.
//FIRFilter.c
#include "FIRFilter.h"
void FIRFilter(short* buffer, int frameSize, short* output,
int delay)
{
//Function Definition
}
Function declaration is provided in the header file through which it can be linked to other
files importing it.
//FIRFilter.h
#include <stdio.h>
void FIRFilter(short* buffer, int frameSize, short* output,
int delay);
Once the function is declared in the header file, it can be accessed anywhere in the app, simply
by importing the same header file.
L4.5 MULTI-THREADING
Similar to Android, iOS also requires all audio processing to occur within the minimum al-
lotted frame time. iOS uses the Dispatch (https://developer.apple.com/documentatio
n/DISPATCH) framework to allow processes to run concurrently on multicore processors. Dis-
patch allows running processes concurrently synchronously or asynchronously. is is done by
offloading processes that are not required to run at frame time, allowing audio processing to be
run uninterrupted and without any frame skipping.
As an example, the function which updates the iPhone GUI is stated below.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.86.134