Compare commits
5 Commits
0.9.0
...
update_examples
| Author | SHA1 | Date | |
|---|---|---|---|
| 34dc468f16 | |||
| 3bb1b914a2 | |||
| 6d00378ab0 | |||
| ac07210263 | |||
| 5920e7a61e |
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "EZAudio"
|
||||
s.version = "0.9.0"
|
||||
s.version = "0.9.1"
|
||||
s.summary = "A simple, intuitive audio framework for iOS and OSX useful for anyone doing audio processing and/or audio-based visualizations."
|
||||
s.homepage = "https://github.com/syedhali/EZAudio"
|
||||
s.screenshots = "https://s3-us-west-1.amazonaws.com/ezaudio-media/EZAudioSummary.png"
|
||||
|
||||
@@ -156,7 +156,10 @@ FOUNDATION_EXPORT UInt32 const EZAudioPlotDefaultMaxHistoryBufferLength;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)initPlot;
|
||||
/**
|
||||
Called after the view has been created. Subclasses should use to add any additional methods needed instead of overriding the init methods.
|
||||
*/
|
||||
- (void)setupPlot;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -151,11 +151,25 @@ UInt32 const EZAudioPlotDefaultMaxHistoryBufferLength = 8192;
|
||||
self.backgroundColor = nil;
|
||||
[self.layer insertSublayer:self.waveformLayer atIndex:0];
|
||||
|
||||
//
|
||||
// Allow subclass to initialize plot
|
||||
//
|
||||
[self setupPlot];
|
||||
|
||||
self.points = calloc(EZAudioPlotDefaultMaxHistoryBufferLength, sizeof(CGPoint));
|
||||
self.pointCount = [self initialPointCount];
|
||||
[self redraw];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)setupPlot
|
||||
{
|
||||
//
|
||||
// Override in subclass
|
||||
//
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark - Setup
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
+35
-5
@@ -64,21 +64,29 @@ typedef struct
|
||||
The default background color of the plot. For iOS the color is specified as a UIColor while for OSX the color is an NSColor. The default value on both platforms is a sweet looking green.
|
||||
@warning On OSX, if you set the background to a value where the alpha component is 0 then the EZAudioPlotGL will automatically set its superview to be layer-backed.
|
||||
*/
|
||||
@property (nonatomic, strong) id backgroundColor;
|
||||
#if TARGET_OS_IPHONE
|
||||
@property (nonatomic, strong) IBInspectable UIColor *backgroundColor;
|
||||
#elif TARGET_OS_MAC
|
||||
@property (nonatomic, strong) IBInspectable NSColor *backgroundColor;
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
The default color of the plot's data (i.e. waveform, y-axis values). For iOS the color is specified as a UIColor while for OSX the color is an NSColor. The default value on both platforms is white.
|
||||
*/
|
||||
@property (nonatomic, strong) id color;
|
||||
#if TARGET_OS_IPHONE
|
||||
@property (nonatomic, strong) IBInspectable UIColor *color;
|
||||
#elif TARGET_OS_MAC
|
||||
@property (nonatomic, strong) IBInspectable NSColor *color;
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
The plot's gain value, which controls the scale of the y-axis values. The default value of the gain is 1.0f and should always be greater than 0.0f.
|
||||
*/
|
||||
@property (nonatomic, assign) float gain;
|
||||
@property (nonatomic, assign) IBInspectable float gain;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -92,14 +100,14 @@ typedef struct
|
||||
/**
|
||||
A BOOL indicating whether or not to fill in the graph. A value of YES will make a filled graph (filling in the space between the x-axis and the y-value), while a value of NO will create a stroked graph (connecting the points along the y-axis). Default is NO.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL shouldFill;
|
||||
@property (nonatomic, assign) IBInspectable BOOL shouldFill;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
A boolean indicating whether the graph should be rotated along the x-axis to give a mirrored reflection. This is typical for audio plots to produce the classic waveform look. A value of YES will produce a mirrored reflection of the y-values about the x-axis, while a value of NO will only plot the y-values. Default is NO.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL shouldMirror;
|
||||
@property (nonatomic, assign) IBInspectable BOOL shouldMirror;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark - Updating The Plot
|
||||
@@ -198,6 +206,28 @@ typedef struct
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Called during the OpenGL run loop to constantly update the drawing 60 fps. Callers can use this force update the screen while subclasses can override this for complete control over their rendering. However, subclasses are more encouraged to use the `redrawWithPoints:pointCount:baseEffect:vertexBufferObject:vertexArrayBuffer:interpolated:mirrored:gain:`
|
||||
*/
|
||||
- (void)redraw;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Called after the view has been created. Subclasses should use to add any additional methods needed instead of overriding the init methods.
|
||||
*/
|
||||
- (void)setup;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Main method used to copy the sample data from the source buffer and update the
|
||||
plot. Subclasses can overwrite this method for custom behavior.
|
||||
@param data A float array of the sample data. Subclasses should copy this data to a separate array to avoid threading issues.
|
||||
@param length The length of the float array as an int.
|
||||
*/
|
||||
- (void)setSampleData:(float *)data length:(int)length;
|
||||
|
||||
///-----------------------------------------------------------
|
||||
/// @name Subclass Methods
|
||||
///-----------------------------------------------------------
|
||||
|
||||
@@ -182,6 +182,11 @@ typedef struct
|
||||
self.color = [NSColor colorWithCalibratedRed:1.0f green:1.0f blue:1.0f alpha:1.0f];
|
||||
#endif
|
||||
|
||||
//
|
||||
// Allow subclass to initialize plot
|
||||
//
|
||||
[self setupPlot];
|
||||
|
||||
//
|
||||
// Create the display link
|
||||
//
|
||||
@@ -191,6 +196,15 @@ typedef struct
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)setupPlot
|
||||
{
|
||||
//
|
||||
// Override in subclass
|
||||
//
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)setupOpenGL
|
||||
{
|
||||
self.baseEffect = [[GLKBaseEffect alloc] init];
|
||||
@@ -247,6 +261,7 @@ typedef struct
|
||||
#if !TARGET_OS_IPHONE
|
||||
[self.openGLContext unlock];
|
||||
#endif
|
||||
self.frame = self.frame;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
+5
@@ -57,6 +57,11 @@
|
||||
*/
|
||||
@property (nonatomic, weak) IBOutlet NSPopUpButton *microphoneInputChannelPopUpButton;
|
||||
|
||||
/**
|
||||
The checkbox button used to turn the microphone off/on
|
||||
*/
|
||||
@property (nonatomic, weak) IBOutlet NSButton *microphoneSwitch;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark - Actions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
+21
@@ -240,4 +240,25 @@ withNumberOfChannels:(UInt32)numberOfChannels
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)microphone:(EZMicrophone *)microphone changedPlayingState:(BOOL)isPlaying
|
||||
{
|
||||
NSString *title = isPlaying ? @"Microphone On" : @"Microphone Off";
|
||||
[self setTitle:title forButton:self.microphoneSwitch];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark - Utility
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)setTitle:(NSString *)title forButton:(NSButton *)button
|
||||
{
|
||||
NSDictionary *attributes = @{ NSForegroundColorAttributeName : [NSColor whiteColor] };
|
||||
NSAttributedString *attributedTitle = [[NSAttributedString alloc] initWithString:title
|
||||
attributes:attributes];
|
||||
button.attributedTitle = attributedTitle;
|
||||
button.attributedAlternateTitle = attributedTitle;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@end
|
||||
+3
-2
@@ -10,6 +10,7 @@
|
||||
<outlet property="audioPlot" destination="wpL-Ou-GSb" id="OME-Hf-I27"/>
|
||||
<outlet property="microphoneInputChannelPopUpButton" destination="Yi6-fS-Cob" id="pLg-4c-klV"/>
|
||||
<outlet property="microphoneInputPopUpButton" destination="SjR-qx-mWV" id="NuN-SS-ESg"/>
|
||||
<outlet property="microphoneSwitch" destination="kAI-gs-c31" id="ADZ-Fg-aCN"/>
|
||||
<outlet property="view" destination="wpL-Ou-GSb" id="oxJ-iT-SKO"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
@@ -83,7 +84,7 @@
|
||||
<rect key="frame" x="18" y="43" width="36" height="17"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Input" id="Png-Pk-fMc">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
@@ -91,7 +92,7 @@
|
||||
<rect key="frame" x="204" y="43" width="55" height="17"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Channel" id="lkh-zp-WCY">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
|
||||
+5
@@ -61,6 +61,11 @@
|
||||
*/
|
||||
@property (nonatomic, weak) IBOutlet NSPopUpButton *microphoneInputChannelPopUpButton;
|
||||
|
||||
/**
|
||||
The checkbox button used to turn the microphone off/on
|
||||
*/
|
||||
@property (nonatomic, weak) IBOutlet NSButton *microphoneSwitch;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark - Actions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
+22
-2
@@ -226,8 +226,7 @@ withNumberOfChannels:(UInt32)numberOfChannels
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)microphone:(EZMicrophone *)microphone
|
||||
changedDevice:(EZAudioDevice *)device
|
||||
- (void)microphone:(EZMicrophone *)microphone changedDevice:(EZAudioDevice *)device
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
//
|
||||
@@ -246,4 +245,25 @@ withNumberOfChannels:(UInt32)numberOfChannels
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)microphone:(EZMicrophone *)microphone changedPlayingState:(BOOL)isPlaying
|
||||
{
|
||||
NSString *title = isPlaying ? @"Microphone On" : @"Microphone Off";
|
||||
[self setTitle:title forButton:self.microphoneSwitch];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark - Utility
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)setTitle:(NSString *)title forButton:(NSButton *)button
|
||||
{
|
||||
NSDictionary *attributes = @{ NSForegroundColorAttributeName : [NSColor whiteColor] };
|
||||
NSAttributedString *attributedTitle = [[NSAttributedString alloc] initWithString:title
|
||||
attributes:attributes];
|
||||
button.attributedTitle = attributedTitle;
|
||||
button.attributedAlternateTitle = attributedTitle;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@end
|
||||
|
||||
+3
-2
@@ -10,6 +10,7 @@
|
||||
<outlet property="audioPlot" destination="foT-nv-032" id="Baw-Le-z98"/>
|
||||
<outlet property="microphoneInputChannelPopUpButton" destination="Usd-lp-n8s" id="FbQ-hj-24k"/>
|
||||
<outlet property="microphoneInputPopUpButton" destination="wBG-jf-wVy" id="thS-Ur-IMj"/>
|
||||
<outlet property="microphoneSwitch" destination="TbW-ha-PgJ" id="wEZ-dt-f7t"/>
|
||||
<outlet property="view" destination="hFn-jA-9Se" id="cfu-I4-qhQ"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
@@ -86,7 +87,7 @@
|
||||
<rect key="frame" x="18" y="46" width="36" height="17"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Input" id="Fq3-tX-8aU">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
@@ -94,7 +95,7 @@
|
||||
<rect key="frame" x="204" y="46" width="55" height="17"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Channel" id="PTE-g2-mTV">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
|
||||
@@ -506,6 +506,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioFFTExample/EZAudioFFTExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioFFTExample/EZAudioFFTExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -519,6 +520,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioFFTExample/EZAudioFFTExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioFFTExample/EZAudioFFTExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
|
||||
+2
@@ -502,6 +502,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -515,6 +516,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
|
||||
+2
@@ -502,6 +502,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioPassThroughExample/EZAudioPassThroughExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioPassThroughExample/EZAudioPassThroughExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -515,6 +516,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioPassThroughExample/EZAudioPassThroughExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioPassThroughExample/EZAudioPassThroughExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
|
||||
+2
@@ -506,6 +506,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioPlayFileExample/EZAudioPlayFileExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioPlayFileExample/EZAudioPlayFileExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -519,6 +520,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioPlayFileExample/EZAudioPlayFileExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioPlayFileExample/EZAudioPlayFileExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
|
||||
+2
@@ -502,6 +502,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioRecordExample/EZAudioRecordExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioRecordExample/EZAudioRecordExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -515,6 +516,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioRecordExample/EZAudioRecordExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioRecordExample/EZAudioRecordExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
|
||||
+2
@@ -506,6 +506,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioWaveformFromFileExample/EZAudioWaveformFromFileExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioWaveformFromFileExample/EZAudioWaveformFromFileExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -519,6 +520,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EZAudioWaveformFromFileExample/EZAudioWaveformFromFileExample-Prefix.pch";
|
||||
INFOPLIST_FILE = "EZAudioWaveformFromFileExample/EZAudioWaveformFromFileExample-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user