Changeset 1223979
- Timestamp:
- Jul 15, 2012, 8:02:27 PM (12 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:
- 11a1abe
- Parents:
- 32df658
- Location:
- src/io
- Files:
-
- 3 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_apple_audio.c
r32df658 r1223979 25 25 #include "io/source_apple_audio.h" 26 26 27 // CFURLRef, CFURLCreateWithFileSystemPath, ...28 #include <CoreFoundation/CoreFoundation.h>29 27 // ExtAudioFileRef, AudioStreamBasicDescription, AudioBufferList, ... 30 28 #include <AudioToolbox/AudioToolbox.h> … … 45 43 46 44 ExtAudioFileRef audioFile; 47 AudioStreamBasicDescription fileFormat;48 45 AudioBufferList bufferList; 49 46 }; 50 47 51 staticint createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize);52 staticvoid freeAudioBufferList(AudioBufferList *bufferList);53 staticCFURLRef getURLFromPath(const char * path);48 extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize); 49 extern void freeAudioBufferList(AudioBufferList *bufferList); 50 extern CFURLRef getURLFromPath(const char * path); 54 51 55 52 aubio_source_apple_audio_t * new_aubio_source_apple_audio(char_t * path, uint_t samplerate, uint_t block_size) … … 96 93 err = ExtAudioFileSetProperty(s->audioFile, kExtAudioFileProperty_ClientDataFormat, 97 94 propSize, &clientFormat); 98 if (err) { fprintf(stderr,"error in ExtAudioFileSetProperty, %d\n", (int)err); goto beach;}95 if (err) { AUBIO_ERROR("error in ExtAudioFileSetProperty, %d\n", (int)err); goto beach;} 99 96 97 #if 0 100 98 // print client and format descriptions 101 99 AUBIO_DBG("Opened %s\n", s->path); … … 113 111 AUBIO_DBG("file/client Format.mBytesPerPacket : %6d / %d\n", (int)fileFormat.mBytesPerPacket , (int)clientFormat.mBytesPerPacket); 114 112 AUBIO_DBG("file/client Format.mReserved : %6d / %d\n", (int)fileFormat.mReserved , (int)clientFormat.mReserved); 113 #endif 115 114 116 115 // compute the size of the segments needed to read the input file … … 166 165 } 167 166 168 static int createAubioBufferList(AudioBufferList * bufferList, int channels, int segmentSize) {169 bufferList->mNumberBuffers = 1;170 bufferList->mBuffers[0].mNumberChannels = channels;171 bufferList->mBuffers[0].mData = (short *)malloc(segmentSize * sizeof(short));172 bufferList->mBuffers[0].mDataByteSize = segmentSize * sizeof(short);173 return 0;174 }175 176 static void freeAudioBufferList(AudioBufferList *bufferList) {177 UInt32 i = 0;178 if (!bufferList) return;179 for (i = 0; i < bufferList->mNumberBuffers; i++) {180 if (bufferList->mBuffers[i].mData) {181 free (bufferList->mBuffers[i].mData);182 bufferList->mBuffers[i].mData = NULL;183 }184 }185 bufferList = NULL;186 }187 188 static CFURLRef getURLFromPath(const char * path) {189 CFStringRef cfTotalPath = CFStringCreateWithCString (kCFAllocatorDefault,190 path, kCFStringEncodingUTF8);191 192 return CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,193 kCFURLPOSIXPathStyle, false);194 }195 196 197 167 void del_aubio_source_apple_audio(aubio_source_apple_audio_t * s){ 198 168 OSStatus err = noErr;
Note: See TracChangeset
for help on using the changeset viewer.