Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silenced some warnings when built in an environment with a different set of warnings #142

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion EZAudio/AEFloatConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ BOOL AEFloatConverterFromFloatBufferList(AEFloatConverter* converter, AudioBuffe

#ifdef __cplusplus
}
#endif
#endif
18 changes: 12 additions & 6 deletions EZAudio/AEFloatConverter.m
Original file line number Diff line number Diff line change
Expand Up @@ -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; i<targetBuffer->mNumberBuffers; i++ ) {

const size_t nBuffers = targetBuffer->mNumberBuffers;
float *targetBuffers[nBuffers];
bzero(targetBuffers, nBuffers * sizeof(targetBuffers[0]));

for ( int i=0; i<targetBuffer->mNumberBuffers; i++ ) {
targetBuffers[i] = (float*)targetBuffer->mBuffers[i].mData;
}
return AEFloatConverterToFloat(converter, sourceBuffer, targetBuffers, frames);
Expand Down Expand Up @@ -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; i<sourceBuffer->mNumberBuffers; i++ ) {

const size_t nBuffers = sourceBuffer->mNumberBuffers;
float *sourceBuffers[nBuffers];
bzero(sourceBuffers, nBuffers * sizeof(sourceBuffer[0]));

for ( int i=0; i<sourceBuffer->mNumberBuffers; i++ ) {
sourceBuffers[i] = (float*)sourceBuffer->mBuffers[i].mData;
}
return AEFloatConverterFromFloat(converter, sourceBuffers, targetBuffer, frames);
Expand Down
7 changes: 6 additions & 1 deletion EZAudio/EZAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Foundation/Foundation.h>

#pragma mark - 3rd Party Utilties
Expand All @@ -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.

Expand Down Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions EZAudio/EZAudio.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 0 additions & 4 deletions EZAudio/EZAudioFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions EZAudio/EZAudioPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Foundation/Foundation.h>
#import "TargetConditionals.h"

Expand All @@ -33,6 +36,8 @@
#elif TARGET_OS_MAC
#endif

#pragma clang diagnostic pop

@class EZAudioPlayer;

/**
Expand Down
3 changes: 3 additions & 0 deletions EZAudio/EZAudioPlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions EZAudio/EZMicrophone.m
Original file line number Diff line number Diff line change
Expand Up @@ -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<streamFormat.mChannelsPerFrame; i++ ) {
Expand Down
1 change: 0 additions & 1 deletion EZAudio/EZOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ inNumberFrames:(UInt32)inNumberFrames
@param output The instance of the EZOutput that asked for the data.
@param audioBufferList The AudioBufferList structure pointer that needs to be filled with audio data
@param frames The amount of frames as a UInt32 that output will need to properly fill its output buffer.
@return A pointer to the AudioBufferList structure holding the audio data. If nil or NULL, will output silence.
*/
-(void) output:(EZOutput *)output
shouldFillAudioBufferList:(AudioBufferList*)audioBufferList
Expand Down
5 changes: 4 additions & 1 deletion EZAudio/EZPlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <TargetConditionals.h>
#import <Foundation/Foundation.h>

#pragma mark - Enumerations
///-----------------------------------------------------------
/// @name Plot Types
Expand All @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion EZAudio/EZRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ typedef NS_ENUM(NSInteger, EZRecorderFileType)
*/
-(void)closeAudioFile;

@end
@end
2 changes: 1 addition & 1 deletion EZAudio/TPCircularBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Binary file removed EZAudioExamples/.DS_Store
Binary file not shown.
Binary file removed EZAudioExamples/iOS/.DS_Store
Binary file not shown.
Binary file not shown.
Binary file not shown.