diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 2ea50808..00000000 Binary files a/.DS_Store and /dev/null differ diff --git a/EZAudio/AEFloatConverter.h b/EZAudio/AEFloatConverter.h index a1bf7bbb..de6bea9d 100644 --- a/EZAudio/AEFloatConverter.h +++ b/EZAudio/AEFloatConverter.h @@ -121,4 +121,4 @@ BOOL AEFloatConverterFromFloatBufferList(AEFloatConverter* converter, AudioBuffe #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/EZAudio/AEFloatConverter.m b/EZAudio/AEFloatConverter.m index 8b1972d5..10394ea8 100644 --- a/EZAudio/AEFloatConverter.m +++ b/EZAudio/AEFloatConverter.m @@ -133,9 +133,12 @@ BOOL AEFloatConverterToFloat(AEFloatConverter* THIS, AudioBufferList *sourceBuff BOOL AEFloatConverterToFloatBufferList(AEFloatConverter* converter, AudioBufferList *sourceBuffer, AudioBufferList *targetBuffer, UInt32 frames) { assert(targetBuffer->mNumberBuffers == converter->_floatAudioDescription.mChannelsPerFrame); - - float *targetBuffers[targetBuffer->mNumberBuffers]; - for ( int i=0; imNumberBuffers; i++ ) { + + const size_t nBuffers = targetBuffer->mNumberBuffers; + float *targetBuffers[nBuffers]; + bzero(targetBuffers, nBuffers * sizeof(targetBuffers[0])); + + for ( int i=0; imNumberBuffers; i++ ) { targetBuffers[i] = (float*)targetBuffer->mBuffers[i].mData; } return AEFloatConverterToFloat(converter, sourceBuffer, targetBuffers, frames); @@ -180,9 +183,12 @@ BOOL AEFloatConverterFromFloat(AEFloatConverter* THIS, float * const * sourceBuf BOOL AEFloatConverterFromFloatBufferList(AEFloatConverter* converter, AudioBufferList *sourceBuffer, AudioBufferList *targetBuffer, UInt32 frames) { assert(sourceBuffer->mNumberBuffers == converter->_floatAudioDescription.mChannelsPerFrame); - - float *sourceBuffers[sourceBuffer->mNumberBuffers]; - for ( int i=0; imNumberBuffers; i++ ) { + + const size_t nBuffers = sourceBuffer->mNumberBuffers; + float *sourceBuffers[nBuffers]; + bzero(sourceBuffers, nBuffers * sizeof(sourceBuffer[0])); + + for ( int i=0; imNumberBuffers; i++ ) { sourceBuffers[i] = (float*)sourceBuffer->mBuffers[i].mData; } return AEFloatConverterFromFloat(converter, sourceBuffers, targetBuffer, frames); diff --git a/EZAudio/EZAudio.h b/EZAudio/EZAudio.h index 8fe6adf0..a00fe049 100644 --- a/EZAudio/EZAudio.h +++ b/EZAudio/EZAudio.h @@ -23,6 +23,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wauto-import" + #import #pragma mark - 3rd Party Utilties @@ -44,6 +47,8 @@ #import "EZAudioPlotGL.h" #import "EZAudioPlotGLKViewController.h" +#pragma clang diagnostic pop + /** EZAudio is a simple, intuitive framework for iOS and OSX. The goal of EZAudio was to provide a modular, cross-platform framework to simplify performing everyday audio operations like getting microphone input, creating audio waveforms, recording/playing audio files, etc. The visualization tools like the EZAudioPlot and EZAudioPlotGL were created to plug right into the framework's various components and provide highly optimized drawing routines that work in harmony with audio callback loops. All components retain the same namespace whether you're on an iOS device or a Mac computer so an EZAudioPlot understands it will subclass an UIView on an iOS device or an NSView on a Mac. @@ -136,7 +141,7 @@ @param sampleRate The desired sample rate @return A new AudioStreamBasicDescription with the specified format. */ -+(AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sameRate; ++(AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sampleRate; ///----------------------------------------------------------- /// @name AudioStreamBasicDescription Utilities diff --git a/EZAudio/EZAudio.m b/EZAudio/EZAudio.m index 3b44e9f1..1a6bb835 100644 --- a/EZAudio/EZAudio.m +++ b/EZAudio/EZAudio.m @@ -238,15 +238,16 @@ +(void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asb +(void)checkResult:(OSStatus)result operation:(const char *)operation { if (result == noErr) return; - char errorString[20]; + // see if it appears to be a 4-char-code - *(UInt32 *)(errorString + 1) = CFSwapInt32HostToBig(result); - if (isprint(errorString[1]) && isprint(errorString[2]) && isprint(errorString[3]) && isprint(errorString[4])) { - errorString[0] = errorString[5] = '\''; - errorString[6] = '\0'; - } else + const uint32_t swapped = CFSwapInt32HostToBig(result); + const char* const swappedChar = (const char*)&swapped; + char errorString[20] = {'\'', swappedChar[0], swappedChar[1], swappedChar[2], swappedChar[3], '\'','\0'}; + + if (!isprint(errorString[1]) || !isprint(errorString[2]) || !isprint(errorString[3]) || !isprint(errorString[4])) { // no, format it as an integer sprintf(errorString, "%d", (int)result); + } fprintf(stderr, "Error: %s (%s)\n", operation, errorString); exit(1); } diff --git a/EZAudio/EZAudioFile.m b/EZAudio/EZAudioFile.m index 14134338..39df615f 100644 --- a/EZAudio/EZAudioFile.m +++ b/EZAudio/EZAudioFile.m @@ -148,8 +148,6 @@ -(void)_configureAudioFile { for ( int i=0; i< _clientFormat.mChannelsPerFrame; i++ ) { _floatBuffers[i] = (float*)malloc(outputBufferSize); } - - [EZAudio printASBD:_fileFormat]; // There's no waveform data yet _waveformData = NULL; @@ -229,7 +227,6 @@ -(void)getWaveformDataWithCompletionBlock:(WaveformDataCompletionBlock)waveformD numberOfChannels:_clientFormat.mChannelsPerFrame interleaved:YES]; UInt32 bufferSize; - BOOL eof; // Read in the specified number of frames [EZAudio checkResult:ExtAudioFileRead(_audioFile, @@ -238,7 +235,6 @@ -(void)getWaveformDataWithCompletionBlock:(WaveformDataCompletionBlock)waveformD operation:"Failed to read audio data from audio file"]; bufferSize = bufferList->mBuffers[0].mDataByteSize/sizeof(float); bufferSize = MAX(1, bufferSize); - eof = _waveformFrameRate == 0; _frameIndex += _waveformFrameRate; // Calculate RMS of each buffer diff --git a/EZAudio/EZAudioPlayer.h b/EZAudio/EZAudioPlayer.h index 3143fcff..eaa3abe7 100644 --- a/EZAudio/EZAudioPlayer.h +++ b/EZAudio/EZAudioPlayer.h @@ -23,6 +23,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wauto-import" + #import #import "TargetConditionals.h" @@ -33,6 +36,8 @@ #elif TARGET_OS_MAC #endif +#pragma clang diagnostic pop + @class EZAudioPlayer; /** diff --git a/EZAudio/EZAudioPlot.h b/EZAudio/EZAudioPlot.h index 29c7c136..729c1003 100644 --- a/EZAudio/EZAudioPlot.h +++ b/EZAudio/EZAudioPlot.h @@ -47,8 +47,11 @@ */ @interface EZAudioPlot : EZPlot { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wobjc-interface-ivars" CGPoint *plotData; UInt32 plotLength; +#pragma clang diagnostic pop } #pragma mark - Adjust Resolution diff --git a/EZAudio/EZMicrophone.m b/EZAudio/EZMicrophone.m index 3ede9823..ab629b17 100644 --- a/EZAudio/EZMicrophone.m +++ b/EZAudio/EZMicrophone.m @@ -559,6 +559,7 @@ -(void)_configureAudioBufferListWithFrameSize:(UInt32)bufferFrameSize { -(void)_configureFloatConverterWithFrameSize:(UInt32)bufferFrameSize { UInt32 bufferSizeBytes = bufferFrameSize * streamFormat.mBytesPerFrame; converter = [[AEFloatConverter alloc] initWithSourceFormat:streamFormat]; + assert(streamFormat.mChannelsPerFrame); floatBuffers = (float**)malloc(sizeof(float*)*streamFormat.mChannelsPerFrame); assert(floatBuffers); for ( int i=0; i +#import + #pragma mark - Enumerations ///----------------------------------------------------------- /// @name Plot Types @@ -31,7 +34,7 @@ /** The types of plots that can be displayed in the view using the data. */ -typedef NS_ENUM(NSInteger,EZPlotType){ +typedef NS_ENUM(NSInteger,EZPlotType) { /** Plot that displays only the samples of the current buffer */ diff --git a/EZAudio/EZRecorder.h b/EZAudio/EZRecorder.h index 31ca8d04..c3be7b17 100644 --- a/EZAudio/EZRecorder.h +++ b/EZAudio/EZRecorder.h @@ -120,4 +120,4 @@ typedef NS_ENUM(NSInteger, EZRecorderFileType) */ -(void)closeAudioFile; -@end \ No newline at end of file +@end diff --git a/EZAudio/TPCircularBuffer.h b/EZAudio/TPCircularBuffer.h index cd2a4d83..9337d10b 100644 --- a/EZAudio/TPCircularBuffer.h +++ b/EZAudio/TPCircularBuffer.h @@ -183,7 +183,7 @@ static __inline__ __attribute__((always_inline)) bool TPCircularBufferProduceByt int32_t space; void *ptr = TPCircularBufferHead(buffer, &space); if ( space < len ) return false; - memcpy(ptr, src, len); + memcpy(ptr, src, (size_t)len); TPCircularBufferProduce(buffer, len); return true; } diff --git a/EZAudioExamples/.DS_Store b/EZAudioExamples/.DS_Store deleted file mode 100644 index 0dbf02c7..00000000 Binary files a/EZAudioExamples/.DS_Store and /dev/null differ diff --git a/EZAudioExamples/iOS/.DS_Store b/EZAudioExamples/iOS/.DS_Store deleted file mode 100644 index 2504b975..00000000 Binary files a/EZAudioExamples/iOS/.DS_Store and /dev/null differ diff --git a/EZAudioExamples/iOS/EZAudioPlayFileExample/.DS_Store b/EZAudioExamples/iOS/EZAudioPlayFileExample/.DS_Store deleted file mode 100644 index 59b9a8bf..00000000 Binary files a/EZAudioExamples/iOS/EZAudioPlayFileExample/.DS_Store and /dev/null differ diff --git a/EZAudioExamples/iOS/EZAudioRecordExample/.DS_Store b/EZAudioExamples/iOS/EZAudioRecordExample/.DS_Store deleted file mode 100644 index c08cf129..00000000 Binary files a/EZAudioExamples/iOS/EZAudioRecordExample/.DS_Store and /dev/null differ