Index: src/io/audio_unit.c
===================================================================
--- src/io/audio_unit.c	(revision 4084cd8c23011c3141539fc166d35323c87e0c1a)
+++ src/io/audio_unit.c	(revision d3066e2f44c4b18aa9cea8e491b7cba544250da5)
@@ -110,17 +110,17 @@
   /* check for some sizes */
   if ( o->hw_output_channels != o->output_frames->height ) {
-    AUBIO_ERR ("got hw_output_channels = %d, but output_frames has %d rows",
+    AUBIO_ERR ("got hw_output_channels = %d, but output_frames has %d rows\n",
         o->hw_output_channels, o->output_frames->height);
   }
   if ( o->blocksize != o->output_frames->length ) {
-    AUBIO_ERR ("got blocksize = %d, but output_frames has length %d",
+    AUBIO_ERR ("got blocksize = %d, but output_frames has length %d\n",
         o->blocksize, o->output_frames->length);
   }
   if ( o->hw_input_channels != o->input_frames->height ) {
-    AUBIO_ERR ("got hw_input_channels = %d, but input_frames has %d rows",
+    AUBIO_ERR ("got hw_input_channels = %d, but input_frames has %d rows\n",
         o->hw_input_channels, o->input_frames->height);
   }
   if ( o->blocksize != o->input_frames->length ) {
-    AUBIO_ERR ("got blocksize = %d, but input_frames has length %d",
+    AUBIO_ERR ("got blocksize = %d, but input_frames has length %d\n",
         o->blocksize, o->input_frames->length);
   }
@@ -159,5 +159,5 @@
   /* setting up audio session with interruption listener */
   err = AudioSessionInitialize(NULL, NULL, audio_unit_interruption_listener, o);
-  if (err) { AUBIO_ERR("audio_unit: could not initialize audio session (%ld)", err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not initialize audio session (%d)\n", (int)err); goto fail; }
 
   audio_unit_set_audio_session_category(o->input_enabled, o->verbose);
@@ -167,10 +167,10 @@
   err = AudioSessionAddPropertyListener(kAudioSessionProperty_AudioRouteChange,
       audio_unit_route_change_listener, o);
-  if (err) { AUBIO_ERR("audio_unit: could not set route change listener (%ld)", err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not set route change listener (%d)\n", (int)err); goto fail; }
 
   /* set latency */
   err = AudioSessionSetProperty(kAudioSessionProperty_PreferredHardwareIOBufferDuration,
       sizeof(latency), &latency);
-  if (err) { AUBIO_ERR("audio_unit: could not set preferred latency (%ld)", err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not set preferred latency (%d)\n", (int)err); goto fail; }
 
 #if 0 // only for iphone OS >= 3.1
@@ -178,5 +178,5 @@
   err = AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryDefaultToSpeaker,
       sizeof(UInt32), &val);
-  if (err) { AUBIO_ERR("audio_unit: could not set session property to default to speaker"); }
+  if (err) { AUBIO_ERR("audio_unit: could not set session property to default to speaker\n"); }
 #endif
 
@@ -198,5 +198,5 @@
 
   err = AudioComponentInstanceNew(comp, &(o->audio_unit));
-  if (err) { AUBIO_ERR("audio_unit: failed creating the audio unit"); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: failed creating the audio unit\n"); goto fail; }
 
   /* enable IO */
@@ -205,5 +205,5 @@
       kAudioUnitScope_Input, 1, &enabled, sizeof(enabled));
   if (err) {
-    AUBIO_ERR("audio_unit: failed enabling input of audio unit");
+    AUBIO_ERR("audio_unit: failed enabling input of audio unit\n");
     goto fail;
   }
@@ -214,5 +214,5 @@
       kAudioUnitScope_Global, 0, &max_fps, sizeof(max_fps));
   if (err) {
-    AUBIO_ERR("audio_unit: could not set maximum frames per slice property (%ld)", err);
+    AUBIO_ERR("audio_unit: could not set maximum frames per slice property (%d)\n", (int)err);
     goto fail;
   }
@@ -220,13 +220,13 @@
   AudioUnitSetProperty (*audio_unit, kAudioUnitProperty_SetRenderCallback,
       kAudioUnitScope_Input, 0, &(o->au_ios_cb_struct), sizeof(o->au_ios_cb_struct));
-  if (err) { AUBIO_ERR("audio_unit: failed setting audio unit render callback"); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: failed setting audio unit render callback\n"); goto fail; }
 
 #if 0
   err = AudioUnitSetProperty (*audio_unit, kAudioUnitProperty_SampleRate,
       kAudioUnitScope_Input, 0, &samplerate, sizeof(Float64));
-  if (err) { AUBIO_ERR("audio_unit: could not set audio input sample rate"); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not set audio input sample rate\n"); goto fail; }
   err = AudioUnitSetProperty (*audio_unit, kAudioUnitProperty_SampleRate,
       kAudioUnitScope_Output, 1, &samplerate, sizeof(Float64));
-  if (err) { AUBIO_ERR("audio_unit: could not set audio input sample rate"); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not set audio input sample rate\n"); goto fail; }
 #endif
 
@@ -247,8 +247,8 @@
   err = AudioUnitSetProperty (*audio_unit, kAudioUnitProperty_StreamFormat,
       kAudioUnitScope_Input, 0, &audioFormat, sizeof(audioFormat));
-  if (err) { AUBIO_ERR("audio_unit: could not set audio output format"); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not set audio output format\n"); goto fail; }
   err = AudioUnitSetProperty (*audio_unit, kAudioUnitProperty_StreamFormat,
       kAudioUnitScope_Output, 1, &audioFormat, sizeof(audioFormat));
-  if (err) { AUBIO_ERR("audio_unit: could not set audio input format"); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not set audio input format\n"); goto fail; }
 
 #if 0
@@ -257,13 +257,13 @@
   err = AudioUnitGetProperty (*audio_unit, kAudioUnitProperty_StreamFormat,
       kAudioUnitScope_Input, 0, &thruFormat, &thissize);
-  if (err) { AUBIO_ERR("audio_unit: could not get speaker output format, err: %d", (int)err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not get speaker output format, err: %d\n", (int)err); goto fail; }
   err = AudioUnitSetProperty (*audio_unit, kAudioUnitProperty_StreamFormat,
       kAudioUnitScope_Output, 1, &thruFormat, sizeof(thruFormat));
-  if (err) { AUBIO_ERR("audio_unit: could not set input audio format, err: %d", (int)err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not set input audio format, err: %d\n", (int)err); goto fail; }
 #endif
 
   /* time to initialize the unit */
   err = AudioUnitInitialize(*audio_unit);
-  if (err) { AUBIO_ERR("audio_unit: failed initializing audio, err: %d", (int)err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: failed initializing audio, err: %d\n", (int)err); goto fail; }
 
   return 0;
@@ -287,5 +287,5 @@
         inNumber_frames, input_output);
     if (err) {
-      AUBIO_ERR("audio_unit: error performing AudioUnitRender (%d)", err);
+      AUBIO_ERR("audio_unit: error performing AudioUnitRender (%d)\n", err);
       return err;
     }
@@ -297,5 +297,5 @@
   // FIXME find out why this happens
   if (number_frames < 10) {
-    AUBIO_ERR("audio_unit: got number_frames %d", (int)number_frames);
+    AUBIO_ERR("audio_unit: got number_frames %d\n", (int)number_frames);
     return -1;
   }
@@ -373,5 +373,5 @@
 
   if (o->dio_error) {
-    AUBIO_WRN("audio_unit: dio error %d", o->total_frames);
+    AUBIO_WRN("audio_unit: dio error %d\n", o->total_frames);
     o->dio_error = 0;
   }
@@ -421,5 +421,5 @@
 
 fail:
-  AUBIO_ERR("audio_unit: callback() failed");
+  AUBIO_ERR("audio_unit: callback() failed\n");
   o->total_frames += AU_IOS_MAX_FRAMES;
   return 1;
@@ -439,6 +439,6 @@
   err = AudioUnitGetProperty (o->audio_unit, kAudioUnitProperty_SampleRate,
       kAudioUnitScope_Output, 1, &samplerate, &thissize);
-  if (err) { AUBIO_ERR("audio_unit: could not get audio unit sample rate (%ld)",
-      err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not get audio unit sample rate (%d)\n",
+      (int)err); goto fail; }
 
   /* get hardware input channels */
@@ -446,6 +446,6 @@
   err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareInputNumberChannels,
       &thissize, &input_hw_channels);
-  if (err) { AUBIO_ERR("audio_unit: could not get hardware input channels (%ld)",
-      err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not get hardware input channels (%d)\n",
+      (int)err); goto fail; }
 
   /* get hardware output channels */
@@ -453,6 +453,6 @@
   err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputNumberChannels,
       &thissize, &output_hw_channels);
-  if (err) { AUBIO_ERR("audio_unit: could not get hardware output channels (%ld)",
-      err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not get hardware output channels (%d)\n",
+      (int)err); goto fail; }
 
   /* get hardware input volume */
@@ -460,6 +460,6 @@
   err = AudioSessionGetProperty(kAudioSessionProperty_InputGainScalar,
       &thissize, &input_hw_volume);
-  if (err) { AUBIO_ERR("audio_unit: could not get hardware input volume (%ld)",
-      err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not get hardware input volume (%d)\n",
+      (int)err); goto fail; }
 
   /* get hardware output volume */
@@ -467,11 +467,11 @@
   err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume,
       &thissize, &output_hw_volume);
-  if (err) { AUBIO_ERR("audio_unit: could not get hardware output volume (%ld)",
-      err); goto fail; }
-
-  AUBIO_MSG("audio_unit: opened at %.0fHz, sw channels %din/%dout, hw channels %ldin/%ldout, hw vol %.2fin/%.2fout",
+  if (err) { AUBIO_ERR("audio_unit: could not get hardware output volume (%d)\n",
+      (int)err); goto fail; }
+
+  AUBIO_MSG("audio_unit: opened at %.0fHz, sw channels %din/%dout, hw channels %din/%dout, hw vol %.2fin/%.2fout\n",
       samplerate,
       o->sw_input_channels, o->sw_output_channels,
-      input_hw_channels, output_hw_channels,
+      (unsigned int)input_hw_channels, (unsigned int)output_hw_channels,
       input_hw_volume, output_hw_volume);
 
@@ -480,6 +480,6 @@
   err = AudioUnitGetProperty (o->audio_unit, kAudioUnitProperty_MaximumFramesPerSlice,
       kAudioUnitScope_Global, 0, &max_fps, &thissize);
-  if (err) { AUBIO_ERR("audio_unit: could not get maximum frames per slice property %ld",
-      err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not get maximum frames per slice property %d\n",
+      (int)err); goto fail; }
 
   /* get hardware latency */
@@ -487,6 +487,6 @@
   err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareIOBufferDuration,
       &thissize, &latency);
-  if (err) { AUBIO_ERR("audio_unit: could not get hardware latency %ld",
-      err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not get hardware latency %d\n",
+      (int)err); goto fail; }
 
   /* get input latency */
@@ -494,6 +494,6 @@
   err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareInputLatency,
       &thissize, &input_latency);
-  if (err) { AUBIO_ERR("audio_unit: could not get input latency %ld",
-      err); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not get input latency %d\n",
+      (int)err); goto fail; }
 
   /* get output harlatency */
@@ -501,8 +501,8 @@
   err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputLatency,
       &thissize, &output_latency);
-  if (err) { AUBIO_ERR("audio_unit: could not get output latency %ld",
-      err); goto fail; }
-
-  AUBIO_MSG("audio_unit: I/O latency: %.2fms, %d frames, (%.2fms, %d frames in, %.2fms %d frames out)",
+  if (err) { AUBIO_ERR("audio_unit: could not get output latency %d\n",
+      (int)err); goto fail; }
+
+  AUBIO_MSG("audio_unit: I/O latency: %.2fms, %d frames, (%.2fms, %d frames in, %.2fms %d frames out)\n",
       latency*1000., (sint_t)round(latency*samplerate),
       input_latency*1000., (sint_t)ROUND(input_latency*samplerate),
@@ -523,5 +523,5 @@
   /* time to start the unit */
   err = AudioOutputUnitStart (o->audio_unit);
-  if (err) { AUBIO_ERR("audio_unit: could not start unit (%ld)", err); }
+  if (err) { AUBIO_ERR("audio_unit: could not start unit (%d)\n", (int)err); }
   return err;
 }
@@ -531,9 +531,9 @@
   if (o->audio_unit == NULL) return -1;
   OSStatus err = AudioOutputUnitStop (o->audio_unit);
-  if (err) { AUBIO_WRN("audio_unit: failed stopping audio unit (%ld)", err); }
+  if (err) { AUBIO_WRN("audio_unit: failed stopping audio unit (%d)\n", (int)err); }
   err = AudioUnitUninitialize (o->audio_unit);
-  if (err) { AUBIO_WRN("audio_unit: failed unitializing audio unit (%ld)", err); }
+  if (err) { AUBIO_WRN("audio_unit: failed unitializing audio unit (%d)\n", (int)err); }
   err = AudioSessionSetActive(false);
-  if (err) { AUBIO_WRN("audio_unit: failed stopping audio session (%ld)", err); }
+  if (err) { AUBIO_WRN("audio_unit: failed stopping audio session (%d)\n", (int)err); }
   return err;
 }
@@ -554,26 +554,26 @@
 
   if (inInterruptionState == kAudioSessionEndInterruption) {
-    AUBIO_WRN("audio_unit: session interruption ended");
+    AUBIO_WRN("audio_unit: session interruption ended\n");
     err = AudioSessionSetActive(true);
     if (err) {
-      AUBIO_ERR("audio_unit: could not make session active after interruption (%ld)", err);
+      AUBIO_ERR("audio_unit: could not make session active after interruption (%d)\n", (int)err);
       goto fail;
     }
     err = AudioOutputUnitStart(this_unit);
     if (err) {
-      AUBIO_ERR("audio_unit: failed starting unit (%ld)", err);
+      AUBIO_ERR("audio_unit: failed starting unit (%d)\n", (int)err);
       goto fail;
     }
   }
   if (inInterruptionState == kAudioSessionBeginInterruption) {
-    AUBIO_WRN("audio_unit: session interruption started");
+    AUBIO_WRN("audio_unit: session interruption started\n");
     err = AudioOutputUnitStop(this_unit);
     if (err) {
-      AUBIO_ERR("audio_unit: could not stop unit at interruption (%ld)", err);
+      AUBIO_ERR("audio_unit: could not stop unit at interruption (%d)\n", (int)err);
       goto fail;
     }
     err = AudioSessionSetActive(false);
     if (err) {
-      AUBIO_ERR("audio_unit: could not make session inactive after interruption (%ld)", err);
+      AUBIO_ERR("audio_unit: could not make session inactive after interruption (%d)\n", (int)err);
       goto fail;
     }
@@ -589,19 +589,19 @@
       &thissize, &category);
   if (err) {
-    AUBIO_ERR("audio_unit: could not get audio category (%ld)", err);
+    AUBIO_ERR("audio_unit: could not get audio category (%d)\n", (int)err);
     return err;
   }
   if (category == kAudioSessionCategory_AmbientSound) {
-    AUBIO_MSG("audio_unit: session category is AmbiantSound");
+    AUBIO_MSG("audio_unit: session category is AmbiantSound\n");
   } else if (category == kAudioSessionCategory_SoloAmbientSound) {
-    AUBIO_MSG("audio_unit: session category is SoloAmbiantSound");
+    AUBIO_MSG("audio_unit: session category is SoloAmbiantSound\n");
   } else if (category == kAudioSessionCategory_MediaPlayback) {
-    AUBIO_MSG("audio_unit: session category is MediaPlayback");
+    AUBIO_MSG("audio_unit: session category is MediaPlayback\n");
   } else if (category == kAudioSessionCategory_RecordAudio) {
-    AUBIO_MSG("audio_unit: session category is RecordAudio");
+    AUBIO_MSG("audio_unit: session category is RecordAudio\n");
   } else if (category == kAudioSessionCategory_PlayAndRecord) {
-    AUBIO_MSG("audio_unit: session category is PlayAndRecord");
+    AUBIO_MSG("audio_unit: session category is PlayAndRecord\n");
   } else if (category == kAudioSessionCategory_AudioProcessing) {
-    AUBIO_MSG("audio_unit: session category is AudioProcessing");
+    AUBIO_MSG("audio_unit: session category is AudioProcessing\n");
   }
   return category;
@@ -615,13 +615,13 @@
   if (has_input) {
     category = kAudioSessionCategory_PlayAndRecord;
-    if (verbose) AUBIO_MSG("audio_unit: setting category to PlayAndRecord");
+    if (verbose) AUBIO_MSG("audio_unit: setting category to PlayAndRecord\n");
   } else {
     category = kAudioSessionCategory_MediaPlayback;
-    if (verbose) AUBIO_MSG("audio_unit: setting category to MediaPlayback");
+    if (verbose) AUBIO_MSG("audio_unit: setting category to MediaPlayback\n");
   }
   err = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,
       sizeof(category), &category);
   if (err) {
-    AUBIO_ERR("audio_unit: could not set audio category");
+    AUBIO_ERR("audio_unit: could not set audio category\n");
   }
 
@@ -631,5 +631,5 @@
       sizeof (allowMixing), &allowMixing);
   if (err) {
-    AUBIO_ERR("audio_unit: could not set audio session to mix with others");
+    AUBIO_ERR("audio_unit: could not set audio session to mix with others\n");
   }
 
@@ -641,5 +641,5 @@
   UInt32 val, thissize = sizeof(currentRoute);
   OSStatus err = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &thissize, &currentRoute);
-  if (err) { AUBIO_ERR("audio_unit: could not get current route"); goto fail; }
+  if (err) { AUBIO_ERR("audio_unit: could not get current route\n"); goto fail; }
   else {
     char *route = (char *)CFStringGetCStringPtr ( currentRoute, kCFStringEncodingUTF8);
@@ -651,5 +651,5 @@
     }
     if (o->verbose) {
-      AUBIO_MSG ("audio_unit: current route is %s", route);
+      AUBIO_MSG ("audio_unit: current route is %s\n", route);
     }
     free(route);
@@ -677,8 +677,8 @@
         o->input_enabled = false;
         if (o->verbose) {
-          AUBIO_MSG ("audio_unit: disabling input to avoid feedback");
+          AUBIO_MSG ("audio_unit: disabling input to avoid feedback\n");
         }
       } else {
-        AUBIO_WRN ("audio_unit: input not disabled as prevent_feedback set to 0, risking feedback");
+        AUBIO_WRN ("audio_unit: input not disabled as prevent_feedback set to 0, risking feedback\n");
       }
     }
@@ -686,5 +686,5 @@
     err = AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute,
         sizeof(UInt32), &val);
-    if (err) { AUBIO_ERR("audio_unit: could not set session OverrideAudioRoute to Speaker"); }
+    if (err) { AUBIO_ERR("audio_unit: could not set session OverrideAudioRoute to Speaker\n"); }
 
   }
@@ -704,25 +704,25 @@
   switch (change_reason_number) {
     case kAudioSessionRouteChangeReason_NewDeviceAvailable:
-      AUBIO_MSG("audio_unit: route changed to NewDeviceAvailable");
+      AUBIO_MSG("audio_unit: route changed to NewDeviceAvailable\n");
       break;
     case kAudioSessionRouteChangeReason_OldDeviceUnavailable:
-      AUBIO_MSG("audio_unit: route changed to OldDeviceUnavailable");
+      AUBIO_MSG("audio_unit: route changed to OldDeviceUnavailable\n");
       break;
     case kAudioSessionRouteChangeReason_CategoryChange:
-      AUBIO_MSG("audio_unit: route changed to CategoryChange");
+      AUBIO_MSG("audio_unit: route changed to CategoryChange\n");
       audio_unit_get_audio_session_category();
       break;
     case kAudioSessionRouteChangeReason_Override:
-      AUBIO_MSG("audio_unit: route changed to Override");
+      AUBIO_MSG("audio_unit: route changed to Override\n");
       break;
     case kAudioSessionRouteChangeReason_WakeFromSleep:
-      AUBIO_MSG("audio_unit: route changed to WakeFromSleep");
+      AUBIO_MSG("audio_unit: route changed to WakeFromSleep\n");
       break;
     case kAudioSessionRouteChangeReason_NoSuitableRouteForCategory:
-      AUBIO_MSG("audio_unit: route changed to NoSuitableRouteForCategory");
+      AUBIO_MSG("audio_unit: route changed to NoSuitableRouteForCategory\n");
       break;
     case kAudioSessionRouteChangeReason_Unknown:
     default:
-      AUBIO_ERR("audio_unit: route changed for an unknown reason!?");
+      AUBIO_ERR("audio_unit: route changed for an unknown reason!?\n");
       break;
   }
