Permalink
Browse files

Hide methods that don't need to be public (yet)

  • Loading branch information...
1 parent 16f7c31 commit dfcfffea0ba93915bfef57d134dc22a4f47ee1f0 @ndonald2 ndonald2 committed Jun 10, 2013
@@ -36,11 +36,9 @@ - (void)dealloc
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
-
self.audioManager = [Novocaine audioManager];
self.ringBuffer = new RingBuffer(32768, 2);
-
__weak AppDelegate * wself = self;
// A simple delay that's hard to express without ring buffers
@@ -169,22 +169,22 @@ - (void)viewWillAppear:(BOOL)animated
// AUDIO FILE READING OHHH YEAHHHH
// ========================================
-// NSURL *inputFileURL = [[NSBundle mainBundle] URLForResource:@"TLC" withExtension:@"mp3"];
-//
-// self.fileReader = [[AudioFileReader alloc]
-// initWithAudioFileURL:inputFileURL
-// samplingRate:self.audioManager.samplingRate
-// numChannels:self.audioManager.numOutputChannels];
-//
-// [self.fileReader play];
-// self.fileReader.currentTime = 30.0;
-//
-//
-// [self.audioManager setOutputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels)
-// {
-// [wself.fileReader retrieveFreshAudio:data numFrames:numFrames numChannels:numChannels];
-// NSLog(@"Time: %f", wself.fileReader.currentTime);
-// }];
+ NSURL *inputFileURL = [[NSBundle mainBundle] URLForResource:@"TLC" withExtension:@"mp3"];
+
+ self.fileReader = [[AudioFileReader alloc]
+ initWithAudioFileURL:inputFileURL
+ samplingRate:self.audioManager.samplingRate
+ numChannels:self.audioManager.numOutputChannels];
+
+ [self.fileReader play];
+ self.fileReader.currentTime = 30.0;
+
+
+ [self.audioManager setOutputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels)
+ {
+ [wself.fileReader retrieveFreshAudio:data numFrames:numFrames numChannels:numChannels];
+ NSLog(@"Time: %f", wself.fileReader.currentTime);
+ }];
// AUDIO FILE WRITING YEAH!
@@ -34,7 +34,7 @@
@property (nonatomic, assign) UInt32 numChannels;
@property (nonatomic, assign) float latency;
@property (nonatomic, copy) NSURL *audioFileURL;
-@property (nonatomic, copy) InputBlock readerBlock;
+@property (nonatomic, copy) NovocaineInputBlock readerBlock;
@property (nonatomic, assign) BOOL playing;
@@ -37,7 +37,7 @@
@property (nonatomic, assign) UInt32 numChannels;
@property (nonatomic, assign) float latency;
@property (nonatomic, copy) NSURL *audioFileURL;
-@property (nonatomic, copy) InputBlock writerBlock;
+@property (nonatomic, copy) NovocaineInputBlock writerBlock;
@property (nonatomic, assign) BOOL recording;
View
@@ -89,20 +89,32 @@ void sessionInterruptionListener(void *inClientData, UInt32 inInterruption);
}
#endif
-typedef void (^OutputBlock)(float *data, UInt32 numFrames, UInt32 numChannels);
-typedef void (^InputBlock)(float *data, UInt32 numFrames, UInt32 numChannels);
+typedef void (^NovocaineOutputBlock)(float *data, UInt32 numFrames, UInt32 numChannels);
+typedef void (^NovocaineInputBlock)(float *data, UInt32 numFrames, UInt32 numChannels);
#if defined (USING_IOS)
@interface Novocaine : NSObject <UIAlertViewDelegate>
#elif defined (USING_OSX)
@interface Novocaine : NSObject
#endif
-@property (nonatomic, copy) OutputBlock outputBlock;
-@property (nonatomic, copy) InputBlock inputBlock;
-@property (nonatomic, copy) NSString *inputRoute;
+// ------ These properties/methods are used for configuration -------
-// these should be readonly - no need for public access
+@property (nonatomic, copy) NSString *inputRoute;
+
+// ND: Exposing the block setters this way will create the correct block signature for auto-complete.
+// These will map to "copy" property setters in class continuation in source file
+- (void)setInputBlock:(NovocaineInputBlock)block;
+- (void)setOutputBlock:(NovocaineOutputBlock)block;
+
+// ND: Not sure if there is a need to reference these elsewhere, but here are the getters just in case
+// These will also map to the property getters in the class continuation.
+- (NovocaineInputBlock)inputBlock;
+- (NovocaineOutputBlock)outputBlock;
+
+// ------------------------------------------------------------------
+
+// these should be readonly in public interface - no need for public write access
@property (nonatomic, assign, readonly) AudioUnit inputUnit;
@property (nonatomic, assign, readonly) AudioUnit outputUnit;
@property (nonatomic, assign, readonly) AudioBufferList *inputBuffer;
@@ -115,30 +127,16 @@ typedef void (^InputBlock)(float *data, UInt32 numFrames, UInt32 numChannels);
@property (nonatomic, assign, readonly) AudioStreamBasicDescription inputFormat;
@property (nonatomic, assign, readonly) AudioStreamBasicDescription outputFormat;
@property (nonatomic, assign, readonly) BOOL playing;
-@property (nonatomic, assign, readonly) float *inData;
-@property (nonatomic, assign, readonly) float *outData;
// @property BOOL playThroughEnabled;
-#if defined (USING_OSX)
-@property (nonatomic, assign) AudioDeviceID *deviceIDs;
-@property (nonatomic, strong) NSMutableArray *deviceNames;
-@property (nonatomic, assign) AudioDeviceID defaultInputDeviceID;
-@property (nonatomic, strong) NSString *defaultInputDeviceName;
-@property (nonatomic, assign) AudioDeviceID defaultOutputDeviceID;
-@property (nonatomic, strong) NSString *defaultOutputDeviceName;
-- (void)enumerateAudioDevices;
-#endif
-
// Singleton methods
+ (Novocaine *) audioManager;
// Audio Unit methods
- (void)play;
- (void)pause;
-- (void)setupAudio;
-- (void)ifAudioInputIsAvailableThenSetupAudioSession;
#if defined ( USING_IOS )
- (void)checkSessionProperties;
View
@@ -61,7 +61,22 @@ @interface Novocaine()
@property (nonatomic, assign, readwrite) float *inData;
@property (nonatomic, assign, readwrite) float *outData;
+@property (nonatomic, copy) NovocaineOutputBlock outputBlock;
+@property (nonatomic, copy) NovocaineInputBlock inputBlock;
+
+#if defined (USING_OSX)
+@property (nonatomic, assign) AudioDeviceID *deviceIDs;
+@property (nonatomic, strong) NSMutableArray *deviceNames;
+@property (nonatomic, assign) AudioDeviceID defaultInputDeviceID;
+@property (nonatomic, strong) NSString *defaultInputDeviceName;
+@property (nonatomic, assign) AudioDeviceID defaultOutputDeviceID;
+@property (nonatomic, strong) NSString *defaultOutputDeviceName;
+- (void)enumerateAudioDevices;
+#endif
+
- (void)setupAudio;
+- (void)ifAudioInputIsAvailableThenSetupAudioSession;
+
- (NSString *)applicationDocumentsDirectory;
- (void)freeBuffers;
@@ -557,8 +572,6 @@ - (void)setupAudio
CheckError(AudioUnitInitialize(_outputUnit), "Couldn't initialize the output unit");
#endif
-
-
}
#if defined (USING_OSX)

0 comments on commit dfcfffe

Please sign in to comment.