Skip to content

Commit

Permalink
objc: whitespace fixes, made indenting consistent to tabs (Xcode defa…
Browse files Browse the repository at this point in the history
…ult)
  • Loading branch information
danomatika committed May 1, 2014
1 parent baedcc0 commit 4146304
Show file tree
Hide file tree
Showing 14 changed files with 707 additions and 713 deletions.
18 changes: 9 additions & 9 deletions objc/AudioHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,41 @@

#pragma mark - Audio Unit / Audio Session Debugging

// uncomment this to log more information from the audio classes, or define it in "Other C Flags" build settings
/// uncomment this to log more information from the audio classes, or define it in "Other C Flags" build settings
//#define AU_DEBUG_VERBOSE

// returns the name of the const value associated with the OSStatus as a string
/// returns the name of the const value associated with the OSStatus as a string
extern NSString *AVStatusCodeAsString(OSStatus status);
extern NSString *AUStatusCodeAsString(OSStatus status);

// log debug info along with the class, function and line number
/// log debug info along with the class, function and line number
#define AU_LOG(nslog_string, ...) do {\
NSLog((@"%s[%d] " nslog_string), __func__, __LINE__, ##__VA_ARGS__);\
} while (0)

// same as AU_Log, but only logs if AU_DEBUG_VERBOSE is defined
/// same as AU_Log, but only logs if AU_DEBUG_VERBOSE is defined
#if defined(AU_DEBUG_VERBOSE)
#define AU_LOGV(nslog_string, ...) AU_LOG(nslog_string, ##__VA_ARGS__)
#define AU_LOGV(nslog_string, ...) AU_LOG(nslog_string, ##__VA_ARGS__)
#else
#define AU_LOGV(nslog_string, ...)
#define AU_LOGV(nslog_string, ...)
#endif

// a debug check, which will only log if the value is non-zero
/// a debug check, which will only log if the value is non-zero
#define AU_LOG_IF_ERROR(value, nslog_string, ...) do {\
if(value) {\
NSLog((@"*** ERROR *** %s[%d] " nslog_string), __func__, __LINE__, ##__VA_ARGS__);\
}\
} while (0)

// check if the audio unit had an error, and if so print it and return
/// check if the audio unit had an error, and if so print it and return
#define AU_RETURN_IF_ERROR(status) do {\
if(status) {\
NSLog(@"*** ERROR *** %s[%d] status code = %@", __func__, __LINE__, AUStatusCodeAsString(status));\
return;\
}\
} while (0)

// check if the audio unit had an error, and if so print it and return false
/// check if the audio unit had an error, and if so print it and return false
#define AU_RETURN_FALSE_IF_ERROR(status) do {\
if(status) {\
NSLog(@"*** ERROR *** %s[%d] status code = %@", __func__, __LINE__, AUStatusCodeAsString(status));\
Expand Down
2 changes: 1 addition & 1 deletion objc/AudioHelpers.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ BOOL floatsAreEqual(Float64 f1, Float64 f2) {
return ((fabs(f1 - f2) < 0.0001) ? YES : NO);
}

//http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious
// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious
int log2int(int x) {
int y = 0;
while (x >>= 1) {
Expand Down
43 changes: 22 additions & 21 deletions objc/PdAudioController.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,57 @@
#import "PdAudioUnit.h"

typedef enum PdAudioStatus {
PdAudioOK = 0, // success
PdAudioError = -1, // unrecoverable error
PdAudioOK = 0, // success
PdAudioError = -1, // unrecoverable error
PdAudioPropertyChanged = 1 // some properties have changed to run correctly (not fatal)
} PdAudioStatus;

/* PdAudioController: A class for managing PdAudioUnit within iOS
* by using the AVFoundation and Audio Services APIs.
* Handles phone interruptions and provides high level configuration methods
* The returned PdAudioStatus is used to indicate success, failure, or
* that parameters had to be adjusted in order to work.
*/
/// PdAudioController: A class for managing PdAudioUnit within iOS
/// by using the AVFoundation and Audio Services APIs.
/// Handles phone interruptions and provides high level configuration methods
/// The returned PdAudioStatus is used to indicate success, failure, or
/// that parameters had to be adjusted in order to work.
///
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
@interface PdAudioController : NSObject
#else
// AVAudioSessionDelegate is deprecated starting in iOS 6
@interface PdAudioController : NSObject <AVAudioSessionDelegate>
#endif

// Read only properties that are set by the configure methods
/// Read only properties that are set by the configure methods
@property (nonatomic, readonly) int sampleRate;
@property (nonatomic, readonly) int numberChannels;
@property (nonatomic, readonly) BOOL inputEnabled;
@property (nonatomic, readonly) BOOL mixingEnabled;
@property (nonatomic, readonly) int ticksPerBuffer;

// Check or set the active status of the audio unit
/// Check or set the active status of the audio unit
@property (nonatomic, getter=isActive) BOOL active;

// Configure the audio with the specified samplerate, as well as number of output channels (which will also be the number of
// input channels if input is enable). Note that this method has three possible outcomes: success, failure, or conditional
// success, where parameters had to be adjusted to set up the audio. In the third case, you can query the sample rate and
// channel properties to determine whether the selected configuration is acceptable. Specifying mixingEnabled = YES will
// allow the app to continue playing audio along with other apps (such as iPod music player).
/// Configure the audio with the specified samplerate, as well as number of output channels (which will also be the number of
/// input channels if input is enable). Note that this method has three possible outcomes: success, failure, or conditional
/// success, where parameters had to be adjusted to set up the audio. In the third case, you can query the sample rate and
/// channel properties to determine whether the selected configuration is acceptable. Specifying mixingEnabled = YES will
/// allow the app to continue playing audio along with other apps (such as iPod music player).
- (PdAudioStatus)configurePlaybackWithSampleRate:(int)sampleRate
numberChannels:(int)numChannels
inputEnabled:(BOOL)inputEnabled
mixingEnabled:(BOOL)mixingEnabled;

// Configure audio for ambient use, without input channels. Specifying mixingEnabled = YES will allow the app to continue
// playing audio along with other apps (such as iPod music player).
/// Configure audio for ambient use, without input channels. Specifying mixingEnabled = YES will allow the app to continue
/// playing audio along with other apps (such as iPod music player).
- (PdAudioStatus)configureAmbientWithSampleRate:(int)sampleRate
numberChannels:(int)numChannels
mixingEnabled:(BOOL)mixingEnabled;

// Configure the ticksPerBuffer parameter, which will change the audio sessions IO buffer size.
// This can be done on the fly, while audio is running. Note that the audio session only accepts
// values that correspond to a number of frames that are a power of 2 and sometimes this value
// is ignored by the audio unit, which tries to work with whatever number of frames it is provided.
/// Configure the ticksPerBuffer parameter, which will change the audio sessions IO buffer size.
/// This can be done on the fly, while audio is running. Note that the audio session only accepts
/// values that correspond to a number of frames that are a power of 2 and sometimes this value
/// is ignored by the audio unit, which tries to work with whatever number of frames it is provided.
- (PdAudioStatus)configureTicksPerBuffer:(int)ticksPerBuffer;

/// Print current settings to the console.
- (void)print;

@end
Loading

0 comments on commit 4146304

Please sign in to comment.