Changeset 4bc92c0


Ignore:
Timestamp:
Nov 13, 2013, 1:26:33 PM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
a4c1e86
Parents:
d3066e2
Message:

src/io/sink_apple_audio.c: switch to sync mode if async fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_apple_audio.c

    rd3066e2 r4bc92c0  
    4949  AudioBufferList bufferList;
    5050  ExtAudioFileRef audioFile;
     51  bool async;
    5152};
    5253
     
    5758  s->path = uri;
    5859  s->max_frames = MAX_SIZE;
     60  s->async = true;
    5961
    6062  AudioStreamBasicDescription clientFormat;
     
    9496  OSStatus err = noErr;
    9597  UInt32 c, v;
    96   bool async = true;
    9798  short *data = (short*)s->bufferList.mBuffers[0].mData;
    9899  if (write > s->max_frames) {
     
    110111      }
    111112  }
    112   if (async) {
     113  if (s->async) {
    113114    err = ExtAudioFileWriteAsync(s->audioFile, write, &s->bufferList);
    114     if (err) { AUBIO_ERROR("error in ExtAudioFileWriteAsync, %d\n", (int)err); }
     115
     116    if (err) {
     117      AUBIO_ERROR("in aubio_sink_apple_audio_do, writing %s\n", s->path);
     118      AUBIO_ERROR("ExtAudioFileWriteAsync failed with %d, switching to sync\n", (int)err);
     119      s->async = false;
     120    } else {
     121      return;
     122    }
     123
    115124  } else {
    116125    err = ExtAudioFileWrite(s->audioFile, write, &s->bufferList);
    117     if (err) { AUBIO_ERROR("error in ExtAudioFileWrite, %d\n", (int)err); }
     126
     127    if (err) {
     128      AUBIO_ERROR("in aubio_sink_apple_audio_do, writing %s\n", s->path);
     129      AUBIO_ERROR("ExtAudioFileWrite failed with %d, aborting\n", (int)err);
     130    }
    118131  }
    119132  return;
Note: See TracChangeset for help on using the changeset viewer.