Changeset 9fa9b86
- Timestamp:
- Feb 8, 2016, 5:01:31 PM (9 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 5bd806d
- Parents:
- 94b16497
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink_apple_audio.c
r94b16497 r9fa9b86 44 44 #define MAX_SIZE 4096 // the maximum number of frames that can be written at a time 45 45 46 void aubio_sink_apple_audio_write(aubio_sink_apple_audio_t *s, uint_t write); 47 46 48 struct _aubio_sink_apple_audio_t { 47 49 uint_t samplerate; … … 60 62 s->path = uri; 61 63 s->max_frames = MAX_SIZE; 62 s->async = true;64 s->async = false; 63 65 64 66 if (uri == NULL) { … … 163 165 164 166 void aubio_sink_apple_audio_do(aubio_sink_apple_audio_t * s, fvec_t * write_data, uint_t write) { 165 OSStatus err = noErr;166 167 UInt32 c, v; 167 168 short *data = (short*)s->bufferList.mBuffers[0].mData; … … 180 181 } 181 182 } 182 if (s->async) { 183 err = ExtAudioFileWriteAsync(s->audioFile, write, &s->bufferList); 184 185 if (err) { 186 char_t errorstr[20]; 187 AUBIO_ERROR("sink_apple_audio: error while writing %s " 188 "in ExtAudioFileWriteAsync (%s), switching to sync\n", s->path, 189 getPrintableOSStatusError(errorstr, err)); 190 s->async = false; 191 } else { 192 return; 193 } 194 195 } else { 196 err = ExtAudioFileWrite(s->audioFile, write, &s->bufferList); 197 198 if (err) { 199 char_t errorstr[20]; 200 AUBIO_ERROR("sink_apple_audio: error while writing %s " 201 "in ExtAudioFileWrite (%s)\n", s->path, 202 getPrintableOSStatusError(errorstr, err)); 203 } 204 } 205 return; 183 aubio_sink_apple_audio_write(s, write); 206 184 } 207 185 208 186 void aubio_sink_apple_audio_do_multi(aubio_sink_apple_audio_t * s, fmat_t * write_data, uint_t write) { 209 OSStatus err = noErr;210 187 UInt32 c, v; 211 188 short *data = (short*)s->bufferList.mBuffers[0].mData; … … 224 201 } 225 202 } 203 aubio_sink_apple_audio_write(s, write); 204 } 205 206 void aubio_sink_apple_audio_write(aubio_sink_apple_audio_t *s, uint_t write) { 207 OSStatus err = noErr; 226 208 if (s->async) { 227 209 err = ExtAudioFileWriteAsync(s->audioFile, write, &s->bufferList); 228 229 210 if (err) { 230 211 char_t errorstr[20]; 212 if (err == kExtAudioFileError_AsyncWriteBufferOverflow) { 213 sprintf(errorstr,"buffer overflow"); 214 } else if (err == kExtAudioFileError_AsyncWriteTooLarge) { 215 sprintf(errorstr,"write too large"); 216 } else { 217 // unknown error 218 getPrintableOSStatusError(errorstr, err); 219 } 231 220 AUBIO_ERROR("sink_apple_audio: error while writing %s " 232 "in ExtAudioFileWriteAsync (%s), switching to sync\n", s->path, 233 getPrintableOSStatusError(errorstr, err)); 234 s->async = false; 235 } else { 236 return; 221 "in ExtAudioFileWriteAsync (%s)\n", s->path, errorstr); 237 222 } 238 239 223 } else { 240 224 err = ExtAudioFileWrite(s->audioFile, write, &s->bufferList); 241 242 225 if (err) { 243 226 char_t errorstr[20]; … … 247 230 } 248 231 } 249 return;250 232 } 251 233
Note: See TracChangeset
for help on using the changeset viewer.