summaryrefslogtreecommitdiff
path: root/platform/iphone/audio_driver_iphone.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/iphone/audio_driver_iphone.cpp')
-rw-r--r--platform/iphone/audio_driver_iphone.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/platform/iphone/audio_driver_iphone.cpp b/platform/iphone/audio_driver_iphone.cpp
index eda3897841..eff91fa40f 100644
--- a/platform/iphone/audio_driver_iphone.cpp
+++ b/platform/iphone/audio_driver_iphone.cpp
@@ -41,9 +41,9 @@ Error AudioDriverIphone::init() {
strdesc.mFramesPerPacket = 1;
strdesc.mBitsPerChannel = 16;
strdesc.mBytesPerFrame =
- strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
+ strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
strdesc.mBytesPerPacket =
- strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
+ strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
OSStatus result = noErr;
AURenderCallbackStruct callback;
@@ -55,7 +55,7 @@ Error AudioDriverIphone::init() {
zeromem(&desc, sizeof(desc));
desc.componentType = kAudioUnitType_Output;
- desc.componentSubType = kAudioUnitSubType_RemoteIO; /* !!! FIXME: ? */
+ desc.componentSubType = kAudioUnitSubType_RemoteIO; /* !!! FIXME: ? */
comp = AudioComponentFindNext(NULL, &desc);
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
@@ -64,16 +64,16 @@ Error AudioDriverIphone::init() {
ERR_FAIL_COND_V(comp == NULL, FAILED);
result = AudioUnitSetProperty(audio_unit,
- kAudioUnitProperty_StreamFormat,
- scope, bus, &strdesc, sizeof(strdesc));
+ kAudioUnitProperty_StreamFormat,
+ scope, bus, &strdesc, sizeof(strdesc));
ERR_FAIL_COND_V(result != noErr, FAILED);
zeromem(&callback, sizeof(AURenderCallbackStruct));
callback.inputProc = &AudioDriverIphone::output_callback;
callback.inputProcRefCon = this;
result = AudioUnitSetProperty(audio_unit,
- kAudioUnitProperty_SetRenderCallback,
- scope, bus, &callback, sizeof(callback));
+ kAudioUnitProperty_SetRenderCallback,
+ scope, bus, &callback, sizeof(callback));
ERR_FAIL_COND_V(result != noErr, FAILED);
result = AudioUnitInitialize(audio_unit);
@@ -90,14 +90,13 @@ Error AudioDriverIphone::init() {
};
OSStatus AudioDriverIphone::output_callback(void *inRefCon,
- AudioUnitRenderActionFlags * ioActionFlags,
- const AudioTimeStamp * inTimeStamp,
- UInt32 inBusNumber, UInt32 inNumberFrames,
- AudioBufferList * ioData) {
-
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber, UInt32 inNumberFrames,
+ AudioBufferList *ioData) {
AudioBuffer *abuf;
- AudioDriverIphone* ad = (AudioDriverIphone*)inRefCon;
+ AudioDriverIphone *ad = (AudioDriverIphone *)inRefCon;
bool mix = true;
@@ -107,7 +106,6 @@ OSStatus AudioDriverIphone::output_callback(void *inRefCon,
mix = ad->mutex->try_lock() == OK;
};
-
if (!mix) {
for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) {
abuf = &ioData->mBuffers[i];
@@ -122,7 +120,7 @@ OSStatus AudioDriverIphone::output_callback(void *inRefCon,
abuf = &ioData->mBuffers[i];
frames_left = inNumberFrames;
- int16_t* out = (int16_t*)abuf->mData;
+ int16_t *out = (int16_t *)abuf->mData;
while (frames_left) {
@@ -131,9 +129,9 @@ OSStatus AudioDriverIphone::output_callback(void *inRefCon,
ad->audio_server_process(frames, ad->samples_in);
//ad->unlock();
- for(int i = 0; i < frames * ad->channels; i++) {
+ for (int i = 0; i < frames * ad->channels; i++) {
- out[i] = ad->samples_in[i]>>16;
+ out[i] = ad->samples_in[i] >> 16;
}
frames_left -= frames;
@@ -175,12 +173,11 @@ void AudioDriverIphone::finish() {
memdelete_arr(samples_in);
};
-
AudioDriverIphone::AudioDriverIphone() {
- mutex=Mutex::create();//NULL;
+ mutex = Mutex::create(); //NULL;
};
-AudioDriverIphone::~AudioDriverIphone() {
+AudioDriverIphone::~AudioDriverIphone(){
};